@nocobase/plugin-auth 0.14.0-alpha.7 → 0.14.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const AuthProvider: FC;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const AuthProvider: React.FC;
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(n,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"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","antd","react","@formily/shared","react-i18next","@ant-design/icons","@formily/react","react-router-dom"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n["@nocobase/plugin-auth"]={},n["@nocobase/client"],n.jsxRuntime,n.antd,n.react,n["@formily/shared"],n["react-i18next"],n["@ant-design/icons"],n["@formily/react"],n["react-router-dom"]))})(this,function(n,e,t,l,c,g,x,d,a,y){"use strict";var J=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var I=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,A=(n,e)=>{for(var t in e||(e={}))X.call(e,t)&&I(n,t,e[t]);if(P)for(var t of P(e))Y.call(e,t)&&I(n,t,e[t]);return n},C=(n,e)=>Q(n,W(e));var f=(n,e,t)=>new Promise((l,c)=>{var g=a=>{try{d(t.next(a))}catch(y){c(y)}},x=a=>{try{d(t.throw(a))}catch(y){c(y)}},d=a=>a.done?l(a.value):Promise.resolve(a.value).then(g,x);d((t=t.apply(n,e)).next())});const S=c.createContext({type:""}),w=c.createContext({types:[]}),D=()=>{const{types:o}=c.useContext(w);return o},T={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"}}]},k={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(S);return e.useRequest(()=>Promise.resolve({data:{name:`s_${g.uid()}`,authType:i}}),C(A({},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 }}"}}}}}}}},q={type:"void",name:"authenticators","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:T,resourceName:"authenticators",dragSort:!0,request:{resource:"authenticators",action:"list",params:{pageSize:50,sort:"sort",appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:T},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:A({},r.options)}),C(A({},o),{manual:!0})),{run:p}=i,s=e.useActionContext();return c.useEffect(()=>{s.visible&&p()},[s.visible,p]),i},j=a.observer(()=>{const o=a.useForm(),r=e.useRecord();return e.useOptionsComponent(o.values.authType||r.authType)}),O="auth";function h(){return x.useTranslation(O)}const L=()=>{const{setVisible:o}=e.useActionContext();return{run(){return f(this,null,function*(){o(!1)})}}},E=()=>{const{t:o}=x.useTranslation(),[r,i]=c.useState(!1),[p,s]=c.useState(""),u=D(),v=u.map(m=>C(A({},m),{onClick:()=>{i(!0),s(m.value)}}));return t.jsx(e.ActionContextProvider,{value:{visible:r,setVisible:i},children:t.jsxs(S.Provider,{value:{type:p},children:[t.jsx(l.Dropdown,{menu:{items:v},children:t.jsxs(l.Button,{icon:t.jsx(d.PlusOutlined,{}),type:"primary",children:[o("Add new")," ",t.jsx(d.DownOutlined,{})]})}),t.jsx(e.SchemaComponent,{scope:{useCloseAction:L,types:u,setType:s},schema:k})]})})},V=()=>(e.useAsyncData(),!1),B=()=>{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(w.Provider,{value:{types:r},children:t.jsx(e.SchemaComponent,{schema:q,components:{AddNew:E,Options:j},scope:{types:r,useValuesFromOptions:$,useCanNotDelete:V,t:o}})})})},U={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 }}"}}},_=
|
|
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:U,scope:{useBasicSignIn:H,allowSignUp:m,signupLink:G,t:r}})},b="Email/Password",N={type:"object",name:g.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")}}'}}}}},z=o=>{const{t:r}=h(),i=()=>e.useSignup({authenticator:o.name});return t.jsx(e.SchemaComponent,{schema:N,scope:{useBasicSignup:i,t:r}})},M=()=>{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.")}}'}}}}})},Z=o=>{const{t:r}=h();return t.jsx(e.SettingsCenterProvider,{settings:{auth:{title:r("Authentication"),icon:"LoginOutlined",tabs:{authenticators:{title:r("Authenticators"),component:()=>t.jsx(B,{})}}}},children:t.jsx(e.OptionsComponentProvider,{authType:b,component:M,children:t.jsx(e.SigninPageProvider,{authType:b,tabTitle:r("Sign in via password"),component:_,children:t.jsx(e.SignupPageProvider,{authType:b,component:z,children:o.children})})})})},K=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})};class F extends e.Plugin{load(){return f(this,null,function*(){this.app.providers.unshift([K,{}]),this.app.use(Z)})}}n.AuthPlugin=F,n.default=F,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.14.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.14.0-alpha.8",
|
|
3
3
|
"react": "18.2.0",
|
|
4
|
-
"
|
|
5
|
-
"@nocobase/
|
|
6
|
-
"@nocobase/
|
|
4
|
+
"react-router-dom": "6.14.1",
|
|
5
|
+
"@nocobase/auth": "0.14.0-alpha.8",
|
|
6
|
+
"@nocobase/database": "0.14.0-alpha.8",
|
|
7
|
+
"@nocobase/server": "0.14.0-alpha.8",
|
|
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.
|
|
13
|
+
"@nocobase/actions": "0.14.0-alpha.8"
|
|
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-
|
|
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-01T02:11:17.898Z"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "0.14.0-alpha.
|
|
3
|
+
"version": "0.14.0-alpha.8",
|
|
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": "
|
|
27
|
+
"gitHead": "59c82fef6e34707802b5841f5ec4d9b3b6b68abb"
|
|
28
28
|
}
|