@tachybase/module-auth 1.0.6 → 1.0.25

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.
@@ -19,4 +19,4 @@
19
19
  } else {
20
20
  return /^[^@.<>"'/]{2,16}$/.test(value) || t("Please enter a valid username");
21
21
  }
22
- }}}`,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},je=e=>{const{t}=v(),n=e.authenticator,{authType:o,name:i,options:s}=n,p=!!ne()[o]&&(s==null?void 0:s.allowSignUp),y=`/signup?name=${i}`,x=()=>oe(i);return c.jsx(r.SchemaComponent,{schema:$e,scope:{useBasicSignIn:x,allowSignUp:p,signUpLink:y,t}})},Be=e=>{const t=T.useNavigate(),n=f.useForm(),o=r.useAPIClient(),{t:i}=w.useTranslation();return{run(){return A(this,null,function*(){var a;yield n.submit(),yield o.auth.signUp(n.values,e==null?void 0:e.authenticator),d.message.success(((a=e==null?void 0:e.message)==null?void 0:a.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(()=>{t("/signin")},2e3)})}}},De={type:"object",name:f.uid(),"x-component":"FormV2",properties:{username:{type:"string",required:!0,"x-component":"Input","x-validator":{username:!0},"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username")}}',style:{}}},password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Confirm password")}}',style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}}},Ue=({authenticatorName:e})=>{const{t}=v(),n=()=>Be({authenticator:e}),o=Z(e),{options:i}=o;return i!=null&&i.allowSignUp?c.jsx(r.SchemaComponent,{schema:De,scope:{useBasicSignUp:n,t}}):c.jsx(T.Navigate,{to:"/not-found",replace:!0})},Ve=()=>{const{t:e}=v();return c.jsx(r.SchemaComponent,{scope:{t:e},components:{Alert:d.Alert},schema:{type:"object",properties:{public:{type:"object",properties:{allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox","x-component-props":{defaultChecked:!0}}}},notice:{type:"void","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}}}}})},Le=()=>{var o;const t=r.usePlugin(I).authTypes.getEntities(),n={};for(const[i,s]of t)(o=s.components)!=null&&o.BindForm&&(n[i]=s.components.BindForm);return n},Me=()=>{const e=r.useRecord(),n=Le()[e.authType];return l.createElement(n,{authenticator:e})},qe={type:"void",name:"authenticatorBind","x-decorator":"TableBlockProvider","x-decorator-props":{collection:{name:"authenticators",sortable:!1,fields:[{interface:"input",type:"string",name:"authType"},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"bind",uiSchema:{type:"boolean",title:'{{t("Bind")}}',"x-component":"Checkbox"}},{type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}}]},resource:"authenticators",action:"bindTypes",params:{sort:["sort"]},rowKey:"name",showIndex:!0},"x-component":"div",properties:{table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"name"},properties:{authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},bind:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{bind:{type:"boolean","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}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{unbind:{"x-visible":'{{ $self.query(".bind").value() }}',type:"void",title:'{{ t("Unbind") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Unbind')}}",content:"{{t('Are you sure to unbind this authenticator?')}}"},useAction:"{{ useUnbindAction }}"}},bind:{"x-visible":'{{ !$self.query(".bind").value() }}',type:"void",title:"{{ t('Bind') }}","x-component":"Action.Link",properties:{modal:{type:"void","x-decorator":"Form",title:"{{ t('Bind') }}","x-component":"Action.Modal","x-component-props":{width:800},properties:{form:{type:"void","x-component":"BindForm"}}}}}}}}}}}}},Ke=()=>{const{refreshCM:e}=r.useCollectionManager_deprecated(),t=r.useAPIClient(),n=r.useRecord();return{run(){return A(this,null,function*(){yield t.resource("authenticators").unbind({authenticator:n.name}),e()})}}},We=()=>{const{t:e}=v();return c.jsx(d.Card,{bordered:!1,children:c.jsx(r.SchemaComponent,{schema:qe,components:{BindForm:Me},scope:{t:e,useUnbindAction:Ke}})})};var V=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function He(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ie=He,Ge=typeof V=="object"&&V&&V.Object===Object&&V,Xe=Ge,ze=Xe,Ye=typeof self=="object"&&self&&self.Object===Object&&self,Ze=ze||Ye||Function("return this")(),se=Ze,Je=se,Qe=function(){return Je.Date.now()},Re=Qe,et=/\s/;function tt(e){for(var t=e.length;t--&&et.test(e.charAt(t)););return t}var nt=tt,ot=nt,rt=/^\s+/;function it(e){return e&&e.slice(0,ot(e)+1).replace(rt,"")}var st=it,at=se,ct=at.Symbol,ae=ct,ce=ae,pe=Object.prototype,pt=pe.hasOwnProperty,ut=pe.toString,D=ce?ce.toStringTag:void 0;function lt(e){var t=pt.call(e,D),n=e[D];try{e[D]=void 0;var o=!0}catch(s){}var i=ut.call(e);return o&&(t?e[D]=n:delete e[D]),i}var dt=lt,mt=Object.prototype,yt=mt.toString;function ht(e){return yt.call(e)}var xt=ht,ue=ae,ft=dt,gt=xt,bt="[object Null]",Tt="[object Undefined]",le=ue?ue.toStringTag:void 0;function vt(e){return e==null?e===void 0?Tt:bt:le&&le in Object(e)?ft(e):gt(e)}var St=vt;function Ct(e){return e!=null&&typeof e=="object"}var At=Ct,wt=St,Et=At,Ft="[object Symbol]";function It(e){return typeof e=="symbol"||Et(e)&&wt(e)==Ft}var kt=It,Pt=st,de=ie,Ot=kt,me=NaN,Nt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,$t=/^0o[0-7]+$/i,jt=parseInt;function Bt(e){if(typeof e=="number")return e;if(Ot(e))return me;if(de(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=de(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Pt(e);var n=_t.test(e);return n||$t.test(e)?jt(e.slice(2),n?2:8):Nt.test(e)?me:+e}var Dt=Bt,Ut=ie,J=Re,ye=Dt,Vt="Expected a function",Lt=Math.max,Mt=Math.min;function qt(e,t,n){var o,i,s,a,p,y,x=0,_=!1,b=!1,g=!0;if(typeof e!="function")throw new TypeError(Vt);t=ye(t)||0,Ut(n)&&(_=!!n.leading,b="maxWait"in n,s=b?Lt(ye(n.maxWait)||0,t):s,g="trailing"in n?!!n.trailing:g);function $(h){var S=o,U=i;return o=i=void 0,x=h,a=e.apply(U,S),a}function W(h){return x=h,p=setTimeout(X,t),_?$(h):a}function H(h){var S=h-y,U=h-x,Te=t-S;return b?Mt(Te,s-U):Te}function G(h){var S=h-y,U=h-x;return y===void 0||S>=t||S<0||b&&U>=s}function X(){var h=J();if(G(h))return be(h);p=setTimeout(X,H(h))}function be(h){return p=void 0,g&&o?$(h):(o=i=void 0,a)}function gn(){p!==void 0&&clearTimeout(p),x=0,o=y=i=p=void 0}function bn(){return p===void 0?a:be(J())}function te(){var h=J(),S=G(h);if(o=arguments,i=this,y=h,S){if(p===void 0)return W(y);if(b)return clearTimeout(p),p=setTimeout(X,t),$(y)}return p===void 0&&(p=setTimeout(X,t)),a}return te.cancel=gn,te.flush=bn,te}var Kt=qt;const Wt=re(Kt),L={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"};function Ht(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${n.replace(/\/?$/,"")}(\\/|$)`);return e.replace(o,"/")||e}const Gt=Wt(e=>{e()},3e3,{leading:!0,trailing:!1});function Xt({app:e}){return e.apiClient.axios,[o=>{var s;const i=(s=o==null?void 0:o.headers)==null?void 0:s["x-new-token"];return i&&e.apiClient.auth.setToken(i),o},o=>{var b,g,$,W,H;const i=(g=(b=o==null?void 0:o.response)==null?void 0:b.headers)==null?void 0:g["x-new-token"],s=(W=($=o==null?void 0:o.response)==null?void 0:$.data)==null?void 0:W.errors,a=Array.isArray(s)?s[0]:null,p=e.router.state,{pathname:y,search:x}=p.location,_=e.router.basename;if(i&&e.apiClient.auth.setToken(i),o.status===401&&(a!=null&&a.code)&&L[a.code]&&(e.apiClient.auth.setToken(""),y===e.getHref("signin")&&(a==null?void 0:a.code)!==L.EMPTY_TOKEN&&o.config&&(o.config.skipNotify=!1),(a==null?void 0:a.code)==="USER_HAS_NO_ROLES_ERR"&&(o.config.skipNotify=!0,e.error=a)),o.status===401&&!((H=o.config)!=null&&H.skipAuth)&&(a!=null&&a.code)&&L[a.code]){if(!a||(a==null?void 0:a.code)===L.SKIP_TOKEN_RENEW)throw o;if(y!==e.getHref("signin")){const G=Ht(y,_);Gt(()=>{e.apiClient.auth.setToken(null),e.router.navigate(`/signin?redirect=${G}${x}`,{replace:!0})})}}throw o}]}const Q=l.createContext({type:""});Q.displayName="AuthTypeContext";const R=l.createContext({types:[]});R.displayName="AuthTypesContext";const zt=()=>{const{types:e}=l.useContext(R);return e},Yt=e=>{const t=r.useRecord(),n=r.useRequest(()=>Promise.resolve({data:C({},t.options)}),Y(C({},e),{manual:!0})),{run:o}=n,i=r.useActionContext();return l.useEffect(()=>{i.visible&&o()},[i.visible,o]),n},Zt=e=>{var o;const n=r.usePlugin(I).authTypes.get(e);return(o=n==null?void 0:n.components)==null?void 0:o.AdminSettingsForm},Jt=f.observer(()=>{const e=f.useForm(),t=r.useRecord(),n=Zt(e.values.authType||t.authType);return n?c.jsx(n,{}):null},{displayName:"Options"}),he={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":e=>/^[a-zA-Z0-9_-]+$/.test(e)?"":r.i18n.t("a-z, A-Z, 0-9, _, -"),required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},Qt={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const t=r.useActionContext(),{type:n}=l.useContext(Q);return r.useRequest(()=>Promise.resolve({data:{name:`s_${f.uid()}`,authType:n}}),Y(C({},e),{refreshDeps:[t.visible]}))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}}}}}},Rt={type:"void",name:"authenticators","x-decorator":"TableBlockProvider","x-decorator-props":{collection:he,dragSort:!0,action:"list",params:{pageSize:50,sort:"sort",appends:[]}},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":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{id:{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}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{type:"boolean","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:{updateAuthenticator:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"authenticators:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:he},"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"}}}},name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},en=()=>{const{setVisible:e}=r.useActionContext();return{run(){return A(this,null,function*(){e(!1)})}}},tn=()=>{const{t:e}=w.useTranslation(),[t,n]=l.useState(!1),[o,i]=l.useState(""),s=zt(),a=s.map(p=>Y(C({},p),{onClick:()=>{n(!0),i(p.value)}}));return c.jsx(r.ActionContextProvider,{value:{visible:t,setVisible:n},children:c.jsxs(Q.Provider,{value:{type:o},children:[c.jsx(d.Dropdown,{menu:{items:a},children:c.jsxs(d.Button,{icon:c.jsx(k.PlusOutlined,{}),type:"primary",children:[e("Add new")," ",c.jsx(k.DownOutlined,{})]})}),c.jsx(r.SchemaComponent,{scope:{useCloseAction:en,types:s,setType:i},schema:Qt})]})})},nn=()=>(r.useAsyncData(),!1),on=()=>{const{t:e}=v(),[t,n]=l.useState([]),o=r.useAPIClient();return r.useRequest(()=>o.resource("authenticators").listTypes().then(i=>{var a;return(((a=i==null?void 0:i.data)==null?void 0:a.data)||[]).map(p=>({key:p.name,label:e(p.title||p.name),value:p.name}))}),{onSuccess:i=>{n(i)}}),c.jsx(d.Card,{bordered:!1,children:c.jsx(R.Provider,{value:{types:t},children:c.jsx(r.SchemaComponent,{schema:Rt,components:{AddNew:tn,Options:Jt},scope:{types:t,useValuesFromOptions:Yt,useCanNotDelete:nn,t:e}})})})},{Option:ee}=d.Select,rn=f.connect(e=>{const{t}=v(),b=e,{value:n,onChange:o,minNum:i=1}=b,s=Ae(b,["value","onChange","minNum"]),a=/^(\d*)([a-zA-Z]*)$/,p=n?n.match(a):null;l.useEffect(()=>{p||o("10m")},[p,o]);const[y,x]=p?[parseInt(p[1]),p[2]]:[10,"m"],_=c.jsxs(d.Select,{value:x,onChange:g=>o(`${y}${g}`),style:{width:120},children:[c.jsx(ee,{value:"m",children:t("Minutes")}),c.jsx(ee,{value:"h",children:t("Hours")}),c.jsx(ee,{value:"d",children:t("Days")})]});return c.jsx(d.InputNumber,C({value:y,addonAfter:_,min:i,onChange:g=>o(`${g!=null?g:1}${x}`)},s))},f.mapProps({onInput:"onChange"})),M={InputTime:"InputTime"},sn={[M.InputTime]:rn};var P=1e3,O=P*60,N=O*60,F=N*24,an=F*7,cn=F*365.25,pn=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return un(e);if(n==="number"&&isFinite(e))return t.long?dn(e):ln(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function un(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*cn;case"weeks":case"week":case"w":return n*an;case"days":case"day":case"d":return n*F;case"hours":case"hour":case"hrs":case"hr":case"h":return n*N;case"minutes":case"minute":case"mins":case"min":case"m":return n*O;case"seconds":case"second":case"secs":case"sec":case"s":return n*P;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function ln(e){var t=Math.abs(e);return t>=F?Math.round(e/F)+"d":t>=N?Math.round(e/N)+"h":t>=O?Math.round(e/O)+"m":t>=P?Math.round(e/P)+"s":e+"ms"}function dn(e){var t=Math.abs(e);return t>=F?q(e,t,F,"day"):t>=N?q(e,t,N,"hour"):t>=O?q(e,t,O,"minute"):t>=P?q(e,t,P,"second"):e+" ms"}function q(e,t,n,o){var i=t>=n*1.5;return Math.round(e/n)+" "+o+(i?"s":"")}const xe=re(pn),fe="token-policy-config",ge="tokenControlConfig",mn=()=>{const e=r.useAPIClient(),t=l.useMemo(()=>f.createForm(),[]);return l.useEffect(()=>{A(this,null,function*(){var o;try{const{data:i}=yield e.resource(ge).get({filterByTk:fe});(o=i==null?void 0:i.data)!=null&&o.config&&t.setValues(i.data.config)}catch(i){console.error(i)}})},[t,e]),{form:t}},yn=()=>{const{message:e}=d.App.useApp(),t=r.useAPIClient(),n=f.useForm(),{t:o}=v();return{type:"primary",onClick(){return A(this,null,function*(){n.clearErrors("*");const{tokenExpirationTime:s,sessionExpirationTime:a,expiredTokenRenewLimit:p}=n.values;if(xe(s)>=xe(a)){n.setFieldState("tokenExpirationTime",x=>{x.feedbacks=[{type:"error",code:"ValidateError",messages:[o("Token validity period must be less than session validity period!")]}]});return}yield n.submit();const y=yield t.resource(ge).update({values:{config:n.values},filterByTk:fe});y&&y.status===200&&e.success(o("Saved successfully!"))})}}},K={useSubmitActionProps:"useSubmitActionProps",useEditForm:"useEditForm"},hn={[K.useEditForm]:mn,[K.useSubmitActionProps]:yn},xn={name:f.uid(),"x-component":"FormV2","x-use-component-props":K.useEditForm,type:"object",properties:{sessionExpirationTime:{type:"string",title:j("Session validity period"),"x-decorator":"FormItem","x-component":M.InputTime,required:!0,description:j("The maximum valid time for each user login. During the session validity, the Token will be automatically updated. After the timeout, the user is required to log in again.")},tokenExpirationTime:{type:"string",title:j("Token validity period"),"x-decorator":"FormItem","x-component":M.InputTime,required:!0,description:j("The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)")},expiredTokenRenewLimit:{type:"string",title:"{{t('Expired token refresh limit')}}","x-decorator":"FormItem","x-component":M.InputTime,"x-component-props":{minNum:0},required:!0,description:j("The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.")},footer:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column"},properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":K.useSubmitActionProps}}}}},fn=()=>{const{t:e}=v();return c.jsx(d.Card,{bordered:!1,children:c.jsx(r.SchemaComponent,{schema:xn,scope:C({t:e},hn),components:sn})})};class I extends r.Plugin{constructor(){super(...arguments),this.authTypes=new m.Registry}registerType(t,n){this.authTypes.register(t,n)}load(){return A(this,null,function*(){this.app.systemSettingsManager.add("system-services."+E,{icon:"LoginOutlined",title:`{{t("Authentication", { ns: "${E}" })}}`,Component:on,aclSnippet:"pm.auth.authenticators"}),this.app.userSettingsManager.add(E,{icon:"LoginOutlined",title:`{{t("Authentication login bind", { ns: "${E}" })}}`,Component:We,aclSnippet:"pm.auth.authenticators"}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.app.addComponents({AuthLayout:Fe,SignInPage:Pe,SignUpPage:Ne}),this.app.providers.unshift([Ee,{}]),this.registerType(we,{components:{SignInForm:je,SignUpForm:Ue,AdminSettingsForm:Ve}}),this.app.systemSettingsManager.add("security.token-policy",{title:`{{t("Token policy", { ns: "${E}" })}}`,Component:fn,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0});const[t,n]=Xt({app:this.app});this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:t,rejected:n,synchronous:!1,runWhen:null})})}}u.AuthenticatorsContext=B,u.PluginAuthClient=I,u.default=I,u.useAuthenticator=Z,u.useSignIn=oe,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
22
+ }}}`,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"}}},je=e=>{const{t}=v(),n=e.authenticator,{authType:o,name:i,options:s}=n,p=!!ne()[o]&&(s==null?void 0:s.allowSignUp),y=`/signup?name=${i}`,x=()=>oe(i);return c.jsx(r.SchemaComponent,{schema:$e,scope:{useBasicSignIn:x,allowSignUp:p,signUpLink:y,t}})},Be=e=>{const t=T.useNavigate(),n=f.useForm(),o=r.useAPIClient(),{t:i}=w.useTranslation();return{run(){return A(this,null,function*(){var a;yield n.submit(),yield o.auth.signUp(n.values,e==null?void 0:e.authenticator),d.message.success(((a=e==null?void 0:e.message)==null?void 0:a.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(()=>{t("/signin")},2e3)})}}},De={type:"object",name:f.uid(),"x-component":"FormV2",properties:{username:{type:"string",required:!0,"x-component":"Input","x-validator":{username:!0},"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username")}}',style:{}}},password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Confirm password")}}',style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}}},Ue=({authenticatorName:e})=>{const{t}=v(),n=()=>Be({authenticator:e}),o=Z(e),{options:i}=o;return i!=null&&i.allowSignUp?c.jsx(r.SchemaComponent,{schema:De,scope:{useBasicSignUp:n,t}}):c.jsx(T.Navigate,{to:"/not-found",replace:!0})},Ve=()=>{const{t:e}=v();return c.jsx(r.SchemaComponent,{scope:{t:e},components:{Alert:d.Alert},schema:{type:"object",properties:{public:{type:"object",properties:{allowSignUp:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox","x-component-props":{defaultChecked:!0}}}},notice:{type:"void","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}}}}})},Le=()=>{var o;const t=r.usePlugin(I).authTypes.getEntities(),n={};for(const[i,s]of t)(o=s.components)!=null&&o.BindForm&&(n[i]=s.components.BindForm);return n},Me=()=>{const e=r.useRecord(),n=Le()[e.authType];return l.createElement(n,{authenticator:e})},qe={type:"void",name:"authenticatorBind","x-decorator":"TableBlockProvider","x-decorator-props":{collection:{name:"authenticators",sortable:!1,fields:[{interface:"input",type:"string",name:"authType"},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"bind",uiSchema:{type:"boolean",title:'{{t("Bind")}}',"x-component":"Checkbox"}},{type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}}]},resource:"authenticators",action:"bindTypes",params:{sort:["sort"]},rowKey:"name",showIndex:!0},"x-component":"div",properties:{table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"name"},properties:{authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},bind:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{bind:{type:"boolean","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}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{unbind:{"x-visible":'{{ $self.query(".bind").value() }}',type:"void",title:'{{ t("Unbind") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Unbind')}}",content:"{{t('Are you sure to unbind this authenticator?')}}"},useAction:"{{ useUnbindAction }}"}},bind:{"x-visible":'{{ !$self.query(".bind").value() }}',type:"void",title:"{{ t('Bind') }}","x-component":"Action.Link",properties:{modal:{type:"void","x-decorator":"Form",title:"{{ t('Bind') }}","x-component":"Action.Modal","x-component-props":{width:800},properties:{form:{type:"void","x-component":"BindForm"}}}}}}}}}}}}},Ke=()=>{const{refreshCM:e}=r.useCollectionManager_deprecated(),t=r.useAPIClient(),n=r.useRecord();return{run(){return A(this,null,function*(){yield t.resource("authenticators").unbind({authenticator:n.name}),e()})}}},We=()=>{const{t:e}=v();return c.jsx(d.Card,{bordered:!1,children:c.jsx(r.SchemaComponent,{schema:qe,components:{BindForm:Me},scope:{t:e,useUnbindAction:Ke}})})};var V=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function He(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ie=He,Ge=typeof V=="object"&&V&&V.Object===Object&&V,Xe=Ge,ze=Xe,Ye=typeof self=="object"&&self&&self.Object===Object&&self,Ze=ze||Ye||Function("return this")(),se=Ze,Je=se,Qe=function(){return Je.Date.now()},Re=Qe,et=/\s/;function tt(e){for(var t=e.length;t--&&et.test(e.charAt(t)););return t}var nt=tt,ot=nt,rt=/^\s+/;function it(e){return e&&e.slice(0,ot(e)+1).replace(rt,"")}var st=it,at=se,ct=at.Symbol,ae=ct,ce=ae,pe=Object.prototype,pt=pe.hasOwnProperty,ut=pe.toString,D=ce?ce.toStringTag:void 0;function lt(e){var t=pt.call(e,D),n=e[D];try{e[D]=void 0;var o=!0}catch(s){}var i=ut.call(e);return o&&(t?e[D]=n:delete e[D]),i}var dt=lt,mt=Object.prototype,yt=mt.toString;function ht(e){return yt.call(e)}var xt=ht,ue=ae,ft=dt,gt=xt,bt="[object Null]",Tt="[object Undefined]",le=ue?ue.toStringTag:void 0;function vt(e){return e==null?e===void 0?Tt:bt:le&&le in Object(e)?ft(e):gt(e)}var St=vt;function Ct(e){return e!=null&&typeof e=="object"}var At=Ct,wt=St,Et=At,Ft="[object Symbol]";function It(e){return typeof e=="symbol"||Et(e)&&wt(e)==Ft}var kt=It,Pt=st,de=ie,Ot=kt,me=NaN,Nt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,$t=/^0o[0-7]+$/i,jt=parseInt;function Bt(e){if(typeof e=="number")return e;if(Ot(e))return me;if(de(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=de(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Pt(e);var n=_t.test(e);return n||$t.test(e)?jt(e.slice(2),n?2:8):Nt.test(e)?me:+e}var Dt=Bt,Ut=ie,J=Re,ye=Dt,Vt="Expected a function",Lt=Math.max,Mt=Math.min;function qt(e,t,n){var o,i,s,a,p,y,x=0,_=!1,b=!1,g=!0;if(typeof e!="function")throw new TypeError(Vt);t=ye(t)||0,Ut(n)&&(_=!!n.leading,b="maxWait"in n,s=b?Lt(ye(n.maxWait)||0,t):s,g="trailing"in n?!!n.trailing:g);function $(h){var S=o,U=i;return o=i=void 0,x=h,a=e.apply(U,S),a}function W(h){return x=h,p=setTimeout(X,t),_?$(h):a}function H(h){var S=h-y,U=h-x,Te=t-S;return b?Mt(Te,s-U):Te}function G(h){var S=h-y,U=h-x;return y===void 0||S>=t||S<0||b&&U>=s}function X(){var h=J();if(G(h))return be(h);p=setTimeout(X,H(h))}function be(h){return p=void 0,g&&o?$(h):(o=i=void 0,a)}function gn(){p!==void 0&&clearTimeout(p),x=0,o=y=i=p=void 0}function bn(){return p===void 0?a:be(J())}function te(){var h=J(),S=G(h);if(o=arguments,i=this,y=h,S){if(p===void 0)return W(y);if(b)return clearTimeout(p),p=setTimeout(X,t),$(y)}return p===void 0&&(p=setTimeout(X,t)),a}return te.cancel=gn,te.flush=bn,te}var Kt=qt;const Wt=re(Kt),L={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"};function Ht(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${n.replace(/\/?$/,"")}(\\/|$)`);return e.replace(o,"/")||e}const Gt=Wt(e=>{e()},3e3,{leading:!0,trailing:!1});function Xt({app:e}){return e.apiClient.axios,[o=>{var s;const i=(s=o==null?void 0:o.headers)==null?void 0:s["x-new-token"];return i&&e.apiClient.auth.setToken(i),o},o=>{var b,g,$,W,H;const i=(g=(b=o==null?void 0:o.response)==null?void 0:b.headers)==null?void 0:g["x-new-token"],s=(W=($=o==null?void 0:o.response)==null?void 0:$.data)==null?void 0:W.errors,a=Array.isArray(s)?s[0]:null,p=e.router.state,{pathname:y,search:x}=p.location,_=e.router.basename;if(i&&e.apiClient.auth.setToken(i),o.status===401&&(a!=null&&a.code)&&L[a.code]&&(e.apiClient.auth.setToken(""),y===e.getHref("signin")&&(a==null?void 0:a.code)!==L.EMPTY_TOKEN&&o.config&&(o.config.skipNotify=!1),(a==null?void 0:a.code)==="USER_HAS_NO_ROLES_ERR"&&(o.config.skipNotify=!0,e.error=a)),o.status===401&&!((H=o.config)!=null&&H.skipAuth)&&(a!=null&&a.code)&&L[a.code]){if(!a||(a==null?void 0:a.code)===L.SKIP_TOKEN_RENEW)throw o;if(y!==e.getHref("signin")){const G=Ht(y,_);Gt(()=>{e.apiClient.auth.setToken(null),e.router.navigate(`/signin?redirect=${G}${x}`,{replace:!0})})}}throw o}]}const Q=l.createContext({type:""});Q.displayName="AuthTypeContext";const R=l.createContext({types:[]});R.displayName="AuthTypesContext";const zt=()=>{const{types:e}=l.useContext(R);return e},Yt=e=>{const t=r.useRecord(),n=r.useRequest(()=>Promise.resolve({data:C({},t.options)}),Y(C({},e),{manual:!0})),{run:o}=n,i=r.useActionContext();return l.useEffect(()=>{i.visible&&o()},[i.visible,o]),n},Zt=e=>{var o;const n=r.usePlugin(I).authTypes.get(e);return(o=n==null?void 0:n.components)==null?void 0:o.AdminSettingsForm},Jt=f.observer(()=>{const e=f.useForm(),t=r.useRecord(),n=Zt(e.values.authType||t.authType);return n?c.jsx(n,{}):null},{displayName:"Options"}),he={name:"authenticators",sortable:!0,fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Auth UID")}}',"x-component":"Input","x-validator":e=>/^[a-zA-Z0-9_-]+$/.test(e)?"":r.i18n.t("a-z, A-Z, 0-9, _, -"),required:!0}},{interface:"input",type:"string",name:"authType",uiSchema:{type:"string",title:'{{t("Auth Type")}}',"x-component":"Select",dataSource:"{{ types }}",required:!0}},{interface:"input",type:"string",name:"title",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"textarea",type:"string",name:"description",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},Qt={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const t=r.useActionContext(),{type:n}=l.useContext(Q);return r.useRequest(()=>Promise.resolve({data:{name:`s_${f.uid()}`,authType:n}}),Y(C({},e),{refreshDeps:[t.visible]}))}},title:'{{t("Add new")}}',properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}}}}}},Rt={type:"void",name:"authenticators","x-decorator":"TableBlockProvider","x-decorator-props":{collection:he,dragSort:!0,action:"list",params:{pageSize:50,sort:"sort",appends:[]}},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":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{id:{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}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{type:"boolean","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:{updateAuthenticator:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"authenticators:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:he},"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"}}}},name:{"x-component":"CollectionField","x-decorator":"FormItem"},authType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},title:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},en=()=>{const{setVisible:e}=r.useActionContext();return{run(){return A(this,null,function*(){e(!1)})}}},tn=()=>{const{t:e}=w.useTranslation(),[t,n]=l.useState(!1),[o,i]=l.useState(""),s=zt(),a=s.map(p=>Y(C({},p),{onClick:()=>{n(!0),i(p.value)}}));return c.jsx(r.ActionContextProvider,{value:{visible:t,setVisible:n},children:c.jsxs(Q.Provider,{value:{type:o},children:[c.jsx(d.Dropdown,{menu:{items:a},children:c.jsxs(d.Button,{icon:c.jsx(k.PlusOutlined,{}),type:"primary",children:[e("Add new")," ",c.jsx(k.DownOutlined,{})]})}),c.jsx(r.SchemaComponent,{scope:{useCloseAction:en,types:s,setType:i},schema:Qt})]})})},nn=()=>{const{data:e}=r.useAsyncData();return!1},on=()=>{const{t:e}=v(),[t,n]=l.useState([]),o=r.useAPIClient();return r.useRequest(()=>o.resource("authenticators").listTypes().then(i=>{var a;return(((a=i==null?void 0:i.data)==null?void 0:a.data)||[]).map(p=>({key:p.name,label:e(p.title||p.name),value:p.name}))}),{onSuccess:i=>{n(i)}}),c.jsx(d.Card,{bordered:!1,children:c.jsx(R.Provider,{value:{types:t},children:c.jsx(r.SchemaComponent,{schema:Rt,components:{AddNew:tn,Options:Jt},scope:{types:t,useValuesFromOptions:Yt,useCanNotDelete:nn,t:e}})})})},{Option:ee}=d.Select,rn=f.connect(e=>{const{t}=v(),b=e,{value:n,onChange:o,minNum:i=1}=b,s=Ae(b,["value","onChange","minNum"]),a=/^(\d*)([a-zA-Z]*)$/,p=n?n.match(a):null;l.useEffect(()=>{p||o("10m")},[p,o]);const[y,x]=p?[parseInt(p[1]),p[2]]:[10,"m"],_=c.jsxs(d.Select,{value:x,onChange:g=>o(`${y}${g}`),style:{width:120},children:[c.jsx(ee,{value:"m",children:t("Minutes")}),c.jsx(ee,{value:"h",children:t("Hours")}),c.jsx(ee,{value:"d",children:t("Days")})]});return c.jsx(d.InputNumber,C({value:y,addonAfter:_,min:i,onChange:g=>o(`${g!=null?g:1}${x}`)},s))},f.mapProps({onInput:"onChange"})),M={InputTime:"InputTime"},sn={[M.InputTime]:rn};var P=1e3,O=P*60,N=O*60,F=N*24,an=F*7,cn=F*365.25,pn=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return un(e);if(n==="number"&&isFinite(e))return t.long?dn(e):ln(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function un(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*cn;case"weeks":case"week":case"w":return n*an;case"days":case"day":case"d":return n*F;case"hours":case"hour":case"hrs":case"hr":case"h":return n*N;case"minutes":case"minute":case"mins":case"min":case"m":return n*O;case"seconds":case"second":case"secs":case"sec":case"s":return n*P;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function ln(e){var t=Math.abs(e);return t>=F?Math.round(e/F)+"d":t>=N?Math.round(e/N)+"h":t>=O?Math.round(e/O)+"m":t>=P?Math.round(e/P)+"s":e+"ms"}function dn(e){var t=Math.abs(e);return t>=F?q(e,t,F,"day"):t>=N?q(e,t,N,"hour"):t>=O?q(e,t,O,"minute"):t>=P?q(e,t,P,"second"):e+" ms"}function q(e,t,n,o){var i=t>=n*1.5;return Math.round(e/n)+" "+o+(i?"s":"")}const xe=re(pn),fe="token-policy-config",ge="tokenControlConfig",mn=()=>{const e=r.useAPIClient(),t=l.useMemo(()=>f.createForm(),[]);return l.useEffect(()=>{A(this,null,function*(){var o;try{const{data:i}=yield e.resource(ge).get({filterByTk:fe});(o=i==null?void 0:i.data)!=null&&o.config&&t.setValues(i.data.config)}catch(i){console.error(i)}})},[t,e]),{form:t}},yn=()=>{const{message:e}=d.App.useApp(),t=r.useAPIClient(),n=f.useForm(),{t:o}=v();return{type:"primary",onClick(){return A(this,null,function*(){n.clearErrors("*");const{tokenExpirationTime:s,sessionExpirationTime:a,expiredTokenRenewLimit:p}=n.values;if(xe(s)>=xe(a)){n.setFieldState("tokenExpirationTime",x=>{x.feedbacks=[{type:"error",code:"ValidateError",messages:[o("Token validity period must be less than session validity period!")]}]});return}yield n.submit();const y=yield t.resource(ge).update({values:{config:n.values},filterByTk:fe});y&&y.status===200&&e.success(o("Saved successfully!"))})}}},K={useSubmitActionProps:"useSubmitActionProps",useEditForm:"useEditForm"},hn={[K.useEditForm]:mn,[K.useSubmitActionProps]:yn},xn={name:f.uid(),"x-component":"FormV2","x-use-component-props":K.useEditForm,type:"object",properties:{sessionExpirationTime:{type:"string",title:j("Session validity period"),"x-decorator":"FormItem","x-component":M.InputTime,required:!0,description:j("The maximum valid time for each user login. During the session validity, the Token will be automatically updated. After the timeout, the user is required to log in again.")},tokenExpirationTime:{type:"string",title:j("Token validity period"),"x-decorator":"FormItem","x-component":M.InputTime,required:!0,description:j("The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)")},expiredTokenRenewLimit:{type:"string",title:"{{t('Expired token refresh limit')}}","x-decorator":"FormItem","x-component":M.InputTime,"x-component-props":{minNum:0},required:!0,description:j("The maximum time limit allowed for refreshing a Token after it expires. After this time limit, the token cannot be automatically renewed, and the user needs to log in again.")},footer:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column"},properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":K.useSubmitActionProps}}}}},fn=()=>{const{t:e}=v();return c.jsx(d.Card,{bordered:!1,children:c.jsx(r.SchemaComponent,{schema:xn,scope:C({t:e},hn),components:sn})})};class I extends r.Plugin{constructor(){super(...arguments),this.authTypes=new m.Registry}registerType(t,n){this.authTypes.register(t,n)}load(){return A(this,null,function*(){this.app.systemSettingsManager.add("system-services."+E,{icon:"LoginOutlined",title:`{{t("Authentication", { ns: "${E}" })}}`,Component:on,aclSnippet:"pm.auth.authenticators"}),this.app.userSettingsManager.add(E,{icon:"LoginOutlined",title:`{{t("Authentication login bind", { ns: "${E}" })}}`,Component:We,aclSnippet:"pm.auth.authenticators"}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.app.addComponents({AuthLayout:Fe,SignInPage:Pe,SignUpPage:Ne}),this.app.providers.unshift([Ee,{}]),this.registerType(we,{components:{SignInForm:je,SignUpForm:Ue,AdminSettingsForm:Ve}}),this.app.systemSettingsManager.add("security.token-policy",{title:`{{t("Token policy", { ns: "${E}" })}}`,Component:fn,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0});const[t,n]=Xt({app:this.app});this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:t,rejected:n,synchronous:!1,runWhen:null})})}}u.AuthenticatorsContext=B,u.PluginAuthClient=I,u.default=I,u.useAuthenticator=Z,u.useSignIn=oe,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,19 +1,19 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.0.6",
3
+ "@tachybase/client": "1.0.25",
4
4
  "react-router-dom": "6.28.1",
