@yeepay/auth-wujie 0.1.0-alpha.0
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/README.md +21 -0
- package/dist/index.d.mts +66 -0
- package/dist/index.mjs +162 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @yeepay/auth-wujie
|
|
2
|
+
|
|
3
|
+
封装 Wujie 主子应用认证通信。业务代码只使用 Host/Child Runtime 与 AuthBridge,不直接操作 `$wujie`。
|
|
4
|
+
|
|
5
|
+
## 安装与示例
|
|
6
|
+
|
|
7
|
+
`pnpm add @yeepay/auth-core @yeepay/auth-wujie @yeepay/request wujie`
|
|
8
|
+
|
|
9
|
+
主应用用 `createHostAuthRuntime` 连接 AuthClient 与 `createWujieBridge(bus)`;子应用用 `createChildAuthRuntime`,再把 `createChildRequestOptions(runtime)` 传给 request,实现 Token 和会话失效自动衔接。
|
|
10
|
+
|
|
11
|
+
## 协议配置
|
|
12
|
+
|
|
13
|
+
协议通过版本和能力集合协商,当前 v3 兼容 v2、v1。新增字段必须可选并有默认行为,旧版本可以忽略未知事件;不兼容变化必须升级主版本。
|
|
14
|
+
|
|
15
|
+
主应用唯一持有 Token 与权限服务。子应用接口会话失效时上报主应用;主应用单飞清理状态、广播退出并跳转统一登录页,同时通过 `callback` 参数携带当前地址。首期不提供 Refresh Token 或请求重放。
|
|
16
|
+
|
|
17
|
+
## 迁移
|
|
18
|
+
|
|
19
|
+
升级前先在兼容 fixture 验证目标协议;移除或改名事件时按主版本迁移,并保持 Host 至少兼容前两个主版本。
|
|
20
|
+
|
|
21
|
+
[公司飞书规范](https://yeepay.feishu.cn/docx/S67Wd9mdVokULGxIRmFcQiK8nKg)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AuthClient, AuthSnapshot } from "@yeepay/auth-core";
|
|
2
|
+
import { HttpClientOptions } from "@yeepay/request";
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
type ProtocolVersion = 1 | 2 | 3;
|
|
5
|
+
declare const CURRENT_PROTOCOL_VERSION: ProtocolVersion;
|
|
6
|
+
declare const SUPPORTED_PROTOCOL_VERSIONS: readonly [1, 2, 3];
|
|
7
|
+
declare const AUTH_CAPABILITIES: readonly ["auth-context", "session-expired", "logout", "capability-negotiation"];
|
|
8
|
+
type AuthCapability = typeof AUTH_CAPABILITIES[number];
|
|
9
|
+
type AuthEventType = 'auth:context' | 'auth:expired' | 'auth:hello' | 'auth:logout' | 'auth:logout-request';
|
|
10
|
+
interface AuthEnvelope<TPayload = unknown> {
|
|
11
|
+
protocolVersion: ProtocolVersion;
|
|
12
|
+
type: AuthEventType;
|
|
13
|
+
payload: TPayload;
|
|
14
|
+
}
|
|
15
|
+
interface AuthBridge {
|
|
16
|
+
send(message: AuthEnvelope): Promise<void> | void;
|
|
17
|
+
subscribe(listener: (message: AuthEnvelope) => void): () => void;
|
|
18
|
+
}
|
|
19
|
+
interface WujieEventBusLike {
|
|
20
|
+
$emit(event: string, message: AuthEnvelope): unknown;
|
|
21
|
+
$on(event: string, listener: (message: AuthEnvelope) => void): unknown;
|
|
22
|
+
$off(event: string, listener: (message: AuthEnvelope) => void): unknown;
|
|
23
|
+
}
|
|
24
|
+
/** 将 Wujie EventBus 隔离在公共包内,业务代码无需直接操作 `$wujie`。 */
|
|
25
|
+
declare function createWujieBridge(bus: WujieEventBusLike, channel?: string): AuthBridge;
|
|
26
|
+
interface AuthContext {
|
|
27
|
+
capabilities: AuthCapability[];
|
|
28
|
+
snapshot: AuthSnapshot;
|
|
29
|
+
token: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
interface HostAuthRuntimeOptions {
|
|
32
|
+
auth: AuthClient;
|
|
33
|
+
bridge: AuthBridge;
|
|
34
|
+
currentUrl?: () => string;
|
|
35
|
+
getToken: () => Promise<string | undefined> | string | undefined;
|
|
36
|
+
loginUrl: string;
|
|
37
|
+
navigate?: (url: string) => void;
|
|
38
|
+
supportedVersions?: readonly ProtocolVersion[];
|
|
39
|
+
}
|
|
40
|
+
interface HostAuthRuntime {
|
|
41
|
+
mode: 'host';
|
|
42
|
+
start(): () => void;
|
|
43
|
+
broadcastContext(version?: ProtocolVersion, capabilities?: readonly AuthCapability[]): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
declare function createHostAuthRuntime(options: HostAuthRuntimeOptions): HostAuthRuntime;
|
|
46
|
+
interface ChildAuthRuntimeOptions {
|
|
47
|
+
bridge: AuthBridge;
|
|
48
|
+
supportedVersions?: readonly ProtocolVersion[];
|
|
49
|
+
}
|
|
50
|
+
interface ChildAuthRuntime {
|
|
51
|
+
mode: 'wujie-child';
|
|
52
|
+
start(): Promise<void>;
|
|
53
|
+
stop(): void;
|
|
54
|
+
getContext(): AuthContext | undefined;
|
|
55
|
+
protocolVersion(): ProtocolVersion | undefined;
|
|
56
|
+
tokenProvider(): Promise<string | undefined>;
|
|
57
|
+
reportSessionExpired(): Promise<void>;
|
|
58
|
+
logout(): Promise<void>;
|
|
59
|
+
subscribe(listener: (context: AuthContext | undefined) => void): () => void;
|
|
60
|
+
}
|
|
61
|
+
declare function createChildAuthRuntime(options: ChildAuthRuntimeOptions): ChildAuthRuntime;
|
|
62
|
+
/** 将子应用 Runtime 直接接到 request,会话失效无需业务重复编排。 */
|
|
63
|
+
declare function createChildRequestOptions(runtime: ChildAuthRuntime): Pick<HttpClientOptions, 'onSessionExpired' | 'tokenProvider'>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { AUTH_CAPABILITIES, AuthBridge, AuthCapability, AuthContext, AuthEnvelope, AuthEventType, CURRENT_PROTOCOL_VERSION, ChildAuthRuntime, ChildAuthRuntimeOptions, HostAuthRuntime, HostAuthRuntimeOptions, ProtocolVersion, SUPPORTED_PROTOCOL_VERSIONS, WujieEventBusLike, createChildAuthRuntime, createChildRequestOptions, createHostAuthRuntime, createWujieBridge };
|
|
66
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const CURRENT_PROTOCOL_VERSION = 3;
|
|
3
|
+
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
4
|
+
1,
|
|
5
|
+
2,
|
|
6
|
+
3
|
|
7
|
+
];
|
|
8
|
+
const AUTH_CAPABILITIES = [
|
|
9
|
+
"auth-context",
|
|
10
|
+
"session-expired",
|
|
11
|
+
"logout",
|
|
12
|
+
"capability-negotiation"
|
|
13
|
+
];
|
|
14
|
+
/** 将 Wujie EventBus 隔离在公共包内,业务代码无需直接操作 `$wujie`。 */
|
|
15
|
+
function createWujieBridge(bus, channel = "yeepay:auth") {
|
|
16
|
+
return {
|
|
17
|
+
send(message) {
|
|
18
|
+
bus.$emit(channel, message);
|
|
19
|
+
},
|
|
20
|
+
subscribe(listener) {
|
|
21
|
+
bus.$on(channel, listener);
|
|
22
|
+
return () => {
|
|
23
|
+
bus.$off(channel, listener);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function highestSharedVersion(left, right) {
|
|
29
|
+
return [...left].sort((a, b) => b - a).find((version) => right.includes(version));
|
|
30
|
+
}
|
|
31
|
+
function latestVersion(versions) {
|
|
32
|
+
return [...versions].sort((a, b) => b - a)[0] ?? 3;
|
|
33
|
+
}
|
|
34
|
+
function createHostAuthRuntime(options) {
|
|
35
|
+
const supportedVersions = options.supportedVersions ?? SUPPORTED_PROTOCOL_VERSIONS;
|
|
36
|
+
let expiration;
|
|
37
|
+
async function context(version = 3, requestedCapabilities = AUTH_CAPABILITIES) {
|
|
38
|
+
return {
|
|
39
|
+
protocolVersion: version,
|
|
40
|
+
type: "auth:context",
|
|
41
|
+
payload: {
|
|
42
|
+
capabilities: AUTH_CAPABILITIES.filter((capability) => requestedCapabilities.includes(capability)),
|
|
43
|
+
snapshot: options.auth.getSnapshot(),
|
|
44
|
+
token: await options.getToken()
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function broadcastContext(version, capabilities) {
|
|
49
|
+
await options.bridge.send(await context(version, capabilities));
|
|
50
|
+
}
|
|
51
|
+
async function expire() {
|
|
52
|
+
if (expiration) return expiration;
|
|
53
|
+
expiration = Promise.resolve().then(async () => {
|
|
54
|
+
options.auth.clear();
|
|
55
|
+
await options.bridge.send({
|
|
56
|
+
protocolVersion: 3,
|
|
57
|
+
type: "auth:logout",
|
|
58
|
+
payload: {}
|
|
59
|
+
});
|
|
60
|
+
const callback = encodeURIComponent(options.currentUrl?.() ?? (typeof location === "undefined" ? "/" : location.href));
|
|
61
|
+
const target = `${options.loginUrl}${options.loginUrl.includes("?") ? "&" : "?"}callback=${callback}`;
|
|
62
|
+
if (options.navigate) options.navigate(target);
|
|
63
|
+
else if (typeof location !== "undefined") location.assign(target);
|
|
64
|
+
}).finally(() => {
|
|
65
|
+
setTimeout(() => expiration = void 0, 0);
|
|
66
|
+
});
|
|
67
|
+
return expiration;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
mode: "host",
|
|
71
|
+
start() {
|
|
72
|
+
return options.bridge.subscribe((message) => {
|
|
73
|
+
if (message.type === "auth:hello") {
|
|
74
|
+
const hello = message.payload;
|
|
75
|
+
const version = highestSharedVersion(supportedVersions, hello.supportedVersions);
|
|
76
|
+
if (version !== void 0) broadcastContext(version, hello.capabilities);
|
|
77
|
+
} else if (message.type === "auth:expired") expire();
|
|
78
|
+
else if (message.type === "auth:logout-request") options.auth.logout().finally(() => options.bridge.send({
|
|
79
|
+
protocolVersion: message.protocolVersion,
|
|
80
|
+
type: "auth:logout",
|
|
81
|
+
payload: {}
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
broadcastContext
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function createChildAuthRuntime(options) {
|
|
89
|
+
const supportedVersions = options.supportedVersions ?? SUPPORTED_PROTOCOL_VERSIONS;
|
|
90
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
91
|
+
let authContext;
|
|
92
|
+
let selectedVersion;
|
|
93
|
+
let unsubscribe;
|
|
94
|
+
let pendingStart;
|
|
95
|
+
function publish(value) {
|
|
96
|
+
authContext = value;
|
|
97
|
+
for (const listener of listeners) listener(value);
|
|
98
|
+
}
|
|
99
|
+
function ensureSubscription() {
|
|
100
|
+
if (unsubscribe) return;
|
|
101
|
+
unsubscribe = options.bridge.subscribe((message) => {
|
|
102
|
+
if (message.type === "auth:context" && supportedVersions.includes(message.protocolVersion)) {
|
|
103
|
+
selectedVersion = message.protocolVersion;
|
|
104
|
+
publish(message.payload);
|
|
105
|
+
pendingStart?.();
|
|
106
|
+
pendingStart = void 0;
|
|
107
|
+
} else if (message.type === "auth:logout") publish(void 0);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
mode: "wujie-child",
|
|
112
|
+
async start() {
|
|
113
|
+
ensureSubscription();
|
|
114
|
+
const ready = new Promise((resolve) => pendingStart = resolve);
|
|
115
|
+
await options.bridge.send({
|
|
116
|
+
protocolVersion: latestVersion(supportedVersions),
|
|
117
|
+
type: "auth:hello",
|
|
118
|
+
payload: {
|
|
119
|
+
capabilities: [...AUTH_CAPABILITIES],
|
|
120
|
+
supportedVersions: [...supportedVersions]
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
await ready;
|
|
124
|
+
},
|
|
125
|
+
stop() {
|
|
126
|
+
unsubscribe?.();
|
|
127
|
+
unsubscribe = void 0;
|
|
128
|
+
},
|
|
129
|
+
getContext: () => authContext,
|
|
130
|
+
protocolVersion: () => selectedVersion,
|
|
131
|
+
tokenProvider: async () => authContext?.token,
|
|
132
|
+
async reportSessionExpired() {
|
|
133
|
+
await options.bridge.send({
|
|
134
|
+
protocolVersion: selectedVersion ?? latestVersion(supportedVersions),
|
|
135
|
+
type: "auth:expired",
|
|
136
|
+
payload: {}
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
async logout() {
|
|
140
|
+
await options.bridge.send({
|
|
141
|
+
protocolVersion: selectedVersion ?? latestVersion(supportedVersions),
|
|
142
|
+
type: "auth:logout-request",
|
|
143
|
+
payload: {}
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
subscribe(listener) {
|
|
147
|
+
listeners.add(listener);
|
|
148
|
+
return () => listeners.delete(listener);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** 将子应用 Runtime 直接接到 request,会话失效无需业务重复编排。 */
|
|
153
|
+
function createChildRequestOptions(runtime) {
|
|
154
|
+
return {
|
|
155
|
+
onSessionExpired: () => runtime.reportSessionExpired(),
|
|
156
|
+
tokenProvider: () => runtime.tokenProvider()
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { AUTH_CAPABILITIES, CURRENT_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, createChildAuthRuntime, createChildRequestOptions, createHostAuthRuntime, createWujieBridge };
|
|
161
|
+
|
|
162
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { AuthClient, AuthSnapshot } from '@yeepay/auth-core'\nimport type { HttpClientOptions } from '@yeepay/request'\n\nexport type ProtocolVersion = 1 | 2 | 3\nexport const CURRENT_PROTOCOL_VERSION: ProtocolVersion = 3\nexport const SUPPORTED_PROTOCOL_VERSIONS = [1, 2, 3] as const\nexport const AUTH_CAPABILITIES = ['auth-context', 'session-expired', 'logout', 'capability-negotiation'] as const\n\nexport type AuthCapability = typeof AUTH_CAPABILITIES[number]\nexport type AuthEventType = 'auth:context' | 'auth:expired' | 'auth:hello' | 'auth:logout' | 'auth:logout-request'\n\nexport interface AuthEnvelope<TPayload = unknown> {\n protocolVersion: ProtocolVersion\n type: AuthEventType\n payload: TPayload\n}\n\nexport interface AuthBridge {\n send(message: AuthEnvelope): Promise<void> | void\n subscribe(listener: (message: AuthEnvelope) => void): () => void\n}\n\nexport interface WujieEventBusLike {\n $emit(event: string, message: AuthEnvelope): unknown\n $on(event: string, listener: (message: AuthEnvelope) => void): unknown\n $off(event: string, listener: (message: AuthEnvelope) => void): unknown\n}\n\n/** 将 Wujie EventBus 隔离在公共包内,业务代码无需直接操作 `$wujie`。 */\nexport function createWujieBridge(bus: WujieEventBusLike, channel = 'yeepay:auth'): AuthBridge {\n return {\n send(message) {\n bus.$emit(channel, message)\n },\n subscribe(listener) {\n bus.$on(channel, listener)\n return () => { bus.$off(channel, listener) }\n },\n }\n}\n\nexport interface AuthContext {\n capabilities: AuthCapability[]\n snapshot: AuthSnapshot\n token: string | undefined\n}\n\ninterface HelloPayload {\n supportedVersions: ProtocolVersion[]\n capabilities: AuthCapability[]\n}\n\nexport interface HostAuthRuntimeOptions {\n auth: AuthClient\n bridge: AuthBridge\n currentUrl?: () => string\n getToken: () => Promise<string | undefined> | string | undefined\n loginUrl: string\n navigate?: (url: string) => void\n supportedVersions?: readonly ProtocolVersion[]\n}\n\nexport interface HostAuthRuntime {\n mode: 'host'\n start(): () => void\n broadcastContext(version?: ProtocolVersion, capabilities?: readonly AuthCapability[]): Promise<void>\n}\n\nfunction highestSharedVersion(left: readonly ProtocolVersion[], right: readonly ProtocolVersion[]): ProtocolVersion | undefined {\n return [...left].sort((a, b) => b - a).find(version => right.includes(version))\n}\n\nfunction latestVersion(versions: readonly ProtocolVersion[]): ProtocolVersion {\n return [...versions].sort((a, b) => b - a)[0] ?? CURRENT_PROTOCOL_VERSION\n}\n\nexport function createHostAuthRuntime(options: HostAuthRuntimeOptions): HostAuthRuntime {\n const supportedVersions = options.supportedVersions ?? SUPPORTED_PROTOCOL_VERSIONS\n let expiration: Promise<void> | undefined\n\n async function context(version = CURRENT_PROTOCOL_VERSION, requestedCapabilities: readonly AuthCapability[] = AUTH_CAPABILITIES): Promise<AuthEnvelope<AuthContext>> {\n return {\n protocolVersion: version,\n type: 'auth:context',\n payload: {\n capabilities: AUTH_CAPABILITIES.filter(capability => requestedCapabilities.includes(capability)),\n snapshot: options.auth.getSnapshot(),\n token: await options.getToken(),\n },\n }\n }\n\n async function broadcastContext(version?: ProtocolVersion, capabilities?: readonly AuthCapability[]): Promise<void> {\n await options.bridge.send(await context(version, capabilities))\n }\n\n async function expire(): Promise<void> {\n if (expiration)\n return expiration\n expiration = Promise.resolve().then(async () => {\n options.auth.clear()\n await options.bridge.send({ protocolVersion: CURRENT_PROTOCOL_VERSION, type: 'auth:logout', payload: {} })\n const callback = encodeURIComponent(options.currentUrl?.() ?? (typeof location === 'undefined' ? '/' : location.href))\n const target = `${options.loginUrl}${options.loginUrl.includes('?') ? '&' : '?'}callback=${callback}`\n if (options.navigate)\n options.navigate(target)\n else if (typeof location !== 'undefined')\n location.assign(target)\n }).finally(() => {\n setTimeout(() => expiration = undefined, 0)\n })\n return expiration\n }\n\n return {\n mode: 'host',\n start() {\n return options.bridge.subscribe((message) => {\n if (message.type === 'auth:hello') {\n const hello = message.payload as HelloPayload\n const version = highestSharedVersion(supportedVersions, hello.supportedVersions)\n if (version !== undefined)\n void broadcastContext(version, hello.capabilities)\n }\n else if (message.type === 'auth:expired') {\n void expire()\n }\n else if (message.type === 'auth:logout-request') {\n void options.auth.logout().finally(() => options.bridge.send({ protocolVersion: message.protocolVersion, type: 'auth:logout', payload: {} }))\n }\n })\n },\n broadcastContext,\n }\n}\n\nexport interface ChildAuthRuntimeOptions {\n bridge: AuthBridge\n supportedVersions?: readonly ProtocolVersion[]\n}\n\nexport interface ChildAuthRuntime {\n mode: 'wujie-child'\n start(): Promise<void>\n stop(): void\n getContext(): AuthContext | undefined\n protocolVersion(): ProtocolVersion | undefined\n tokenProvider(): Promise<string | undefined>\n reportSessionExpired(): Promise<void>\n logout(): Promise<void>\n subscribe(listener: (context: AuthContext | undefined) => void): () => void\n}\n\nexport function createChildAuthRuntime(options: ChildAuthRuntimeOptions): ChildAuthRuntime {\n const supportedVersions = options.supportedVersions ?? SUPPORTED_PROTOCOL_VERSIONS\n const listeners = new Set<(context: AuthContext | undefined) => void>()\n let authContext: AuthContext | undefined\n let selectedVersion: ProtocolVersion | undefined\n let unsubscribe: (() => void) | undefined\n let pendingStart: ((value: void) => void) | undefined\n\n function publish(value: AuthContext | undefined): void {\n authContext = value\n for (const listener of listeners)\n listener(value)\n }\n\n function ensureSubscription(): void {\n if (unsubscribe)\n return\n unsubscribe = options.bridge.subscribe((message) => {\n if (message.type === 'auth:context' && supportedVersions.includes(message.protocolVersion)) {\n selectedVersion = message.protocolVersion\n publish(message.payload as AuthContext)\n pendingStart?.()\n pendingStart = undefined\n }\n else if (message.type === 'auth:logout') {\n publish(undefined)\n }\n })\n }\n\n return {\n mode: 'wujie-child',\n async start() {\n ensureSubscription()\n const ready = new Promise<void>(resolve => pendingStart = resolve)\n await options.bridge.send({\n protocolVersion: latestVersion(supportedVersions),\n type: 'auth:hello',\n payload: { capabilities: [...AUTH_CAPABILITIES], supportedVersions: [...supportedVersions] } satisfies HelloPayload,\n })\n await ready\n },\n stop() { unsubscribe?.(); unsubscribe = undefined },\n getContext: () => authContext,\n protocolVersion: () => selectedVersion,\n tokenProvider: async () => authContext?.token,\n async reportSessionExpired() {\n await options.bridge.send({ protocolVersion: selectedVersion ?? latestVersion(supportedVersions), type: 'auth:expired', payload: {} })\n },\n async logout() {\n await options.bridge.send({ protocolVersion: selectedVersion ?? latestVersion(supportedVersions), type: 'auth:logout-request', payload: {} })\n },\n subscribe(listener) { listeners.add(listener); return () => listeners.delete(listener) },\n }\n}\n\n/** 将子应用 Runtime 直接接到 request,会话失效无需业务重复编排。 */\nexport function createChildRequestOptions(runtime: ChildAuthRuntime): Pick<HttpClientOptions, 'onSessionExpired' | 'tokenProvider'> {\n return {\n onSessionExpired: () => runtime.reportSessionExpired(),\n tokenProvider: () => runtime.tok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
"README.md"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsdown src/index.ts --format esm --dts --sourcemap",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"typecheck": "tsc --noEmit"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@yeepay/auth-core": "^0.1.0-alpha.0",
|
|
22
|
+
"@yeepay/request": "^0.1.0-alpha.0",
|
|
23
|
+
"wujie": "2.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@yeepay/auth-core": "workspace:*",
|
|
27
|
+
"@yeepay/request": "workspace:*",
|
|
28
|
+
"wujie": "catalog:"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
}
|
|
33
|
+
}
|