@chaoyue-erp/ysy-openapi-mcp 1.0.0 → 1.0.1

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 CHANGED
@@ -14,7 +14,7 @@ WorkBuddy(用户本机)
14
14
  │ stdio 本地进程,不经过 WorkBuddy 云端
15
15
  ▼
16
16
  MCP Server(本包,npx 启动)
17
- │ OAuth2 client_credentials 取 Token(按模块缓存、自动刷新)
17
+ │ OAuth2 client_credentials 取 Token(自动缓存、到期前刷新)
18
18
  │ POST /api/openapi/v1/query
19
19
  ▼
20
20
  悦商云开放接口 api2.ysy123.cn
@@ -28,9 +28,10 @@ Token 全程只在 MCP Server 进程内流转,AI 接触不到;`moduleCode`
28
28
 
29
29
  | 字段 | 说明 |
30
30
  | --- | --- |
31
- | 客户端密钥(JSON) | 按模块填 `{"sale":{"clientId":"..","clientSecret":".."}}`。**一个客户端只对应一个模块**,只填实际领到的模块即可 |
32
-
33
- 正式环境地址由连接器自动配置。
31
+ | 环境 | `prod` 正式 / `test` 内网测试,默认 `prod` |
32
+ | 客户端密钥(JSON) | 通常只有一套密钥,填 `{"clientId":"..","clientSecret":".."}`,对全部已授权模块生效。服务方若按模块分别发放客户端,可写 `{"sale":{..},"finance":{..}}` 指定 |
33
+ | 认证服务基址 | 默认 `https://api2.ysy123.cn/sys/api` |
34
+ | 业务应用基址 | 默认 `https://api2.ysy123.cn/custom` |
34
35
 
35
36
  密钥仅保存在本机 `~/.workbuddy` 目录,不写入连接器包,也不出现在日志与对话中。
36
37
 
@@ -73,6 +74,7 @@ HTTP 请求行、请求头、请求体、响应头、响应体都在通道内;
73
74
 
74
75
  - 证书由服务方在网关 / Nginx 上维护,本包不参与;到期前需续期,否则连接会报证书错误。
75
76
  - `token-schema.json` 与 `src/data-map.json` 的正式环境默认值均为 `https://`。**请勿改回 `http://`**,否则 `client_secret`、`access_token` 与业务数据会明文传输。
77
+ - 内网测试环境(`192.168.2.204`)仍为 HTTP,仅限内网使用。
76
78
 
77
79
  > 开放平台「远程 MCP 使用 HTTPS」的要求针对 `sse` / `streamableHttp` 的 MCP 地址;本连接器为 `stdio` 本地进程,不触发该条。
78
80
 
@@ -87,22 +89,27 @@ HTTP 请求行、请求头、请求体、响应头、响应体都在通道内;
87
89
  ### 发布 npm 包
88
90
 
89
91
  ```bash
90
- # 首次发布未占用的 1.0.0,确认公开内容后执行:
91
- npm publish --access public
92
- # 后续更新:先 npm version patch(或 minor / major),并同步 connector-meta.json 的 version
92
+ npm version patch # 或 minor / major
93
+ npm publish # publishConfig 已指定官方 registry 与 public
93
94
  ```
94
95
 
95
- 发布后验证使用方获取到的新版本并重启 MCP 连接器;镜像和缓存更新可能存在延迟。
96
+ 发布后等待 WorkBuddy 内置 npm 镜像同步(通常几分钟)再测试。
96
97
 
97
98
  ### 生成并提交 Connector 包
98
99
 
100
+ **版本必须精确锁定**:开放平台审核要求 `mcp.json` 的 npx 目标写成 `包名@x.y.z`,禁止 `@1` / `latest` / `^` / `~`。因此**每次发新版都要重新打包并提交审核**,不能只发 npm 包——否则用户运行的仍是审核时锁定的旧版本。
101
+
99
102
  ```bash
100
- npm run pack:connector # 生成 dist/ysy-openapi-connector-v<version>.zip
103
+ # 1. 递增 connector-meta.json 的 version(市场版本),与代码是否变更是两回事
104
+ # 2. 打包:脚本自动把 mcp.json 锁定到 package.json 对应的已发布 npm 版本并校验三段版本号
105
+ npm run pack:connector # 生成 dist/ysy-openapi-connector-v<市场版本>.zip
101
106
  ```
