gant-core 0.2.30 → 0.2.31
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.
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
package/lib/core/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R}from"./request/index.js";export{r as request}from"./request/index.js";export{e as expireCache}from"./cache/index.js";
|
|
1
|
+
import{a as R}from"./request/index.js";export{r as request}from"./request/index.js";export{e as expireCache}from"./cache/index.js";import{g as S,u as U}from"./store/index.js";export{a as MENU_BREADCRUMBS_UPDATE,M as MENU_HISTORY_UPDATE,c as codeListStore,i as companydataStore,l as loginStore,m as menuStore,p as parameterStore,s as storageStore}from"./store/index.js";import{i as O}from"./i18n/index.js";export{t as tr}from"./i18n/index.js";export{P as PresetColors,T as TinyColor,A as bounds,b as compactAlgorithm,J as convertDecimalToHex,K as convertHexToDecimal,a as darkAlgorithm,d as defaultAlgorithm,f as formatAliasToken,u as fromRatio,g as getAliasToken,h as getAlphaColor,k as getBackgroundColor,i as getDarkenSolidColor,j as getLightenSolidColor,e as getTokenCssVar,D as hslToRgb,F as hsvToRgb,w as inputToRGB,o as isReadable,y as isValidCSSUnit,v as legacyRandom,l as lighten,c as meetingDerivative,p as mostReadable,n as names,M as numberInputToObject,L as parseIntFromHex,z as random,r as readability,G as rgbToHex,C as rgbToHsl,E as rgbToHsv,B as rgbToRgb,I as rgbaToArgbHex,H as rgbaToHex,s as seed,x as stringInputToObject,m as tinycolor,q as toMsFilter,t as token}from"./theme/index.js";export{g as getTraceId}from"./microservices/index.js";import{g as $}from"./utils/index.js";export{a as getAntdLocaleKey,b as getRoutes,s as setLocaleKey}from"./utils/index.js";import{uniqueId as _}from"lodash-es";export*from"axios";import"mitt";const N="X-G-TRACE-ID",V=e=>s=>{const{url:a="",serviceId:r}=s,o={};Object.keys(e).forEach((s=>{e[s].forEach((e=>{o[e]=s}))})),Object.keys(e).forEach((e=>{}));let t=`${a}.api`;const[,i]=t.split("/");return t=r?`/${r}${t}`:o[i]?`/${o[i]}${t}`:t,delete s.serviceId,s.url=t,s},X=e=>s=>{const a=_(N);return s.headers={...s.headers,[N]:a,needHtmlEscape:"false",userLanguage:e,...U.userIdentity},s};var Y=async({microServiceMap:e,dynamicLangCallback:s,...a})=>{R.interceptors.request.use(V(e)),await S.findPlantform();const r=$();R.interceptors.request.use(X(r)),await O(r),await(s?.());return await S.init(a)};export{$ as getLocaleKey,S as globalStore,Y as init,O as initDynamicLang,R as requestInstance,X as useRequestHeader,V as useRequestMicroSevices,U as userStore};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/main.ts"],"sourcesContent":["import { requestInstance, InternalAxiosRequestConfig, userStore, globalStore, initDynamicLang } from './core';\nimport type { GlobalOptions } from './core/store/type';\nimport { getLocaleKey } from './core/utils';\nimport { uniqueId, get, isEmpty } from 'lodash-es';\n\nconst TraceIdKey = 'X-G-TRACE-ID';\n\nexport const useRequestMicroSevices = (microServiceMap?: any) => {\n return (config: InternalAxiosRequestConfig) => {\n const { url = '', serviceId } = config;\n const serviceIdMap: any = {};\n Object.keys(microServiceMap).forEach(key => {\n microServiceMap[key as keyof typeof microServiceMap].forEach((module: any) => {\n serviceIdMap[module] = key;\n });\n });\n\n const urlMap: any = {};\n Object.keys(microServiceMap).forEach(key => {\n urlMap[key] = key;\n });\n const suffix = '.api';\n //传入拼接的url\n let newUrl = suffix ? `${url}${suffix}` : url;\n const [, urlPrefix] = newUrl.split('/');\n newUrl = serviceId\n ? `/${serviceId}${newUrl}`\n : serviceIdMap[urlPrefix]\n ? `/${serviceIdMap[urlPrefix]}${newUrl}`\n : newUrl;\n\n delete config.serviceId;\n config.url = newUrl;\n return config;\n };\n};\nexport const useRequestHeader = (userLanguage: string) => (config: InternalAxiosRequestConfig) => {\n const TRACE_ID = uniqueId(TraceIdKey);\n config.headers = {\n ...config.headers,\n [TraceIdKey]: TRACE_ID,\n needHtmlEscape: 'false',\n userLanguage,\n ...userStore.userIdentity,\n } as any;\n return config;\n};\nexport interface MainOptions extends GlobalOptions {\n microServiceMap?: any;\n locale?: string;\n dynamicLangCallback?: () => void;\n}\n\nexport default async ({ microServiceMap, dynamicLangCallback, ...globalOptions }: MainOptions) => {\n requestInstance.interceptors.request.use(useRequestMicroSevices(microServiceMap));\n await globalStore.findPlantform();\n const locale = getLocaleKey();\n requestInstance.interceptors.request.use(useRequestHeader(locale));\n await initDynamicLang(locale);\n await dynamicLangCallback?.();\n const res = await globalStore.init(globalOptions);\n return res;\n};\n"],"names":["TraceIdKey","useRequestMicroSevices","microServiceMap","config","url","serviceId","serviceIdMap","Object","keys","forEach","key","module","newUrl","urlPrefix","split","useRequestHeader","userLanguage","TRACE_ID","uniqueId","headers","needHtmlEscape","userStore","userIdentity","main","async","dynamicLangCallback","globalOptions","requestInstance","interceptors","request","use","globalStore","findPlantform","locale","getLocaleKey","initDynamicLang","init"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/main.ts"],"sourcesContent":["import { requestInstance, InternalAxiosRequestConfig, userStore, globalStore, initDynamicLang } from './core';\nimport type { GlobalOptions } from './core/store/type';\nimport { getLocaleKey } from './core/utils';\nimport { uniqueId, get, isEmpty } from 'lodash-es';\n\nconst TraceIdKey = 'X-G-TRACE-ID';\n\nexport const useRequestMicroSevices = (microServiceMap?: any) => {\n return (config: InternalAxiosRequestConfig) => {\n const { url = '', serviceId } = config;\n const serviceIdMap: any = {};\n Object.keys(microServiceMap).forEach(key => {\n microServiceMap[key as keyof typeof microServiceMap].forEach((module: any) => {\n serviceIdMap[module] = key;\n });\n });\n\n const urlMap: any = {};\n Object.keys(microServiceMap).forEach(key => {\n urlMap[key] = key;\n });\n const suffix = '.api';\n //传入拼接的url\n let newUrl = suffix ? `${url}${suffix}` : url;\n const [, urlPrefix] = newUrl.split('/');\n newUrl = serviceId\n ? `/${serviceId}${newUrl}`\n : serviceIdMap[urlPrefix]\n ? `/${serviceIdMap[urlPrefix]}${newUrl}`\n : newUrl;\n\n delete config.serviceId;\n config.url = newUrl;\n return config;\n };\n};\nexport const useRequestHeader = (userLanguage: string) => (config: InternalAxiosRequestConfig) => {\n const TRACE_ID = uniqueId(TraceIdKey);\n config.headers = {\n ...config.headers,\n [TraceIdKey]: TRACE_ID,\n needHtmlEscape: 'false',\n userLanguage,\n ...userStore.userIdentity,\n } as any;\n return config;\n};\nexport interface MainOptions extends GlobalOptions {\n microServiceMap?: any;\n locale?: string;\n dynamicLangCallback?: () => void;\n}\n\nexport default async ({ microServiceMap, dynamicLangCallback, ...globalOptions }: MainOptions) => {\n requestInstance.interceptors.request.use(useRequestMicroSevices(microServiceMap));\n await globalStore.findPlantform();\n const locale = getLocaleKey();\n requestInstance.interceptors.request.use(useRequestHeader(locale));\n await initDynamicLang(locale);\n await dynamicLangCallback?.();\n const res = await globalStore.init(globalOptions);\n return res;\n};\n"],"names":["TraceIdKey","useRequestMicroSevices","microServiceMap","config","url","serviceId","serviceIdMap","Object","keys","forEach","key","module","newUrl","urlPrefix","split","useRequestHeader","userLanguage","TRACE_ID","uniqueId","headers","needHtmlEscape","userStore","userIdentity","main","async","dynamicLangCallback","globalOptions","requestInstance","interceptors","request","use","globalStore","findPlantform","locale","getLocaleKey","initDynamicLang","init"],"mappings":"06CAKA,MAAMA,EAAa,eAENC,EAA0BC,GAC7BC,IACN,MAAMC,IAAEA,EAAM,GAAEC,UAAEA,GAAcF,EAC1BG,EAAoB,CAAA,EAC1BC,OAAOC,KAAKN,GAAiBO,SAAQC,IACnCR,EAAgBQ,GAAqCD,SAASE,IAC5DL,EAAaK,GAAUD,CAAG,GAC1B,IAIJH,OAAOC,KAAKN,GAAiBO,SAAQC,QAKrC,IAAIE,EAAkB,GAAGR,QACzB,MAAS,CAAAS,GAAaD,EAAOE,MAAM,KASnC,OARAF,EAASP,EACL,IAAIA,IAAYO,IAChBN,EAAaO,GACX,IAAIP,EAAaO,KAAaD,IAC9BA,SAECT,EAAOE,UACdF,EAAOC,IAAMQ,EACNT,CAAM,EAGJY,EAAoBC,GAA0Bb,IACzD,MAAMc,EAAWC,EAASlB,GAQ1B,OAPAG,EAAOgB,QAAU,IACZhB,EAAOgB,QACVnB,CAACA,GAAaiB,EACdG,eAAgB,QAChBJ,kBACGK,EAAUC,cAERnB,CAAM,EAQf,IAAeoB,EAAAC,OAAStB,kBAAiBuB,yBAAwBC,MAC/DC,EAAgBC,aAAaC,QAAQC,IAAI7B,EAAuBC,UAC1D6B,EAAYC,gBAClB,MAAMC,EAASC,IACfP,EAAgBC,aAAaC,QAAQC,IAAIf,EAAiBkB,UACpDE,EAAgBF,SAChBR,OAEN,aADkBM,EAAYK,KAAKV,EACzB"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import * as axios from 'axios';
|
|
|
5
5
|
import { AxiosRequestConfig, AxiosRequestHeaders, AxiosInterceptorManager, AxiosResponse } from 'axios';
|
|
6
6
|
export * from 'axios';
|
|
7
7
|
import { Emitter } from 'mitt';
|
|
8
|
-
export { Emitter, default as mitt } from 'mitt';
|
|
9
8
|
import * as i18next from 'i18next';
|
|
10
9
|
import { InitOptions, Callback } from 'i18next';
|
|
11
10
|
export * from '@ctrl/tinycolor';
|