@smart100/spu-web-plugin 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +28 -25
- package/dist/spu-web-plugin.mjs +24564 -24737
- package/package.json +6 -4
- package/src/apaasSpuTrack.ts +5 -4
- package/src/axios.ts +9 -12
- package/src/cloudServ.ts +0 -58
- package/src/components/expandexp/index.ts +41 -34
- package/src/components/expandexp/template.ts +7 -0
- package/src/core.js +7 -230
- package/src/index.ts +118 -10
- package/src/login.ts +243 -63
- package/src/oss/downloadService.ts +7 -7
- package/src/oss/servtoken.ts +2 -2
- package/src/oss/uploadService.ts +7 -6
- package/src/package/ali-oss/aliyun-oss-sdk.js +25121 -25121
- package/src/package/ali-oss/aliyun-oss-sdk.min.js +14 -14
- package/src/package/ali-oss/package.json +162 -162
- package/src/spuConfig.ts +2 -2
- package/src/storageProxy.ts +2 -4
- package/src/test.ts +4 -2
- package/src/types/global.d.ts +0 -7
- package/src/types/index.d.ts +95 -0
- package/src/types/shims-lib.d.ts +1 -0
- package/src/utils.ts +2 -20
- package/src/install.ts +0 -79
- package/src/tenantInfo.ts +0 -74
package/src/tenantInfo.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { apaasAxios } from './axios'
|
|
2
|
-
import cloudServ from './cloudServ'
|
|
3
|
-
import { lsProxy } from './storageProxy'
|
|
4
|
-
|
|
5
|
-
class TenantInfo {
|
|
6
|
-
async get (tenantCode?: string) {
|
|
7
|
-
try {
|
|
8
|
-
const tenants: null | ITenantInfo[] = await apaasAxios.get('/api/auth/tenantlist', {}).then((res: any) => {
|
|
9
|
-
// debugger
|
|
10
|
-
return res?.data?.tenants
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
// debugger
|
|
14
|
-
|
|
15
|
-
if (tenants && tenants.length) {
|
|
16
|
-
if (!tenantCode) {
|
|
17
|
-
return tenants[0]
|
|
18
|
-
} else {
|
|
19
|
-
const res =
|
|
20
|
-
tenants.find((item) => {
|
|
21
|
-
return item.code === tenantCode
|
|
22
|
-
}) || null
|
|
23
|
-
return res
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
} catch (e) {
|
|
29
|
-
throw new Error((e as any).errorMsg)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
format (tenant: ITenantInfo) {
|
|
34
|
-
if (!tenant) {
|
|
35
|
-
return null
|
|
36
|
-
}
|
|
37
|
-
const cloundTagMap = ['storage', 'storage-1d', 'storage-1y', 'storage-3m']
|
|
38
|
-
const result: NormalizedCloudServ = {}
|
|
39
|
-
for (const keyItem of cloundTagMap) {
|
|
40
|
-
const cloudServ = tenant.cloudserv[keyItem as StorageEnum]
|
|
41
|
-
if (cloudServ) {
|
|
42
|
-
result[keyItem as StorageEnum] = {
|
|
43
|
-
cloudserv_storage_provider: cloudServ.provider,
|
|
44
|
-
cloudserv_storage_storagebucket: cloudServ.storagebucket,
|
|
45
|
-
cloudserv_storage_storageendpoint: cloudServ.storageendpoint,
|
|
46
|
-
cloudserv_storage_storageurl: cloudServ.storageurl,
|
|
47
|
-
cloudserv_storage_accesskeyid: cloudServ.accesskeyid,
|
|
48
|
-
cloudserv_storage_region: cloudServ.region
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (Object.keys(result).length === 0) {
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
55
|
-
return result
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async getAndSave (tenantCode?: string) {
|
|
59
|
-
const tenant: ITenantInfo | null = await this.get(tenantCode)
|
|
60
|
-
if (!tenant) {
|
|
61
|
-
lsProxy.removeItem('tenant')
|
|
62
|
-
cloudServ.remove()
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
lsProxy.setItem('tenant', JSON.stringify(tenant))
|
|
67
|
-
const normalizedTenant = this.format(tenant)
|
|
68
|
-
if (normalizedTenant) {
|
|
69
|
-
cloudServ.set(normalizedTenant)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default new TenantInfo()
|