@tachybase/module-user 1.3.20 → 1.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/externalVersion.js +5 -8
  3. package/dist/server/actions/users.d.ts +1 -1
  4. package/dist/server/actions/users.js +2 -2
  5. package/dist/server/collections/users.d.ts +1 -1
  6. package/dist/server/collections/users.js +2 -2
  7. package/dist/server/migrations/20220818072639-add-users-phone-constraint.d.ts +1 -1
  8. package/dist/server/migrations/20220818072639-add-users-phone-constraint.js +2 -3
  9. package/dist/server/migrations/20220818072639-add-users-phone.d.ts +1 -1
  10. package/dist/server/migrations/20220818072639-add-users-phone.js +1 -1
  11. package/dist/server/migrations/20230802170800-add-username-constraint.d.ts +1 -1
  12. package/dist/server/migrations/20230802170800-add-username-constraint.js +2 -3
  13. package/dist/server/migrations/20230802170800-add-username.d.ts +1 -1
  14. package/dist/server/migrations/20230802170800-add-username.js +1 -1
  15. package/dist/server/migrations/20230802183100-update-username.d.ts +1 -1
  16. package/dist/server/migrations/20230802183100-update-username.js +1 -1
  17. package/dist/server/migrations/20230908164036-update-username-interface.d.ts +1 -1
  18. package/dist/server/migrations/20230908164036-update-username-interface.js +1 -1
  19. package/dist/server/migrations/20240722114514-add-users-specialRole.d.ts +1 -1
  20. package/dist/server/migrations/20240722114514-add-users-specialRole.js +1 -1
  21. package/dist/server/models/UserModel.d.ts +1 -1
  22. package/dist/server/models/UserModel.js +2 -2
  23. package/dist/server/server.d.ts +1 -1
  24. package/dist/server/server.js +5 -7
  25. package/package.json +10 -18
