bjx-auth 1.19.0 → 1.19.2

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
- /*! version: 1.19.0 */
2
- "use strict";var e=require("crypto"),t=require("axios");var a,r={exports:{}},n={exports:{}};function o(){return a||(a=1,function(e){const t={eqp:"",os:"",ba:"",bp:"",ver:"",clientId:"",clientSecret:"",apiVersion:"",signVersion:"",signKey:"",timeout:2e4,passportapi:"",userapi:"",login:"",auth:"",enterpriseapi:"",debug:!1,debugApiUrl:"",app:null};function a(e,a){"auth"===e&&console.warn("config.auth配置项已弃用"),void 0!==t[e]&&(t[e]=a)}const r={getConfig:function(e){return e?t[e]:t},setConfig:async function(e,t){if("object"==typeof e)for(const t in e)a(t,e[t]);else e&&a(e,t)}};Object.keys(t).forEach(e=>{Object.defineProperty(r,e,{get:()=>t[e],enumerable:!0})}),e.exports=r}(n)),n.exports}var i,s,u,c,p={exports:{}},d={exports:{}},l={exports:{}};function f(){if(u)return s;let t;return u=1,i||(i=1,function(){const t=e;l.exports={hashHS256:function(e,a){return t.createHmac("sha256",a).update(e).digest("base64")},hashMD5:function(e){return t.createHash("md5").update(e).digest("hex").toUpperCase()}}}()),t=l.exports,s=t}function g(){return c||(c=1,function(e){const{hashHS256:t}=f(),a=o();function r(e){return"[object Object]"===Object.prototype.toString.call(e)?Object.keys(e).sort().reduce((t,a)=>(t[a]=r(e[a]),t),{}):"[object Array]"===Object.prototype.toString.call(e)?e.map(e=>r(e)):e}function n(e,a){const n=function(e){let t=[];return Object.entries(e).map(([e,a])=>{void 0===a||""===a||null===a||("[object Array]"===Object.prototype.toString.call(a)||"[object Object]"===Object.prototype.toString.call(a)?t.push(`${e}=${encodeURIComponent(JSON.stringify(a))}`):t.push(`${e}=${encodeURIComponent(a)}`))}),t.join("&")}(r(e)),o=t(n,a);return{...e,sign:o}}e.exports=function(e,t){const{eqp:r,os:o,ba:i,bp:s,ver:u,apiVersion:c,signVersion:p,clientId:d,clientSecret:l,data:f={}}=e||{};return n({eqp:r||a.eqp||"",os:1*o||1*a.os||1,ba:i||a.ba||"",bp:s||a.bp||"",ver:u||a.ver||"1.0.0",ts:Date.now(),apiVersion:c||a.apiVersion||"1.0.0",signVersion:p||a.signVersion||"V1",clientId:d||a.clientId||"",clientSecret:l||a.clientSecret||"",data:f},t=t||a.signKey)}}(d)),d.exports}var h,b,y,m={exports:{}},S={exports:{}},w={exports:{}},x={exports:{}};function P(){return h||(h=1,function(e){const t=o();e.exports={errorLogger:function(...e){t.app?t.app.emit?.("error",e[0],e[1]||{},"bjx-auth"):console.error(...e)},debugLogger:function(...e){t.debug&&console.log(...e)}}}(x)),x.exports}function v(){return b||(b=1,function(e){const a=t,r=o(),{debugLogger:n}=P(),i=e=>t=>{if(!r[e])throw new Error(`config.${e}配置项未配置`);return t.baseURL||(t.baseURL=r[e]||""),t.timeout||(t.timeout=r.timeout||2e4),r.debugApiUrl?.includes(t.url)&&n(t.url+" <<",t),t},s=e=>(r.debugApiUrl?.includes(e.config.url)&&n(e.config.url+" >>",e.data),e),u=a.create({withCredentials:!1,proxy:!1});u.interceptors.request.use(i("passportapi")),u.interceptors.response.use(s);const c=a.create({withCredentials:!1,proxy:!1});c.interceptors.request.use(i("userapi")),c.interceptors.response.use(s);const p=a.create({proxy:!1});p.interceptors.request.use(i("auth")),p.interceptors.response.use(s);const d=a.create({proxy:!1});d.interceptors.request.use(i("enterpriseapi")),d.interceptors.response.use(s),e.exports={axios:a,passportapi:u,userapi:c,auth:p,enterpriseapi:d}}(w)),w.exports}function O(){return y||(y=1,function(e){const t=g(),{passportapi:a}=v(),{errorLogger:r,debugLogger:n}=P();let o=null;e.exports={getPublicPem:async function(){if(o&&o.expiresAt>Date.now())return o.value;let e=t();try{const{data:t}=await a({url:"/api/v1/common/config/security",method:"POST",data:e});if(!1===t.isError)return n("公钥获取成功"),o={value:`-----BEGIN PUBLIC KEY-----\n${t.data.rsaPubkey}\n-----END PUBLIC KEY-----`,expiresAt:Date.now()+288e5},o.value;throw new Error("getPublicPem invalid data",{cause:t})}catch(e){return r(e),null}},clearPublicPemCache:function(){return n("公钥清除成功"),o=null,!0},hasPublicPemCache:function(){return!!o}}}(S)),S.exports}var I,C,q,k,T={exports:{}};function E(){if(q)return C;let t;return q=1,I||(I=1,function(){const t=e;T.exports={encryptRSA:function(e,a){if(!a)throw new Error("publicPem is required");const r=Buffer.from(e,"utf8");return t.publicEncrypt({key:a,padding:t.constants.RSA_PKCS1_PADDING},r).toString("base64")},encryptAES:function(e){const a=t.randomBytes(16),r=a,n=t.createCipheriv("aes-128-cbc",r,a);let o=n.update(e,"utf8","base64");return o+=n.final("base64"),{iv:a.toString("hex"),encrypted:o}}}}()),t=T.exports,C=t}function B(){return k||(k=1,function(e){const{getPublicPem:t}=O(),{encryptRSA:a,encryptAES:r}=E();e.exports=async function(e){if(!e)throw new Error("data is required");const n=await t(),o=JSON.stringify(e),{encrypted:i,iv:s}=r(o);return{akaParams:i,secretKey:a(s,n)}}}(m)),m.exports}var _,N,j={exports:{}};function A(){return _||(_=1,function(e){const{hashMD5:t}=f(),a=o();e.exports={getReqSign:function(e,...r){"string"==typeof e&&(e={eqp:e||"",os:r[0]||"",ba:r[1]||"",bp:r[2]||""});let{eqp:n,os:o,ba:i,bp:s,ver:u,ctx:c}=e||{};c&&(n||(n=c.uuid),i||(i=c.query.ba),s||(s=c.query.bp));const p={EQP:n||a.eqp||"",OS:o||1*a.os||1,BA:i||a.ba||"",BP:s||a.bp||"",Ver:u||a.ver||"1.0.0",TS:Date.now()},d=t(`EQP=${p.EQP}&OS=${p.OS}&BA=${p.BA}&BP=${p.BP}&Ver=${p.Ver}&TS=${p.TS}+bjxstat2019`).toUpperCase();return Object.assign(p,{Sign:d})},getReqSign2:function(e,...r){"string"==typeof e&&(e={eqp:e||"",os:r[0]||"",ba:r[1]||"",bp:r[2]||"",xappid:r[3]||""});let{eqp:n,os:o,ba:i,bp:s,ver:u,xappid:c,ctx:p}=e||{};p&&(n||(n=p.uuid),i||(i=p.query.ba),s||(s=p.query.bp));const d={EQP:n||a.eqp||"",OS:o||1*a.os||1,BA:i||a.ba||"",BP:s||a.bp||"",Ver:u||a.ver||"1.0.0",TS:Date.now(),XAppId:c||a.clientId||""},l=t(`EQP=${d.EQP}&OS=${d.OS}&BA=${d.BA}&BP=${d.BP}&Ver=${d.Ver}&TS=${d.TS}&XAppId=${d.XAppId}+%SiGn2021!@#`).toUpperCase();return Object.assign(d,{Sign:l})}}}(j)),j.exports}function R(){return N||(N=1,function(e){const t=g(),a=B(),r=A();e.exports={reqSign:t,reqEncrypt:a,getReqBody:async function(e,r,n){let{eqp:o="",os:i="",ba:s="",bp:u="",ver:c="",apiVersion:p="",signVersion:d="",clientId:l="",clientSecret:f="",ctx:g}=n||{};g&&(o||(o=g.uuid),s||(s=g.query.ba),u||(u=g.query.bp));const h={eqp:o,os:i,ba:s,bp:u,ver:c,apiVersion:p,signVersion:d,clientId:l,clientSecret:f};return r&&e&&Object.keys(e).length>0?h.data=await a(e):h.data=e||{},t(h)},...r}}(p)),p.exports}var U,D={exports:{}};function V(){return U||(U=1,function(e){const{passportapi:t}=v(),{getReqBody:a}=R();e.exports={getToken:async function(e,r){return e.__isRefresh__?async function(e,r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/token/refresh/web",method:"POST",...e})}(e,r):async function(e,r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/token/web",method:"POST",...e})}(e,r)},loginSms:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/sms/web",method:"POST",...e})},loginPwd:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/pwd/web",method:"POST",...e})},registerSms:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/register/sms/web",method:"POST",...e})},logout:async function(e,r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/logout/web",method:"POST",...e})},loginSmsQuick:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/sms/quick/web",method:"POST",...e})},userPatchInfo:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/basic/sync",method:"POST",...e})},userBusmold:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/busmold/seekers/set",method:"POST",...e})},userExist:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/exist/phone",method:"POST",...e})},pwdResetVerify:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/user/pwd/reset/verify",method:"POST",...e})},pwdReset:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/user/pwd/reset",method:"POST",...e})},wxpubCode:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/qrcode",method:"POST",...e})},wxpubScan:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/scan/login",method:"POST",...e})},wxpubBindLogin:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/wxpub/scan/bindlogin",method:"POST",...e})},wxpubH5Code:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/h5/getcode",method:"POST",...e})},wxpubH5BindLogin:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/wxpub/h5/bindlogin",method:"POST",...e})},webappCode:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/webapp/code",method:"POST",...e})},webappBindLogin:async function(e,r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/webapp/bindlogin",method:"POST",...e})}}}(D)),D.exports}var $,H={exports:{}};function L(){return $||($=1,function(e){const{userapi:t}=v(),{getReqBody:a}=R();e.exports={baseinfo:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/baseinfo",method:"POST",...e})},geetestGet:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/geetest/sign/get",method:"POST",...e})},geetestCheck:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/geetest/sign/check",method:"POST",...e})},geetestSend:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/sms/geetest/code/send",method:"POST",...e})},regionCode:async function(e,r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/common/country/region-code",method:"POST",...e})}}}(H)),H.exports}var Q,K,G={exports:{}};function M(){return Q||(Q=1,function(e){const{auth:t,enterpriseapi:a,userapi:r}=v(),{getReqSign:n,getReqBody:o}=R();e.exports={getUserInfo:async function(e,i){const s=["baseinfo","BaseInfo","BaseInfoV1","ExtendInfo","userInfo"];return s.includes(e.__type__)||(e.__type__=s[0]),"userInfo"===e.__type__?async function(e,t={}){return e.data={...e.data,...n(t)},a({url:"/enterprise/user/userInfo",method:"POST",...e}).then(e=>{const{data:t}=e;return e.data={HttpStatusCode:t.code,Error:t.errMsg,IsError:!t.success,Data:t.data&&Object.keys(t.data).length?{HasCompany:t.data.hasCompanyState>0,Id:t.data.id||"",UId:t.data.userId||0,UserName:t.data.userName||"",NickName:t.data.nickName||"",Email:t.data.userEmail||"",EmailIsCheck:t.data.emailCheckState>0,RegionCode:t.data.regionCode||"",Phone:t.data.userPhone||"",PhoneIsCheck:t.data.phoneCheckState>0,HeadUrl:t.data.headUrl||"",BackImage:t.data.backImage||"",BriefIntro:t.data.briefIntro||"",Industry:t.data.industryId||0,Source:t.data.registerSource||0,ShowName:t.data.showName||"",HeadIsDef:t.data.headDefState>0,Nick:t.data.nick||"",NickShowName:t.data.nickShowName||"",RegDate:t.data.registerDate||""}:{}},e})}(e,i):"baseinfo"===e.__type__?async function(e,t={}){return e.data=await o(e.data,!1,t),r({url:"/api/v1/user/baseinfo",method:"POST",...e}).then(e=>{const{data:t}=e;return e.data={HttpStatusCode:t.httpStatusCode,Error:t.error,IsError:t.isError,Data:t.data&&Object.keys(t.data).length?{HasCompany:t.data.hasCompany,Id:t.data.id||"",UId:t.data.uid||0,UserName:t.data.userName||"",NickName:t.data.nickName||"",Email:t.data.email||"",EmailIsCheck:t.data.emailIsCheck,RegionCode:t.data.regionCode||"",Phone:t.data.phone||"",PhoneIsCheck:t.data.phoneIsCheck,HeadUrl:t.data.headUrl||"",BackImage:t.data.backImage||"",BriefIntro:t.data.briefIntro||"",Industry:t.data.industry||0,Source:t.data.source||0,ShowName:t.data.showName||"",HeadIsDef:t.data.headIsDef,Nick:t.data.nick||"",NickShowName:t.data.nickShowName||"",RegDate:t.data.regDate||""}:{}},e})}(e,i):async function(e,a={}){return e.data={...e.data,...n(a)},t({url:"/api/User/"+e.__type__,method:"POST",...e})}(e,i)}}}(G)),G.exports}exports.getDefaultExportFromCjs=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e},exports.requireConfig=o,exports.requireLogger=P,exports.requireRequest=function(){return K||(K=1,function(e){const{setConfig:t,getConfig:a}=o(),r=R(),n=V(),i=L(),s=M(),{clearPublicPemCache:u,hasPublicPemCache:c}=O();e.exports=Object.assign({setConfig:t,getConfig:a,clearPublicPemCache:u,hasPublicPemCache:c},r,n,i,s)}(r)),r.exports};
1
+ /*! version: 1.19.2 */
2
+ "use strict";var e=require("crypto"),t=require("axios");var a,r={exports:{}},n={exports:{}};function o(){return a||(a=1,function(e){const t={eqp:"",os:"",ba:"",bp:"",ver:"",clientId:"",clientSecret:"",apiVersion:"",signVersion:"",signKey:"",timeout:2e4,passportapi:"",userapi:"",login:"",auth:"",enterpriseapi:"",debug:!1,debugApiUrl:"",app:null};function a(e,a){"auth"===e&&console.warn("config.auth配置项已弃用"),void 0!==t[e]&&(t[e]=a)}const r={getConfig:function(e){return e?t[e]:t},setConfig:async function(e,t){if("object"==typeof e)for(const t in e)a(t,e[t]);else e&&a(e,t)}};Object.keys(t).forEach(e=>{Object.defineProperty(r,e,{get:()=>t[e],enumerable:!0})}),e.exports=r}(n)),n.exports}var i,s,u,c,p={exports:{}},d={exports:{}},l={exports:{}};function f(){if(u)return s;let t;return u=1,i||(i=1,function(){const t=e;l.exports={hashHS256:function(e,a){return t.createHmac("sha256",a).update(e).digest("base64")},hashMD5:function(e){return t.createHash("md5").update(e).digest("hex").toUpperCase()}}}()),t=l.exports,s=t}function g(){return c||(c=1,function(e){const{hashHS256:t}=f(),a=o();function r(e){return"[object Object]"===Object.prototype.toString.call(e)?Object.keys(e).sort().reduce((t,a)=>(t[a]=r(e[a]),t),{}):"[object Array]"===Object.prototype.toString.call(e)?e.map(e=>r(e)):e}function n(e,a){const n=function(e){let t=[];return Object.entries(e).map(([e,a])=>{void 0===a||""===a||null===a||("[object Array]"===Object.prototype.toString.call(a)||"[object Object]"===Object.prototype.toString.call(a)?t.push(`${e}=${encodeURIComponent(JSON.stringify(a))}`):t.push(`${e}=${encodeURIComponent(a)}`))}),t.join("&")}(r(e)),o=t(n,a);return{...e,sign:o}}e.exports=function(e,t){const{eqp:r,os:o,ba:i,bp:s,ver:u,apiVersion:c,signVersion:p,clientId:d,clientSecret:l,data:f={}}=e||{};return n({eqp:r||a.eqp||"",os:1*o||1*a.os||1,ba:i||a.ba||"",bp:s||a.bp||"",ver:u||a.ver||"1.0.0",ts:Date.now(),apiVersion:c||a.apiVersion||"1.0.0",signVersion:p||a.signVersion||"V1",clientId:d||a.clientId||"",clientSecret:l||a.clientSecret||"",data:f},t=t||a.signKey)}}(d)),d.exports}var h,b,y,m={exports:{}},S={exports:{}},w={exports:{}},x={exports:{}};function P(){return h||(h=1,function(e){const t=o();e.exports={errorLogger:function(...e){t.app?t.app.emit?.("error",e[0],e[1]||{},"bjx-auth"):console.error(...e)},debugLogger:function(...e){t.debug&&console.log(...e)}}}(x)),x.exports}function v(){return b||(b=1,function(e){const a=t,r=o(),{debugLogger:n}=P(),i=e=>t=>{if(!r[e])throw new Error(`config.${e}配置项未配置`);return t.baseURL||(t.baseURL=r[e]||""),t.timeout||(t.timeout=r.timeout||2e4),r.debugApiUrl?.includes(t.url)&&n(t.url+" <<",t),t},s=e=>(r.debugApiUrl?.includes(e.config.url)&&n(e.config.url+" >>",e.data),e),u=a.create({withCredentials:!1,proxy:!1});u.interceptors.request.use(i("passportapi")),u.interceptors.response.use(s);const c=a.create({withCredentials:!1,proxy:!1});c.interceptors.request.use(i("userapi")),c.interceptors.response.use(s);const p=a.create({proxy:!1});p.interceptors.request.use(i("auth")),p.interceptors.response.use(s);const d=a.create({proxy:!1});d.interceptors.request.use(i("enterpriseapi")),d.interceptors.response.use(s),e.exports={axios:a,passportapi:u,userapi:c,auth:p,enterpriseapi:d}}(w)),w.exports}function O(){return y||(y=1,function(e){const t=g(),{passportapi:a}=v(),{errorLogger:r,debugLogger:n}=P();let o=null;e.exports={getPublicPem:async function(){if(o&&o.expiresAt>Date.now())return o.value;let e=t();try{const{data:t}=await a({url:"/api/v1/common/config/security",method:"POST",data:e});if(!1===t.isError)return n("公钥获取成功"),o={value:`-----BEGIN PUBLIC KEY-----\n${t.data.rsaPubkey}\n-----END PUBLIC KEY-----`,expiresAt:Date.now()+288e5},o.value;throw new Error("getPublicPem invalid data",{cause:t})}catch(e){return r(e),null}},clearPublicPemCache:function(){return n("公钥清除成功"),o=null,!0},hasPublicPemCache:function(){return!!o}}}(S)),S.exports}var I,C,q,k,T={exports:{}};function E(){if(q)return C;let t;return q=1,I||(I=1,function(){const t=e;T.exports={encryptRSA:function(e,a){if(!a)throw new Error("publicPem is required");const r=Buffer.from(e,"utf8");return t.publicEncrypt({key:a,padding:t.constants.RSA_PKCS1_PADDING},r).toString("base64")},encryptAES:function(e){const a=t.randomBytes(16),r=a,n=t.createCipheriv("aes-128-cbc",r,a);let o=n.update(e,"utf8","base64");return o+=n.final("base64"),{iv:a.toString("hex"),encrypted:o}}}}()),t=T.exports,C=t}function B(){return k||(k=1,function(e){const{getPublicPem:t}=O(),{encryptRSA:a,encryptAES:r}=E();e.exports=async function(e){if(!e)throw new Error("data is required");const n=await t(),o=JSON.stringify(e),{encrypted:i,iv:s}=r(o);return{akaParams:i,secretKey:a(s,n)}}}(m)),m.exports}var _,N,j={exports:{}};function A(){return _||(_=1,function(e){const{hashMD5:t}=f(),a=o();e.exports={getReqSign:function(e,...r){"string"==typeof e&&(e={eqp:e||"",os:r[0]||"",ba:r[1]||"",bp:r[2]||""});let{eqp:n,os:o,ba:i,bp:s,ver:u,ctx:c}=e||{};c&&(n||(n=c.uuid),i||(i=c.query.ba),s||(s=c.query.bp));const p={EQP:n||a.eqp||"",OS:o||1*a.os||1,BA:i||a.ba||"",BP:s||a.bp||"",Ver:u||a.ver||"1.0.0",TS:Date.now()},d=t(`EQP=${p.EQP}&OS=${p.OS}&BA=${p.BA}&BP=${p.BP}&Ver=${p.Ver}&TS=${p.TS}+bjxstat2019`).toUpperCase();return Object.assign(p,{Sign:d})},getReqSign2:function(e,...r){"string"==typeof e&&(e={eqp:e||"",os:r[0]||"",ba:r[1]||"",bp:r[2]||"",xappid:r[3]||""});let{eqp:n,os:o,ba:i,bp:s,ver:u,xappid:c,ctx:p}=e||{};p&&(n||(n=p.uuid),i||(i=p.query.ba),s||(s=p.query.bp));const d={EQP:n||a.eqp||"",OS:o||1*a.os||1,BA:i||a.ba||"",BP:s||a.bp||"",Ver:u||a.ver||"1.0.0",TS:Date.now(),XAppId:c||a.clientId||""},l=t(`EQP=${d.EQP}&OS=${d.OS}&BA=${d.BA}&BP=${d.BP}&Ver=${d.Ver}&TS=${d.TS}&XAppId=${d.XAppId}+%SiGn2021!@#`).toUpperCase();return Object.assign(d,{Sign:l})}}}(j)),j.exports}function R(){return N||(N=1,function(e){const t=g(),a=B(),r=A();e.exports={reqSign:t,reqEncrypt:a,getReqBody:async function(e,r,n){let{eqp:o="",os:i="",ba:s="",bp:u="",ver:c="",apiVersion:p="",signVersion:d="",clientId:l="",clientSecret:f="",ctx:g}=n||{};g&&(o||(o=g.uuid),s||(s=g.query.ba),u||(u=g.query.bp));const h={eqp:o,os:i,ba:s,bp:u,ver:c,apiVersion:p,signVersion:d,clientId:l,clientSecret:f};return r&&e&&Object.keys(e).length>0?h.data=await a(e):h.data=e||{},t(h)},...r}}(p)),p.exports}var U,D={exports:{}};function V(){return U||(U=1,function(e){const{passportapi:t}=v(),{getReqBody:a}=R();e.exports={getToken:async function(e={},r={}){return e.__isRefresh__?async function(e={},r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/token/refresh/web",method:"POST",...e})}(e,r):async function(e={},r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/token/web",method:"POST",...e})}(e,r)},loginSms:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/sms/web",method:"POST",...e})},loginPwd:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/pwd/web",method:"POST",...e})},registerSms:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/register/sms/web",method:"POST",...e})},logout:async function(e={},r={}){return e.data=await a(null,!1,r),t({url:"/api/v1/logout/web",method:"POST",...e})},loginSmsQuick:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/login/sms/quick/web",method:"POST",...e})},userPatchInfo:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/user/basic/sync",method:"POST",...e})},userBusmold:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/busmold/seekers/set",method:"POST",...e})},userExist:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/exist/phone",method:"POST",...e})},pwdResetVerify:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/user/pwd/reset/verify",method:"POST",...e})},pwdReset:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/user/pwd/reset",method:"POST",...e})},wxpubCode:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/qrcode",method:"POST",...e})},wxpubScan:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/scan/login",method:"POST",...e})},wxpubBindLogin:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/wxpub/scan/bindlogin",method:"POST",...e})},wxpubH5Code:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/wxpub/h5/getcode",method:"POST",...e})},wxpubH5BindLogin:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/wxpub/h5/bindlogin",method:"POST",...e})},webappCode:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/wechat/webapp/code",method:"POST",...e})},webappBindLogin:async function(e={},r={}){return e.data=await a(e.data,!0,r),t({url:"/api/v1/wechat/webapp/bindlogin",method:"POST",...e})}}}(D)),D.exports}var $,H={exports:{}};function L(){return $||($=1,function(e){const{userapi:t}=v(),{getReqBody:a}=R();e.exports={baseinfo:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/user/baseinfo",method:"POST",...e})},geetestGet:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/geetest/sign/get",method:"POST",...e})},geetestCheck:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/geetest/sign/check",method:"POST",...e})},geetestSend:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/sms/geetest/code/send",method:"POST",...e})},regionCode:async function(e={},r={}){return e.data=await a(e.data,!1,r),t({url:"/api/v1/common/country/region-code",method:"POST",...e})}}}(H)),H.exports}var Q,K,G={exports:{}};function M(){return Q||(Q=1,function(e){const{auth:t,enterpriseapi:a,userapi:r}=v(),{getReqSign:n,getReqBody:o}=R();e.exports={getUserInfo:async function(e={},i={}){const s=["baseinfo","BaseInfo","BaseInfoV1","ExtendInfo","userInfo"];return s.includes(e.__type__)||(e.__type__=s[0]),"userInfo"===e.__type__?async function(e={},t={}){return e.data={...e.data,...n(t)},a({url:"/enterprise/user/userInfo",method:"POST",...e}).then(e=>{const{data:t}=e;return e.data={HttpStatusCode:t.code,Error:t.errMsg,IsError:!t.success,Data:t.data&&Object.keys(t.data).length?{HasCompany:t.data.hasCompanyState>0,Id:t.data.id||"",UId:t.data.userId||0,UserName:t.data.userName||"",NickName:t.data.nickName||"",Email:t.data.userEmail||"",EmailIsCheck:t.data.emailCheckState>0,RegionCode:t.data.regionCode||"",Phone:t.data.userPhone||"",PhoneIsCheck:t.data.phoneCheckState>0,HeadUrl:t.data.headUrl||"",BackImage:t.data.backImage||"",BriefIntro:t.data.briefIntro||"",Industry:t.data.industryId||0,Source:t.data.registerSource||0,ShowName:t.data.showName||"",HeadIsDef:t.data.headDefState>0,Nick:t.data.nick||"",NickShowName:t.data.nickShowName||"",RegDate:t.data.registerDate||""}:{}},e})}(e,i):"baseinfo"===e.__type__?async function(e={},t={}){return e.data=await o(e.data,!1,t),r({url:"/api/v1/user/baseinfo",method:"POST",...e}).then(e=>{const{data:t}=e;return e.data={HttpStatusCode:t.httpStatusCode,Error:t.error,IsError:t.isError,Data:t.data&&Object.keys(t.data).length?{HasCompany:t.data.hasCompany,Id:t.data.id||"",UId:t.data.uid||0,UserName:t.data.userName||"",NickName:t.data.nickName||"",Email:t.data.email||"",EmailIsCheck:t.data.emailIsCheck,RegionCode:t.data.regionCode||"",Phone:t.data.phone||"",PhoneIsCheck:t.data.phoneIsCheck,HeadUrl:t.data.headUrl||"",BackImage:t.data.backImage||"",BriefIntro:t.data.briefIntro||"",Industry:t.data.industry||0,Source:t.data.source||0,ShowName:t.data.showName||"",HeadIsDef:t.data.headIsDef,Nick:t.data.nick||"",NickShowName:t.data.nickShowName||"",RegDate:t.data.regDate||""}:{}},e})}(e,i):async function(e={},a={}){return e.data={...e.data,...n(a)},t({url:"/api/User/"+e.__type__,method:"POST",...e})}(e,i)}}}(G)),G.exports}exports.getDefaultExportFromCjs=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e},exports.requireConfig=o,exports.requireLogger=P,exports.requireRequest=function(){return K||(K=1,function(e){const{setConfig:t,getConfig:a}=o(),r=R(),n=V(),i=L(),s=M(),{clearPublicPemCache:u,hasPublicPemCache:c}=O();e.exports=Object.assign({setConfig:t,getConfig:a,clearPublicPemCache:u,hasPublicPemCache:c},r,n,i,s)}(r)),r.exports};
@@ -1,2 +1,2 @@
1
- /*! version: 1.19.0 */
2
- "use strict";var e,t,o,r,s,n,i,a=require("./index-DS7yy9q5.js"),c=require("passport"),h={exports:{}};function d(){if(r)return o;r=1;const{Strategy:s}=c,{setConfig:n,getConfig:i,getTokenApi:h,getUserInfoApi:d}=function(){if(t)return e;t=1;const{setConfig:o,getConfig:r,getToken:s,getUserInfo:n}=a.requireRequest();return e={setConfig:o,getConfig:r,getTokenApi:async function(e,t,{headers:o,ctx:r}){return s({__isRefresh__:t,headers:{Cookie:Object.entries(e).map(e=>e.join("=")).join("; "),...o}},{ctx:r}).then(({data:t,headers:o})=>{if(!1===t.isError)return{token_type:"",access_token:t.data.authToken,expires_at:t.data.expiresAt||Date.now()/1e3+14400|0,__flag__:e["idsrv.session"]};throw t.set_cookie=o["set-cookie"],new Error("getTokenApi invalid data",{cause:t})})},getUserInfoApi:async function(e,t,{headers:o,ctx:r}){const s={};return e.startsWith("Bearer ")?s.Authorization=e:s.AuthToken=e,n({__type__:t,headers:{...o,...s}},{ctx:r}).then(({data:e})=>{if(!1===e.IsError)return e.Data;throw new Error("getUserInfoApi invalid data",{cause:e})})}}}(),{errorLogger:u,debugLogger:j}=a.requireLogger();return o={BjxStrategy:class extends s{constructor(e={},t){super(),this.name="bjx",this.loadUserInfo=e.loadUserInfo||!1,this.userInfoExpires=this.normalizeExpires(e.loadUserInfo),this.userInfoType=e.userInfoType||"",this.handleHeadrToken=e.handleHeadrToken||!1,this.verify=t||((e,t)=>t(null,e)),n(e.authConfig),e.authConfig.debug&&j("配置项",i())}normalizeExpires(e){return"number"==typeof e&&e>0?60*e*1e3:18e5}authenticate(e,t){const o=e.cookies&&e.cookies.get("idsrv.session")&&e.cookies.get(".AspNetCore.Identity.Application"),r=e.headers&&(e.headers.authtoken||e.headers.authorization);if(!(o||this.handleHeadrToken&&r))return j("认证失败",o,"(",this.handleHeadrToken,r,")"),this.fail();this.handleHeadrToken&&r?this.executeCosplayAuthentication(e).then(e=>{this.success(e)}).catch(e=>{"__goto_next__"===e.message?this.pass():this.fail(e)}):o?this.executeAuthentication(e).then(e=>this.verify(e,(e,t)=>{if(e)return this.error(e);this.success(t)})).catch(e=>{"__goto_next__"===e.message?this.pass():this.fail(e)}):this.pass()}async executeCosplayAuthentication(e){let t="",o=!1;e.headers?.authtoken?t=e.headers.authtoken:e.headers?.authorization&&(t=e.headers.authorization.replace("Bearer ",""),o=!0);const r=e?.session?.passport?.user||{};if(r.token?.access_token===t)throw new Error("__goto_next__");r.info=null;const s=await this.getUserInfoWithRefresh((o?"Bearer ":"")+t,e,{});if(s)return j(`通过${o?"Authorization":"AuthToken"}头信息登录系统`),o?{token:{token_type:"Bearer",access_token:t,expires_at:Date.now()/1e3+3600|0,__source__:"header"},info:this.loadUserInfo?s:void 0}:{token:{token_type:"",access_token:t,expires_at:Date.now()/1e3+3600|0,__flag__:"This token from AuthToken header",__source__:"header"},info:this.loadUserInfo?s:void 0};throw new Error("Invalid headers token")}async executeAuthentication(e){const t=this.extractHeaders(e),o={"idsrv.session":e.cookies.get("idsrv.session"),".AspNetCore.Identity.Application":e.cookies.get(".AspNetCore.Identity.Application")},r=await this.getTokenWithRefresh(o,e,t);if(!r)throw new Error("Empty token data");let s;if(this.loadUserInfo){const o=r.access_token;if(s=await this.getUserInfoWithRefresh(o,e,t),!s)throw new Error("Empty userInfo data")}return{token:r,info:s}}extractHeaders(e){return{"X-Forwarded-For":e.headers["x-forwarded-for"],"X-Forwarded-Host":e.headers["x-forwarded-host"],"User-Agent":e.headers["user-agent"],Referer:e.headers.referer}}async getTokenWithRefresh(e,t,o){const r=t?.session?.passport?.user||{},s=Date.now();if(r.token?.__flag__!==e["idsrv.session"]&&(delete r.token,delete r.info,j(r.token?.__flag__?"令牌缓存标识和cookie内的不一致":"令牌缓存不存在")),r.token&&1e3*r.token.expires_at>s)throw new Error("__goto_next__");const n=!!r.token;let i;n&&j("刷新令牌");try{i=await h(e,n,{ctx:t.ctx,headers:o})}catch(e){try{e?.cause?.set_cookie&&t?.ctx?.response?.set&&(t.ctx.response.set("Set-Cookie",e.cause.set_cookie),j("转发授权服务器cookie: 成功",e.cause.set_cookie))}catch(e){u(e)}throw new Error("Get token failed",{cause:e})}return j("获取“新”令牌: "+(i?"成功":"失败"),e,n,i||"无"),i}async getUserInfoWithRefresh(e,t,o){const r=t?.session?.passport?.user||{},s=Date.now();if(r.info&&r.info.__expires_at__>s)throw new Error("__goto_next__");let n;try{n=await d(e,this.userInfoType,{ctx:t.ctx,headers:o})}catch(e){throw new Error("Get userInfo failed",{cause:e})}return n&&(n.__expires_at__=s+this.userInfoExpires),j("获取“新”用户信息: "+(n?"成功":"失败"),e,n||"无"),n}},createBjxAuthMiddleware:function(e,t){const{excludeRouterReg:o=/^\/(oidc|sso|api|proxy|css|img|js)(\/.*|$)/i}=t||{};return async(t,r)=>{if(i("app")||n("app",t.app),o.test(t.path)||"/favicon.ico"===t.path)return r();await new Promise((o,r)=>{e.authenticate("bjx",(e,r,s,n)=>{e?(j("this.error() is called"),u(e,t),t.logout()):!1===r?(j("this.fail() is called"),s&&u(s,t),t.logout()):r&&(j("this.success() is called"),t.login(r)),o()})(t,()=>{j("this.pass() is called"),o()})}),await r()}}}}function u(){if(n)return s;n=1;const e=a.requireConfig();function t(e){if(!e||0===Object.keys(e).length)return"";const t=[];for(const o in e)e[o]&&t.push(`${o}=${encodeURIComponent(e[o])}`);return t.join("&")}return s={getLoginCenterUrl:function(o,r=""){const{ctx:s,site:n="",returnUrl:i="",BA:a="",BP:c="",OS:h="",EQP:d="",...u}=o||{};if(!n&&!s)throw new Error("site is required");if(!i&&!s)throw new Error("returnUrl is required");const{clientId:j,login:b}=e,f=t({BA:a||s?.query?.ba||e.ba||"",BP:c||s?.query?.bp||e.bp||"",OS:h||e.os||1,EQP:d||s?.uuid||e.eqp||""});let l;!s||n&&i||(l=function(e,t){let o=e.query.f||"";const r=e.origin,s=new RegExp("^"+r);if(/^\//.test(o))o=r+o;else if(o&&!s.test(o))o=r;else if(!o){const t=e.headers.referer;o=s.test(t)&&t!==e.href?t:r}const n={returnUrl:o};if(t){const e=o.replace(/^https?:\/\//,"").replace(/\/.*/,"");n.site=function(e){const t={hr:3e4,dljob:30100,hdjob:30101,fdjob:30102,sdjob:30103,hedjob:30104,gfjob:30105,zhnyfwjob:30106,shdjob:30107,tanjob:30108,qnjob:30109,dqjob:30200,cnjob:30201,spdjob:30202,zdhjob:30203,xxhjob:30204,hbjob:30300,scljob:30301,gfcljob:30302,dqzljob:30303,jchpjob:30304,hbfdjob:30305,hbgcjob:30306,hbsbjob:30307,hjxfjob:30308,jnjob:30309,gcjob:30400,dlgcjob:30401,jzjob:30402,szlqjob:30403,gdjob:30404,jdjob:30406,sjjob:30407,jljob:30408,gczjjob:30409,dcjob:30500,dcscjob:30501,dcyyjob:30502,dccljob:30503,dchsjob:30504,dcjsjob:30507,spdsbjob:30601,pdywjob:30602,pwpdgcjob:30603,znwdwjob:30604,zlpdwjob:30605,xndcjob:30606,dlscjob:30700,mhr:4e4,mdljob:40100,mhdjob:40101,mfdjob:40102,msdjob:40103,mhedjob:40104,mgfjob:40105,mzhnyfwjob:40106,mshdjob:40107,mtanjob:40108,mqnjob:40109,mdqjob:40200,mcnjob:40201,mspdjob:40202,mzdhjob:40203,mxxhjob:40204,mhbjob:40300,mscljob:40301,mgfcljob:40302,mdqzljob:40303,mjchpjob:40304,mhbfdjob:40305,mhbgcjob:40306,mhbsbjob:40307,mhjxfjob:40308,mjnjob:40309,mgcjob:40400,mdlgcjob:40401,mjzjob:40402,mszlqjob:40403,mgdjob:40404,mjdjob:40406,msjjob:40407,mjljob:40408,mgczjjob:40409,mdcjob:40500,mdcscjob:40501,mdcyyjob:40502,mdccljob:40503,mdchsjob:40504,mdcjsjob:40507,mspdsbjob:40601,mpdywjob:40602,mpwpdgcjob:40603,mznwdwjob:40604,mzlpdwjob:40605,mxndcjob:40606,mdlscjob:40700,yun:3099,yun:30991,yun:30992,yun:30993,yun:30994,yun:30995,yun:30996,tv:3095,sp:3096,sxh:3094,msxh:3093,xiaoyuan:3091,mxiaoyuan:4091,xxsxh:3090,mxxsxh:4090,keyjob:3092,my:3097,mmy:4097,star:3088,stat:3086,manager2:3095,hrcrm:3084,baogao:3076};for(const o in t){if(e.includes(o))return o+".bjx.com.cn";if(e.includes(t[o]))return o+".bjx.com.cn"}return"hr.bjx.com.cn"}(e)}return n}(s,!n));const g=t({site:n||l.site,clientId:j,pp:f,...u,returnUrl:i||l.returnUrl}),p=`/Account/Login?${g}`,_={login:`${b}${p}`,register:`${b}${`/Account/Register?${g}`}`,logout:`${b}${`/Account/Logout?${g}`}`,bind:`${b}${`/External/UserBind?${g}`}`,logout2:`${b}${`/Account/Logout?${g.replace("returnUrl=.+$","")+encodeURIComponent(p)}`}`,returnUrl:l.returnUrl};if(r){let e=[];if(Array.isArray(r)?e=r:"string"==typeof r&&(e=r.split(",").map(e=>e.trim())),!e.length)return _;const t={};return e.forEach(e=>{const o=_[e];o&&(t[e]=o)}),1===Object.keys(t).length?Object.values(t)[0]:Object.keys(t).length?t:_}return _}}}exports.requireStrategy=function(){return i||(i=1,function(e){const{setConfig:t,getConfig:o}=a.requireConfig(),r=d(),s=u();e.exports=Object.assign({setConfig:t,getConfig:o},r,s)}(h)),h.exports};
1
+ /*! version: 1.19.2 */
2
+ "use strict";var e,t,o,r,s,n,i,a=require("./index-COsG-hYf.js"),c=require("passport"),h={exports:{}};function d(){if(r)return o;r=1;const{Strategy:s}=c,{setConfig:n,getConfig:i,getTokenApi:h,getUserInfoApi:d}=function(){if(t)return e;t=1;const{setConfig:o,getConfig:r,getToken:s,getUserInfo:n}=a.requireRequest();return e={setConfig:o,getConfig:r,getTokenApi:async function(e,t,{headers:o,ctx:r}){return s({__isRefresh__:t,headers:{Cookie:Object.entries(e).map(e=>e.join("=")).join("; "),...o}},{ctx:r}).then(({data:t,headers:o})=>{if(!1===t.isError)return{token_type:"",access_token:t.data.authToken,expires_at:t.data.expiresAt||Date.now()/1e3+14400|0,__flag__:e["idsrv.session"]};throw t.set_cookie=o["set-cookie"],new Error("getTokenApi invalid data",{cause:t})})},getUserInfoApi:async function(e,t,{headers:o,ctx:r}){const s={};return e.startsWith("Bearer ")?s.Authorization=e:s.AuthToken=e,n({__type__:t,headers:{...o,...s}},{ctx:r}).then(({data:e})=>{if(!1===e.IsError)return e.Data;throw new Error("getUserInfoApi invalid data",{cause:e})})}}}(),{errorLogger:u,debugLogger:j}=a.requireLogger();return o={BjxStrategy:class extends s{constructor(e={},t){super(),this.name="bjx",this.loadUserInfo=e.loadUserInfo||!1,this.userInfoExpires=this.normalizeExpires(e.loadUserInfo),this.userInfoType=e.userInfoType||"",this.handleHeadrToken=e.handleHeadrToken||!1,this.verify=t||((e,t)=>t(null,e)),n(e.authConfig),e.authConfig.debug&&j("配置项",i())}normalizeExpires(e){return"number"==typeof e&&e>0?60*e*1e3:18e5}authenticate(e,t){const o=e.cookies&&e.cookies.get("idsrv.session")&&e.cookies.get(".AspNetCore.Identity.Application"),r=e.headers&&(e.headers.authtoken||e.headers.authorization);if(!(o||this.handleHeadrToken&&r))return j("认证失败",o,"(",this.handleHeadrToken,r,")"),this.fail();this.handleHeadrToken&&r?this.executeCosplayAuthentication(e).then(e=>{this.success(e)}).catch(e=>{"__goto_next__"===e.message?this.pass():this.fail(e)}):o?this.executeAuthentication(e).then(e=>this.verify(e,(e,t)=>{if(e)return this.error(e);this.success(t)})).catch(e=>{"__goto_next__"===e.message?this.pass():this.fail(e)}):this.pass()}async executeCosplayAuthentication(e){let t="",o=!1;e.headers?.authtoken?t=e.headers.authtoken:e.headers?.authorization&&(t=e.headers.authorization.replace("Bearer ",""),o=!0);const r=e?.session?.passport?.user||{};if(r.token?.access_token===t)throw new Error("__goto_next__");r.info=null;const s=await this.getUserInfoWithRefresh((o?"Bearer ":"")+t,e,{});if(s)return j(`通过${o?"Authorization":"AuthToken"}头信息登录系统`),o?{token:{token_type:"Bearer",access_token:t,expires_at:Date.now()/1e3+3600|0,__source__:"header"},info:this.loadUserInfo?s:void 0}:{token:{token_type:"",access_token:t,expires_at:Date.now()/1e3+3600|0,__flag__:"This token from AuthToken header",__source__:"header"},info:this.loadUserInfo?s:void 0};throw new Error("Invalid headers token")}async executeAuthentication(e){const t=this.extractHeaders(e),o={"idsrv.session":e.cookies.get("idsrv.session"),".AspNetCore.Identity.Application":e.cookies.get(".AspNetCore.Identity.Application")},r=await this.getTokenWithRefresh(o,e,t);if(!r)throw new Error("Empty token data");let s;if(this.loadUserInfo){const o=r.access_token;if(s=await this.getUserInfoWithRefresh(o,e,t),!s)throw new Error("Empty userInfo data")}return{token:r,info:s}}extractHeaders(e){return{"X-Forwarded-For":e.headers["x-forwarded-for"],"X-Forwarded-Host":e.headers["x-forwarded-host"],"User-Agent":e.headers["user-agent"],Referer:e.headers.referer}}async getTokenWithRefresh(e,t,o){const r=t?.session?.passport?.user||{},s=Date.now();if(r.token?.__flag__!==e["idsrv.session"]&&(delete r.token,delete r.info,j(r.token?.__flag__?"令牌缓存标识和cookie内的不一致":"令牌缓存不存在")),r.token&&1e3*r.token.expires_at>s)throw new Error("__goto_next__");const n=!!r.token;let i;n&&j("刷新令牌");try{i=await h(e,n,{ctx:t.ctx,headers:o})}catch(e){try{e?.cause?.set_cookie&&t?.ctx?.response?.set&&(t.ctx.response.set("Set-Cookie",e.cause.set_cookie),j("转发授权服务器cookie: 成功",e.cause.set_cookie))}catch(e){u(e)}throw new Error("Get token failed",{cause:e})}return j("获取“新”令牌: "+(i?"成功":"失败"),e,n,i||"无"),i}async getUserInfoWithRefresh(e,t,o){const r=t?.session?.passport?.user||{},s=Date.now();if(r.info&&r.info.__expires_at__>s)throw new Error("__goto_next__");let n;try{n=await d(e,this.userInfoType,{ctx:t.ctx,headers:o})}catch(e){throw new Error("Get userInfo failed",{cause:e})}return n&&(n.__expires_at__=s+this.userInfoExpires),j("获取“新”用户信息: "+(n?"成功":"失败"),e,n||"无"),n}},createBjxAuthMiddleware:function(e,t){const{excludeRouterReg:o=/^\/(oidc|sso|api|proxy|css|img|js)(\/.*|$)/i}=t||{};return async(t,r)=>{if(i("app")||n("app",t.app),o.test(t.path)||"/favicon.ico"===t.path)return r();await new Promise((o,r)=>{e.authenticate("bjx",(e,r,s,n)=>{e?(j("this.error() is called"),u(e,t),t.logout()):!1===r?(j("this.fail() is called"),s&&u(s,t),t.logout()):r&&(j("this.success() is called"),t.login(r)),o()})(t,()=>{j("this.pass() is called"),o()})}),await r()}}}}function u(){if(n)return s;n=1;const e=a.requireConfig();function t(e){if(!e||0===Object.keys(e).length)return"";const t=[];for(const o in e)e[o]&&t.push(`${o}=${encodeURIComponent(e[o])}`);return t.join("&")}return s={getLoginCenterUrl:function(o,r=""){const{ctx:s,site:n="",returnUrl:i="",BA:a="",BP:c="",OS:h="",EQP:d="",...u}=o||{};if(!n&&!s)throw new Error("site is required");if(!i&&!s)throw new Error("returnUrl is required");const{clientId:j,login:b}=e,f=t({BA:a||s?.query?.ba||e.ba||"",BP:c||s?.query?.bp||e.bp||"",OS:h||e.os||1,EQP:d||s?.uuid||e.eqp||""});let l;!s||n&&i||(l=function(e,t){let o=e.query.f||"";const r=e.origin,s=new RegExp("^"+r);if(/^\//.test(o))o=r+o;else if(o&&!s.test(o))o=r;else if(!o){const t=e.headers.referer;o=s.test(t)&&t!==e.href?t:r}const n={returnUrl:o};if(t){const e=o.replace(/^https?:\/\//,"").replace(/\/.*/,"");n.site=function(e){const t={hr:3e4,dljob:30100,hdjob:30101,fdjob:30102,sdjob:30103,hedjob:30104,gfjob:30105,zhnyfwjob:30106,shdjob:30107,tanjob:30108,qnjob:30109,dqjob:30200,cnjob:30201,spdjob:30202,zdhjob:30203,xxhjob:30204,hbjob:30300,scljob:30301,gfcljob:30302,dqzljob:30303,jchpjob:30304,hbfdjob:30305,hbgcjob:30306,hbsbjob:30307,hjxfjob:30308,jnjob:30309,gcjob:30400,dlgcjob:30401,jzjob:30402,szlqjob:30403,gdjob:30404,jdjob:30406,sjjob:30407,jljob:30408,gczjjob:30409,dcjob:30500,dcscjob:30501,dcyyjob:30502,dccljob:30503,dchsjob:30504,dcjsjob:30507,spdsbjob:30601,pdywjob:30602,pwpdgcjob:30603,znwdwjob:30604,zlpdwjob:30605,xndcjob:30606,dlscjob:30700,mhr:4e4,mdljob:40100,mhdjob:40101,mfdjob:40102,msdjob:40103,mhedjob:40104,mgfjob:40105,mzhnyfwjob:40106,mshdjob:40107,mtanjob:40108,mqnjob:40109,mdqjob:40200,mcnjob:40201,mspdjob:40202,mzdhjob:40203,mxxhjob:40204,mhbjob:40300,mscljob:40301,mgfcljob:40302,mdqzljob:40303,mjchpjob:40304,mhbfdjob:40305,mhbgcjob:40306,mhbsbjob:40307,mhjxfjob:40308,mjnjob:40309,mgcjob:40400,mdlgcjob:40401,mjzjob:40402,mszlqjob:40403,mgdjob:40404,mjdjob:40406,msjjob:40407,mjljob:40408,mgczjjob:40409,mdcjob:40500,mdcscjob:40501,mdcyyjob:40502,mdccljob:40503,mdchsjob:40504,mdcjsjob:40507,mspdsbjob:40601,mpdywjob:40602,mpwpdgcjob:40603,mznwdwjob:40604,mzlpdwjob:40605,mxndcjob:40606,mdlscjob:40700,yun:3099,yun:30991,yun:30992,yun:30993,yun:30994,yun:30995,yun:30996,tv:3095,sp:3096,sxh:3094,msxh:3093,xiaoyuan:3091,mxiaoyuan:4091,xxsxh:3090,mxxsxh:4090,keyjob:3092,my:3097,mmy:4097,star:3088,stat:3086,manager2:3095,hrcrm:3084,baogao:3076};for(const o in t){if(e.includes(o))return o+".bjx.com.cn";if(e.includes(t[o]))return o+".bjx.com.cn"}return"hr.bjx.com.cn"}(e)}return n}(s,!n));const g=t({site:n||l.site,clientId:j,pp:f,...u,returnUrl:i||l.returnUrl}),p=`/Account/Login?${g}`,_={login:`${b}${p}`,register:`${b}${`/Account/Register?${g}`}`,logout:`${b}${`/Account/Logout?${g}`}`,bind:`${b}${`/External/UserBind?${g}`}`,logout2:`${b}${`/Account/Logout?${g.replace("returnUrl=.+$","")+encodeURIComponent(p)}`}`,returnUrl:l.returnUrl};if(r){let e=[];if(Array.isArray(r)?e=r:"string"==typeof r&&(e=r.split(",").map(e=>e.trim())),!e.length)return _;const t={};return e.forEach(e=>{const o=_[e];o&&(t[e]=o)}),1===Object.keys(t).length?Object.values(t)[0]:Object.keys(t).length?t:_}return _}}}exports.requireStrategy=function(){return i||(i=1,function(e){const{setConfig:t,getConfig:o}=a.requireConfig(),r=d(),s=u();e.exports=Object.assign({setConfig:t,getConfig:o},r,s)}(h)),h.exports};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- /*! version: 1.19.0 */
2
- "use strict";var e=require("./index-DS7yy9q5.js"),r=require("./index-BI-SkHlI.js");require("crypto"),require("axios"),require("passport");var t,s={exports:{}};var u=(t||(t=1,function(t){const s=e.requireRequest(),u=r.requireStrategy();t.exports={request:s,strategy:u}}(s)),s.exports),i=e.getDefaultExportFromCjs(u);module.exports=i;
1
+ /*! version: 1.19.2 */
2
+ "use strict";var e=require("./index-COsG-hYf.js"),r=require("./index-DinyMXZz.js");require("crypto"),require("axios"),require("passport");var t,s={exports:{}};var u=(t||(t=1,function(t){const s=e.requireRequest(),u=r.requireStrategy();t.exports={request:s,strategy:u}}(s)),s.exports),i=e.getDefaultExportFromCjs(u);module.exports=i;
package/dist/request.cjs CHANGED
@@ -1,2 +1,2 @@
1
- /*! version: 1.19.0 */
2
- "use strict";var e=require("./index-DS7yy9q5.js");require("crypto"),require("axios");var r=e.requireRequest(),t=e.getDefaultExportFromCjs(r);module.exports=t;
1
+ /*! version: 1.19.2 */
2
+ "use strict";var e=require("./index-COsG-hYf.js");require("crypto"),require("axios");var r=e.requireRequest(),t=e.getDefaultExportFromCjs(r);module.exports=t;
package/dist/strategy.cjs CHANGED
@@ -1,2 +1,2 @@
1
- /*! version: 1.19.0 */
2
- "use strict";var r=require("./index-DS7yy9q5.js"),e=require("./index-BI-SkHlI.js");require("crypto"),require("axios"),require("passport");var i=e.requireStrategy(),t=r.getDefaultExportFromCjs(i);module.exports=t;
1
+ /*! version: 1.19.2 */
2
+ "use strict";var r=require("./index-COsG-hYf.js"),e=require("./index-DinyMXZz.js");require("crypto"),require("axios"),require("passport");var i=e.requireStrategy(),t=r.getDefaultExportFromCjs(i);module.exports=t;
package/dist/web.mjs CHANGED
@@ -1,2 +1,2 @@
1
- /*! version: 1.19.0 */
2
- import t from"mitt";import e from"axios";import n from"crypto-js/hmac-sha256";import o from"crypto-js/enc-base64";import r from"crypto-js/md5";import s from"crypto-js/enc-hex";import a from"jsencrypt";import i from"crypto-js/aes";import c from"crypto-js/lib-typedarrays";import u from"crypto-js/pad-pkcs7";function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach(function(e){d(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var g,f={exports:{}},b={exports:{}};function _(){return g||(g=1,function(t){const e={eqp:"",os:"",ba:"",bp:"",ver:"",clientId:"",clientSecret:"",apiVersion:"",signVersion:"",signKey:"",timeout:2e4,passportapi:"",userapi:"",login:"",auth:"",enterpriseapi:"",debug:!1,debugApiUrl:"",app:null};function n(t,n){"auth"===t&&console.warn("config.auth配置项已弃用"),void 0!==e[t]&&(e[t]=n)}const o={getConfig:function(t){return t?e[t]:e},setConfig:async function(t,e){if("object"==typeof t)for(const e in t)n(e,t[e]);else t&&n(t,e)}};Object.keys(e).forEach(t=>{Object.defineProperty(o,t,{get:()=>e[t],enumerable:!0})}),t.exports=o}(b)),b.exports}var m,y,j,v,x={exports:{}},w={exports:{}},k={exports:{}};function S(){if(j)return y;let t;return j=1,m||(m=1,function(){const t=n,e=o,a=r,i=s;k.exports={hashHS256:function(n,o){return t(n,o).toString(e)},hashMD5:function(t){return a(t).toString(i)}}}()),t=k.exports,y=t}function I(){return v||(v=1,function(t){const{hashHS256:e}=S(),n=_();function o(t){return"[object Object]"===Object.prototype.toString.call(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=o(t[n]),e),{}):"[object Array]"===Object.prototype.toString.call(t)?t.map(t=>o(t)):t}function r(t,n){const r=function(t){let e=[];return Object.entries(t).map(t=>{let[n,o]=t;void 0===o||""===o||null===o||("[object Array]"===Object.prototype.toString.call(o)||"[object Object]"===Object.prototype.toString.call(o)?e.push("".concat(n,"=").concat(encodeURIComponent(JSON.stringify(o)))):e.push("".concat(n,"=").concat(encodeURIComponent(o))))}),e.join("&")}(o(t)),s=e(r,n);return p(p({},t),{},{sign:s})}t.exports=function(t,e){const{eqp:o,os:s,ba:a,bp:i,ver:c,apiVersion:u,signVersion:h,clientId:d,clientSecret:l,data:p={}}=t||{};return r({eqp:o||n.eqp||"",os:1*s||1*n.os||1,ba:a||n.ba||"",bp:i||n.bp||"",ver:c||n.ver||"1.0.0",ts:Date.now(),apiVersion:u||n.apiVersion||"1.0.0",signVersion:h||n.signVersion||"V1",clientId:d||n.clientId||"",clientSecret:l||n.clientSecret||"",data:p},e=e||n.signKey)}}(w)),w.exports}var C,P,E,O={exports:{}},q={exports:{}},T={exports:{}},D={exports:{}};function A(){return C||(C=1,function(t){const e=_();t.exports={errorLogger:function(){var t,n;e.app?null===(t=(n=e.app).emit)||void 0===t||t.call(n,"error",arguments.length<=0?void 0:arguments[0],(arguments.length<=1?void 0:arguments[1])||{},"bjx-auth"):console.error(...arguments)},debugLogger:function(){e.debug&&console.log(...arguments)}}}(D)),D.exports}function R(){return P||(P=1,function(t){const n=e,o=_(),{debugLogger:r}=A(),s=t=>e=>{var n;if(!o[t])throw new Error("config.".concat(t,"配置项未配置"));return e.baseURL||(e.baseURL=o[t]||""),e.timeout||(e.timeout=o.timeout||2e4),null!==(n=o.debugApiUrl)&&void 0!==n&&n.includes(e.url)&&r(e.url+" <<",e),e},a=t=>{var e;return null!==(e=o.debugApiUrl)&&void 0!==e&&e.includes(t.config.url)&&r(t.config.url+" >>",t.data),t},i=n.create({withCredentials:!0,proxy:!1});i.interceptors.request.use(s("passportapi")),i.interceptors.response.use(a);const c=n.create({withCredentials:!0,proxy:!1});c.interceptors.request.use(s("userapi")),c.interceptors.response.use(a);const u=n.create({proxy:!1});u.interceptors.request.use(s("auth")),u.interceptors.response.use(a);const h=n.create({proxy:!1});h.interceptors.request.use(s("enterpriseapi")),h.interceptors.response.use(a),t.exports={axios:n,passportapi:i,userapi:c,auth:u,enterpriseapi:h}}(T)),T.exports}function U(){return E||(E=1,function(t){const e=I(),{passportapi:n}=R(),{errorLogger:o,debugLogger:r}=A();let s=null;t.exports={getPublicPem:async function(){if(s&&s.expiresAt>Date.now())return s.value;let t=e();try{const{data:e}=await n({url:"/api/v1/common/config/security",method:"POST",data:t});if(!1===e.isError)return r("公钥获取成功"),s={value:"-----BEGIN PUBLIC KEY-----\n".concat(e.data.rsaPubkey,"\n-----END PUBLIC KEY-----"),expiresAt:Date.now()+288e5},s.value;throw new Error("getPublicPem invalid data",{cause:e})}catch(t){return o(t),null}},clearPublicPemCache:function(){return r("公钥清除成功"),s=null,!0},hasPublicPemCache:function(){return!!s}}}(q)),q.exports}var B,N,V,L,H={exports:{}};function z(){if(V)return N;let t;return V=1,B||(B=1,function(){const t=a,e=i,n=c,o=u,r=s;H.exports={encryptRSA:function(e,n){if(!n)throw new Error("publicPem is required");const o=new t;return o.setPublicKey(n),o.encrypt(e)},encryptAES:function(t){const s=n.random(16),a=s,i=e.encrypt(t,a,{iv:s,padding:o});return{iv:s.toString(r),encrypted:i.toString()}}}}()),t=H.exports,N=t}function Q(){return L||(L=1,function(t){const{getPublicPem:e}=U(),{encryptRSA:n,encryptAES:o}=z();t.exports=async function(t){if(!t)throw new Error("data is required");const r=await e(),s=JSON.stringify(t),{encrypted:a,iv:i}=o(s);return{akaParams:a,secretKey:n(i,r)}}}(O)),O.exports}var J,W,G={exports:{}};function M(){return J||(J=1,function(t){const{hashMD5:e}=S(),n=_();t.exports={getReqSign:function(t){"string"==typeof t&&(t={eqp:t||"",os:(arguments.length<=1?void 0:arguments[1])||"",ba:(arguments.length<=2?void 0:arguments[2])||"",bp:(arguments.length<=3?void 0:arguments[3])||""});let{eqp:o,os:r,ba:s,bp:a,ver:i,ctx:c}=t||{};c&&(o||(o=c.uuid),s||(s=c.query.ba),a||(a=c.query.bp));const u={EQP:o||n.eqp||"",OS:r||1*n.os||1,BA:s||n.ba||"",BP:a||n.bp||"",Ver:i||n.ver||"1.0.0",TS:Date.now()},h="EQP=".concat(u.EQP,"&OS=").concat(u.OS,"&BA=").concat(u.BA,"&BP=").concat(u.BP,"&Ver=").concat(u.Ver,"&TS=").concat(u.TS,"+").concat("bjxstat2019"),d=e(h).toUpperCase();return Object.assign(u,{Sign:d})},getReqSign2:function(t){"string"==typeof t&&(t={eqp:t||"",os:(arguments.length<=1?void 0:arguments[1])||"",ba:(arguments.length<=2?void 0:arguments[2])||"",bp:(arguments.length<=3?void 0:arguments[3])||"",xappid:(arguments.length<=4?void 0:arguments[4])||""});let{eqp:o,os:r,ba:s,bp:a,ver:i,xappid:c,ctx:u}=t||{};u&&(o||(o=u.uuid),s||(s=u.query.ba),a||(a=u.query.bp));const h={EQP:o||n.eqp||"",OS:r||1*n.os||1,BA:s||n.ba||"",BP:a||n.bp||"",Ver:i||n.ver||"1.0.0",TS:Date.now(),XAppId:c||n.clientId||""},d="EQP=".concat(h.EQP,"&OS=").concat(h.OS,"&BA=").concat(h.BA,"&BP=").concat(h.BP,"&Ver=").concat(h.Ver,"&TS=").concat(h.TS,"&XAppId=").concat(h.XAppId,"+").concat("%SiGn2021!@#"),l=e(d).toUpperCase();return Object.assign(h,{Sign:l})}}}(G)),G.exports}function K(){return W||(W=1,function(t){const e=I(),n=Q(),o=M();t.exports=p({reqSign:e,reqEncrypt:n,getReqBody:async function(t,o,r){let{eqp:s="",os:a="",ba:i="",bp:c="",ver:u="",apiVersion:h="",signVersion:d="",clientId:l="",clientSecret:p="",ctx:g}=r||{};g&&(s||(s=g.uuid),i||(i=g.query.ba),c||(c=g.query.bp));const f={eqp:s,os:a,ba:i,bp:c,ver:u,apiVersion:h,signVersion:d,clientId:l,clientSecret:p};return o&&t&&Object.keys(t).length>0?f.data=await n(t):f.data=t||{},e(f)}},o)}(x)),x.exports}var F,X={exports:{}};function Y(){return F||(F=1,function(t){const{passportapi:e}=R(),{getReqBody:n}=K();t.exports={getToken:async function(t,o){return t.__isRefresh__?async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/token/refresh/web",method:"POST"},t))}(t,o):async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/token/web",method:"POST"},t))}(t,o)},loginSms:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/sms/web",method:"POST"},t))},loginPwd:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/pwd/web",method:"POST"},t))},registerSms:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/register/sms/web",method:"POST"},t))},logout:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/logout/web",method:"POST"},t))},loginSmsQuick:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/sms/quick/web",method:"POST"},t))},userPatchInfo:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/basic/sync",method:"POST"},t))},userBusmold:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/busmold/seekers/set",method:"POST"},t))},userExist:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/exist/phone",method:"POST"},t))},pwdResetVerify:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/user/pwd/reset/verify",method:"POST"},t))},pwdReset:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/user/pwd/reset",method:"POST"},t))},wxpubCode:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/qrcode",method:"POST"},t))},wxpubScan:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/scan/login",method:"POST"},t))},wxpubBindLogin:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/wxpub/scan/bindlogin",method:"POST"},t))},wxpubH5Code:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/h5/getcode",method:"POST"},t))},wxpubH5BindLogin:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/wxpub/h5/bindlogin",method:"POST"},t))},webappCode:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/webapp/code",method:"POST"},t))},webappBindLogin:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/webapp/bindlogin",method:"POST"},t))}}}(X)),X.exports}var $,Z={exports:{}};function tt(){return $||($=1,function(t){const{userapi:e}=R(),{getReqBody:n}=K();t.exports={baseinfo:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/baseinfo",method:"POST"},t))},geetestGet:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/geetest/sign/get",method:"POST"},t))},geetestCheck:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/geetest/sign/check",method:"POST"},t))},geetestSend:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/sms/geetest/code/send",method:"POST"},t))},regionCode:async function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/common/country/region-code",method:"POST"},t))}}}(Z)),Z.exports}var et,nt,ot={exports:{}};function rt(){return et||(et=1,function(t){const{auth:e,enterpriseapi:n,userapi:o}=R(),{getReqSign:r,getReqBody:s}=K();t.exports={getUserInfo:async function(t,a){const i=["baseinfo","BaseInfo","BaseInfoV1","ExtendInfo","userInfo"];return i.includes(t.__type__)||(t.__type__=i[0]),"userInfo"===t.__type__?async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=p(p({},t.data),r(e)),n(p({url:"/enterprise/user/userInfo",method:"POST"},t)).then(t=>{const{data:e}=t;return t.data={HttpStatusCode:e.code,Error:e.errMsg,IsError:!e.success,Data:e.data&&Object.keys(e.data).length?{HasCompany:e.data.hasCompanyState>0,Id:e.data.id||"",UId:e.data.userId||0,UserName:e.data.userName||"",NickName:e.data.nickName||"",Email:e.data.userEmail||"",EmailIsCheck:e.data.emailCheckState>0,RegionCode:e.data.regionCode||"",Phone:e.data.userPhone||"",PhoneIsCheck:e.data.phoneCheckState>0,HeadUrl:e.data.headUrl||"",BackImage:e.data.backImage||"",BriefIntro:e.data.briefIntro||"",Industry:e.data.industryId||0,Source:e.data.registerSource||0,ShowName:e.data.showName||"",HeadIsDef:e.data.headDefState>0,Nick:e.data.nick||"",NickShowName:e.data.nickShowName||"",RegDate:e.data.registerDate||""}:{}},t})}(t,a):"baseinfo"===t.__type__?async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await s(t.data,!1,e),o(p({url:"/api/v1/user/baseinfo",method:"POST"},t)).then(t=>{const{data:e}=t;return t.data={HttpStatusCode:e.httpStatusCode,Error:e.error,IsError:e.isError,Data:e.data&&Object.keys(e.data).length?{HasCompany:e.data.hasCompany,Id:e.data.id||"",UId:e.data.uid||0,UserName:e.data.userName||"",NickName:e.data.nickName||"",Email:e.data.email||"",EmailIsCheck:e.data.emailIsCheck,RegionCode:e.data.regionCode||"",Phone:e.data.phone||"",PhoneIsCheck:e.data.phoneIsCheck,HeadUrl:e.data.headUrl||"",BackImage:e.data.backImage||"",BriefIntro:e.data.briefIntro||"",Industry:e.data.industry||0,Source:e.data.source||0,ShowName:e.data.showName||"",HeadIsDef:e.data.headIsDef,Nick:e.data.nick||"",NickShowName:e.data.nickShowName||"",RegDate:e.data.regDate||""}:{}},t})}(t,a):async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=p(p({},t.data),r(n)),e(p({url:"/api/User/"+t.__type__,method:"POST"},t))}(t,a)}}}(ot)),ot.exports}function st(){return nt||(nt=1,function(t){const{setConfig:e,getConfig:n}=_(),o=K(),r=Y(),s=tt(),a=rt(),{clearPublicPemCache:i,hasPublicPemCache:c}=U();t.exports=Object.assign({setConfig:e,getConfig:n,clearPublicPemCache:i,hasPublicPemCache:c},o,r,s,a)}(f)),f.exports}const at=["ctx","site","returnUrl","BA","BP","OS","EQP"];var it,ct,ut,ht,dt,lt,pt,gt;function ft(){if(ct)return it;ct=1;const t=_();function e(t){if(!t||0===Object.keys(t).length)return"";const e=[];for(const n in t)t[n]&&e.push("".concat(n,"=").concat(encodeURIComponent(t[n])));return e.join("&")}return it={getLoginCenterUrl:function(n){var o,r;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const a=n||{},{ctx:i,site:c="",returnUrl:u="",BA:h="",BP:d="",OS:l="",EQP:g=""}=a,f=function(t,e){if(null==t)return{};var n,o,r=function(t,e){if(null==t)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(o=0;o<s.length;o++)n=s[o],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(a,at);if(!c&&!i)throw new Error("site is required");if(!u&&!i)throw new Error("returnUrl is required");const{clientId:b,login:_}=t,m=e({BA:h||(null==i||null===(o=i.query)||void 0===o?void 0:o.ba)||t.ba||"",BP:d||(null==i||null===(r=i.query)||void 0===r?void 0:r.bp)||t.bp||"",OS:l||t.os||1,EQP:g||(null==i?void 0:i.uuid)||t.eqp||""});let y;!i||c&&u||(y=function(t,e){let n=t.query.f||"";const o=t.origin,r=new RegExp("^"+o);if(/^\//.test(n))n=o+n;else if(n&&!r.test(n))n=o;else if(!n){const e=t.headers.referer;n=r.test(e)&&e!==t.href?e:o}const s={returnUrl:n};if(e){const t=n.replace(/^https?:\/\//,"").replace(/\/.*/,"");s.site=function(t){const e={hr:3e4,dljob:30100,hdjob:30101,fdjob:30102,sdjob:30103,hedjob:30104,gfjob:30105,zhnyfwjob:30106,shdjob:30107,tanjob:30108,qnjob:30109,dqjob:30200,cnjob:30201,spdjob:30202,zdhjob:30203,xxhjob:30204,hbjob:30300,scljob:30301,gfcljob:30302,dqzljob:30303,jchpjob:30304,hbfdjob:30305,hbgcjob:30306,hbsbjob:30307,hjxfjob:30308,jnjob:30309,gcjob:30400,dlgcjob:30401,jzjob:30402,szlqjob:30403,gdjob:30404,jdjob:30406,sjjob:30407,jljob:30408,gczjjob:30409,dcjob:30500,dcscjob:30501,dcyyjob:30502,dccljob:30503,dchsjob:30504,dcjsjob:30507,spdsbjob:30601,pdywjob:30602,pwpdgcjob:30603,znwdwjob:30604,zlpdwjob:30605,xndcjob:30606,dlscjob:30700,mhr:4e4,mdljob:40100,mhdjob:40101,mfdjob:40102,msdjob:40103,mhedjob:40104,mgfjob:40105,mzhnyfwjob:40106,mshdjob:40107,mtanjob:40108,mqnjob:40109,mdqjob:40200,mcnjob:40201,mspdjob:40202,mzdhjob:40203,mxxhjob:40204,mhbjob:40300,mscljob:40301,mgfcljob:40302,mdqzljob:40303,mjchpjob:40304,mhbfdjob:40305,mhbgcjob:40306,mhbsbjob:40307,mhjxfjob:40308,mjnjob:40309,mgcjob:40400,mdlgcjob:40401,mjzjob:40402,mszlqjob:40403,mgdjob:40404,mjdjob:40406,msjjob:40407,mjljob:40408,mgczjjob:40409,mdcjob:40500,mdcscjob:40501,mdcyyjob:40502,mdccljob:40503,mdchsjob:40504,mdcjsjob:40507,mspdsbjob:40601,mpdywjob:40602,mpwpdgcjob:40603,mznwdwjob:40604,mzlpdwjob:40605,mxndcjob:40606,mdlscjob:40700,yun:3099,yun:30991,yun:30992,yun:30993,yun:30994,yun:30995,yun:30996,tv:3095,sp:3096,sxh:3094,msxh:3093,xiaoyuan:3091,mxiaoyuan:4091,xxsxh:3090,mxxsxh:4090,keyjob:3092,my:3097,mmy:4097,star:3088,stat:3086,manager2:3095,hrcrm:3084,baogao:3076};for(const n in e){if(t.includes(n))return n+".bjx.com.cn";if(t.includes(e[n]))return n+".bjx.com.cn"}return"hr.bjx.com.cn"}(t)}return s}(i,!c));const j=e(p(p({site:c||y.site,clientId:b,pp:m},f),{},{returnUrl:u||y.returnUrl})),v="/Account/Login?".concat(j),x={login:v,register:"/Account/Register?".concat(j),logout:"/Account/Logout?".concat(j),bind:"/External/UserBind?".concat(j),logout2:"/Account/Logout?".concat(j.replace("returnUrl=.+$","")+encodeURIComponent(v))},w={login:"".concat(_).concat(x.login),register:"".concat(_).concat(x.register),logout:"".concat(_).concat(x.logout),bind:"".concat(_).concat(x.bind),logout2:"".concat(_).concat(x.logout2),returnUrl:y.returnUrl};if(s){let t=[];if(Array.isArray(s)?t=s:"string"==typeof s&&(t=s.split(",").map(t=>t.trim())),!t.length)return w;const e={};return t.forEach(t=>{const n=w[t];n&&(e[t]=n)}),1===Object.keys(e).length?Object.values(e)[0]:Object.keys(e).length?e:w}return w}},it}function bt(){if(lt)return dt;lt=1;const n=t,o=e,r=st(),{getLoginCenterUrl:s}=ft(),{errorLogger:a,debugLogger:i}=A(),{setConfig:c,getConfig:u,getTokenApi:h,refreshTokenApi:d,getUserInfoApi:l}=function(){if(ht)return ut;ht=1;const{setConfig:t,getConfig:e,getToken:n,getUserInfo:o}=st();async function r(t){const e=new URLSearchParams(window.location.search),o=e.get("ba")||"",r=e.get("bp")||"";return n({__isRefresh__:t||!1},{ba:o,bp:r}).then(t=>{let{data:e}=t;if(!1===e.isError)return{token_type:"",access_token:e.data.authToken,expires_at:e.data.expiresAt||Date.now()/1e3+14400|0};throw new Error("invalid data",{cause:e})})}return ut={setConfig:t,getConfig:e,getTokenApi:r,refreshTokenApi:async function(){return r(!0)},getUserInfoApi:async function(t,e){if(!t)return null;const n={};t.__flag__?n.AuthToken=t.access_token:n.Authorization=t.token_type+" "+t.access_token;const r=new URLSearchParams(window.location.search),s=r.get("ba")||"",a=r.get("bp")||"";return o({__type__:e,headers:p({},n)},{ba:s,bp:a}).then(t=>{let{data:e}=t;if(!1===e.IsError)return e.Data;throw new Error("invalid data",{cause:e})})}}}();class g{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=p({loadUserInfo:!0,userInfoType:"",handleQueryToken:!1,dispatchCustomEvent:!1,authConfig:{},extendDataHandler:null,extendDataExpires:30,storage:"",cookieWatchInterval:1e3,excludeRouterReg:/^\/sso\/|^\/oidc\//},t),this._cookieWatchInterval=this.options.cookieWatchInterval||1e3,this._userInfoExpires=this._normalizeExpires(this.options.loadUserInfo),this._extendDataExpires=this._normalizeExpires(this.options.extendDataExpires),this.storage=null,this._initStorage(),this.emitter=n(),this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit,this.tokenset=null,this.userInfo=null,this.extendData=null,this._pendingRequests={},this._queryTokenset=null,this.options.handleQueryToken&&this._handleQueryToken(),this._restoreFromStorage(),this.storage===window.localStorage&&(this._boundHandleStorageEvent=this._handleStorageEvent.bind(this),window.addEventListener("storage",this._boundHandleStorageEvent)),c(this.options.authConfig),this.options.authConfig.debug&&i("配置项",u()),this._cookieTimer=null}_normalizeExpires(t){return"number"==typeof t&&t>0?60*t*1e3:18e5}_handleQueryToken(){const t=new URLSearchParams(window.location.search),e=t.get("token"),n=t.get("authtoken");n?this._queryTokenset={token_type:"",access_token:n,expires_at:Math.floor(Date.now()/1e3)+3600,__flag__:"This token from authtoken query",__source__:"query"}:e&&(this._queryTokenset={token_type:"Bearer",access_token:e.replace("Bearer ",""),expires_at:Math.floor(Date.now()/1e3)+3600,__source__:"query"}),this._queryTokenset&&(this.storage=null)}_initStorage(){try{if("localStorage"===this.options.storage)this.storage=window.localStorage;else if("sessionStorage"===this.options.storage)this.storage=window.sessionStorage;else if("object"==typeof this.options.storage&&null!==this.options.storage){if(!("setItem"in this.options.storage&&"getItem"in this.options.storage&&"removeItem"in this.options.storage))throw new Error("Storage object is not valid");this.storage=this.options.storage}else void 0!==this.options.storage&&""!==this.options.storage||(this.storage=window.localStorage)}catch(t){a("Init storage Failed",t)}}_restoreFromStorage(){if(!this.storage)return;const t=this._getCookie("idsrv.session");if(!t)return;const e=JSON.parse(this.storage.getItem("bjx_auth_tokenset")||"null");e&&e.__flag__===t&&1e3*e.expires_at>Date.now()&&(this.tokenset=e,this.userInfo=JSON.parse(this.storage.getItem("bjx_auth_userInfo")||"null"),this.extendData=JSON.parse(this.storage.getItem("bjx_auth_extendData")||"null"),this.tokenset&&this._dispatchEvent("tokensetChange",this.tokenset),this.userInfo&&this._dispatchEvent("userInfoChange",this.userInfo),this.extendData&&this._dispatchEvent("extendDataChange",this.extendData),this._startCookieWatcher())}_startCookieWatcher(){return this._stopCookieWatcher(),this._cookieTimer=setInterval(()=>{var t;const e=this._getCookie("idsrv.session");e&&e===(null===(t=this.tokenset)||void 0===t?void 0:t.__flag__)||this._clearAuthData()},this._cookieWatchInterval),!0}_stopCookieWatcher(){this._cookieTimer&&(clearInterval(this._cookieTimer),this._cookieTimer=null)}_saveToStorage(t){this.storage&&(!this.tokenset||t&&"tokenset"!==t||this.storage.setItem("bjx_auth_tokenset",JSON.stringify(this.tokenset)),!this.userInfo||t&&"userInfo"!==t||this.storage.setItem("bjx_auth_userInfo",JSON.stringify(this.userInfo)),!this.extendData||t&&"extendData"!==t||this.storage.setItem("bjx_auth_extendData",JSON.stringify(this.extendData)))}_clearAuthData(t){this._stopCookieWatcher(),this.tokenset=null,this.userInfo=null,this.extendData=null,this.storage&&["bjx_auth_tokenset","bjx_auth_userInfo","bjx_auth_extendData"].forEach(t=>{this.storage.removeItem(t)}),t||(this._dispatchEvent("tokensetChange",null),this._dispatchEvent("userInfoChange",null),"function"==typeof this.options.extendDataHandler&&this._dispatchEvent("extendDataChange",null))}_getCookie(t){const e="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===e.length?e.pop().split(";").shift():null}_setCookie(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o="";if(n){const t=new Date;t.setTime(t.getTime()+24*n*60*60*1e3),o="; expires="+t.toUTCString()}document.cookie=t+"="+(e||"")+o+"; path=/"}_deleteCookie(t){document.cookie=t+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"}_handleStorageEvent(t){if(!this.storage)return;const e=this._getCookie("idsrv.session");if("bjx_auth_tokenset"===t.key){const n=JSON.parse(t.newValue||"null");(n&&n.__flag__===e||!t.newValue)&&(this.tokenset=n,this._dispatchEvent("tokensetChange",n))}else"bjx_auth_userInfo"===t.key?Promise.resolve().then(()=>{(this.tokenset&&this.tokenset.__flag__===e||!t.newValue)&&(this.userInfo=JSON.parse(t.newValue||"null"),this._dispatchEvent("userInfoChange",this.userInfo))}):"bjx_auth_extendData"===t.key&&Promise.resolve().then(()=>{(this.tokenset&&this.tokenset.__flag__===e||!t.newValue)&&(this.extendData=JSON.parse(t.newValue||"null"),this._dispatchEvent("extendDataChange",this.extendData))})}_dispatchEvent(t,e){Promise.resolve().then(()=>{if(this.emit(t,e),this.options.dispatchCustomEvent){const n=new CustomEvent("bjxAuth:"+t,{detail:e});window.dispatchEvent(n)}})}async init(){return this.getTokenset()}async isAuth(){return null!==await this.getTokenset()}async getToken(){const t=await this.getTokenset();return t&&t.access_token?(t.token_type?t.token_type+" ":"")+t.access_token:null}async getTokenset(){if(this._queryTokenset){return await this.getUserInfo(void 0,this._queryTokenset)?(this.options.authConfig.debug&&i("通过".concat(this._queryTokenset.__flag__?"authtoken":"token","参数登录系统")),this.tokenset=this._queryTokenset,this._dispatchEvent("tokensetChange",this._queryTokenset),this.getExtendData(),this.tokenset):null}const t=this._getCookie("idsrv.session");if(!t)return this.tokenset&&this._clearAuthData(),null;if(this.tokenset&&this.tokenset.__flag__===t){if(1e3*this.tokenset.expires_at<=Date.now()){let e="refreshToken";try{this._pendingRequests[e]||(this._pendingRequests[e]=d.call(this));const n=await this._pendingRequests[e];if(delete this._pendingRequests[e],!n)throw new Error("Empty refreshToken data");this.tokenset=p(p({},n),{},{__flag__:t}),this._saveToStorage("tokenset"),this._dispatchEvent("tokensetChange",this.tokenset)}catch(t){return delete this._pendingRequests[e],a("Get refreshToken failed:",t),null}}}else{let e="getToken";try{this._pendingRequests[e]||(this._pendingRequests[e]=h.call(this));const n=await this._pendingRequests[e];if(delete this._pendingRequests[e],!n)throw new Error("Empty token data");this.tokenset=p(p({},n),{},{__flag__:t}),this._saveToStorage("tokenset"),this._dispatchEvent("tokensetChange",this.tokenset),this._startCookieWatcher()}catch(t){return delete this._pendingRequests[e],a("Get token failed:",t),null}}return this.getUserInfo(),this.getExtendData(),this.tokenset}async getUserInfo(t,e){const n=e||this.tokenset;if(!n)return null;if(!this.options.loadUserInfo&&!e)return null;const o=this._getCookie("idsrv.session");if(!t&&this.userInfo&&this.userInfo.__expires_at__>Date.now()&&this.userInfo.__flag__===o)return this.userInfo;const r="getUserInfo";try{this._pendingRequests[r]||(this._pendingRequests[r]=l.call(this,n,this.options.userInfoType));const t=await this._pendingRequests[r];if(delete this._pendingRequests[r],!t)throw new Error("Empty userInfo data");const e=p(p({},t),{},{__flag__:o,__expires_at__:Date.now()+this._userInfoExpires});return this.options.loadUserInfo&&(this.userInfo=e,this._saveToStorage("userInfo"),this._dispatchEvent("userInfoChange",this.userInfo)),e}catch(t){return delete this._pendingRequests[r],a("Get userInfo failed:",t),null}}async getExtendData(t){if("function"!=typeof this.options.extendDataHandler)return null;if(!this.tokenset)return null;const e=this._getCookie("idsrv.session");if(!t&&this.extendData&&this.extendData.__expires_at__>Date.now()&&this.extendData.__flag__===e)return this.extendData;const n="getExtendData";try{this._pendingRequests[n]||(this._pendingRequests[n]=this.options.extendDataHandler.call(this,this.tokenset,this));const t=await this._pendingRequests[n];if(delete this._pendingRequests[n],!t)throw new Error("Empty extendData data");return this.extendData=p(p({},t),{},{__flag__:e,__expires_at__:Date.now()+this._extendDataExpires}),this._saveToStorage("extendData"),this._dispatchEvent("extendDataChange",this.extendData),this.extendData}catch(t){return delete this._pendingRequests[n],a("Get extendData failed:",t),null}}createVueRouterMiddleware(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/sso/login";return async(e,n,o)=>{var r,s;const a=await this.isAuth();null!=e&&null!==(r=e.meta)&&void 0!==r&&r.isPublic||null!==(s=this.options.excludeRouterReg)&&void 0!==s&&s.test(null==e?void 0:e.path)||a?o():o(t)}}destroy(){this._stopCookieWatcher(),this.emitter.all.clear(),this.tokenset=null,this.userInfo=null,this.extendData=null,this._pendingRequests={},this._boundHandleStorageEvent&&(window.removeEventListener("storage",this._boundHandleStorageEvent),this._boundHandleStorageEvent=null)}clear(t){this._clearAuthData(t)}}return g.prototype.mitt=n,g.prototype.axios=o,g.prototype.bjxAuthApi=r,g.prototype.getLoginCenterUrl=s,g.mitt=n,g.axios=o,g.bjxAuthApi=r,g.getLoginCenterUrl=s,dt=g}var _t=function(){if(gt)return pt;gt=1;const t=bt(),e=t.axios,n=document.currentScript;if(n){const o=n.hasAttribute("init"),r=n.getAttribute("init"),s=n.hasAttribute("expose"),a=n.getAttribute("expose"),i=n.hasAttribute("bind"),c=n.hasAttribute("debug");o&&e({url:r||"/api/get_bjx_auth_conf"}).then(e=>{let{data:n}=e;const o=(null==n?void 0:n.Data)||(null==n?void 0:n.data)||n;if(o&&Object.keys(o).length){const e=p(p({},o),{},{dispatchCustomEvent:!0});c&&(e.authConfig=p(p({},e.authConfig),{},{debug:!0}));const n=new t(e);n.init(),i&&(n.on("tokensetChange",t=>{t&&t.access_token?n._setCookie("bjx_auth_token",t.access_token,0):n._deleteCookie("bjx_auth_token")}),n.on("userInfoChange",t=>{t&&t.UId?n._setCookie("bjx_auth_uid",t.UId,0):n._deleteCookie("bjx_auth_uid")})),s&&(window[a||"bjx_auth_ins"]=n)}})}return pt=t}(),mt=h(_t);export{mt as default};
1
+ /*! version: 1.19.2 */
2
+ import t from"mitt";import e from"axios";import n from"crypto-js/hmac-sha256";import o from"crypto-js/enc-base64";import r from"crypto-js/md5";import s from"crypto-js/enc-hex";import i from"jsencrypt";import a from"crypto-js/aes";import c from"crypto-js/lib-typedarrays";import u from"crypto-js/pad-pkcs7";function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach(function(e){d(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var g,f={exports:{}},b={exports:{}};function _(){return g||(g=1,function(t){const e={eqp:"",os:"",ba:"",bp:"",ver:"",clientId:"",clientSecret:"",apiVersion:"",signVersion:"",signKey:"",timeout:2e4,passportapi:"",userapi:"",login:"",auth:"",enterpriseapi:"",debug:!1,debugApiUrl:"",app:null};function n(t,n){"auth"===t&&console.warn("config.auth配置项已弃用"),void 0!==e[t]&&(e[t]=n)}const o={getConfig:function(t){return t?e[t]:e},setConfig:async function(t,e){if("object"==typeof t)for(const e in t)n(e,t[e]);else t&&n(t,e)}};Object.keys(e).forEach(t=>{Object.defineProperty(o,t,{get:()=>e[t],enumerable:!0})}),t.exports=o}(b)),b.exports}var m,v,y,j,x={exports:{}},w={exports:{}},k={exports:{}};function S(){if(y)return v;let t;return y=1,m||(m=1,function(){const t=n,e=o,i=r,a=s;k.exports={hashHS256:function(n,o){return t(n,o).toString(e)},hashMD5:function(t){return i(t).toString(a)}}}()),t=k.exports,v=t}function I(){return j||(j=1,function(t){const{hashHS256:e}=S(),n=_();function o(t){return"[object Object]"===Object.prototype.toString.call(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=o(t[n]),e),{}):"[object Array]"===Object.prototype.toString.call(t)?t.map(t=>o(t)):t}function r(t,n){const r=function(t){let e=[];return Object.entries(t).map(t=>{let[n,o]=t;void 0===o||""===o||null===o||("[object Array]"===Object.prototype.toString.call(o)||"[object Object]"===Object.prototype.toString.call(o)?e.push("".concat(n,"=").concat(encodeURIComponent(JSON.stringify(o)))):e.push("".concat(n,"=").concat(encodeURIComponent(o))))}),e.join("&")}(o(t)),s=e(r,n);return p(p({},t),{},{sign:s})}t.exports=function(t,e){const{eqp:o,os:s,ba:i,bp:a,ver:c,apiVersion:u,signVersion:h,clientId:d,clientSecret:l,data:p={}}=t||{};return r({eqp:o||n.eqp||"",os:1*s||1*n.os||1,ba:i||n.ba||"",bp:a||n.bp||"",ver:c||n.ver||"1.0.0",ts:Date.now(),apiVersion:u||n.apiVersion||"1.0.0",signVersion:h||n.signVersion||"V1",clientId:d||n.clientId||"",clientSecret:l||n.clientSecret||"",data:p},e=e||n.signKey)}}(w)),w.exports}var C,P,E,O={exports:{}},q={exports:{}},T={exports:{}},D={exports:{}};function A(){return C||(C=1,function(t){const e=_();t.exports={errorLogger:function(){var t,n;e.app?null===(t=(n=e.app).emit)||void 0===t||t.call(n,"error",arguments.length<=0?void 0:arguments[0],(arguments.length<=1?void 0:arguments[1])||{},"bjx-auth"):console.error(...arguments)},debugLogger:function(){e.debug&&console.log(...arguments)}}}(D)),D.exports}function R(){return P||(P=1,function(t){const n=e,o=_(),{debugLogger:r}=A(),s=t=>e=>{var n;if(!o[t])throw new Error("config.".concat(t,"配置项未配置"));return e.baseURL||(e.baseURL=o[t]||""),e.timeout||(e.timeout=o.timeout||2e4),null!==(n=o.debugApiUrl)&&void 0!==n&&n.includes(e.url)&&r(e.url+" <<",e),e},i=t=>{var e;return null!==(e=o.debugApiUrl)&&void 0!==e&&e.includes(t.config.url)&&r(t.config.url+" >>",t.data),t},a=n.create({withCredentials:!0,proxy:!1});a.interceptors.request.use(s("passportapi")),a.interceptors.response.use(i);const c=n.create({withCredentials:!0,proxy:!1});c.interceptors.request.use(s("userapi")),c.interceptors.response.use(i);const u=n.create({proxy:!1});u.interceptors.request.use(s("auth")),u.interceptors.response.use(i);const h=n.create({proxy:!1});h.interceptors.request.use(s("enterpriseapi")),h.interceptors.response.use(i),t.exports={axios:n,passportapi:a,userapi:c,auth:u,enterpriseapi:h}}(T)),T.exports}function U(){return E||(E=1,function(t){const e=I(),{passportapi:n}=R(),{errorLogger:o,debugLogger:r}=A();let s=null;t.exports={getPublicPem:async function(){if(s&&s.expiresAt>Date.now())return s.value;let t=e();try{const{data:e}=await n({url:"/api/v1/common/config/security",method:"POST",data:t});if(!1===e.isError)return r("公钥获取成功"),s={value:"-----BEGIN PUBLIC KEY-----\n".concat(e.data.rsaPubkey,"\n-----END PUBLIC KEY-----"),expiresAt:Date.now()+288e5},s.value;throw new Error("getPublicPem invalid data",{cause:e})}catch(t){return o(t),null}},clearPublicPemCache:function(){return r("公钥清除成功"),s=null,!0},hasPublicPemCache:function(){return!!s}}}(q)),q.exports}var B,N,V,L,H={exports:{}};function z(){if(V)return N;let t;return V=1,B||(B=1,function(){const t=i,e=a,n=c,o=u,r=s;H.exports={encryptRSA:function(e,n){if(!n)throw new Error("publicPem is required");const o=new t;return o.setPublicKey(n),o.encrypt(e)},encryptAES:function(t){const s=n.random(16),i=s,a=e.encrypt(t,i,{iv:s,padding:o});return{iv:s.toString(r),encrypted:a.toString()}}}}()),t=H.exports,N=t}function Q(){return L||(L=1,function(t){const{getPublicPem:e}=U(),{encryptRSA:n,encryptAES:o}=z();t.exports=async function(t){if(!t)throw new Error("data is required");const r=await e(),s=JSON.stringify(t),{encrypted:i,iv:a}=o(s);return{akaParams:i,secretKey:n(a,r)}}}(O)),O.exports}var J,W,G={exports:{}};function M(){return J||(J=1,function(t){const{hashMD5:e}=S(),n=_();t.exports={getReqSign:function(t){"string"==typeof t&&(t={eqp:t||"",os:(arguments.length<=1?void 0:arguments[1])||"",ba:(arguments.length<=2?void 0:arguments[2])||"",bp:(arguments.length<=3?void 0:arguments[3])||""});let{eqp:o,os:r,ba:s,bp:i,ver:a,ctx:c}=t||{};c&&(o||(o=c.uuid),s||(s=c.query.ba),i||(i=c.query.bp));const u={EQP:o||n.eqp||"",OS:r||1*n.os||1,BA:s||n.ba||"",BP:i||n.bp||"",Ver:a||n.ver||"1.0.0",TS:Date.now()},h="EQP=".concat(u.EQP,"&OS=").concat(u.OS,"&BA=").concat(u.BA,"&BP=").concat(u.BP,"&Ver=").concat(u.Ver,"&TS=").concat(u.TS,"+").concat("bjxstat2019"),d=e(h).toUpperCase();return Object.assign(u,{Sign:d})},getReqSign2:function(t){"string"==typeof t&&(t={eqp:t||"",os:(arguments.length<=1?void 0:arguments[1])||"",ba:(arguments.length<=2?void 0:arguments[2])||"",bp:(arguments.length<=3?void 0:arguments[3])||"",xappid:(arguments.length<=4?void 0:arguments[4])||""});let{eqp:o,os:r,ba:s,bp:i,ver:a,xappid:c,ctx:u}=t||{};u&&(o||(o=u.uuid),s||(s=u.query.ba),i||(i=u.query.bp));const h={EQP:o||n.eqp||"",OS:r||1*n.os||1,BA:s||n.ba||"",BP:i||n.bp||"",Ver:a||n.ver||"1.0.0",TS:Date.now(),XAppId:c||n.clientId||""},d="EQP=".concat(h.EQP,"&OS=").concat(h.OS,"&BA=").concat(h.BA,"&BP=").concat(h.BP,"&Ver=").concat(h.Ver,"&TS=").concat(h.TS,"&XAppId=").concat(h.XAppId,"+").concat("%SiGn2021!@#"),l=e(d).toUpperCase();return Object.assign(h,{Sign:l})}}}(G)),G.exports}function K(){return W||(W=1,function(t){const e=I(),n=Q(),o=M();t.exports=p({reqSign:e,reqEncrypt:n,getReqBody:async function(t,o,r){let{eqp:s="",os:i="",ba:a="",bp:c="",ver:u="",apiVersion:h="",signVersion:d="",clientId:l="",clientSecret:p="",ctx:g}=r||{};g&&(s||(s=g.uuid),a||(a=g.query.ba),c||(c=g.query.bp));const f={eqp:s,os:i,ba:a,bp:c,ver:u,apiVersion:h,signVersion:d,clientId:l,clientSecret:p};return o&&t&&Object.keys(t).length>0?f.data=await n(t):f.data=t||{},e(f)}},o)}(x)),x.exports}var F,X={exports:{}};function Y(){return F||(F=1,function(t){const{passportapi:e}=R(),{getReqBody:n}=K();t.exports={getToken:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__isRefresh__?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/token/refresh/web",method:"POST"},t))}(t,o):async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/token/web",method:"POST"},t))}(t,o)},loginSms:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/sms/web",method:"POST"},t))},loginPwd:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/pwd/web",method:"POST"},t))},registerSms:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/register/sms/web",method:"POST"},t))},logout:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(null,!1,o),e(p({url:"/api/v1/logout/web",method:"POST"},t))},loginSmsQuick:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/login/sms/quick/web",method:"POST"},t))},userPatchInfo:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/user/basic/sync",method:"POST"},t))},userBusmold:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/busmold/seekers/set",method:"POST"},t))},userExist:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/exist/phone",method:"POST"},t))},pwdResetVerify:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/user/pwd/reset/verify",method:"POST"},t))},pwdReset:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/user/pwd/reset",method:"POST"},t))},wxpubCode:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/qrcode",method:"POST"},t))},wxpubScan:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/scan/login",method:"POST"},t))},wxpubBindLogin:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/wxpub/scan/bindlogin",method:"POST"},t))},wxpubH5Code:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/wxpub/h5/getcode",method:"POST"},t))},wxpubH5BindLogin:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/wxpub/h5/bindlogin",method:"POST"},t))},webappCode:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/wechat/webapp/code",method:"POST"},t))},webappBindLogin:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!0,o),e(p({url:"/api/v1/wechat/webapp/bindlogin",method:"POST"},t))}}}(X)),X.exports}var $,Z={exports:{}};function tt(){return $||($=1,function(t){const{userapi:e}=R(),{getReqBody:n}=K();t.exports={baseinfo:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/user/baseinfo",method:"POST"},t))},geetestGet:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/geetest/sign/get",method:"POST"},t))},geetestCheck:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/geetest/sign/check",method:"POST"},t))},geetestSend:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/sms/geetest/code/send",method:"POST"},t))},regionCode:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await n(t.data,!1,o),e(p({url:"/api/v1/common/country/region-code",method:"POST"},t))}}}(Z)),Z.exports}var et,nt,ot={exports:{}};function rt(){return et||(et=1,function(t){const{auth:e,enterpriseapi:n,userapi:o}=R(),{getReqSign:r,getReqBody:s}=K();t.exports={getUserInfo:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=["baseinfo","BaseInfo","BaseInfoV1","ExtendInfo","userInfo"];return a.includes(t.__type__)||(t.__type__=a[0]),"userInfo"===t.__type__?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=p(p({},t.data),r(e)),n(p({url:"/enterprise/user/userInfo",method:"POST"},t)).then(t=>{const{data:e}=t;return t.data={HttpStatusCode:e.code,Error:e.errMsg,IsError:!e.success,Data:e.data&&Object.keys(e.data).length?{HasCompany:e.data.hasCompanyState>0,Id:e.data.id||"",UId:e.data.userId||0,UserName:e.data.userName||"",NickName:e.data.nickName||"",Email:e.data.userEmail||"",EmailIsCheck:e.data.emailCheckState>0,RegionCode:e.data.regionCode||"",Phone:e.data.userPhone||"",PhoneIsCheck:e.data.phoneCheckState>0,HeadUrl:e.data.headUrl||"",BackImage:e.data.backImage||"",BriefIntro:e.data.briefIntro||"",Industry:e.data.industryId||0,Source:e.data.registerSource||0,ShowName:e.data.showName||"",HeadIsDef:e.data.headDefState>0,Nick:e.data.nick||"",NickShowName:e.data.nickShowName||"",RegDate:e.data.registerDate||""}:{}},t})}(t,i):"baseinfo"===t.__type__?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=await s(t.data,!1,e),o(p({url:"/api/v1/user/baseinfo",method:"POST"},t)).then(t=>{const{data:e}=t;return t.data={HttpStatusCode:e.httpStatusCode,Error:e.error,IsError:e.isError,Data:e.data&&Object.keys(e.data).length?{HasCompany:e.data.hasCompany,Id:e.data.id||"",UId:e.data.uid||0,UserName:e.data.userName||"",NickName:e.data.nickName||"",Email:e.data.email||"",EmailIsCheck:e.data.emailIsCheck,RegionCode:e.data.regionCode||"",Phone:e.data.phone||"",PhoneIsCheck:e.data.phoneIsCheck,HeadUrl:e.data.headUrl||"",BackImage:e.data.backImage||"",BriefIntro:e.data.briefIntro||"",Industry:e.data.industry||0,Source:e.data.source||0,ShowName:e.data.showName||"",HeadIsDef:e.data.headIsDef,Nick:e.data.nick||"",NickShowName:e.data.nickShowName||"",RegDate:e.data.regDate||""}:{}},t})}(t,i):async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.data=p(p({},t.data),r(n)),e(p({url:"/api/User/"+t.__type__,method:"POST"},t))}(t,i)}}}(ot)),ot.exports}function st(){return nt||(nt=1,function(t){const{setConfig:e,getConfig:n}=_(),o=K(),r=Y(),s=tt(),i=rt(),{clearPublicPemCache:a,hasPublicPemCache:c}=U();t.exports=Object.assign({setConfig:e,getConfig:n,clearPublicPemCache:a,hasPublicPemCache:c},o,r,s,i)}(f)),f.exports}const it=["ctx","site","returnUrl","BA","BP","OS","EQP"];var at,ct,ut,ht,dt,lt,pt,gt;function ft(){if(ct)return at;ct=1;const t=_();function e(t){if(!t||0===Object.keys(t).length)return"";const e=[];for(const n in t)t[n]&&e.push("".concat(n,"=").concat(encodeURIComponent(t[n])));return e.join("&")}return at={getLoginCenterUrl:function(n){var o,r;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=n||{},{ctx:a,site:c="",returnUrl:u="",BA:h="",BP:d="",OS:l="",EQP:g=""}=i,f=function(t,e){if(null==t)return{};var n,o,r=function(t,e){if(null==t)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(o=0;o<s.length;o++)n=s[o],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(i,it);if(!c&&!a)throw new Error("site is required");if(!u&&!a)throw new Error("returnUrl is required");const{clientId:b,login:_}=t,m=e({BA:h||(null==a||null===(o=a.query)||void 0===o?void 0:o.ba)||t.ba||"",BP:d||(null==a||null===(r=a.query)||void 0===r?void 0:r.bp)||t.bp||"",OS:l||t.os||1,EQP:g||(null==a?void 0:a.uuid)||t.eqp||""});let v;!a||c&&u||(v=function(t,e){let n=t.query.f||"";const o=t.origin,r=new RegExp("^"+o);if(/^\//.test(n))n=o+n;else if(n&&!r.test(n))n=o;else if(!n){const e=t.headers.referer;n=r.test(e)&&e!==t.href?e:o}const s={returnUrl:n};if(e){const t=n.replace(/^https?:\/\//,"").replace(/\/.*/,"");s.site=function(t){const e={hr:3e4,dljob:30100,hdjob:30101,fdjob:30102,sdjob:30103,hedjob:30104,gfjob:30105,zhnyfwjob:30106,shdjob:30107,tanjob:30108,qnjob:30109,dqjob:30200,cnjob:30201,spdjob:30202,zdhjob:30203,xxhjob:30204,hbjob:30300,scljob:30301,gfcljob:30302,dqzljob:30303,jchpjob:30304,hbfdjob:30305,hbgcjob:30306,hbsbjob:30307,hjxfjob:30308,jnjob:30309,gcjob:30400,dlgcjob:30401,jzjob:30402,szlqjob:30403,gdjob:30404,jdjob:30406,sjjob:30407,jljob:30408,gczjjob:30409,dcjob:30500,dcscjob:30501,dcyyjob:30502,dccljob:30503,dchsjob:30504,dcjsjob:30507,spdsbjob:30601,pdywjob:30602,pwpdgcjob:30603,znwdwjob:30604,zlpdwjob:30605,xndcjob:30606,dlscjob:30700,mhr:4e4,mdljob:40100,mhdjob:40101,mfdjob:40102,msdjob:40103,mhedjob:40104,mgfjob:40105,mzhnyfwjob:40106,mshdjob:40107,mtanjob:40108,mqnjob:40109,mdqjob:40200,mcnjob:40201,mspdjob:40202,mzdhjob:40203,mxxhjob:40204,mhbjob:40300,mscljob:40301,mgfcljob:40302,mdqzljob:40303,mjchpjob:40304,mhbfdjob:40305,mhbgcjob:40306,mhbsbjob:40307,mhjxfjob:40308,mjnjob:40309,mgcjob:40400,mdlgcjob:40401,mjzjob:40402,mszlqjob:40403,mgdjob:40404,mjdjob:40406,msjjob:40407,mjljob:40408,mgczjjob:40409,mdcjob:40500,mdcscjob:40501,mdcyyjob:40502,mdccljob:40503,mdchsjob:40504,mdcjsjob:40507,mspdsbjob:40601,mpdywjob:40602,mpwpdgcjob:40603,mznwdwjob:40604,mzlpdwjob:40605,mxndcjob:40606,mdlscjob:40700,yun:3099,yun:30991,yun:30992,yun:30993,yun:30994,yun:30995,yun:30996,tv:3095,sp:3096,sxh:3094,msxh:3093,xiaoyuan:3091,mxiaoyuan:4091,xxsxh:3090,mxxsxh:4090,keyjob:3092,my:3097,mmy:4097,star:3088,stat:3086,manager2:3095,hrcrm:3084,baogao:3076};for(const n in e){if(t.includes(n))return n+".bjx.com.cn";if(t.includes(e[n]))return n+".bjx.com.cn"}return"hr.bjx.com.cn"}(t)}return s}(a,!c));const y=e(p(p({site:c||v.site,clientId:b,pp:m},f),{},{returnUrl:u||v.returnUrl})),j="/Account/Login?".concat(y),x={login:j,register:"/Account/Register?".concat(y),logout:"/Account/Logout?".concat(y),bind:"/External/UserBind?".concat(y),logout2:"/Account/Logout?".concat(y.replace("returnUrl=.+$","")+encodeURIComponent(j))},w={login:"".concat(_).concat(x.login),register:"".concat(_).concat(x.register),logout:"".concat(_).concat(x.logout),bind:"".concat(_).concat(x.bind),logout2:"".concat(_).concat(x.logout2),returnUrl:v.returnUrl};if(s){let t=[];if(Array.isArray(s)?t=s:"string"==typeof s&&(t=s.split(",").map(t=>t.trim())),!t.length)return w;const e={};return t.forEach(t=>{const n=w[t];n&&(e[t]=n)}),1===Object.keys(e).length?Object.values(e)[0]:Object.keys(e).length?e:w}return w}},at}function bt(){if(lt)return dt;lt=1;const n=t,o=e,r=st(),{getLoginCenterUrl:s}=ft(),{errorLogger:i,debugLogger:a}=A(),{setConfig:c,getConfig:u,getTokenApi:h,refreshTokenApi:d,getUserInfoApi:l}=function(){if(ht)return ut;ht=1;const{setConfig:t,getConfig:e,getToken:n,getUserInfo:o}=st();async function r(t){const e=new URLSearchParams(window.location.search),o=e.get("ba")||"",r=e.get("bp")||"";return n({__isRefresh__:t||!1},{ba:o,bp:r}).then(t=>{let{data:e}=t;if(!1===e.isError)return{token_type:"",access_token:e.data.authToken,expires_at:e.data.expiresAt||Date.now()/1e3+14400|0};throw new Error("invalid data",{cause:e})})}return ut={setConfig:t,getConfig:e,getTokenApi:r,refreshTokenApi:async function(){return r(!0)},getUserInfoApi:async function(t,e){if(!t)return null;const n={};t.__flag__?n.AuthToken=t.access_token:n.Authorization=t.token_type+" "+t.access_token;const r=new URLSearchParams(window.location.search),s=r.get("ba")||"",i=r.get("bp")||"";return o({__type__:e,headers:p({},n)},{ba:s,bp:i}).then(t=>{let{data:e}=t;if(!1===e.IsError)return e.Data;throw new Error("invalid data",{cause:e})})}}}();class g{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=p({loadUserInfo:!0,userInfoType:"",handleQueryToken:!1,dispatchCustomEvent:!1,authConfig:{},extendDataHandler:null,extendDataExpires:30,storage:"",cookieWatchInterval:1e3,excludeRouterReg:/^\/sso\/|^\/oidc\//},t),this._cookieWatchInterval=this.options.cookieWatchInterval||1e3,this._userInfoExpires=this._normalizeExpires(this.options.loadUserInfo),this._extendDataExpires=this._normalizeExpires(this.options.extendDataExpires),this.storage=null,this._initStorage(),this.emitter=n(),this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit,this.tokenset=null,this.userInfo=null,this.extendData=null,this._pendingRequests={},this._queryTokenset=null,this.options.handleQueryToken&&this._handleQueryToken(),this._restoreFromStorage(),this.storage===window.localStorage&&(this._boundHandleStorageEvent=this._handleStorageEvent.bind(this),window.addEventListener("storage",this._boundHandleStorageEvent)),c(this.options.authConfig),this.options.authConfig.debug&&a("配置项",u()),this._cookieTimer=null}_normalizeExpires(t){return"number"==typeof t&&t>0?60*t*1e3:18e5}_handleQueryToken(){const t=new URLSearchParams(window.location.search),e=t.get("token"),n=t.get("authtoken");n?this._queryTokenset={token_type:"",access_token:n,expires_at:Math.floor(Date.now()/1e3)+3600,__flag__:"This token from authtoken query",__source__:"query"}:e&&(this._queryTokenset={token_type:"Bearer",access_token:e.replace("Bearer ",""),expires_at:Math.floor(Date.now()/1e3)+3600,__source__:"query"}),this._queryTokenset&&(this.storage=null)}_initStorage(){try{if("localStorage"===this.options.storage)this.storage=window.localStorage;else if("sessionStorage"===this.options.storage)this.storage=window.sessionStorage;else if("object"==typeof this.options.storage&&null!==this.options.storage){if(!("setItem"in this.options.storage&&"getItem"in this.options.storage&&"removeItem"in this.options.storage))throw new Error("Storage object is not valid");this.storage=this.options.storage}else void 0!==this.options.storage&&""!==this.options.storage||(this.storage=window.localStorage)}catch(t){i("Init storage Failed",t)}}_restoreFromStorage(){if(!this.storage)return;const t=this._getCookie("idsrv.session");if(!t)return;const e=JSON.parse(this.storage.getItem("bjx_auth_tokenset")||"null");e&&e.__flag__===t&&1e3*e.expires_at>Date.now()&&(this.tokenset=e,this.userInfo=JSON.parse(this.storage.getItem("bjx_auth_userInfo")||"null"),this.extendData=JSON.parse(this.storage.getItem("bjx_auth_extendData")||"null"),this.tokenset&&this._dispatchEvent("tokensetChange",this.tokenset),this.userInfo&&this._dispatchEvent("userInfoChange",this.userInfo),this.extendData&&this._dispatchEvent("extendDataChange",this.extendData),this._startCookieWatcher())}_startCookieWatcher(){return this._stopCookieWatcher(),this._cookieTimer=setInterval(()=>{var t;const e=this._getCookie("idsrv.session");e&&e===(null===(t=this.tokenset)||void 0===t?void 0:t.__flag__)||this._clearAuthData()},this._cookieWatchInterval),!0}_stopCookieWatcher(){this._cookieTimer&&(clearInterval(this._cookieTimer),this._cookieTimer=null)}_saveToStorage(t){this.storage&&(!this.tokenset||t&&"tokenset"!==t||this.storage.setItem("bjx_auth_tokenset",JSON.stringify(this.tokenset)),!this.userInfo||t&&"userInfo"!==t||this.storage.setItem("bjx_auth_userInfo",JSON.stringify(this.userInfo)),!this.extendData||t&&"extendData"!==t||this.storage.setItem("bjx_auth_extendData",JSON.stringify(this.extendData)))}_clearAuthData(t){this._stopCookieWatcher(),this.tokenset=null,this.userInfo=null,this.extendData=null,this.storage&&["bjx_auth_tokenset","bjx_auth_userInfo","bjx_auth_extendData"].forEach(t=>{this.storage.removeItem(t)}),t||(this._dispatchEvent("tokensetChange",null),this._dispatchEvent("userInfoChange",null),"function"==typeof this.options.extendDataHandler&&this._dispatchEvent("extendDataChange",null))}_getCookie(t){const e="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===e.length?e.pop().split(";").shift():null}_setCookie(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o="";if(n){const t=new Date;t.setTime(t.getTime()+24*n*60*60*1e3),o="; expires="+t.toUTCString()}document.cookie=t+"="+(e||"")+o+"; path=/"}_deleteCookie(t){document.cookie=t+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"}_handleStorageEvent(t){if(!this.storage)return;const e=this._getCookie("idsrv.session");if("bjx_auth_tokenset"===t.key){const n=JSON.parse(t.newValue||"null");(n&&n.__flag__===e||!t.newValue)&&(this.tokenset=n,this._dispatchEvent("tokensetChange",n))}else"bjx_auth_userInfo"===t.key?Promise.resolve().then(()=>{(this.tokenset&&this.tokenset.__flag__===e||!t.newValue)&&(this.userInfo=JSON.parse(t.newValue||"null"),this._dispatchEvent("userInfoChange",this.userInfo))}):"bjx_auth_extendData"===t.key&&Promise.resolve().then(()=>{(this.tokenset&&this.tokenset.__flag__===e||!t.newValue)&&(this.extendData=JSON.parse(t.newValue||"null"),this._dispatchEvent("extendDataChange",this.extendData))})}_dispatchEvent(t,e){Promise.resolve().then(()=>{if(this.emit(t,e),this.options.dispatchCustomEvent){const n=new CustomEvent("bjxAuth:"+t,{detail:e});window.dispatchEvent(n)}})}async init(){return this.getTokenset()}async isAuth(){return null!==await this.getTokenset()}async getToken(){const t=await this.getTokenset();return t&&t.access_token?(t.token_type?t.token_type+" ":"")+t.access_token:null}async getTokenset(){if(this._queryTokenset){return await this.getUserInfo(void 0,this._queryTokenset)?(this.options.authConfig.debug&&a("通过".concat(this._queryTokenset.__flag__?"authtoken":"token","参数登录系统")),this.tokenset=this._queryTokenset,this._dispatchEvent("tokensetChange",this._queryTokenset),this.getExtendData(),this.tokenset):null}const t=this._getCookie("idsrv.session");if(!t)return this.tokenset&&this._clearAuthData(),null;if(this.tokenset&&this.tokenset.__flag__===t){if(1e3*this.tokenset.expires_at<=Date.now()){let e="refreshToken";try{this._pendingRequests[e]||(this._pendingRequests[e]=d.call(this));const n=await this._pendingRequests[e];if(delete this._pendingRequests[e],!n)throw new Error("Empty refreshToken data");this.tokenset=p(p({},n),{},{__flag__:t}),this._saveToStorage("tokenset"),this._dispatchEvent("tokensetChange",this.tokenset)}catch(t){return delete this._pendingRequests[e],i("Get refreshToken failed:",t),null}}}else{let e="getToken";try{this._pendingRequests[e]||(this._pendingRequests[e]=h.call(this));const n=await this._pendingRequests[e];if(delete this._pendingRequests[e],!n)throw new Error("Empty token data");this.tokenset=p(p({},n),{},{__flag__:t}),this._saveToStorage("tokenset"),this._dispatchEvent("tokensetChange",this.tokenset),this._startCookieWatcher()}catch(t){return delete this._pendingRequests[e],i("Get token failed:",t),null}}return this.getUserInfo(),this.getExtendData(),this.tokenset}async getUserInfo(t,e){const n=e||this.tokenset;if(!n)return null;if(!this.options.loadUserInfo&&!e)return null;const o=this._getCookie("idsrv.session");if(!t&&this.userInfo&&this.userInfo.__expires_at__>Date.now()&&this.userInfo.__flag__===o)return this.userInfo;const r="getUserInfo";try{this._pendingRequests[r]||(this._pendingRequests[r]=l.call(this,n,this.options.userInfoType));const t=await this._pendingRequests[r];if(delete this._pendingRequests[r],!t)throw new Error("Empty userInfo data");const e=p(p({},t),{},{__flag__:o,__expires_at__:Date.now()+this._userInfoExpires});return this.options.loadUserInfo&&(this.userInfo=e,this._saveToStorage("userInfo"),this._dispatchEvent("userInfoChange",this.userInfo)),e}catch(t){return delete this._pendingRequests[r],i("Get userInfo failed:",t),null}}async getExtendData(t){if("function"!=typeof this.options.extendDataHandler)return null;if(!this.tokenset)return null;const e=this._getCookie("idsrv.session");if(!t&&this.extendData&&this.extendData.__expires_at__>Date.now()&&this.extendData.__flag__===e)return this.extendData;const n="getExtendData";try{this._pendingRequests[n]||(this._pendingRequests[n]=this.options.extendDataHandler.call(this,this.tokenset,this));const t=await this._pendingRequests[n];if(delete this._pendingRequests[n],!t)throw new Error("Empty extendData data");return this.extendData=p(p({},t),{},{__flag__:e,__expires_at__:Date.now()+this._extendDataExpires}),this._saveToStorage("extendData"),this._dispatchEvent("extendDataChange",this.extendData),this.extendData}catch(t){return delete this._pendingRequests[n],i("Get extendData failed:",t),null}}createVueRouterMiddleware(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/sso/login";return async(e,n,o)=>{var r,s;const i=await this.isAuth();null!=e&&null!==(r=e.meta)&&void 0!==r&&r.isPublic||null!==(s=this.options.excludeRouterReg)&&void 0!==s&&s.test(null==e?void 0:e.path)||i?o():o(t)}}destroy(){this._stopCookieWatcher(),this.emitter.all.clear(),this.tokenset=null,this.userInfo=null,this.extendData=null,this._pendingRequests={},this._boundHandleStorageEvent&&(window.removeEventListener("storage",this._boundHandleStorageEvent),this._boundHandleStorageEvent=null)}clear(t){this._clearAuthData(t)}}return g.prototype.mitt=n,g.prototype.axios=o,g.prototype.bjxAuthApi=r,g.prototype.getLoginCenterUrl=s,g.mitt=n,g.axios=o,g.bjxAuthApi=r,g.getLoginCenterUrl=s,dt=g}var _t=function(){if(gt)return pt;gt=1;const t=bt(),e=t.axios,n=document.currentScript;if(n){const o=n.hasAttribute("init"),r=n.getAttribute("init"),s=n.hasAttribute("expose"),i=n.getAttribute("expose"),a=n.hasAttribute("bind"),c=n.hasAttribute("debug");o&&e({url:r||"/api/get_bjx_auth_conf"}).then(e=>{let{data:n}=e;const o=(null==n?void 0:n.Data)||(null==n?void 0:n.data)||n;if(o&&Object.keys(o).length){const e=p(p({},o),{},{dispatchCustomEvent:!0});c&&(e.authConfig=p(p({},e.authConfig),{},{debug:!0}));const n=new t(e);n.init(),a&&(n.on("tokensetChange",t=>{t&&t.access_token?n._setCookie("bjx_auth_token",t.access_token,0):n._deleteCookie("bjx_auth_token")}),n.on("userInfoChange",t=>{t&&t.UId?n._setCookie("bjx_auth_uid",t.UId,0):n._deleteCookie("bjx_auth_uid")})),s&&(window[i||"bjx_auth_ins"]=n)}})}return pt=t}(),mt=h(_t);export{mt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bjx-auth",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/web.mjs",
6
6
  "exports": {