@tachybase/module-file 1.3.21 → 1.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/client/interfaces/attachment.d.ts +1 -0
- package/dist/externalVersion.js +7 -9
- package/dist/node_modules/@aws-sdk/client-s3/node_modules/.bin/uuid +2 -2
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mkdirp/LICENSE +2 -2
- package/dist/node_modules/mkdirp/bin/cmd.js +64 -29
- package/dist/node_modules/mkdirp/index.js +1 -1
- package/dist/node_modules/mkdirp/lib/find-made.js +29 -0
- package/dist/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
- package/dist/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
- package/dist/node_modules/mkdirp/lib/opts-arg.js +23 -0
- package/dist/node_modules/mkdirp/lib/path-arg.js +29 -0
- package/dist/node_modules/mkdirp/lib/use-native.js +10 -0
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/mkdirp/readme.markdown +201 -35
- package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/server/FileModel.d.ts +1 -1
- package/dist/server/FileModel.js +2 -2
- package/dist/server/actions/attachments.d.ts +1 -1
- package/dist/server/actions/attachments.js +7 -7
- package/dist/server/actions/index.js +2 -12
- package/dist/server/collections/attachments.d.ts +1 -1
- package/dist/server/collections/attachments.js +2 -2
- package/dist/server/collections/storages.d.ts +1 -1
- package/dist/server/collections/storages.js +2 -2
- package/dist/server/migrations/20230831160742-fix-attachment-field.d.ts +1 -1
- package/dist/server/migrations/20230831160742-fix-attachment-field.js +2 -3
- package/dist/server/migrations/20231120142523-fix-storage.d.ts +1 -1
- package/dist/server/migrations/20231120142523-fix-storage.js +1 -1
- package/dist/server/migrations/20240306223006-update-target.d.ts +1 -1
- package/dist/server/migrations/20240306223006-update-target.js +1 -1
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +4 -4
- package/dist/server/storages/index.d.ts +1 -2
- package/dist/server/storages/index.js +2 -2
- package/package.json +11 -18
- package/dist/node_modules/mkdirp/bin/usage.txt +0 -12
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("react-i18next"),require("@tachybase/schema"),require("@ant-design/icons"),require("@tachybase/components")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","antd","react-i18next","@tachybase/schema","@ant-design/icons","@tachybase/components"],t):(n=typeof globalThis!="undefined"?globalThis:n||self,t(n["@tachybase/module-file"]={},n["@tachybase/client"],n.jsxRuntime,n.react,n.antd,n["react-i18next"],n["@tachybase/schema"],n["@ant-design/icons"],n["@tachybase/components"]))})(this,function(n,t,r,m,b,f,p,S,y){"use strict";var J=Object.defineProperty,Q=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var w=(n,t,r)=>t in n?J(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,h=(n,t)=>{for(var r in t||(t={}))Y.call(t,r)&&w(n,r,t[r]);if(q)for(var r of q(t))ee.call(t,r)&&w(n,r,t[r]);return n},A=(n,t)=>Q(n,X(t));var D=(n,t,r)=>new Promise((m,b)=>{var f=y=>{try{S(r.next(y))}catch(e){b(e)}},p=y=>{try{S(r.throw(y))}catch(e){b(e)}},S=y=>y.done?m(y.value):Promise.resolve(y.value).then(f,p);S((r=r.apply(n,t)).next())});const e="file";function K(){return f.useTranslation(e)}const $=1024*1024*1024,k=Object.freeze(Object.defineProperty({__proto__:null,FILE_LIMIT_SIZE:$,useUploadFiles:()=>{const{service:s}=t.useBlockRequestContext(),{t:o}=K(),{setVisible:a}=t.useActionContext(),{props:i}=t.useBlockRequestContext(),d=t.useCollection(),l=t.useSourceIdFromParentRecord(),F=m.useMemo(()=>{let g=`${d.name}:create`;if(i!=null&&i.association){const[x,T]=i.association.split(".");g=`${x}/${l}/${T}:create`}return g},[d.name,i==null?void 0:i.association,l]),{setSelectedRows:u}=m.useContext(t.RecordPickerContext)||{},c={};let I=0;return{action:F,beforeUpload(g){return g.size>$?(b.notification.error({message:`${o("File size cannot exceed")} ${$/1024/1024}M`}),g.status="error",!1):!0},onChange(g){g.forEach(x=>{var T;x.status==="uploading"&&!c[x.uid]&&(I++,c[x.uid]=!0),x.status!=="uploading"&&c[x.uid]&&(delete c[x.uid],--I===0&&((T=s==null?void 0:s.refresh)==null||T.call(s),u==null||u(H=>[...H,...g.filter(P=>P.status==="done").map(P=>P.response.data)])))}),g.every(x=>x.status==="done")&&a(!1)}}}},Symbol.toStringTag,{value:"Module"})),W=s=>{t.useCollection_deprecated();const 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 r.jsx(t.ActionInitializer,A(h({},s),{schema:o}))},G=({children:s})=>r.jsx(t.SchemaComponentOptions,{scope:k,components:{UploadActionInitializer:W},children:s}),v={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":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,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"}}]},B={type:"void",properties:{[p.uid()]:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:v,action:"list",params:{pageSize:50,sort:["id"],appends:[]},rowKey:"id"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",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:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.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":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage"},delete:{type:"void",title:'{{t("Delete")}}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},_={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}}},M=p.observer(s=>{const o=p.useForm(),a=p.useField(),[i,d]=m.useState(new p.Schema({}));return m.useEffect(()=>{d(new p.Schema(_[o.values.type]||{}))},[o.values.type]),r.jsx(y.FormLayout,{layout:"vertical",children:r.jsx(p.RecursionField,{basePath:a.address,onlyRenderProperties:!0,schema:i},o.values.type||"local")})},{displayName:"StorageOptions"}),E=()=>{const[s,o]=m.useState({}),a=t.usePlugin(C),i=t.useCompile(),[d,l]=m.useState(!1),{t:F}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:d,setVisible:l},children:[r.jsx(b.Dropdown,{menu:{onClick(u){const c=a.storageTypes.get(u.key);l(!0),o({properties:{[p.uid()]:{type:"void",title:i("{{t('Add new')}}")+" - "+i(c.title),"x-component":"Action.Drawer",properties:{body:{type:"void","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:v},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:h({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{type:c.name}}}}}},c.properties)}}}}}}})},items:[...a.storageTypes.values()].map(u=>({key:u.name,label:i(u.title)}))},children:r.jsxs(b.Button,{type:"primary",icon:r.jsx(S.PlusOutlined,{}),children:[F("Add new")," ",r.jsx(S.DownOutlined,{})]})}),r.jsx(t.SchemaComponent,{scope:{createOnly:!0},schema:s})]})})},O=()=>{const s=t.useCollectionRecordData(),[o,a]=m.useState({}),i=t.usePlugin(C),d=t.useCompile(),[l,F]=m.useState(!1),{t:u}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:l,setVisible:F},children:[r.jsx("a",{onClick:()=>{F(!0);const c=i.storageTypes.get(s.type);c.properties.default&&(c.properties.default["x-reactions"]=I=>{I.initialValue?I.disabled=!0:I.disabled=!1}),a({properties:{[p.uid()]:{type:"void",title:d("{{t('Edit')}}")+" - "+d(c.title),"x-component":"Action.Drawer",properties:{card:{type:"void","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:v},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:h({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}}},c.properties)}}}}}}})},children:u("Edit")}),r.jsx(t.SchemaComponent,{scope:{createOnly:!1},schema:o})]})})},U=()=>{const{t:s}=f.useTranslation(),o=t.useCompile(),i=[...t.usePlugin(C).storageTypes.values()].map(l=>({value:l.name,label:o(l.title)})),d=r.jsxs("div",{children:[s("See more")," ",r.jsx("a",{target:"_blank",href:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",rel:"noreferrer",children:"x-oss-process"})]});return r.jsx(t.SchemaComponent,{components:{StorageOptions:M,CreateStorage:E,EditStorage:O},scope:{useNewId:l=>`${l}${p.uid()}`,storageTypes:i,xStyleProcessDesc:d},schema:B})};class V extends t.CollectionFieldInterface{constructor(){super(...arguments),this.name="attachment",this.type="object",this.group="media",this.title=`{{t("Attachment", { ns: "${e}" })}}`,this.isAssociation=!0,this.default={type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-component-props":{}}},this.availableTypes=["belongsToMany"],this.properties=A(h({},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"}}}}),this.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"}}]}}schemaInitialize(o,{block:a,field:i}){["Table","Kanban"].includes(a)&&(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=`${i.target}:create${i.storage?`?attachmentField=${i.collectionName}.${i.name}`:""}`}initialize(o){o.through||(o.through=`t_${p.uid()}`),o.foreignKey||(o.foreignKey=`f_${p.uid()}`),o.otherKey||(o.otherKey=`f_${p.uid()}`),o.sourceKey||(o.sourceKey="id"),o.targetKey||(o.targetKey="id")}}const z={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 }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,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:"?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}" })}}`}}},j={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 }}",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","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,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/"}},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}" })}}`}}},N={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 }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},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}" })}}`}}},L={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 }}",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"},options:{type:"object","x-component":"div",properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",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}" })}}`}}},R={local:j,"ali-oss":z,s3:N,"tx-cos":L};class Z extends t.CollectionTemplate{constructor(){super(...arguments),this.name="file",this.title=`{{t("File collection", { ns: "${e}" })}}`,this.order=3,this.color="blue",this.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", { ns: "${e}" })}}`,"x-component":"TextAreaWithGlobalScope","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", { ns: "${e}" })}}`,"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,uiSchema:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]},this.configurableProperties=h(A(h(A(h({},t.getConfigurableProperties("title","name")),{inherits:A(h({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage","x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}}),t.getConfigurableProperties("presetFields"))}}class C extends t.Plugin{constructor(){super(...arguments),this.storageTypes=new Map}load(){return D(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([V]),this.app.dataSourceManager.addCollectionTemplates([Z]),this.app.use(G),this.app.systemSettingsManager.add("business-components."+e,{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",Component:U,aclSnippet:"pm.file-manager.storages"}),Object.values(R).forEach(a=>{this.registerStorageType(a.name,a)});const o=this.app.schemaInitializerManager.get("table:configureActions");o==null||o.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return t.useCollection().template==="file"}})})}registerStorageType(o,a){this.storageTypes.set(o,a)}}n.FileManagerPlugin=C,n.default=C,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("react-i18next"),require("@tachybase/schema"),require("@ant-design/icons"),require("@tego/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","antd","react-i18next","@tachybase/schema","@ant-design/icons","@tego/client"],t):(n=typeof globalThis!="undefined"?globalThis:n||self,t(n["@tachybase/module-file"]={},n["@tachybase/client"],n.jsxRuntime,n.react,n.antd,n["react-i18next"],n["@tachybase/schema"],n["@ant-design/icons"],n["@tego/client"]))})(this,function(n,t,r,m,b,f,p,S,y){"use strict";var J=Object.defineProperty,Q=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var w=(n,t,r)=>t in n?J(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,h=(n,t)=>{for(var r in t||(t={}))Y.call(t,r)&&w(n,r,t[r]);if(q)for(var r of q(t))ee.call(t,r)&&w(n,r,t[r]);return n},A=(n,t)=>Q(n,X(t));var D=(n,t,r)=>new Promise((m,b)=>{var f=y=>{try{S(r.next(y))}catch(e){b(e)}},p=y=>{try{S(r.throw(y))}catch(e){b(e)}},S=y=>y.done?m(y.value):Promise.resolve(y.value).then(f,p);S((r=r.apply(n,t)).next())});const e="file";function K(){return f.useTranslation(e)}const $=1024*1024*1024,k=Object.freeze(Object.defineProperty({__proto__:null,FILE_LIMIT_SIZE:$,useUploadFiles:()=>{const{service:s}=t.useBlockRequestContext(),{t:o}=K(),{setVisible:a}=t.useActionContext(),{props:i}=t.useBlockRequestContext(),d=t.useCollection(),l=t.useSourceIdFromParentRecord(),F=m.useMemo(()=>{let g=`${d.name}:create`;if(i!=null&&i.association){const[x,T]=i.association.split(".");g=`${x}/${l}/${T}:create`}return g},[d.name,i==null?void 0:i.association,l]),{setSelectedRows:u}=m.useContext(t.RecordPickerContext)||{},c={};let I=0;return{action:F,beforeUpload(g){return g.size>$?(b.notification.error({message:`${o("File size cannot exceed")} ${$/1024/1024}M`}),g.status="error",!1):!0},onChange(g){g.forEach(x=>{var T;x.status==="uploading"&&!c[x.uid]&&(I++,c[x.uid]=!0),x.status!=="uploading"&&c[x.uid]&&(delete c[x.uid],--I===0&&((T=s==null?void 0:s.refresh)==null||T.call(s),u==null||u(H=>[...H,...g.filter(P=>P.status==="done").map(P=>P.response.data)])))}),g.every(x=>x.status==="done")&&a(!1)}}}},Symbol.toStringTag,{value:"Module"})),W=s=>{t.useCollection_deprecated();const 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 r.jsx(t.ActionInitializer,A(h({},s),{schema:o}))},G=({children:s})=>r.jsx(t.SchemaComponentOptions,{scope:k,components:{UploadActionInitializer:W},children:s}),v={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":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,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"}}]},B={type:"void",properties:{[p.uid()]:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:v,action:"list",params:{pageSize:50,sort:["id"],appends:[]},rowKey:"id"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",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:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.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":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage"},delete:{type:"void",title:'{{t("Delete")}}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},_={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}}},M=p.observer(s=>{const o=p.useForm(),a=p.useField(),[i,d]=m.useState(new p.Schema({}));return m.useEffect(()=>{d(new p.Schema(_[o.values.type]||{}))},[o.values.type]),r.jsx(y.FormLayout,{layout:"vertical",children:r.jsx(p.RecursionField,{basePath:a.address,onlyRenderProperties:!0,schema:i},o.values.type||"local")})},{displayName:"StorageOptions"}),O=()=>{const[s,o]=m.useState({}),a=t.usePlugin(C),i=t.useCompile(),[d,l]=m.useState(!1),{t:F}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:d,setVisible:l},children:[r.jsx(b.Dropdown,{menu:{onClick(u){const c=a.storageTypes.get(u.key);l(!0),o({properties:{[p.uid()]:{type:"void",title:i("{{t('Add new')}}")+" - "+i(c.title),"x-component":"Action.Drawer",properties:{body:{type:"void","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:v},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:h({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{type:c.name}}}}}},c.properties)}}}}}}})},items:[...a.storageTypes.values()].map(u=>({key:u.name,label:i(u.title)}))},children:r.jsxs(b.Button,{type:"primary",icon:r.jsx(S.PlusOutlined,{}),children:[F("Add new")," ",r.jsx(S.DownOutlined,{})]})}),r.jsx(t.SchemaComponent,{scope:{createOnly:!0},schema:s})]})})},E=()=>{const s=t.useCollectionRecordData(),[o,a]=m.useState({}),i=t.usePlugin(C),d=t.useCompile(),[l,F]=m.useState(!1),{t:u}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:l,setVisible:F},children:[r.jsx("a",{onClick:()=>{F(!0);const c=i.storageTypes.get(s.type);c.properties.default&&(c.properties.default["x-reactions"]=I=>{I.initialValue?I.disabled=!0:I.disabled=!1}),a({properties:{[p.uid()]:{type:"void",title:d("{{t('Edit')}}")+" - "+d(c.title),"x-component":"Action.Drawer",properties:{card:{type:"void","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:v},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:h({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}}},c.properties)}}}}}}})},children:u("Edit")}),r.jsx(t.SchemaComponent,{scope:{createOnly:!1},schema:o})]})})},U=()=>{const{t:s}=f.useTranslation(),o=t.useCompile(),i=[...t.usePlugin(C).storageTypes.values()].map(l=>({value:l.name,label:o(l.title)})),d=r.jsxs("div",{children:[s("See more")," ",r.jsx("a",{target:"_blank",href:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",rel:"noreferrer",children:"x-oss-process"})]});return r.jsx(t.SchemaComponent,{components:{StorageOptions:M,CreateStorage:O,EditStorage:E},scope:{useNewId:l=>`${l}${p.uid()}`,storageTypes:i,xStyleProcessDesc:d},schema:B})};class V extends t.CollectionFieldInterface{constructor(){super(...arguments),this.name="attachment",this.type="object",this.group="media",this.icon="FileOutlined",this.title=`{{t("Attachment", { ns: "${e}" })}}`,this.isAssociation=!0,this.default={type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-component-props":{}}},this.availableTypes=["belongsToMany"],this.properties=A(h({},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"}}}}),this.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"}}]}}schemaInitialize(o,{block:a,field:i}){["Table","Kanban"].includes(a)&&(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=`${i.target}:create${i.storage?`?attachmentField=${i.collectionName}.${i.name}`:""}`}initialize(o){o.through||(o.through=`t_${p.uid()}`),o.foreignKey||(o.foreignKey=`f_${p.uid()}`),o.otherKey||(o.otherKey=`f_${p.uid()}`),o.sourceKey||(o.sourceKey="id"),o.targetKey||(o.targetKey="id")}}const z={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 }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,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:"?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}" })}}`}}},j={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 }}",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","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,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/"}},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}" })}}`}}},N={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 }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},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}" })}}`}}},L={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 }}",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"},options:{type:"object","x-component":"div",properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",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}" })}}`}}},R={local:j,"ali-oss":z,s3:N,"tx-cos":L};class Z extends t.CollectionTemplate{constructor(){super(...arguments),this.name="file",this.title=`{{t("File collection", { ns: "${e}" })}}`,this.order=3,this.color="blue",this.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", { ns: "${e}" })}}`,"x-component":"TextAreaWithGlobalScope","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", { ns: "${e}" })}}`,"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,uiSchema:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]},this.configurableProperties=h(A(h(A(h({},t.getConfigurableProperties("title","name")),{inherits:A(h({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage","x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}}),t.getConfigurableProperties("presetFields"))}}class C extends t.Plugin{constructor(){super(...arguments),this.storageTypes=new Map}load(){return D(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([V]),this.app.dataSourceManager.addCollectionTemplates([Z]),this.app.use(G),this.app.systemSettingsManager.add("business-components."+e,{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",Component:U,aclSnippet:"pm.file-manager.storages"}),Object.values(R).forEach(a=>{this.registerStorageType(a.name,a)});const o=this.app.schemaInitializerManager.get("table:configureActions");o==null||o.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return t.useCollection().template==="file"}})})}registerStorageType(o,a){this.storageTypes.set(o,a)}}n.FileManagerPlugin=C,n.default=C,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/schema": "1.3.
|
|
5
|
-
"@ant-design/icons": "5.
|
|
3
|
+
"@tachybase/client": "1.3.23",
|
|
4
|
+
"@tachybase/schema": "1.3.43",
|
|
5
|
+
"@ant-design/icons": "5.6.1",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
7
|
"lodash": "4.17.21",
|
|
8
8
|
"react-i18next": "15.2.0",
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
11
|
-
"@tachybase/
|
|
12
|
-
"
|
|
13
|
-
"@tachybase/utils": "1.3.21",
|
|
14
|
-
"@tachybase/actions": "1.3.21",
|
|
9
|
+
"@tego/client": "1.3.43",
|
|
10
|
+
"@tego/server": "1.3.43",
|
|
11
|
+
"@tachybase/test": "1.3.43",
|
|
12
|
+
"dayjs": "1.11.13",
|
|
15
13
|
"multer": "2.0.1"
|
|
16
14
|
};
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/node_modules"
|
|
13
|
+
export NODE_PATH="/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
15
|
+
export NODE_PATH="/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../../../../../../uuid@9.0.1/node_modules/uuid/dist/bin/uuid" "$@"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.850.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:integration":"yarn g:vitest run -c vitest.config.integ.ts","test:integration:watch":"yarn g:vitest watch -c vitest.config.integ.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.846.0","@aws-sdk/credential-provider-node":"3.848.0","@aws-sdk/middleware-bucket-endpoint":"3.840.0","@aws-sdk/middleware-expect-continue":"3.840.0","@aws-sdk/middleware-flexible-checksums":"3.846.0","@aws-sdk/middleware-host-header":"3.840.0","@aws-sdk/middleware-location-constraint":"3.840.0","@aws-sdk/middleware-logger":"3.840.0","@aws-sdk/middleware-recursion-detection":"3.840.0","@aws-sdk/middleware-sdk-s3":"3.846.0","@aws-sdk/middleware-ssec":"3.840.0","@aws-sdk/middleware-user-agent":"3.848.0","@aws-sdk/region-config-resolver":"3.840.0","@aws-sdk/signature-v4-multi-region":"3.846.0","@aws-sdk/types":"3.840.0","@aws-sdk/util-endpoints":"3.848.0","@aws-sdk/util-user-agent-browser":"3.840.0","@aws-sdk/util-user-agent-node":"3.848.0","@aws-sdk/xml-builder":"3.821.0","@smithy/config-resolver":"^4.1.4","@smithy/core":"^3.7.0","@smithy/eventstream-serde-browser":"^4.0.4","@smithy/eventstream-serde-config-resolver":"^4.1.2","@smithy/eventstream-serde-node":"^4.0.4","@smithy/fetch-http-handler":"^5.1.0","@smithy/hash-blob-browser":"^4.0.4","@smithy/hash-node":"^4.0.4","@smithy/hash-stream-node":"^4.0.4","@smithy/invalid-dependency":"^4.0.4","@smithy/md5-js":"^4.0.4","@smithy/middleware-content-length":"^4.0.4","@smithy/middleware-endpoint":"^4.1.15","@smithy/middleware-retry":"^4.1.16","@smithy/middleware-serde":"^4.0.8","@smithy/middleware-stack":"^4.0.4","@smithy/node-config-provider":"^4.1.3","@smithy/node-http-handler":"^4.1.0","@smithy/protocol-http":"^5.1.2","@smithy/smithy-client":"^4.4.7","@smithy/types":"^4.3.1","@smithy/url-parser":"^4.0.4","@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.23","@smithy/util-defaults-mode-node":"^4.0.23","@smithy/util-endpoints":"^3.0.6","@smithy/util-middleware":"^4.0.4","@smithy/util-retry":"^4.0.6","@smithy/util-stream":"^4.2.3","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.6","@types/uuid":"^9.0.1","tslib":"^2.6.2","uuid":"^9.0.1"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.848.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.8.3"},"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-
|
|
1
|
+
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.850.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:integration":"yarn g:vitest run -c vitest.config.integ.ts","test:integration:watch":"yarn g:vitest watch -c vitest.config.integ.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.846.0","@aws-sdk/credential-provider-node":"3.848.0","@aws-sdk/middleware-bucket-endpoint":"3.840.0","@aws-sdk/middleware-expect-continue":"3.840.0","@aws-sdk/middleware-flexible-checksums":"3.846.0","@aws-sdk/middleware-host-header":"3.840.0","@aws-sdk/middleware-location-constraint":"3.840.0","@aws-sdk/middleware-logger":"3.840.0","@aws-sdk/middleware-recursion-detection":"3.840.0","@aws-sdk/middleware-sdk-s3":"3.846.0","@aws-sdk/middleware-ssec":"3.840.0","@aws-sdk/middleware-user-agent":"3.848.0","@aws-sdk/region-config-resolver":"3.840.0","@aws-sdk/signature-v4-multi-region":"3.846.0","@aws-sdk/types":"3.840.0","@aws-sdk/util-endpoints":"3.848.0","@aws-sdk/util-user-agent-browser":"3.840.0","@aws-sdk/util-user-agent-node":"3.848.0","@aws-sdk/xml-builder":"3.821.0","@smithy/config-resolver":"^4.1.4","@smithy/core":"^3.7.0","@smithy/eventstream-serde-browser":"^4.0.4","@smithy/eventstream-serde-config-resolver":"^4.1.2","@smithy/eventstream-serde-node":"^4.0.4","@smithy/fetch-http-handler":"^5.1.0","@smithy/hash-blob-browser":"^4.0.4","@smithy/hash-node":"^4.0.4","@smithy/hash-stream-node":"^4.0.4","@smithy/invalid-dependency":"^4.0.4","@smithy/md5-js":"^4.0.4","@smithy/middleware-content-length":"^4.0.4","@smithy/middleware-endpoint":"^4.1.15","@smithy/middleware-retry":"^4.1.16","@smithy/middleware-serde":"^4.0.8","@smithy/middleware-stack":"^4.0.4","@smithy/node-config-provider":"^4.1.3","@smithy/node-http-handler":"^4.1.0","@smithy/protocol-http":"^5.1.2","@smithy/smithy-client":"^4.4.7","@smithy/types":"^4.3.1","@smithy/url-parser":"^4.0.4","@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.23","@smithy/util-defaults-mode-node":"^4.0.23","@smithy/util-endpoints":"^3.0.6","@smithy/util-middleware":"^4.0.4","@smithy/util-retry":"^4.0.6","@smithy/util-stream":"^4.2.3","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.6","@types/uuid":"^9.0.1","tslib":"^2.6.2","uuid":"^9.0.1"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.848.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.8.3"},"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-02T21:24:33.341Z"}
|
|
@@ -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-
|
|
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-02T21:24:26.954Z"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
|
|
2
2
|
|
|
3
|
-
This project is free software released under the MIT
|
|
3
|
+
This project is free software released under the MIT license:
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,33 +1,68 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
const usage = () => `
|
|
4
|
+
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
|
|
5
|
+
|
|
6
|
+
Create each supplied directory including any necessary parent directories
|
|
7
|
+
that don't yet exist.
|
|
8
|
+
|
|
9
|
+
If the directory already exists, do nothing.
|
|
10
|
+
|
|
11
|
+
OPTIONS are:
|
|
12
|
+
|
|
13
|
+
-m<mode> If a directory needs to be created, set the mode as an octal
|
|
14
|
+
--mode=<mode> permission string.
|
|
15
|
+
|
|
16
|
+
-v --version Print the mkdirp version number
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
-h --help Print this helpful banner
|
|
19
|
+
|
|
20
|
+
-p --print Print the first directories created for each path provided
|
|
21
|
+
|
|
22
|
+
--manual Use manual implementation, even if native is available
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const dirs = []
|
|
26
|
+
const opts = {}
|
|
27
|
+
let print = false
|
|
28
|
+
let dashdash = false
|
|
29
|
+
let manual = false
|
|
30
|
+
for (const arg of process.argv.slice(2)) {
|
|
31
|
+
if (dashdash)
|
|
32
|
+
dirs.push(arg)
|
|
33
|
+
else if (arg === '--')
|
|
34
|
+
dashdash = true
|
|
35
|
+
else if (arg === '--manual')
|
|
36
|
+
manual = true
|
|
37
|
+
else if (/^-h/.test(arg) || /^--help/.test(arg)) {
|
|
38
|
+
console.log(usage())
|
|
39
|
+
process.exit(0)
|
|
40
|
+
} else if (arg === '-v' || arg === '--version') {
|
|
41
|
+
console.log(require('../package.json').version)
|
|
42
|
+
process.exit(0)
|
|
43
|
+
} else if (arg === '-p' || arg === '--print') {
|
|
44
|
+
print = true
|
|
45
|
+
} else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
|
|
46
|
+
const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
|
|
47
|
+
if (isNaN(mode)) {
|
|
48
|
+
console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
|
|
49
|
+
process.exit(1)
|
|
32
50
|
}
|
|
33
|
-
|
|
51
|
+
opts.mode = mode
|
|
52
|
+
} else
|
|
53
|
+
dirs.push(arg)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const mkdirp = require('../')
|
|
57
|
+
const impl = manual ? mkdirp.manual : mkdirp
|
|
58
|
+
if (dirs.length === 0)
|
|
59
|
+
console.error(usage())
|
|
60
|
+
|
|
61
|
+
Promise.all(dirs.map(dir => impl(dir, opts)))
|
|
62
|
+
.then(made => print ? made.forEach(m => m && console.log(m)) : null)
|
|
63
|
+
.catch(er => {
|
|
64
|
+
console.error(er.message)
|
|
65
|
+
if (er.code)
|
|
66
|
+
console.error(' code: ' + er.code)
|
|
67
|
+
process.exit(1)
|
|
68
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={
|
|
1
|
+
(function(){var e={237:function(e,t,r){const n=r(10);const s=r(763);const{mkdirpNative:c,mkdirpNativeSync:i}=r(58);const{mkdirpManual:o,mkdirpManualSync:a}=r(559);const{useNative:u,useNativeSync:d}=r(764);const mkdirp=(e,t)=>{e=s(e);t=n(t);return u(t)?c(e,t):o(e,t)};const mkdirpSync=(e,t)=>{e=s(e);t=n(t);return d(t)?i(e,t):a(e,t)};mkdirp.sync=mkdirpSync;mkdirp.native=(e,t)=>c(s(e),n(t));mkdirp.manual=(e,t)=>o(s(e),n(t));mkdirp.nativeSync=(e,t)=>i(s(e),n(t));mkdirp.manualSync=(e,t)=>a(s(e),n(t));e.exports=mkdirp},874:function(e,t,r){const{dirname:n}=r(928);const findMade=(e,t,r=undefined)=>{if(r===t)return Promise.resolve();return e.statAsync(t).then((e=>e.isDirectory()?r:undefined),(r=>r.code==="ENOENT"?findMade(e,n(t),t):undefined))};const findMadeSync=(e,t,r=undefined)=>{if(r===t)return undefined;try{return e.statSync(t).isDirectory()?r:undefined}catch(r){return r.code==="ENOENT"?findMadeSync(e,n(t),t):undefined}};e.exports={findMade:findMade,findMadeSync:findMadeSync}},559:function(e,t,r){const{dirname:n}=r(928);const mkdirpManual=(e,t,r)=>{t.recursive=false;const s=n(e);if(s===e){return t.mkdirAsync(e,t).catch((e=>{if(e.code!=="EISDIR")throw e}))}return t.mkdirAsync(e,t).then((()=>r||e),(n=>{if(n.code==="ENOENT")return mkdirpManual(s,t).then((r=>mkdirpManual(e,t,r)));if(n.code!=="EEXIST"&&n.code!=="EROFS")throw n;return t.statAsync(e).then((e=>{if(e.isDirectory())return r;else throw n}),(()=>{throw n}))}))};const mkdirpManualSync=(e,t,r)=>{const s=n(e);t.recursive=false;if(s===e){try{return t.mkdirSync(e,t)}catch(e){if(e.code!=="EISDIR")throw e;else return}}try{t.mkdirSync(e,t);return r||e}catch(n){if(n.code==="ENOENT")return mkdirpManualSync(e,t,mkdirpManualSync(s,t,r));if(n.code!=="EEXIST"&&n.code!=="EROFS")throw n;try{if(!t.statSync(e).isDirectory())throw n}catch(e){throw n}}};e.exports={mkdirpManual:mkdirpManual,mkdirpManualSync:mkdirpManualSync}},58:function(e,t,r){const{dirname:n}=r(928);const{findMade:s,findMadeSync:c}=r(874);const{mkdirpManual:i,mkdirpManualSync:o}=r(559);const mkdirpNative=(e,t)=>{t.recursive=true;const r=n(e);if(r===e)return t.mkdirAsync(e,t);return s(t,e).then((r=>t.mkdirAsync(e,t).then((()=>r)).catch((r=>{if(r.code==="ENOENT")return i(e,t);else throw r}))))};const mkdirpNativeSync=(e,t)=>{t.recursive=true;const r=n(e);if(r===e)return t.mkdirSync(e,t);const s=c(t,e);try{t.mkdirSync(e,t);return s}catch(r){if(r.code==="ENOENT")return o(e,t);else throw r}};e.exports={mkdirpNative:mkdirpNative,mkdirpNativeSync:mkdirpNativeSync}},10:function(e,t,r){const{promisify:n}=r(23);const s=r(896);const optsArg=e=>{if(!e)e={mode:511,fs:s};else if(typeof e==="object")e={mode:511,fs:s,...e};else if(typeof e==="number")e={mode:e,fs:s};else if(typeof e==="string")e={mode:parseInt(e,8),fs:s};else throw new TypeError("invalid options argument");e.mkdir=e.mkdir||e.fs.mkdir||s.mkdir;e.mkdirAsync=n(e.mkdir);e.stat=e.stat||e.fs.stat||s.stat;e.statAsync=n(e.stat);e.statSync=e.statSync||e.fs.statSync||s.statSync;e.mkdirSync=e.mkdirSync||e.fs.mkdirSync||s.mkdirSync;return e};e.exports=optsArg},763:function(e,t,r){const n=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const{resolve:s,parse:c}=r(928);const pathArg=e=>{if(/\0/.test(e)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=s(e);if(n==="win32"){const t=/[*|"<>?:]/;const{root:r}=c(e);if(t.test(e.substr(r.length))){throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}}return e};e.exports=pathArg},764:function(e,t,r){const n=r(896);const s=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const c=s.replace(/^v/,"").split(".");const i=+c[0]>10||+c[0]===10&&+c[1]>=12;const o=!i?()=>false:e=>e.mkdir===n.mkdir;const a=!i?()=>false:e=>e.mkdirSync===n.mkdirSync;e.exports={useNative:o,useNativeSync:a}},896:function(e){"use strict";e.exports=require("fs")},928:function(e){"use strict";e.exports=require("path")},23:function(e){"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={exports:{}};var c=true;try{e[r](s,s.exports,__nccwpck_require__);c=false}finally{if(c)delete t[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(237);module.exports=r})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const {dirname} = require('path')
|
|
2
|
+
|
|
3
|
+
const findMade = (opts, parent, path = undefined) => {
|
|
4
|
+
// we never want the 'made' return value to be a root directory
|
|
5
|
+
if (path === parent)
|
|
6
|
+
return Promise.resolve()
|
|
7
|
+
|
|
8
|
+
return opts.statAsync(parent).then(
|
|
9
|
+
st => st.isDirectory() ? path : undefined, // will fail later
|
|
10
|
+
er => er.code === 'ENOENT'
|
|
11
|
+
? findMade(opts, dirname(parent), parent)
|
|
12
|
+
: undefined
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const findMadeSync = (opts, parent, path = undefined) => {
|
|
17
|
+
if (path === parent)
|
|
18
|
+
return undefined
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
return opts.statSync(parent).isDirectory() ? path : undefined
|
|
22
|
+
} catch (er) {
|
|
23
|
+
return er.code === 'ENOENT'
|
|
24
|
+
? findMadeSync(opts, dirname(parent), parent)
|
|
25
|
+
: undefined
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = {findMade, findMadeSync}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const {dirname} = require('path')
|
|
2
|
+
|
|
3
|
+
const mkdirpManual = (path, opts, made) => {
|
|
4
|
+
opts.recursive = false
|
|
5
|
+
const parent = dirname(path)
|
|
6
|
+
if (parent === path) {
|
|
7
|
+
return opts.mkdirAsync(path, opts).catch(er => {
|
|
8
|
+
// swallowed by recursive implementation on posix systems
|
|
9
|
+
// any other error is a failure
|
|
10
|
+
if (er.code !== 'EISDIR')
|
|
11
|
+
throw er
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return opts.mkdirAsync(path, opts).then(() => made || path, er => {
|
|
16
|
+
if (er.code === 'ENOENT')
|
|
17
|
+
return mkdirpManual(parent, opts)
|
|
18
|
+
.then(made => mkdirpManual(path, opts, made))
|
|
19
|
+
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
|
|
20
|
+
throw er
|
|
21
|
+
return opts.statAsync(path).then(st => {
|
|
22
|
+
if (st.isDirectory())
|
|
23
|
+
return made
|
|
24
|
+
else
|
|
25
|
+
throw er
|
|
26
|
+
}, () => { throw er })
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const mkdirpManualSync = (path, opts, made) => {
|
|
31
|
+
const parent = dirname(path)
|
|
32
|
+
opts.recursive = false
|
|
33
|
+
|
|
34
|
+
if (parent === path) {
|
|
35
|
+
try {
|
|
36
|
+
return opts.mkdirSync(path, opts)
|
|
37
|
+
} catch (er) {
|
|
38
|
+
// swallowed by recursive implementation on posix systems
|
|
39
|
+
// any other error is a failure
|
|
40
|
+
if (er.code !== 'EISDIR')
|
|
41
|
+
throw er
|
|
42
|
+
else
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
opts.mkdirSync(path, opts)
|
|
49
|
+
return made || path
|
|
50
|
+
} catch (er) {
|
|
51
|
+
if (er.code === 'ENOENT')
|
|
52
|
+
return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
|
|
53
|
+
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
|
|
54
|
+
throw er
|
|
55
|
+
try {
|
|
56
|
+
if (!opts.statSync(path).isDirectory())
|
|
57
|
+
throw er
|
|
58
|
+
} catch (_) {
|
|
59
|
+
throw er
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {mkdirpManual, mkdirpManualSync}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const {dirname} = require('path')
|
|
2
|
+
const {findMade, findMadeSync} = require('./find-made.js')
|
|
3
|
+
const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
|
|
4
|
+
|
|
5
|
+
const mkdirpNative = (path, opts) => {
|
|
6
|
+
opts.recursive = true
|
|
7
|
+
const parent = dirname(path)
|
|
8
|
+
if (parent === path)
|
|
9
|
+
return opts.mkdirAsync(path, opts)
|
|
10
|
+
|
|
11
|
+
return findMade(opts, path).then(made =>
|
|
12
|
+
opts.mkdirAsync(path, opts).then(() => made)
|
|
13
|
+
.catch(er => {
|
|
14
|
+
if (er.code === 'ENOENT')
|
|
15
|
+
return mkdirpManual(path, opts)
|
|
16
|
+
else
|
|
17
|
+
throw er
|
|
18
|
+
}))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const mkdirpNativeSync = (path, opts) => {
|
|
22
|
+
opts.recursive = true
|
|
23
|
+
const parent = dirname(path)
|
|
24
|
+
if (parent === path)
|
|
25
|
+
return opts.mkdirSync(path, opts)
|
|
26
|
+
|
|
27
|
+
const made = findMadeSync(opts, path)
|
|
28
|
+
try {
|
|
29
|
+
opts.mkdirSync(path, opts)
|
|
30
|
+
return made
|
|
31
|
+
} catch (er) {
|
|
32
|
+
if (er.code === 'ENOENT')
|
|
33
|
+
return mkdirpManualSync(path, opts)
|
|
34
|
+
else
|
|
35
|
+
throw er
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {mkdirpNative, mkdirpNativeSync}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { promisify } = require('util')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const optsArg = opts => {
|
|
4
|
+
if (!opts)
|
|
5
|
+
opts = { mode: 0o777, fs }
|
|
6
|
+
else if (typeof opts === 'object')
|
|
7
|
+
opts = { mode: 0o777, fs, ...opts }
|
|
8
|
+
else if (typeof opts === 'number')
|
|
9
|
+
opts = { mode: opts, fs }
|
|
10
|
+
else if (typeof opts === 'string')
|
|
11
|
+
opts = { mode: parseInt(opts, 8), fs }
|
|
12
|
+
else
|
|
13
|
+
throw new TypeError('invalid options argument')
|
|
14
|
+
|
|
15
|
+
opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
|
|
16
|
+
opts.mkdirAsync = promisify(opts.mkdir)
|
|
17
|
+
opts.stat = opts.stat || opts.fs.stat || fs.stat
|
|
18
|
+
opts.statAsync = promisify(opts.stat)
|
|
19
|
+
opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
|
|
20
|
+
opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
|
|
21
|
+
return opts
|
|
22
|
+
}
|
|
23
|
+
module.exports = optsArg
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
|
|
2
|
+
const { resolve, parse } = require('path')
|
|
3
|
+
const pathArg = path => {
|
|
4
|
+
if (/\0/.test(path)) {
|
|
5
|
+
// simulate same failure that node raises
|
|
6
|
+
throw Object.assign(
|
|
7
|
+
new TypeError('path must be a string without null bytes'),
|
|
8
|
+
{
|
|
9
|
+
path,
|
|
10
|
+
code: 'ERR_INVALID_ARG_VALUE',
|
|
11
|
+
}
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
path = resolve(path)
|
|
16
|
+
if (platform === 'win32') {
|
|
17
|
+
const badWinChars = /[*|"<>?:]/
|
|
18
|
+
const {root} = parse(path)
|
|
19
|
+
if (badWinChars.test(path.substr(root.length))) {
|
|
20
|
+
throw Object.assign(new Error('Illegal characters in path.'), {
|
|
21
|
+
path,
|
|
22
|
+
code: 'EINVAL',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return path
|
|
28
|
+
}
|
|
29
|
+
module.exports = pathArg
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
3
|
+
const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
|
|
4
|
+
const versArr = version.replace(/^v/, '').split('.')
|
|
5
|
+
const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
|
|
6
|
+
|
|
7
|
+
const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
|
|
8
|
+
const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
|
|
9
|
+
|
|
10
|
+
module.exports = {useNative, useNativeSync}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.
|
|
1
|
+
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2025-08-02T21:24:29.784Z"}
|