@qoniai/qoni 0.5.0 → 0.5.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/CHANGELOG.md +9 -0
- package/README.md +3 -0
- package/README.zh-CN.md +2 -0
- package/dist/index.cjs +0 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1253,7 +1253,6 @@ declare class Qoni {
|
|
|
1253
1253
|
private readonly secretKey;
|
|
1254
1254
|
private readonly host;
|
|
1255
1255
|
private runtimeConfigPromise?;
|
|
1256
|
-
private readonly productTokenCache;
|
|
1257
1256
|
private genAuthAdminTokenCache?;
|
|
1258
1257
|
readonly gumem: ReturnType<typeof createGumemNamespace>;
|
|
1259
1258
|
readonly genauth: ReturnType<typeof createGenAuthNamespace>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1253,7 +1253,6 @@ declare class Qoni {
|
|
|
1253
1253
|
private readonly secretKey;
|
|
1254
1254
|
private readonly host;
|
|
1255
1255
|
private runtimeConfigPromise?;
|
|
1256
|
-
private readonly productTokenCache;
|
|
1257
1256
|
private genAuthAdminTokenCache?;
|
|
1258
1257
|
readonly gumem: ReturnType<typeof createGumemNamespace>;
|
|
1259
1258
|
readonly genauth: ReturnType<typeof createGenAuthNamespace>;
|
package/dist/index.js
CHANGED
|
@@ -2066,7 +2066,6 @@ var Qoni = class {
|
|
|
2066
2066
|
secretKey;
|
|
2067
2067
|
host;
|
|
2068
2068
|
runtimeConfigPromise;
|
|
2069
|
-
productTokenCache = /* @__PURE__ */ new Map();
|
|
2070
2069
|
genAuthAdminTokenCache;
|
|
2071
2070
|
gumem;
|
|
2072
2071
|
genauth;
|
|
@@ -2537,9 +2536,6 @@ var Qoni = class {
|
|
|
2537
2536
|
const runtimeToken = requiredRuntimeToken(token);
|
|
2538
2537
|
if (!isQoniDelegationToken(runtimeToken)) return runtimeToken;
|
|
2539
2538
|
const scopes = [...requiredScopes || []].sort();
|
|
2540
|
-
const cacheKey = [service, runtimeToken, scopes.join(" ")].join(":");
|
|
2541
|
-
const cached = this.productTokenCache.get(cacheKey);
|
|
2542
|
-
if (cached && cached.expiresAt > Date.now() + 3e4) return cached.token;
|
|
2543
2539
|
const response = await this.signedPost("/api/v3/eak/token-exchange", {
|
|
2544
2540
|
subjectToken: runtimeToken,
|
|
2545
2541
|
resource: service === "gumem" ? "gumem" : "webagent",
|
|
@@ -2554,10 +2550,6 @@ var Qoni = class {
|
|
|
2554
2550
|
"Qoni product token exchange response did not include an access token"
|
|
2555
2551
|
);
|
|
2556
2552
|
}
|
|
2557
|
-
this.productTokenCache.set(cacheKey, {
|
|
2558
|
-
token: accessToken,
|
|
2559
|
-
expiresAt: Date.now() + Math.max(0, readExpiresIn(payload) ?? 3600) * 1e3
|
|
2560
|
-
});
|
|
2561
2553
|
return accessToken;
|
|
2562
2554
|
}
|
|
2563
2555
|
async genauthAdminTokenFor() {
|