102
107
 
108
+ **版本解耦**:`connector-meta.json` 的 `version`(市场版本)和 `package.json` 的 `version`(npm 锁定版本)互相独立。只改展示名称、描述等元信息时,仅递增市场版本并重新提交审核,**无需发布新 npm 包**;改了代码或数据地图才需要 `npm version patch` + `npm publish`,两者同时递增。
109
+
103
110
  zip 内含 `connector-meta.json`、`mcp.json`、`token-schema.json`、`icon.svg`、`skills/ysy-openapi/SKILL.md`,即开放平台要求的完整结构。上传到 [WorkBuddy 开放平台](https://open.workbuddy.cn/docs/connector) 提交审核,通过后点击发布上架。
104
111
 
105
- `mcp.json` 用 `npx -y @chaoyue-erp/ysy-openapi-mcp@1` 启动,并声明 `runtime` 由 WorkBuddy 托管 Node.js(用户机器没装 Node 也能用),因此 `connector-meta.json` 的 `minWorkbuddyVersion` 设为 `5.0.0`。
112
+ `mcp.json` 用 `npx -y @chaoyue-erp/ysy-openapi-mcp@1.0.0` 启动,并声明 `runtime` 由 WorkBuddy 托管 Node.js(用户机器没装 Node 也能用),因此 `connector-meta.json` 的 `minWorkbuddyVersion` 设为 `5.0.0`。
106
113
 
107
114
  ### 密钥与打包安全
108
115
 
@@ -122,17 +129,19 @@ YSY_TRANSPORT=http YSY_HTTP_PORT=3100 node src/server.mjs # HTTP 模式
122
129
 
123
130
  `mcp.local.json` 是本机调试用的 MCP 配置(指向源码目录),`mcp.json` 才是上架用的发布配置,两者不要混用。
124
131
 
125
- 数据地图 `src/data-map.json` 由 `scripts/build-data-map.py` 从接口文档 HTML 生成。必须明确传入新版文件路径,先生成临时文件并检查差异,再决定是否替换:
132
+ 数据地图 `src/data-map.json` 由 `scripts/build-data-map.py` 从接口文档 HTML 自动生成;文档更新后跑 `npm run build:data-map -- "/绝对路径/新版文档.html"` 重生成即可,无需改代码。但**发布必须走完整流程**(因为 `mcp.json` 锁了精确版本):
126
133
 
127
134
  ```bash
128
- python3 scripts/build-data-map.py "/接口文档/新版接口文档.html" /tmp/ysy-data-map-next.json
129
- # 检查接口、参数、示例及正式环境地址后,再执行:
130
- cp /tmp/ysy-data-map-next.json src/data-map.json
135
+ npm run build:data-map -- "/绝对路径/新版文档.html"
131
136
  npm run check
132
- npm pack --dry-run
137
+ npm version patch
138
+ # 同步 connector-meta.json 的 version 与上一步一致
139
+ npm publish --otp=<6位码>
140
+ npm run pack:connector # 自动锁定 mcp.json 到新版本
141
+ # 把新 zip 重新提交开放平台审核
133
142
  ```
134
143
 
135
- 若新增模块,或认证、网关协议、分页等公共规则发生变化,还需检查并调整生成脚本及 MCP 代码。`npm run check` 不会替代使用真实凭据的正式接口联调。
144
+ 仅当接口清单/描述变化时,还需同步修改 `skills/ysy-openapi/SKILL.md` 与 `connector-meta.json` 的描述文字。
136
145
 
137
146
  ## 许可证
138
147
 
@@ -4,31 +4,6 @@
4
4
  "maxRows": 50,
5
5
  "maxChars": 20000,
6
6
  "timeoutMs": 28000,
7
- "credentials": {
8
- "base": {
9
- "clientId": "",
10
- "clientSecret": ""
11
- },
12
- "mall": {
13
- "clientId": "",
14
- "clientSecret": ""
15
- },
16
- "sale": {
17
- "clientId": "",
18
- "clientSecret": ""
19
- },
20
- "purchase": {
21
- "clientId": "",
22
- "clientSecret": ""
23
- },
24
- "finance": {
25
- "clientId": "",
26
- "clientSecret": ""
27
- },
28
- "import": {
29
- "clientId": "",
30
- "clientSecret": ""
31
- }
32
- },
33
- "_note": "一个客户端只对应一个模块,只填实际领取到密钥的模块即可。Token 由本程序自动获取与缓存,不要把 access_token 写在这里。仅连接正式环境。"
7
+ "credentials": { "clientId": "", "clientSecret": "" },
8
+ "_note": "多数情况只有一套密钥,直接填扁平的 clientId / clientSecret,对全部已授权模块生效;若服务方按模块分别发客户端,可改为 { \"base\": { \"clientId\": \"\", \"clientSecret\": \"\" }, \"sale\": { ... } }。Token 由本程序自动获取与缓存,不要把 access_token 写在这里。私有部署可加 authBase / apiBase 覆盖环境地址。"
34
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaoyue-erp/ysy-openapi-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "悦商云开放接口 MCP Server:把 OAuth2 + 策略网关(query/import/execute)封装为 WorkBuddy 连接器工具",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: ysy-openapi
3
- description: 悦商云开放接口查询技能 - 用自然语言查询商品客户、销售采购单据、财务报表等 41 个业务接口数据
4
- version: 1.0.0
3
+ description: 经营数据开放接口查询技能 - 用自然语言查询商品客户、销售采购单据、财务报表等 41 个业务接口数据
4
+ version: 1.0.1
5
5
  author: 广东超悦科技
6
6
  ---
7
7
 
8
- # 悦商云开放接口使用说明
8
+ # 经营数据开放接口使用说明
9
9
 
10
- 通过连接器调用悦商云开放接口。接口文档版本 2026-11-17,共 41 个 code:29 个查询、10 个 Excel 导入、2 个商城订单 JSON 写入。**默认只启用查询能力**,导入与写入需服务方显式开启。
10
+ 通过连接器调用经营数据开放接口(同一套后端,覆盖悦商云、渠道云、轻管店等产品线的客户)。接口文档版本 2026-11-17,共 41 个 code:29 个查询、10 个 Excel 导入、2 个商城订单 JSON 写入。**默认只启用查询能力**,导入与写入需服务方显式开启。
11
11
 
12
12
  ## 标准调用流程
13
13
 
@@ -24,7 +24,7 @@ author: 广东超悦科技
24
24
  | --- | --- |
25
25
  | 字段名是 `apiCode` | 文档里叫 `apiCode`,不是 `actionCode`;工具兼容 `actionCode` 别名,但优先用 `apiCode`,且**区分大小写** |
26
26
  | 请求外壳 | `{ "moduleCode": "sale", "apiCode": "sale.list", "params": {...} }`,所有业务参数放在 `params` 里 |
27
- | 模块与 code 绑定 | `moduleCode` 由 `apiCode` 决定,不能随意改。一个客户端只对应一个模块,需分别领取密钥、分别取 Token |
27
+ | 模块与 code 绑定 | `moduleCode` 由 `apiCode` 决定,不能随意改。多数客户只有一套密钥,对所有已授权模块通用;服务方若按模块分别发客户端,则各模块独立取 Token |
28
28
  | 不传身份字段 | 不要传 tenantId、dbName、userId 等,身份由 Token 决定 |
29
29
  | 参数名照抄 | 大小写敏感,例如客户的 `keyWord` 与供应商的 `keyword` 不能互换 |
30
30
 
package/src/config.mjs CHANGED
@@ -11,6 +11,9 @@ export const DATA_MAP = JSON.parse(
11
11
 
12
12
  const MODULE_KEYS = Object.keys(DATA_MAP.modules);
13
13
 
14
+ /** 共用凭据的键名:只有一个客户端时,该凭据对所有模块生效。 */
15
+ export const SHARED = "__shared";
16
+
14
17
  function readLocalConfig() {
15
18
  const explicit = process.env.YSY_CONFIG;
16
19
  const candidates = explicit
@@ -28,50 +31,67 @@ function readLocalConfig() {
28
31
 
29
32
  const isPlaceholder = (v) => typeof v === "string" && v.includes("${");
30
33
 
34
+ function normalizeCredential(v) {
35
+ if (!v || typeof v !== "object") return null;
36
+ const clientId = v.clientId ?? v.client_id;
37
+ if (!clientId) return null;
38
+ return {
39
+ clientId: String(clientId),
40
+ clientSecret: String(v.clientSecret ?? v.client_secret ?? ""),
41
+ };
42
+ }
43
+
44
+ /**
45
+ * 支持两种凭据写法:
46
+ * 单客户端(推荐,多数客户只有一套密钥):{"clientId":"..","clientSecret":".."}
47
+ * 按模块(服务方为不同模块分别发了客户端):{"sale":{"clientId":"..","clientSecret":".."}, ...}
48
+ */
31
49
  function parseCredentials(raw) {
32
50
  if (!raw || isPlaceholder(raw)) return {};
51
+ let value;
33
52
  try {
34
- const value = typeof raw === "string" ? JSON.parse(raw) : raw;
35
- if (!value || typeof value !== "object") return {};
36
- const out = {};
37
- for (const [k, v] of Object.entries(value)) {
38
- if (v && typeof v === "object" && (v.clientId || v.client_id)) {
39
- out[k] = {
40
- clientId: String(v.clientId ?? v.client_id ?? ""),
41
- clientSecret: String(v.clientSecret ?? v.client_secret ?? ""),
42
- };
43
- }
44
- }
45
- return out;
53
+ value = typeof raw === "string" ? JSON.parse(raw) : raw;
46
54
  } catch (err) {
47
55
  throw new Error(`YSY_CLIENT_CREDENTIALS 不是合法 JSON: ${err.message}`);
48
56
  }
57
+ if (!value || typeof value !== "object") return {};
58
+ const shared = normalizeCredential(value);
59
+ if (shared) return { [SHARED]: shared };
60
+ const out = {};
61
+ for (const [k, v] of Object.entries(value)) {
62
+ const c = normalizeCredential(v);
63
+ if (c) out[k] = c;
64
+ }
65
+ return out;
66
+ }
67
+
68
+ /** 取某模块实际使用的凭据:优先该模块专属,回退到共用凭据。 */
69
+ export function credentialFor(credentials, moduleCode) {
70
+ return credentials[moduleCode] || credentials[SHARED] || null;
71
+ }
72
+
73
+ export function hasCredentials(credentials, moduleCode) {
74
+ const c = credentialFor(credentials, moduleCode);
75
+ return Boolean(c?.clientId && c?.clientSecret);
49
76
  }
50
77
 
51
78
  export function loadConfig() {
52
79
  const local = readLocalConfig();
53
80
  const envName = process.env.YSY_ENV || local.env || "prod";
54
- if (envName !== "prod") throw new Error(`仅支持正式环境 prod,收到 ${envName}`);
55
- const env = DATA_MAP.endpoints.prod;
81
+ const env = DATA_MAP.endpoints[envName];
82
+ if (!env) throw new Error(`未知环境 ${envName},可选 prod / test`);
56
83
 
57
84
  const credentials = {
58
85
  ...parseCredentials(local.credentials),
59
86
  ...parseCredentials(process.env.YSY_CLIENT_CREDENTIALS),
60
87
  };
61
88
 
62
- // 兼容旧配置中的正式地址,但不允许覆盖到其他上游。
63
- function validateBase(value, expected, name) {
64
- if (!value || isPlaceholder(value)) return;
65
- if (typeof value !== "string" || value.replace(/\/$/, "") !== expected.replace(/\/$/, "")) {
66
- throw new Error(`${name} 仅允许使用正式环境地址`);
67
- }
68
- }
69
- validateBase(local.authBase, env.authBase, "authBase");
70
- validateBase(local.apiBase, env.apiBase, "apiBase");
71
- validateBase(process.env.YSY_AUTH_BASE, env.authBase, "YSY_AUTH_BASE");
72
- validateBase(process.env.YSY_API_BASE, env.apiBase, "YSY_API_BASE");
73
- const authBase = env.authBase;
74
- const apiBase = env.apiBase;
89
+ const authBase = process.env.YSY_AUTH_BASE && !isPlaceholder(process.env.YSY_AUTH_BASE)
90
+ ? process.env.YSY_AUTH_BASE
91
+ : local.authBase || env.authBase;
92
+ const apiBase = process.env.YSY_API_BASE && !isPlaceholder(process.env.YSY_API_BASE)
93
+ ? process.env.YSY_API_BASE
94
+ : local.apiBase || env.apiBase;
75
95
 
76
96
  return {
77
97
  envName,
@@ -91,11 +111,11 @@ export function loadConfig() {
91
111
  }
92
112
 
93
113
  export function configuredModules(cfg) {
94
- return MODULE_KEYS.filter((m) => cfg.credentials[m]?.clientId && cfg.credentials[m]?.clientSecret);
114
+ return MODULE_KEYS.filter((m) => hasCredentials(cfg.credentials, m));
95
115
  }
96
116
 
97
117
  export function missingModules(cfg) {
98
- return MODULE_KEYS.filter((m) => !cfg.credentials[m]?.clientId || !cfg.credentials[m]?.clientSecret);
118
+ return MODULE_KEYS.filter((m) => !hasCredentials(cfg.credentials, m));
99
119
  }
100
120
 
101
121
  export const MODULE_NAMES = DATA_MAP.modules;
package/src/data-map.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026-11-17",
2
+ "version": "2026-11-23",
3
3
  "source": "旧版底稿 openapi-client-guide.md",
4
4
  "generatedFrom": "外部接口对接20261123.html",
5
5
  "apiCount": 41,
@@ -17,6 +17,15 @@
17
17
  "queryUrl": "https://api2.ysy123.cn/custom/api/openapi/v1/query",
18
18
  "importUrl": "https://api2.ysy123.cn/custom/api/openapi/v1/import",
19
19
  "executeUrl": "https://api2.ysy123.cn/custom/api/openapi/v1/execute"
20
+ },
21
+ "test": {
22
+ "name": "测试环境(内网)",
23
+ "authBase": "http://192.168.2.204:7005/sysApi/api",
24
+ "apiBase": "http://192.168.2.204:8011/custom",
25
+ "tokenUrl": "http://192.168.2.204:7005/sysApi/api/oauth2/token",
26
+ "queryUrl": "http://192.168.2.204:8011/custom/api/openapi/v1/query",
27
+ "importUrl": "http://192.168.2.204:8011/custom/api/openapi/v1/import",
28
+ "executeUrl": "http://192.168.2.204:8011/custom/api/openapi/v1/execute"
20
29
  }
21
30
  },
22
31
  "modules": {
@@ -116,7 +125,7 @@
116
125
  "tokenField": "access_token",
117
126
  "expiresInMax": 3600,
118
127
  "refreshToken": false,
119
- "note": "一个客户端只对应一个模块,多模块需分别领取密钥并分别取 Token;Token 无 refresh_token,到期前重新获取即可。"
128
+ "note": "多数客户只有一套客户端密钥,对全部已授权模块通用;服务方若按模块分别发客户端,则各模块独立取 Token。Token 无 refresh_token,到期前重新获取即可。"
120
129
  },
121
130
  "queryShell": {
122
131
  "moduleCode": "string 必填",
@@ -1,9 +1,12 @@
1
- import { DATA_MAP } from "./config.mjs";
1
+ import { DATA_MAP, SHARED, credentialFor } from "./config.mjs";
2
2
  import { TokenError } from "./errors.mjs";
3
3
 
4
4
  const REFRESH_MARGIN_MS = 60_000;
5
5
 
6
- /** 多模块 Token 管理:一个客户端对应一个模块,分别取 Token、分别缓存。 */
6
+ /**
7
+ * Token 管理:按模块缓存 access_token,到期前 60 秒提前刷新。
8
+ * 只有一个客户端时各模块共用同一凭据,缓存也共用一份,避免重复换票。
9
+ */
7
10
  export class TokenManager {
8
11
  constructor(cfg) {
9
12
  this.cfg = cfg;
@@ -11,8 +14,12 @@ export class TokenManager {
11
14
  this.inflight = new Map();
12
15
  }
13
16
 
17
+ #cacheKey(moduleCode) {
18
+ return this.cfg.credentials[moduleCode] ? moduleCode : SHARED;
19
+ }
20
+
14
21
  hasCredentials(moduleCode) {
15
- const c = this.cfg.credentials[moduleCode];
22
+ const c = credentialFor(this.cfg.credentials, moduleCode);
16
23
  return Boolean(c?.clientId && c?.clientSecret);
17
24
  }
18
25
 
@@ -21,28 +28,30 @@ export class TokenManager {
21
28
  if (!this.hasCredentials(moduleCode)) {
22
29
  const hint = DATA_MAP.commonRules.auth.note;
23
30
  throw new TokenError(
24
- `模块 ${moduleCode} 未配置客户端凭据。请在 config.json 的 credentials.${moduleCode} 填写 clientId / clientSecret,或填写 YSY_CLIENT_CREDENTIALS。规范:${hint}`,
31
+ `未配置客户端凭据。请在连接器表单的 YSY_CLIENT_CREDENTIALS 填写 {"clientId":"..","clientSecret":".."}(单个客户端通用),` +
32
+ `或按模块分别填写 {"${moduleCode}":{"clientId":"..","clientSecret":".."}}。规范:${hint}`,
25
33
  );
26
34
  }
27
35
 
28
- const cached = this.cache.get(moduleCode);
36
+ const key = this.#cacheKey(moduleCode);
37
+ const cached = this.cache.get(key);
29
38
  if (!force && cached && Date.now() < cached.expiresAt - REFRESH_MARGIN_MS) {
30
39
  return cached.value;
31
40
  }
32
- if (this.inflight.has(moduleCode)) return this.inflight.get(moduleCode);
41
+ if (this.inflight.has(key)) return this.inflight.get(key);
33
42
 
34
43
  const job = this.#fetch(moduleCode)
35
44
  .then((entry) => {
36
- this.cache.set(moduleCode, entry);
45
+ this.cache.set(key, entry);
37
46
  return entry.value;
38
47
  })
39
- .finally(() => this.inflight.delete(moduleCode));
40
- this.inflight.set(moduleCode, job);
48
+ .finally(() => this.inflight.delete(key));
49
+ this.inflight.set(key, job);
41
50
  return job;
42
51
  }
43
52
 
44
53
  async #fetch(moduleCode) {
45
- const { clientId, clientSecret } = this.cfg.credentials[moduleCode];
54
+ const { clientId, clientSecret } = credentialFor(this.cfg.credentials, moduleCode);
46
55
  const basic = Buffer.from(`${clientId}:${clientSecret}`, "utf8").toString("base64");
47
56
  const controller = new AbortController();
48
57
  const timer = setTimeout(() => controller.abort(), 10_000);
@@ -59,7 +68,7 @@ export class TokenManager {
59
68
  signal: controller.signal,
60
69
  });
61
70
  } catch (err) {
62
- throw new TokenError(`获取 Token 失败(模块 ${moduleCode}):无法连接认证服务 ${this.cfg.tokenUrl}。${err.message}`);
71
+ throw new TokenError(`获取 Token 失败:无法连接认证服务 ${this.cfg.tokenUrl}。${err.message}`);
63
72
  } finally {
64
73
  clearTimeout(timer);
65
74
  }
@@ -79,10 +88,10 @@ export class TokenManager {
79
88
  unsupported_grant_type: "grant_type 固定为 client_credentials。",
80
89
  temporarily_unavailable: "认证服务暂不可用(503),稍后重试。",
81
90
  };
82
- throw new TokenError(`获取 Token 失败(模块 ${moduleCode},HTTP ${res.status},${code}):${tips[code] || text.slice(0, 200)}`);
91
+ throw new TokenError(`获取 Token 失败(HTTP ${res.status},${code}):${tips[code] || text.slice(0, 200)}`);
83
92
  }
84
93
  if (!body.access_token) {
85
- throw new TokenError(`获取 Token 失败(模块 ${moduleCode}):响应缺少 access_token。`);
94
+ throw new TokenError("获取 Token 失败:响应缺少 access_token。");
86
95
  }
87
96
  const expiresIn = Number(body.expires_in) || 3600;
88
97
  return {
@@ -93,6 +102,6 @@ export class TokenManager {
93
102
  }
94
103
 
95
104
  invalidate(moduleCode) {
96
- this.cache.delete(moduleCode);
105
+ this.cache.delete(this.#cacheKey(moduleCode));
97
106
  }
98
107
  }