5
- "@tachybase/utils": "1.0.6",
6
- "axios": "1.7.7",
5
+ "@tachybase/utils": "1.0.25",
6
+ "axios": "0.27.2",
7
7
  "lodash": "4.17.21",
8
- "@tachybase/auth": "1.0.6",
9
- "@tachybase/database": "1.0.6",
10
- "@tachybase/cache": "1.0.6",
11
- "@tachybase/server": "1.0.6",
12
- "@tachybase/logger": "1.0.6",
13
- "@tachybase/test": "1.0.6",
8
+ "@tachybase/auth": "1.0.25",
9
+ "@tachybase/database": "1.0.25",
10
+ "@tachybase/cache": "1.0.25",
11
+ "@tachybase/server": "1.0.25",
12
+ "@tachybase/logger": "1.0.25",
13
+ "@tachybase/test": "1.0.25",
14
14
  "antd": "5.22.5",
15
- "@tachybase/schema": "1.0.6",
15
+ "@tachybase/schema": "1.0.25",
16
16
  "react-i18next": "15.2.0",
17
17
  "@ant-design/icons": "5.3.7",
18
- "@tachybase/actions": "1.0.6"
18
+ "@tachybase/actions": "1.0.25"
19
19
  };
@@ -44,6 +44,7 @@
44
44
  "User can bind or unbind the sign in type": "用户可以绑定或解绑登录方式",
