@nocobase/plugin-auth 0.14.0-alpha.7 → 0.15.0-alpha.1

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.
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const AuthPluginProvider: FC;
@@ -1,2 +1,2 @@
1
- import { FC } from 'react';
2
- export declare const AuthProvider: FC;
1
+ import React from 'react';
2
+ export declare const AuthProvider: React.FC;
@@ -1,4 +1,4 @@
1
- (function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("antd"),require("react"),require("@formily/shared"),require("react-i18next"),require("@ant-design/icons"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","antd","react","@formily/shared","react-i18next","@ant-design/icons","@formily/react"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-auth"]={},o["@nocobase/client"],o.jsxRuntime,o.antd,o.react,o["@formily/shared"],o["react-i18next"],o["@ant-design/icons"],o["@formily/react"]))})(this,function(o,e,t,l,p,A,y,d,a){"use strict";var G=Object.defineProperty,H=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var Q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var P=(o,e,t)=>e in o?G(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,C=(o,e)=>{for(var t in e||(e={}))Q.call(e,t)&&P(o,t,e[t]);if(F)for(var t of F(e))W.call(e,t)&&P(o,t,e[t]);return o},g=(o,e)=>H(o,J(e));var b=(o,e,t)=>new Promise((l,p)=>{var A=a=>{try{d(t.next(a))}catch(x){p(x)}},y=a=>{try{d(t.throw(a))}catch(x){p(x)}},d=a=>a.done?l(a.value):Promise.resolve(a.value).then(A,y);d((t=t.apply(o,e)).next())});const x=p.createContext({type:""}),S=p.createContext({types:[]}),I=()=>{const{types:n}=p.useContext(S);return n},w={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":n=>/^[a-zA-Z0-9_-]+$/.test(n)?"":e.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"}}]},D={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(n){const r=e.useActionContext(),{type:i}=p.useContext(x);return e.useRequest(()=>Promise.resolve({data:{name:`s_${A.uid()}`,authType:i}}),g(C({},n),{refreshDeps:[r.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-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}},k={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:w,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:w},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const n=e.useAPIClient(),{t:r}=y.useTranslation();return{move(c,s){return b(this,null,function*(){yield n.resource("authenticators").move({sourceId:c.id,targetId:s.id}),l.message.success(r("Saved successfully"),.2)})}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',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-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},q=n=>{const r=e.useRecord(),i=e.useRequest(()=>Promise.resolve({data:C({},r.options)}),g(C({},n),{manual:!0})),{run:c}=i,s=e.useActionContext();return p.useEffect(()=>{s.visible&&c()},[s.visible,c]),i},$=a.observer(()=>{const n=a.useForm(),r=e.useRecord();return e.useOptionsComponent(n.values.authType||r.authType)}),j="auth";function h(){return y.useTranslation(j)}const O=()=>{const{setVisible:n}=e.useActionContext();return{run(){return b(this,null,function*(){n(!1)})}}},V=()=>{const{t:n}=y.useTranslation(),[r,i]=p.useState(!1),[c,s]=p.useState(""),m=I(),v=m.map(u=>g(C({},u),{onClick:()=>{i(!0),s(u.value)}}));return t.jsx(e.ActionContextProvider,{value:{visible:r,setVisible:i},children:t.jsxs(x.Provider,{value:{type:c},children:[t.jsx(l.Dropdown,{menu:{items:v},children:t.jsxs(l.Button,{icon:t.jsx(d.PlusOutlined,{}),type:"primary",children:[n("Add new")," ",t.jsx(d.DownOutlined,{})]})}),t.jsx(e.SchemaComponent,{scope:{useCloseAction:O,types:m,setType:s},schema:D})]})})},B=()=>(e.useAsyncData(),!1),E=()=>{const{t:n}=h(),[r,i]=p.useState([]),c=e.useAPIClient();return e.useRequest(()=>c.resource("authenticators").listTypes().then(s=>{var v;return(((v=s==null?void 0:s.data)==null?void 0:v.data)||[]).map(u=>({key:u.name,label:n(u.title||u.name),value:u.name}))}),{onSuccess:s=>{i(s)}}),t.jsx(l.Card,{bordered:!1,children:t.jsx(S.Provider,{value:{types:r},children:t.jsx(e.SchemaComponent,{schema:k,components:{AddNew:V,Options:$},scope:{types:r,useValuesFromOptions:q,useCanNotDelete:B,t:n}})})})},L={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":`{{(value) => {
1
+ (function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react-i18next"),require("antd"),require("react"),require("@formily/shared"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react-i18next","antd","react","@formily/shared","react-router-dom","@ant-design/icons","@formily/react"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n["@nocobase/plugin-auth"]={},n["@nocobase/client"],n.jsxRuntime,n["react-i18next"],n.antd,n.react,n["@formily/shared"],n["react-router-dom"],n["@ant-design/icons"],n["@formily/react"]))})(this,function(n,e,t,x,l,c,A,y,a,d){"use strict";var J=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var D=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,g=(n,e)=>{for(var t in e||(e={}))X.call(e,t)&&D(n,t,e[t]);if(I)for(var t of I(e))Y.call(e,t)&&D(n,t,e[t]);return n},C=(n,e)=>Q(n,W(e));var f=(n,e,t)=>new Promise((x,l)=>{var c=a=>{try{y(t.next(a))}catch(d){l(d)}},A=a=>{try{y(t.throw(a))}catch(d){l(d)}},y=a=>a.done?x(a.value):Promise.resolve(a.value).then(c,A);y((t=t.apply(n,e)).next())});const b="Email/Password",S="auth";function h(){return x.useTranslation(S)}const k=()=>{const{t:o}=h();return t.jsx(e.SchemaComponent,{scope:{t:o},components:{Alert:l.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.")}}'}}}}})},q={type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":`{{(value) => {
2
2
  if (!value) {
3
3
  return t("Please enter your username or email");
4
4
  }
@@ -9,4 +9,4 @@
9
9
  } else {
10
10
  return /^[^@.<>"'/]{2,16}$/.test(value) || t("Please enter a valid username");
11
11
  }
12
- }}}`,"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 }}"}}},_=n=>{const{t:r}=h(),i=n.authenticator,{authType:c,name:s,options:m}=i,u=!!p.useContext(e.SignupPageContext)[c]&&(m==null?void 0:m.allowSignup),Z=`/signup?authType=${c}&name=${s}`,K=()=>e.useSignIn(s);return t.jsx(e.SchemaComponent,{schema:L,scope:{useBasicSignIn:K,allowSignUp:u,signupLink:Z,t:r}})},f="Email/Password",N={type:"object",name:A.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")}}'}}}}},U=n=>{const{t:r}=h(),i=()=>e.useSignup({authenticator:n.name});return t.jsx(e.SchemaComponent,{schema:N,scope:{useBasicSignup:i,t:r}})},z=()=>{const{t:n}=h();return t.jsx(e.SchemaComponent,{scope:{t:n},components:{Alert:l.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.")}}'}}}}})},M=n=>{const{t:r}=h();return t.jsx(e.SettingsCenterProvider,{settings:{auth:{title:r("Authentication"),icon:"LoginOutlined",tabs:{authenticators:{title:r("Authenticators"),component:()=>t.jsx(E,{})}}}},children:t.jsx(e.OptionsComponentProvider,{authType:f,component:z,children:t.jsx(e.SigninPageProvider,{authType:f,tabTitle:r("Sign in via password"),component:_,children:t.jsx(e.SignupPageProvider,{authType:f,component:U,children:n.children})})})})};class T extends e.Plugin{load(){return b(this,null,function*(){this.app.use(M)})}}o.AuthPlugin=T,o.default=T,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
12
+ }}}`,"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 }}"}}},$=o=>{const{t:r}=h(),i=o.authenticator,{authType:p,name:s,options:u}=i,m=!!c.useContext(e.SignupPageContext)[p]&&(u==null?void 0:u.allowSignup),G=`/signup?authType=${p}&name=${s}`,H=()=>e.useSignIn(s);return t.jsx(e.SchemaComponent,{schema:q,scope:{useBasicSignIn:H,allowSignUp:m,signupLink:G,t:r}})},j={type:"object",name:A.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")}}'}}}}},O=o=>{const{t:r}=h(),i=()=>e.useSignup({authenticator:o.name});return t.jsx(e.SchemaComponent,{schema:j,scope:{useBasicSignup:i,t:r}})},L=o=>{const{t:r}=h();return t.jsx(e.OptionsComponentProvider,{authType:b,component:k,children:t.jsx(e.SigninPageProvider,{authType:b,tabTitle:r("Sign in via password"),component:$,children:t.jsx(e.SignupPageProvider,{authType:b,component:O,children:o.children})})})},E=o=>{const r=y.useLocation(),i=e.useAPIClient();return c.useEffect(()=>{const p=new URLSearchParams(r.search),s=p.get("authenticator"),u=p.get("token");u&&(i.auth.setToken(u),i.auth.setAuthenticator(s))}),t.jsx(t.Fragment,{children:o.children})},w=c.createContext({type:""}),T=c.createContext({types:[]}),V=()=>{const{types:o}=c.useContext(T);return o},F={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":o=>/^[a-zA-Z0-9_-]+$/.test(o)?"":e.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"}}]},B={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(o){const r=e.useActionContext(),{type:i}=c.useContext(w);return e.useRequest(()=>Promise.resolve({data:{name:`s_${A.uid()}`,authType:i}}),C(g({},o),{refreshDeps:[r.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-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}},U={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:F,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:F},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const o=e.useAPIClient(),{t:r}=x.useTranslation();return{move(p,s){return f(this,null,function*(){yield o.resource("authenticators").move({sourceId:p.id,targetId:s.id}),l.message.success(r("Saved successfully"),.2)})}}}},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},authType:{title:'{{t("Auth Type")}}',type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{authType:{type:"string","x-component":"Select","x-read-pretty":!0,enum:"{{ types }}"}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},description:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Configure")}}',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-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"},"x-disabled":"{{ useCanNotDelete() }}"}}}}}}}}},_=o=>{const r=e.useRecord(),i=e.useRequest(()=>Promise.resolve({data:g({},r.options)}),C(g({},o),{manual:!0})),{run:p}=i,s=e.useActionContext();return c.useEffect(()=>{s.visible&&p()},[s.visible,p]),i},N=d.observer(()=>{const o=d.useForm(),r=e.useRecord();return e.useOptionsComponent(o.values.authType||r.authType)}),M=()=>{const{setVisible:o}=e.useActionContext();return{run(){return f(this,null,function*(){o(!1)})}}},z=()=>{const{t:o}=x.useTranslation(),[r,i]=c.useState(!1),[p,s]=c.useState(""),u=V(),v=u.map(m=>C(g({},m),{onClick:()=>{i(!0),s(m.value)}}));return t.jsx(e.ActionContextProvider,{value:{visible:r,setVisible:i},children:t.jsxs(w.Provider,{value:{type:p},children:[t.jsx(l.Dropdown,{menu:{items:v},children:t.jsxs(l.Button,{icon:t.jsx(a.PlusOutlined,{}),type:"primary",children:[o("Add new")," ",t.jsx(a.DownOutlined,{})]})}),t.jsx(e.SchemaComponent,{scope:{useCloseAction:M,types:u,setType:s},schema:B})]})})},Z=()=>(e.useAsyncData(),!1),K=()=>{const{t:o}=h(),[r,i]=c.useState([]),p=e.useAPIClient();return e.useRequest(()=>p.resource("authenticators").listTypes().then(s=>{var v;return(((v=s==null?void 0:s.data)==null?void 0:v.data)||[]).map(m=>({key:m.name,label:o(m.title||m.name),value:m.name}))}),{onSuccess:s=>{i(s)}}),t.jsx(l.Card,{bordered:!1,children:t.jsx(T.Provider,{value:{types:r},children:t.jsx(e.SchemaComponent,{schema:U,components:{AddNew:z,Options:N},scope:{types:r,useValuesFromOptions:_,useCanNotDelete:Z,t:o}})})})};class P extends e.Plugin{load(){return f(this,null,function*(){this.app.pluginSettingsManager.add(S,{icon:"LoginOutlined",title:`{{t("Authentication", { ns: "${S}" })}}`,Component:K,aclSnippet:"pm.auth.authenticators"}),this.app.providers.unshift([E,{}]),this.app.use(L)})}}n.AuthPlugin=P,n.default=P,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,13 +1,14 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.14.0-alpha.7",
2
+ "@nocobase/client": "0.15.0-alpha.1",
3
3
  "react": "18.2.0",
4
- "@nocobase/auth": "0.14.0-alpha.7",
5
- "@nocobase/database": "0.14.0-alpha.7",
6
- "@nocobase/server": "0.14.0-alpha.7",
4
+ "react-router-dom": "6.14.1",
5
+ "@nocobase/auth": "0.15.0-alpha.1",
6
+ "@nocobase/database": "0.15.0-alpha.1",
7
+ "@nocobase/server": "0.15.0-alpha.1",
7
8
  "antd": "5.8.6",
8
9
  "@formily/react": "2.2.27",
9
10
  "@formily/shared": "2.2.27",
10
11
  "react-i18next": "11.18.6",
11
12
  "@ant-design/icons": "5.1.4",
12
- "@nocobase/actions": "0.14.0-alpha.7"
13
+ "@nocobase/actions": "0.15.0-alpha.1"
13
14
  };
@@ -1 +1 @@
1
- {"name":"cron","description":"Cron jobs for your node","version":"2.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":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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)","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)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-10-07T08:28:19.909Z"}
1
+ {"name":"cron","description":"Cron jobs for your node","version":"2.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":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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)","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)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-11-13T03:09:36.338Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "0.14.0-alpha.7",
3
+ "version": "0.15.0-alpha.1",
4
4
  "main": "./dist/server/index.js",
5
5
  "devDependencies": {
6
6
  "@ant-design/icons": "5.x",
@@ -24,5 +24,5 @@
24
24
  "displayName.zh-CN": "用户认证",
25
25
  "description": "Basic authentication and authenticator management",
26
26
  "description.zh-CN": "提供基础认证功能和扩展认证器管理功能",
27
- "gitHead": "dc958417d27ed0753439bcef192be91a03dfc30f"
27
+ "gitHead": "8bbeab858a818fbe0a1f954ecf1f61337d06c065"
28
28
  }