@larksuiteoapi/node-sdk 1.0.3 → 1.0.4
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/es/index.js +10 -10
- package/lib/index.js +10 -10
- package/package.json +1 -3
- package/types/index.d.ts +1 -1
package/es/index.js
CHANGED
|
@@ -13581,10 +13581,10 @@ class TokenManager {
|
|
|
13581
13581
|
getCustomTenantAccessToken() {
|
|
13582
13582
|
var _a, _b;
|
|
13583
13583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13584
|
-
const
|
|
13585
|
-
if (
|
|
13584
|
+
const cachedTenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CTenantAccessToken));
|
|
13585
|
+
if (cachedTenantAccessToken) {
|
|
13586
13586
|
this.logger.debug('use cache token');
|
|
13587
|
-
return
|
|
13587
|
+
return cachedTenantAccessToken;
|
|
13588
13588
|
}
|
|
13589
13589
|
this.logger.debug('request token');
|
|
13590
13590
|
// @ts-ignore
|
|
@@ -13607,10 +13607,10 @@ class TokenManager {
|
|
|
13607
13607
|
this.logger.error('market app request need tenant key');
|
|
13608
13608
|
return undefined;
|
|
13609
13609
|
}
|
|
13610
|
-
const
|
|
13611
|
-
if (
|
|
13610
|
+
const tenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(`larkMarketAccessToken${tenantKey}`));
|
|
13611
|
+
if (tenantAccessToken) {
|
|
13612
13612
|
this.logger.debug('use cache token');
|
|
13613
|
-
return
|
|
13613
|
+
return tenantAccessToken;
|
|
13614
13614
|
}
|
|
13615
13615
|
this.logger.debug('get app ticket');
|
|
13616
13616
|
const appTicket = yield this.appTicketManager.getAppTicket();
|
|
@@ -13646,7 +13646,7 @@ class TokenManager {
|
|
|
13646
13646
|
return tenant_access_token;
|
|
13647
13647
|
});
|
|
13648
13648
|
}
|
|
13649
|
-
|
|
13649
|
+
getTenantAccessToken(params) {
|
|
13650
13650
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13651
13651
|
assert(this.appType === AppType.SelfBuild, () => __awaiter(this, void 0, void 0, function* () {
|
|
13652
13652
|
this.logger.debug('get custom app token');
|
|
@@ -13655,10 +13655,10 @@ class TokenManager {
|
|
|
13655
13655
|
this.logger.debug('get market app token ');
|
|
13656
13656
|
}));
|
|
13657
13657
|
// prettier-ignore
|
|
13658
|
-
const
|
|
13658
|
+
const tenantAccessToken = this.appType === AppType.SelfBuild
|
|
13659
13659
|
? yield this.getCustomTenantAccessToken()
|
|
13660
13660
|
: yield this.getMarketTenantAccessToken(get(params, CTenantKey));
|
|
13661
|
-
return
|
|
13661
|
+
return tenantAccessToken;
|
|
13662
13662
|
});
|
|
13663
13663
|
}
|
|
13664
13664
|
}
|
|
@@ -13710,7 +13710,7 @@ class Client extends Client$1 {
|
|
|
13710
13710
|
targetOptions.headers.Authorization = `Bearer ${userAccessToken}`;
|
|
13711
13711
|
}
|
|
13712
13712
|
else if (!this.disableTokenCache) {
|
|
13713
|
-
const tenantAccessToken = yield this.tokenManager.
|
|
13713
|
+
const tenantAccessToken = yield this.tokenManager.getTenantAccessToken({
|
|
13714
13714
|
[CTenantKey]: get(targetOptions.lark, CTenantKey),
|
|
13715
13715
|
});
|
|
13716
13716
|
if (tenantAccessToken) {
|
package/lib/index.js
CHANGED
|
@@ -13596,10 +13596,10 @@ class TokenManager {
|
|
|
13596
13596
|
getCustomTenantAccessToken() {
|
|
13597
13597
|
var _a, _b;
|
|
13598
13598
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13599
|
-
const
|
|
13600
|
-
if (
|
|
13599
|
+
const cachedTenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CTenantAccessToken));
|
|
13600
|
+
if (cachedTenantAccessToken) {
|
|
13601
13601
|
this.logger.debug('use cache token');
|
|
13602
|
-
return
|
|
13602
|
+
return cachedTenantAccessToken;
|
|
13603
13603
|
}
|
|
13604
13604
|
this.logger.debug('request token');
|
|
13605
13605
|
// @ts-ignore
|
|
@@ -13622,10 +13622,10 @@ class TokenManager {
|
|
|
13622
13622
|
this.logger.error('market app request need tenant key');
|
|
13623
13623
|
return undefined;
|
|
13624
13624
|
}
|
|
13625
|
-
const
|
|
13626
|
-
if (
|
|
13625
|
+
const tenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(`larkMarketAccessToken${tenantKey}`));
|
|
13626
|
+
if (tenantAccessToken) {
|
|
13627
13627
|
this.logger.debug('use cache token');
|
|
13628
|
-
return
|
|
13628
|
+
return tenantAccessToken;
|
|
13629
13629
|
}
|
|
13630
13630
|
this.logger.debug('get app ticket');
|
|
13631
13631
|
const appTicket = yield this.appTicketManager.getAppTicket();
|
|
@@ -13661,7 +13661,7 @@ class TokenManager {
|
|
|
13661
13661
|
return tenant_access_token;
|
|
13662
13662
|
});
|
|
13663
13663
|
}
|
|
13664
|
-
|
|
13664
|
+
getTenantAccessToken(params) {
|
|
13665
13665
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13666
13666
|
assert(this.appType === exports.AppType.SelfBuild, () => __awaiter(this, void 0, void 0, function* () {
|
|
13667
13667
|
this.logger.debug('get custom app token');
|
|
@@ -13670,10 +13670,10 @@ class TokenManager {
|
|
|
13670
13670
|
this.logger.debug('get market app token ');
|
|
13671
13671
|
}));
|
|
13672
13672
|
// prettier-ignore
|
|
13673
|
-
const
|
|
13673
|
+
const tenantAccessToken = this.appType === exports.AppType.SelfBuild
|
|
13674
13674
|
? yield this.getCustomTenantAccessToken()
|
|
13675
13675
|
: yield this.getMarketTenantAccessToken(get__default["default"](params, CTenantKey));
|
|
13676
|
-
return
|
|
13676
|
+
return tenantAccessToken;
|
|
13677
13677
|
});
|
|
13678
13678
|
}
|
|
13679
13679
|
}
|
|
@@ -13725,7 +13725,7 @@ class Client extends Client$1 {
|
|
|
13725
13725
|
targetOptions.headers.Authorization = `Bearer ${userAccessToken}`;
|
|
13726
13726
|
}
|
|
13727
13727
|
else if (!this.disableTokenCache) {
|
|
13728
|
-
const tenantAccessToken = yield this.tokenManager.
|
|
13728
|
+
const tenantAccessToken = yield this.tokenManager.getTenantAccessToken({
|
|
13729
13729
|
[CTenantKey]: get__default["default"](targetOptions.lark, CTenantKey),
|
|
13730
13730
|
});
|
|
13731
13731
|
if (tenantAccessToken) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larksuiteoapi/node-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "larksuite open sdk for nodejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"feishu",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"nodejs"
|
|
10
10
|
],
|
|
11
11
|
"types": "./types",
|
|
12
|
-
"main": "./lib/index.js",
|
|
13
|
-
"module": "./es/index.js",
|
|
14
12
|
"files": [
|
|
15
13
|
"lib",
|
|
16
14
|
"es",
|
package/types/index.d.ts
CHANGED
|
@@ -29308,7 +29308,7 @@ declare class TokenManager {
|
|
|
29308
29308
|
constructor(params: IParams);
|
|
29309
29309
|
getCustomTenantAccessToken(): Promise<any>;
|
|
29310
29310
|
getMarketTenantAccessToken(tenantKey: string): Promise<any>;
|
|
29311
|
-
|
|
29311
|
+
getTenantAccessToken(params?: {
|
|
29312
29312
|
[CTenantKey]?: string;
|
|
29313
29313
|
}): Promise<any>;
|
|
29314
29314
|
}
|