45
45
  "User not found. Please sign in again to continue.": "用户不存在。请重新登录以继续。",
46
46
  "Username/Email": "用户名/邮箱",
47
+ "WeChat": "微信",
47
48
  "Your session has expired. Please sign in again.": "您的会话已过期,请重新登录。",
48
49
  "gitea": "Gitea 验证登录",
49
50
  "sms": "短信验证",
@@ -1 +1 @@
1
- {"name":"cron","description":"Cron jobs for your node","version":"3.3.1","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2025-04-02T02:55:46.942Z"}
1
+ {"name":"cron","description":"Cron jobs for your node","version":"3.3.1","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2025-05-22T01:57:45.951Z"}
@@ -1 +1 @@
1
- {"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-04-02T02:55:47.034Z"}
1
+ {"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-05-22T01:57:46.045Z"}
@@ -30,7 +30,7 @@ var token_blacklist_default = (0, import_database.defineCollection)({
30
30
  model: "TokenBlacklistModel",
31
31
  fields: [
32
32
  {
33
- type: "string",
33
+ type: "text",
34
34
  name: "token",
35
35
  index: true
36
36
  },
@@ -27,7 +27,7 @@ class create_token_policy_default extends import_server.Migration {
27
27
  super(...arguments);
28
28
  this.on = "afterLoad";
29
29
  // 'beforeLoad' or 'afterLoad'
30
- this.appVersion = "<0.23.65";
30
+ this.appVersion = "<0.23.66";
31
31
  }
32
32
  async up() {
33
33
  const tokenPolicyRepo = this.app.db.getRepository(import_constants.tokenPolicyCollectionName);
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@tachybase/server';
2
+ export default class extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ }
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var token_text_type_exports = {};
19
+ __export(token_text_type_exports, {
20
+ default: () => token_text_type_default
21
+ });
22
+ module.exports = __toCommonJS(token_text_type_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var import_server = require("@tachybase/server");
25
+ class token_text_type_default extends import_server.Migration {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.on = "afterLoad";
29
+ // 'beforeLoad' or 'afterLoad'
30
+ this.appVersion = "<1.0.10";
31
+ }
32
+ async up() {
33
+ const queryInterface = this.db.sequelize.getQueryInterface();
34
+ await queryInterface.changeColumn("tokenBlacklist", "token", {
35
+ type: import_database.DataTypes.TEXT
36
+ });
37
+ this.app.logger.info("change tokenBlacklist token form string to text success!");
38
+ }
39
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-auth",
3
3
  "displayName": "Authentication",
4
- "version": "1.0.6",
4
+ "version": "1.0.25",
5
5
  "description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
6
6
  "keywords": [
7
7
  "Authentication",
@@ -18,18 +18,18 @@
18
18
  "react": "^18.3.1",
19
19
  "react-i18next": "^15.2.0",
20
20
  "react-router-dom": "6.28.1",
21
- "@tachybase/schema": "1.0.6"
21
+ "@tachybase/schema": "1.0.25"
22
22
  },
23
23
  "peerDependencies": {
24
- "@tachybase/actions": "1.0.6",
25
- "@tachybase/auth": "1.0.6",
26
- "@tachybase/client": "1.0.6",
27
- "@tachybase/server": "1.0.6",
28
- "@tachybase/cache": "1.0.6",
29
- "@tachybase/logger": "1.0.6",
30
- "@tachybase/database": "1.0.6",
31
- "@tachybase/test": "1.0.6",
32
- "@tachybase/utils": "1.0.6"
24
+ "@tachybase/actions": "1.0.25",
25
+ "@tachybase/auth": "1.0.25",
26
+ "@tachybase/client": "1.0.25",
27
+ "@tachybase/cache": "1.0.25",
28
+ "@tachybase/database": "1.0.25",
29
+ "@tachybase/server": "1.0.25",
30
+ "@tachybase/test": "1.0.25",
31
+ "@tachybase/logger": "1.0.25",
32
+ "@tachybase/utils": "1.0.25"
33
33
  },
34
34
  "description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
35
35
  "displayName.zh-CN": "用户认证",