@@ -1,4 +1,4 @@
1
- (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tachybase/module-acl/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("react-i18next"),require("@tachybase/utils/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tachybase/utils/client"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@tachybase/module-user"]={},r["@tachybase/client"],r["@tachybase/module-acl"],r.jsxRuntime,r.react,r["@tachybase/schema"],r.antd,r["react-i18next"],r["@tachybase/utils"]))})(this,function(r,e,p,s,m,x,y,k,h){"use strict";var pe=Object.defineProperty,ie=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var U=(r,e,p)=>e in r?pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):r[e]=p,v=(r,e)=>{for(var p in e||(e={}))E.call(e,p)&&U(r,p,e[p]);if(S)for(var p of S(e))q.call(e,p)&&U(r,p,e[p]);return r},b=(r,e)=>ie(r,ce(e));var M=(r,e)=>{var p={};for(var s in r)E.call(r,s)&&e.indexOf(s)<0&&(p[s]=r[s]);if(r!=null&&S)for(var s of S(r))e.indexOf(s)<0&&q.call(r,s)&&(p[s]=r[s]);return p};var w=(r,e,p)=>new Promise((s,m)=>{var x=h=>{try{k(p.next(h))}catch(C){m(C)}},y=h=>{try{k(p.throw(h))}catch(C){m(C)}},k=h=>h.done?s(h.value):Promise.resolve(h.value).then(x,y);k((p=p.apply(r,e)).next())});function C(){return k.useTranslation(["user","core"],{nsMode:"fallback"})}const F={name:"users",fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"id"},{interface:"input",type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"username",unique:!0,uiSchema:{type:"string",title:'{{t("Username")}}',"x-component":"Input","x-validator":{username:!0},required:!0}},{interface:"email",type:"string",name:"email",unique:!0,uiSchema:{type:"string",title:'{{t("Email")}}',"x-component":"Input","x-validator":"email",required:!0}},{interface:"phone",type:"string",name:"phone",unique:!0,uiSchema:{type:"string",title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone",required:!0}},{interface:"password",type:"password",name:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"m2m",type:"belongsToMany",name:"roles",target:"roles",foreignKey:"userId",otherKey:"roleName",onDelete:"CASCADE",sourceKey:"id",targetKey:"name",through:"rolesUsers",uiSchema:{type:"array",title:'{{t("Roles")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"name"}}}}]},D={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:F,action:"list",params:{pageSize:50,appends:["roles"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"}},create:{type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add user") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"users:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:F},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{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:{},triggerWorkflows:[],pageMode:!1}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-component-props":{autocomplete:"off"},required:!1},password:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{autocomplete:"new-password"},required:!0},roles:{"x-component":"CollectionField","x-collection-field":"users.roles","x-decorator":"FormItem"}}}}}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Roles")}}',properties:{roles:{type:"array","x-component":"UserRolesField"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space",properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"users"},"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormBlockProps",title:'{{t("Edit profile")}}',properties:{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"}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},roles:{"x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"users.roles"}}}}},changePassword:{type:"void",title:'{{ t("Change password") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Change password") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:F,params:{append:["password"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{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"}}}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},N=()=>({type:"void",properties:{[x.uid()]:{type:"void","x-decorator":"RoleUsersTableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersServiceProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{[x.uid()]:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},actions:{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-use-component-props":"useBulkRemoveUsers","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8}}},create:{type:"void",title:'{{t("Add users")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add users")}}',properties:{resource:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{username:{$includes:""}},{nickname:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useAddRoleUsers","x-component-props":{type:"primary",htmlType:"submit"}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}}}}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{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:{remove:{type:"void",title:'{{ t("Remove") }}',"x-component":"Action.Link","x-use-component-props":"useRemoveUser","x-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"}}}}}}}}}}}}}),O=()=>{var a,i;const o=m.useContext(e.CollectionContext),t=e.useFilterFieldOptions(o.fields),{service:n}=e.useTableBlockContext();return e.useFilterFieldProps({options:t,params:((i=(a=n.state)==null?void 0:a.params)==null?void 0:i[0])||n.params,service:n})},R=()=>{const o=e.useAPIClient(),{role:t}=m.useContext(p.RolesManagerContext),n=e.useCollectionRecordData(),{service:a}=e.useTableBlockContext();return{onClick(){return w(this,null,function*(){yield o.resource("roles.users",t==null?void 0:t.name).remove({values:[n.id]}),a==null||a.refresh()})}}},K=()=>{const{t:o}=C(),{message:t}=y.App.useApp(),n=e.useAPIClient(),{service:a,field:i}=e.useTableBlockContext(),{role:d}=m.useContext(p.RolesManagerContext);return{onClick(){return w(this,null,function*(){var u;const l=(u=i==null?void 0:i.data)==null?void 0:u.selectedRowKeys;if(!(l!=null&&l.length)){t.warning(o("Please select users"));return}yield n.resource("roles.users",d==null?void 0:d.name).remove({values:l}),i.data.selectedRowKeys=[],a==null||a.refresh()})}}},$=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),{message:n}=y.App.useApp(),a=e.useAPIClient(),{setVisible:i}=e.useActionContext(),{field:d}=e.useTableBlockContext(),{__parent:c}=e.useBlockRequestContext();return{onClick(){return w(this,null,function*(){var f,g;const u=(f=d==null?void 0:d.data)==null?void 0:f.selectedRowKeys;if(!(u!=null&&u.length)){n.warning(o("Please select users"));return}yield a.resource("roles.users",t==null?void 0:t.name).add({values:u}),d.data.selectedRowKeys=[],i(!1),(g=c==null?void 0:c.props)==null||g.service.refresh()})}}},j=o=>{const{role:t}=m.useContext(p.RolesManagerContext);return b(v({},o),{collection:F,action:"listExcludeRole",params:{roleName:t==null?void 0:t.name}})},W=o=>{const{role:t}=m.useContext(p.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:t==null?void 0:t.name,action:"list"},{ready:!!t});return b(v({},o),{service:n,collection:F,params:{pageSize:50}})},L=e.withDynamicSchemaProps(o=>{const T=o,{showIndex:t,dragSort:n,rowKey:a,fieldNames:i,collection:d,service:c}=T,l=M(T,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),u=x.useField(),{role:f}=m.useContext(p.RolesManagerContext),g=e.useTableBlockParams(o);m.useEffect(()=>{c.run()},[f]);const P=x.useFieldSchema(),{treeTable:A}=(P==null?void 0:P["x-decorator-props"])||{},[V,ne]=m.useState(!!i);let I="children";if(d!=null&&d.tree&&A!==!1){const B=d.fields.find(ae=>ae.treeChildren);B&&(I=B.name),g.tree=!0}const se=m.useMemo(()=>x.createForm(),[A]);return s.jsx(e.SchemaComponentOptions,{scope:{treeTable:A},children:s.jsx(x.FormContext.Provider,{value:se,children:s.jsx(e.BlockProvider,b(v({name:o.name||"table"},o),{params:g,runWhenParamsChanged:!0,children:s.jsx(e.FixedBlockWrapper,{children:s.jsx(e.TableBlockContext.Provider,{value:b(v({},l),{field:u,service:c,params:g,showIndex:t,dragSort:n,rowKey:a,expandFlag:V,childrenColumnName:I,setExpandFlag:()=>ne(!V)}),children:s.jsx(e.RenderChildrenWithAssociationFilter,v({},o))})})}))})})}),z=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),n=m.useMemo(()=>N(),[t]);return s.jsx(e.ExtendCollectionsProvider,{collections:[F],children:s.jsx(e.SchemaComponent,{schema:n,components:{RoleUsersTableBlockProvider:L},scope:{useBulkRemoveUsers:K,useRemoveUser:R,useAddRoleUsers:$,useRoleUsersProps:j,useFilterActionProps:O,useRoleUsersServiceProps:W,t:o}})})},G=()=>{var f,g,P,A;const o=e.useCurrentUserContext(),t=e.useApp().pluginManager,n=t.get("@tachybase/plugin-otp"),a=t.get("@tachybase/plugin-auth-sms"),i=!!n&&!!a,d=((g=(f=o==null?void 0:o.data)==null?void 0:f.data)==null?void 0:g.password)!==null,c=(A=(P=o==null?void 0:o.data)==null?void 0:P.data)==null?void 0:A.phone,{t:l}=e.useTranslation(),u=c?l("Send verification code to phone: {{phoneNumber}}",{phoneNumber:c}):l("Please fill in your mobile phone number in your personal information first");return s.jsx(e.SchemaComponent,{schema:J,scope:{useSaveCurrentUserValues:H,oldPassword:d,codeDescription:u,phoneNumber:c,smsVerifyEnabled:i},components:{VerificationCode:e.VerificationCode}})},H=()=>{var c,l;const o=x.useForm(),t=e.useAPIClient(),{message:n}=y.App.useApp(),{t:a}=e.useTranslation(),i=e.useCurrentUserContext(),d=((l=(c=i==null?void 0:i.data)==null?void 0:c.data)==null?void 0:l.password)===null;return{run(){return w(this,null,function*(){yield o.submit(),(yield t.resource("auth").changePassword({values:o.values})).status===200&&(n.success(a("Edited successfully")),d&&i.mutate({data:b(v({},i.data.data),{password:""})})),yield o.reset()})}}},J={type:"object",properties:{[h.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form",title:'{{t("Change password")}}',properties:{action:{type:"void",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},verifyMethod:{type:"string",required:!0,title:'{{t("Verify method")}}',enum:[{label:'{{t("Use old password")}}',value:"password"},{label:'{{t("Use verification code")}}',value:"code"}],"x-component":"Radio.Group","x-decorator":"FormItem","x-reactions":[{dependencies:[".phoneExist",".oldPasswordExist"],fulfill:{state:{hidden:"{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}",value:"{{ undefined }}"}}}]},phoneExist:{type:"boolean",default:"{{ !!phoneNumber }}","x-hidden":!0},phone:{type:"string",title:'{{t("Phone")}}',default:"{{ phoneNumber }}","x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-hidden":!0},code:{type:"string",title:'{{t("Verification code")}}',description:"{{codeDescription}}","x-component":"VerificationCode","x-component-props":{actionType:"auth:changePassword",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".phoneExist"],fulfill:{state:{hidden:`{{
1
+ (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tachybase/module-acl/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("react-i18next"),require("@tego/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tego/client"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@tachybase/module-user"]={},r["@tachybase/client"],r["@tachybase/module-acl"],r.jsxRuntime,r.react,r["@tachybase/schema"],r.antd,r["react-i18next"],r["@tego/client"]))})(this,function(r,e,p,s,m,x,y,k,h){"use strict";var pe=Object.defineProperty,ie=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var U=(r,e,p)=>e in r?pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):r[e]=p,v=(r,e)=>{for(var p in e||(e={}))E.call(e,p)&&U(r,p,e[p]);if(S)for(var p of S(e))q.call(e,p)&&U(r,p,e[p]);return r},b=(r,e)=>ie(r,ce(e));var M=(r,e)=>{var p={};for(var s in r)E.call(r,s)&&e.indexOf(s)<0&&(p[s]=r[s]);if(r!=null&&S)for(var s of S(r))e.indexOf(s)<0&&q.call(r,s)&&(p[s]=r[s]);return p};var w=(r,e,p)=>new Promise((s,m)=>{var x=h=>{try{k(p.next(h))}catch(C){m(C)}},y=h=>{try{k(p.throw(h))}catch(C){m(C)}},k=h=>h.done?s(h.value):Promise.resolve(h.value).then(x,y);k((p=p.apply(r,e)).next())});function C(){return k.useTranslation(["user","core"],{nsMode:"fallback"})}const F={name:"users",fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"id"},{interface:"input",type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"username",unique:!0,uiSchema:{type:"string",title:'{{t("Username")}}',"x-component":"Input","x-validator":{username:!0},required:!0}},{interface:"email",type:"string",name:"email",unique:!0,uiSchema:{type:"string",title:'{{t("Email")}}',"x-component":"Input","x-validator":"email",required:!0}},{interface:"phone",type:"string",name:"phone",unique:!0,uiSchema:{type:"string",title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone",required:!0}},{interface:"password",type:"password",name:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"m2m",type:"belongsToMany",name:"roles",target:"roles",foreignKey:"userId",otherKey:"roleName",onDelete:"CASCADE",sourceKey:"id",targetKey:"name",through:"rolesUsers",uiSchema:{type:"array",title:'{{t("Roles")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"name"}}}}]},D={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:F,action:"list",params:{pageSize:50,appends:["roles"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"}},create:{type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add user") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"users:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:F},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{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:{},triggerWorkflows:[],pageMode:!1}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-component-props":{autocomplete:"off"},required:!1},password:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{autocomplete:"new-password"},required:!0},roles:{"x-component":"CollectionField","x-collection-field":"users.roles","x-decorator":"FormItem"}}}}}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Roles")}}',properties:{roles:{type:"array","x-component":"UserRolesField"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space",properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"users"},"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormBlockProps",title:'{{t("Edit profile")}}',properties:{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"}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},roles:{"x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"users.roles"}}}}},changePassword:{type:"void",title:'{{ t("Change password") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Change password") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:F,params:{append:["password"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{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"}}}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},N=()=>({type:"void",properties:{[x.uid()]:{type:"void","x-decorator":"RoleUsersTableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersServiceProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{[x.uid()]:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},actions:{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-use-component-props":"useBulkRemoveUsers","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8}}},create:{type:"void",title:'{{t("Add users")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add users")}}',properties:{resource:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{username:{$includes:""}},{nickname:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useAddRoleUsers","x-component-props":{type:"primary",htmlType:"submit"}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}}}}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{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:{remove:{type:"void",title:'{{ t("Remove") }}',"x-component":"Action.Link","x-use-component-props":"useRemoveUser","x-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"}}}}}}}}}}}}}),O=()=>{var a,i;const o=m.useContext(e.CollectionContext),t=e.useFilterFieldOptions(o.fields),{service:n}=e.useTableBlockContext();return e.useFilterFieldProps({options:t,params:((i=(a=n.state)==null?void 0:a.params)==null?void 0:i[0])||n.params,service:n})},R=()=>{const o=e.useAPIClient(),{role:t}=m.useContext(p.RolesManagerContext),n=e.useCollectionRecordData(),{service:a}=e.useTableBlockContext();return{onClick(){return w(this,null,function*(){yield o.resource("roles.users",t==null?void 0:t.name).remove({values:[n.id]}),a==null||a.refresh()})}}},K=()=>{const{t:o}=C(),{message:t}=y.App.useApp(),n=e.useAPIClient(),{service:a,field:i}=e.useTableBlockContext(),{role:d}=m.useContext(p.RolesManagerContext);return{onClick(){return w(this,null,function*(){var u;const l=(u=i==null?void 0:i.data)==null?void 0:u.selectedRowKeys;if(!(l!=null&&l.length)){t.warning(o("Please select users"));return}yield n.resource("roles.users",d==null?void 0:d.name).remove({values:l}),i.data.selectedRowKeys=[],a==null||a.refresh()})}}},$=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),{message:n}=y.App.useApp(),a=e.useAPIClient(),{setVisible:i}=e.useActionContext(),{field:d}=e.useTableBlockContext(),{__parent:c}=e.useBlockRequestContext();return{onClick(){return w(this,null,function*(){var f,g;const u=(f=d==null?void 0:d.data)==null?void 0:f.selectedRowKeys;if(!(u!=null&&u.length)){n.warning(o("Please select users"));return}yield a.resource("roles.users",t==null?void 0:t.name).add({values:u}),d.data.selectedRowKeys=[],i(!1),(g=c==null?void 0:c.props)==null||g.service.refresh()})}}},j=o=>{const{role:t}=m.useContext(p.RolesManagerContext);return b(v({},o),{collection:F,action:"listExcludeRole",params:{roleName:t==null?void 0:t.name}})},W=o=>{const{role:t}=m.useContext(p.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:t==null?void 0:t.name,action:"list"},{ready:!!t});return b(v({},o),{service:n,collection:F,params:{pageSize:50}})},L=e.withDynamicSchemaProps(o=>{const T=o,{showIndex:t,dragSort:n,rowKey:a,fieldNames:i,collection:d,service:c}=T,l=M(T,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),u=x.useField(),{role:f}=m.useContext(p.RolesManagerContext),g=e.useTableBlockParams(o);m.useEffect(()=>{c.run()},[f]);const P=x.useFieldSchema(),{treeTable:A}=(P==null?void 0:P["x-decorator-props"])||{},[V,ne]=m.useState(!!i);let I="children";if(d!=null&&d.tree&&A!==!1){const B=d.fields.find(ae=>ae.treeChildren);B&&(I=B.name),g.tree=!0}const se=m.useMemo(()=>x.createForm(),[A]);return s.jsx(e.SchemaComponentOptions,{scope:{treeTable:A},children:s.jsx(x.FormContext.Provider,{value:se,children:s.jsx(e.BlockProvider,b(v({name:o.name||"table"},o),{params:g,runWhenParamsChanged:!0,children:s.jsx(e.FixedBlockWrapper,{children:s.jsx(e.TableBlockContext.Provider,{value:b(v({},l),{field:u,service:c,params:g,showIndex:t,dragSort:n,rowKey:a,expandFlag:V,childrenColumnName:I,setExpandFlag:()=>ne(!V)}),children:s.jsx(e.RenderChildrenWithAssociationFilter,v({},o))})})}))})})}),z=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),n=m.useMemo(()=>N(),[t]);return s.jsx(e.ExtendCollectionsProvider,{collections:[F],children:s.jsx(e.SchemaComponent,{schema:n,components:{RoleUsersTableBlockProvider:L},scope:{useBulkRemoveUsers:K,useRemoveUser:R,useAddRoleUsers:$,useRoleUsersProps:j,useFilterActionProps:O,useRoleUsersServiceProps:W,t:o}})})},G=()=>{var f,g,P,A;const o=e.useCurrentUserContext(),t=e.useApp().pluginManager,n=t.get("@tachybase/plugin-otp"),a=t.get("@tachybase/plugin-auth-sms"),i=!!n&&!!a,d=((g=(f=o==null?void 0:o.data)==null?void 0:f.data)==null?void 0:g.password)!==null,c=(A=(P=o==null?void 0:o.data)==null?void 0:P.data)==null?void 0:A.phone,{t:l}=e.useTranslation(),u=c?l("Send verification code to phone: {{phoneNumber}}",{phoneNumber:c}):l("Please fill in your mobile phone number in your personal information first");return s.jsx(e.SchemaComponent,{schema:J,scope:{useSaveCurrentUserValues:H,oldPassword:d,codeDescription:u,phoneNumber:c,smsVerifyEnabled:i},components:{VerificationCode:e.VerificationCode}})},H=()=>{var c,l;const o=x.useForm(),t=e.useAPIClient(),{message:n}=y.App.useApp(),{t:a}=e.useTranslation(),i=e.useCurrentUserContext(),d=((l=(c=i==null?void 0:i.data)==null?void 0:c.data)==null?void 0:l.password)===null;return{run(){return w(this,null,function*(){yield o.submit(),(yield t.resource("auth").changePassword({values:o.values})).status===200&&(n.success(a("Edited successfully")),d&&i.mutate({data:b(v({},i.data.data),{password:""})})),yield o.reset()})}}},J={type:"object",properties:{[h.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form",title:'{{t("Change password")}}',properties:{action:{type:"void",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},verifyMethod:{type:"string",required:!0,title:'{{t("Verify method")}}',enum:[{label:'{{t("Use old password")}}',value:"password"},{label:'{{t("Use verification code")}}',value:"code"}],"x-component":"Radio.Group","x-decorator":"FormItem","x-reactions":[{dependencies:[".phoneExist",".oldPasswordExist"],fulfill:{state:{hidden:"{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}",value:"{{ undefined }}"}}}]},phoneExist:{type:"boolean",default:"{{ !!phoneNumber }}","x-hidden":!0},phone:{type:"string",title:'{{t("Phone")}}',default:"{{ phoneNumber }}","x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-hidden":!0},code:{type:"string",title:'{{t("Verification code")}}',description:"{{codeDescription}}","x-component":"VerificationCode","x-component-props":{actionType:"auth:changePassword",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".phoneExist"],fulfill:{state:{hidden:`{{
2
2
  !$deps[1] ||
3
3
  !smsVerifyEnabled ||
4
4
  ($deps[0] !== 'code' && $deps[0] !== undefined) // 有 verifyMethod 但未选 code
@@ -1,13 +1,10 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.3.20",
4
- "@tachybase/schema": "1.3.20",
3
+ "@tachybase/client": "1.3.22",
4
+ "@tachybase/schema": "1.3.39",
5
5
  "antd": "5.22.5",
6
- "@tachybase/module-acl": "1.3.20",
7
- "@tachybase/utils": "1.3.20",
6
+ "@tachybase/module-acl": "1.3.22",
7
+ "@tego/client": "1.3.39",
8
8
  "react-i18next": "15.2.0",
9
- "@tachybase/cache": "1.3.20",
10
- "@tachybase/database": "1.3.20",
11
- "@tachybase/server": "1.3.20",
12
- "@tachybase/actions": "1.3.20"
9
+ "@tego/server": "1.3.39"
13
10
  };
@@ -1,3 +1,3 @@
1
- import { Context, Next } from '@tachybase/actions';
1
+ import { Context, Next } from '@tego/server';
2
2
  export declare function updateProfile(ctx: Context, next: Next): Promise<void>;
3
3
  export declare const listExcludeRole: (ctx: Context, next: Next) => Promise<void>;
@@ -21,7 +21,7 @@ __export(users_exports, {
21
21
  updateProfile: () => updateProfile
22
22
  });
23
23
  module.exports = __toCommonJS(users_exports);
24
- var import_actions = require("@tachybase/actions");
24
+ var import_server = require("@tego/server");
25
25
  var import__ = require("..");
26
26
  async function updateProfile(ctx, next) {
27
27
  const { values } = ctx.action.params;
@@ -47,7 +47,7 @@ async function updateProfile(ctx, next) {
47
47
  await next();
48
48
  }
49
49
  const listExcludeRole = async (ctx, next) => {
50
- const { roleName, page = import_actions.DEFAULT_PAGE, pageSize = import_actions.DEFAULT_PER_PAGE } = ctx.action.params;
50
+ const { roleName, page = import_server.DEFAULT_PAGE, pageSize = import_server.DEFAULT_PER_PAGE } = ctx.action.params;
51
51
  const repo = ctx.db.getRepository("users");
52
52
  const users = await repo.find({
53
53
  fields: ["id"],
@@ -1,2 +1,2 @@
1
- declare const _default: import("@tachybase/database").CollectionOptions;
1
+ declare const _default: import("@tego/server").CollectionOptions;
2
2
  export default _default;
@@ -20,8 +20,8 @@ __export(users_exports, {
20
20
  default: () => users_default
21
21
  });
22
22
  module.exports = __toCommonJS(users_exports);
23
- var import_database = require("@tachybase/database");
24
- var users_default = (0, import_database.defineCollection)({
23
+ var import_server = require("@tego/server");
24
+ var users_default = (0, import_server.defineCollection)({
25
25
  origin: "@tachybase/module-user",
26
26
  dumpRules: {
27
27
  group: "user"
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class AddUsersPhoneMigration extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,8 +20,7 @@ __export(add_users_phone_constraint_exports, {
20
20
  default: () => AddUsersPhoneMigration
21
21
  });
22
22
  module.exports = __toCommonJS(add_users_phone_constraint_exports);
23
- var import_database = require("@tachybase/database");
24
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
25
24
  class AddUsersPhoneMigration extends import_server.Migration {
26
25
  constructor() {
27
26
  super(...arguments);
@@ -43,7 +42,7 @@ class AddUsersPhoneMigration extends import_server.Migration {
43
42
  const exists = await field.existsInDb();
44
43
  if (!exists) {
45
44
  await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
46
- type: import_database.DataTypes.STRING
45
+ type: import_server.DataTypes.STRING
47
46
  });
48
47
  }
49
48
  try {
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class AddUsersPhoneMigration extends Migration {
3
3
  appVersion: string;
4
4
  up(): Promise<void>;
@@ -20,7 +20,7 @@ __export(add_users_phone_exports, {
20
20
  default: () => AddUsersPhoneMigration
21
21
  });
22
22
  module.exports = __toCommonJS(add_users_phone_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class AddUsersPhoneMigration extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class AddUserNameMigration extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,8 +20,7 @@ __export(add_username_constraint_exports, {
20
20
  default: () => AddUserNameMigration
21
21
  });
22
22
  module.exports = __toCommonJS(add_username_constraint_exports);
23
- var import_database = require("@tachybase/database");
24
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
25
24
  class AddUserNameMigration extends import_server.Migration {
26
25
  constructor() {
27
26
  super(...arguments);
@@ -43,7 +42,7 @@ class AddUserNameMigration extends import_server.Migration {
43
42
  const exists = await field.existsInDb();
44
43
  if (!exists) {
45
44
  await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
46
- type: import_database.DataTypes.STRING
45
+ type: import_server.DataTypes.STRING
47
46
  });
48
47
  }
49
48
  try {
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class AddUserNameMigration extends Migration {
3
3
  appVersion: string;
4
4
  up(): Promise<void>;
@@ -20,7 +20,7 @@ __export(add_username_exports, {
20
20
  default: () => AddUserNameMigration
21
21
  });
22
22
  module.exports = __toCommonJS(add_username_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class AddUserNameMigration extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class UpdateUserNameMigration extends Migration {
3
3
  appVersion: string;
4
4
  up(): Promise<void>;
@@ -20,7 +20,7 @@ __export(update_username_exports, {
20
20
  default: () => UpdateUserNameMigration
21
21
  });
22
22
  module.exports = __toCommonJS(update_username_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class UpdateUserNameMigration extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class UpdateUserNameInterfaceMigration extends Migration {
3
3
  appVersion: string;
4
4
  up(): Promise<void>;
@@ -20,7 +20,7 @@ __export(update_username_interface_exports, {
20
20
  default: () => UpdateUserNameInterfaceMigration
21
21
  });
22
22
  module.exports = __toCommonJS(update_username_interface_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class UpdateUserNameInterfaceMigration extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class AddUsersSpecialRoleMigration extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,7 +20,7 @@ __export(add_users_specialRole_exports, {
20
20
  default: () => AddUsersSpecialRoleMigration
21
21
  });
22
22
  module.exports = __toCommonJS(add_users_specialRole_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class AddUsersSpecialRoleMigration extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Model } from '@tachybase/database';
1
+ import { Model } from '@tego/server';
2
2
  export declare class UserModel extends Model {
3
3
  desensitize(): UserModel;
4
4
  }
@@ -20,8 +20,8 @@ __export(UserModel_exports, {
20
20
  UserModel: () => UserModel
21
21
  });
22
22
  module.exports = __toCommonJS(UserModel_exports);
23
- var import_database = require("@tachybase/database");
24
- class UserModel extends import_database.Model {
23
+ var import_server = require("@tego/server");
24
+ class UserModel extends import_server.Model {
25
25
  desensitize() {
26
26
  const { fields } = this.constructor.collection;
27
27
  const result = this.constructor.build({}, { isNewRecord: this.isNewRecord });
@@ -1,4 +1,4 @@
1
- import { Plugin } from '@tachybase/server';
1
+ import { Plugin } from '@tego/server';
2
2
  export default class PluginUsersServer extends Plugin {
3
3
  beforeLoad(): Promise<void>;
4
4
  load(): Promise<void>;
@@ -32,9 +32,7 @@ __export(server_exports, {
32
32
  module.exports = __toCommonJS(server_exports);
33
33
  var import_node_path = require("node:path");
34
34
  var import_node_worker_threads = require("node:worker_threads");
35
- var import_database = require("@tachybase/database");
36
- var import_server = require("@tachybase/server");
37
- var import_utils = require("@tachybase/utils");
35
+ var import_server = require("@tego/server");
38
36
  var actions = __toESM(require("./actions/users"));
39
37
  var import_UserModel = require("./models/UserModel");
40
38
  class PluginUsersServer extends import_server.Plugin {
@@ -46,20 +44,20 @@ class PluginUsersServer extends import_server.Plugin {
46
44
  $isCurrentUser(_, ctx) {
47
45
  var _a, _b, _c, _d;
48
46
  return {
49
- [import_database.Op.eq]: ((_d = (_c = (_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.id) || -1
47
+ [import_server.Op.eq]: ((_d = (_c = (_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.id) || -1
50
48
  };
51
49
  },
52
50
  $isNotCurrentUser(_, ctx) {
53
51
  var _a, _b, _c, _d;
54
52
  return {
55
- [import_database.Op.ne]: ((_d = (_c = (_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.id) || -1
53
+ [import_server.Op.ne]: ((_d = (_c = (_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.id) || -1
56
54
  };
57
55
  },
58
56
  $isVar(val, ctx) {
59
57
  var _a, _b;
60
- const obj = (0, import_utils.parse)({ val: `{{${val}}}` })(JSON.parse(JSON.stringify((_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state)));
58
+ const obj = (0, import_server.parse)({ val: `{{${val}}}` })(JSON.parse(JSON.stringify((_b = (_a = ctx == null ? void 0 : ctx.app) == null ? void 0 : _a.ctx) == null ? void 0 : _b.state)));
61
59
  return {
62
- [import_database.Op.eq]: obj.val
60
+ [import_server.Op.eq]: obj.val
63
61
  };
64
62
  }
65
63
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-user",
3
3
  "displayName": "Users",
4
- "version": "1.3.20",
4
+ "version": "1.3.22",
5
5
  "description": "Provides basic user model, as well as created by and updated by fields.",
6
6
  "keywords": [
7
7
  "Users & permissions"
@@ -10,27 +10,19 @@
10
10
  "main": "./dist/server/index.js",
11
11
  "dependencies": {},
12
12
  "devDependencies": {
13
+ "@tachybase/schema": "^1.3.39",
14
+ "@tachybase/test": "^1.3.39",
15
+ "@tego/client": "^1.3.39",
16
+ "@tego/server": "^1.3.39",
13
17
  "@types/jsonwebtoken": "^8.5.9",
14
18
  "antd": "5.22.5",
15
19
  "jsonwebtoken": "^8.5.1",
16
- "react-i18next": "^15.2.0",
17
- "@tachybase/schema": "1.3.20"
18
- },
19
- "peerDependencies": {
20
- "@tachybase/cache": "1.3.20",
21
- "@tachybase/actions": "1.3.20",
22
- "@tachybase/database": "1.3.20",
23
- "@tachybase/client": "1.3.20",
24
- "@tachybase/module-acl": "1.3.20",
25
- "@tachybase/module-auth": "1.3.20",
26
- "@tachybase/resourcer": "1.3.20",
27
- "@tachybase/server": "1.3.20",
28
- "@tachybase/test": "1.3.20",
29
- "@tachybase/utils": "1.3.20"
20
+ "react-i18next": "15.2.0",
21
+ "@tachybase/client": "1.3.22",
22
+ "@tachybase/module-acl": "1.3.22",
23
+ "@tachybase/module-auth": "1.3.22"
30
24
  },
31
25
  "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
32
26
  "displayName.zh-CN": "用户",
33
- "scripts": {
34
- "build": "tachybase-build --no-dts @tachybase/module-user"
35
- }
27
+ "scripts": {}
36
28
  }