@larksuiteoapi/node-sdk 1.29.0 → 1.31.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/es/index.js +1273 -158
- package/lib/index.js +1273 -157
- package/package.json +2 -2
- package/types/index.d.ts +6303 -691
package/es/index.js
CHANGED
|
@@ -58,6 +58,18 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
function __values(o) {
|
|
62
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
63
|
+
if (m) return m.call(o);
|
|
64
|
+
if (o && typeof o.length === "number") return {
|
|
65
|
+
next: function () {
|
|
66
|
+
if (o && i >= o.length) o = void 0;
|
|
67
|
+
return { value: o && o[i++], done: !o };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
function __await(v) {
|
|
62
74
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
63
75
|
}
|
|
@@ -74,6 +86,14 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
74
86
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
75
87
|
}
|
|
76
88
|
|
|
89
|
+
function __asyncValues(o) {
|
|
90
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
91
|
+
var m = o[Symbol.asyncIterator], i;
|
|
92
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
93
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
94
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
78
98
|
var e = new Error(message);
|
|
79
99
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -114,6 +134,8 @@ const CAppTicket = Symbol('app-ticket');
|
|
|
114
134
|
const CTenantAccessToken = Symbol('tenant-access-token');
|
|
115
135
|
const CWithHelpdeskAuthorization = Symbol('with-helpdesk-authorization');
|
|
116
136
|
const CWithUserAccessToken = Symbol('with-user-access-token');
|
|
137
|
+
const CUserAccessToken = Symbol('user-access-token');
|
|
138
|
+
const CAilySessionRecord = Symbol('aily-session-record');
|
|
117
139
|
|
|
118
140
|
const string2Base64 = (content) => Buffer.from(content).toString('base64');
|
|
119
141
|
|
|
@@ -221,7 +243,7 @@ const formatErrors = (e) => {
|
|
|
221
243
|
};
|
|
222
244
|
|
|
223
245
|
// auto gen
|
|
224
|
-
class Client
|
|
246
|
+
class Client$$ {
|
|
225
247
|
constructor() {
|
|
226
248
|
/**
|
|
227
249
|
* 智能门禁
|
|
@@ -1194,7 +1216,7 @@ class Client$_ {
|
|
|
1194
1216
|
}
|
|
1195
1217
|
|
|
1196
1218
|
// auto gen
|
|
1197
|
-
class Client$
|
|
1219
|
+
class Client$_ extends Client$$ {
|
|
1198
1220
|
constructor() {
|
|
1199
1221
|
super(...arguments);
|
|
1200
1222
|
/**
|
|
@@ -2250,7 +2272,7 @@ class Client$Z extends Client$_ {
|
|
|
2250
2272
|
}
|
|
2251
2273
|
|
|
2252
2274
|
// auto gen
|
|
2253
|
-
class Client$
|
|
2275
|
+
class Client$Z extends Client$_ {
|
|
2254
2276
|
constructor() {
|
|
2255
2277
|
super(...arguments);
|
|
2256
2278
|
/**
|
|
@@ -2619,7 +2641,7 @@ class Client$Y extends Client$Z {
|
|
|
2619
2641
|
}
|
|
2620
2642
|
|
|
2621
2643
|
// auto gen
|
|
2622
|
-
class Client$
|
|
2644
|
+
class Client$Y extends Client$Z {
|
|
2623
2645
|
constructor() {
|
|
2624
2646
|
super(...arguments);
|
|
2625
2647
|
/**
|
|
@@ -3845,7 +3867,7 @@ class Client$X extends Client$Y {
|
|
|
3845
3867
|
}
|
|
3846
3868
|
|
|
3847
3869
|
// auto gen
|
|
3848
|
-
class Client$
|
|
3870
|
+
class Client$X extends Client$Y {
|
|
3849
3871
|
constructor() {
|
|
3850
3872
|
super(...arguments);
|
|
3851
3873
|
/**
|
|
@@ -4138,7 +4160,7 @@ class Client$W extends Client$X {
|
|
|
4138
4160
|
}),
|
|
4139
4161
|
},
|
|
4140
4162
|
/**
|
|
4141
|
-
*
|
|
4163
|
+
* 审批查询
|
|
4142
4164
|
*/
|
|
4143
4165
|
instance: {
|
|
4144
4166
|
/**
|
|
@@ -5107,7 +5129,7 @@ class Client$W extends Client$X {
|
|
|
5107
5129
|
}),
|
|
5108
5130
|
},
|
|
5109
5131
|
/**
|
|
5110
|
-
*
|
|
5132
|
+
* 审批查询
|
|
5111
5133
|
*/
|
|
5112
5134
|
instance: {
|
|
5113
5135
|
/**
|
|
@@ -5795,7 +5817,7 @@ class Client$W extends Client$X {
|
|
|
5795
5817
|
}
|
|
5796
5818
|
|
|
5797
5819
|
// auto gen
|
|
5798
|
-
class Client$
|
|
5820
|
+
class Client$W extends Client$X {
|
|
5799
5821
|
constructor() {
|
|
5800
5822
|
super(...arguments);
|
|
5801
5823
|
/**
|
|
@@ -7743,7 +7765,7 @@ class Client$V extends Client$W {
|
|
|
7743
7765
|
}
|
|
7744
7766
|
|
|
7745
7767
|
// auto gen
|
|
7746
|
-
class Client$
|
|
7768
|
+
class Client$V extends Client$W {
|
|
7747
7769
|
constructor() {
|
|
7748
7770
|
super(...arguments);
|
|
7749
7771
|
/**
|
|
@@ -7987,7 +8009,7 @@ class Client$U extends Client$V {
|
|
|
7987
8009
|
}
|
|
7988
8010
|
|
|
7989
8011
|
// auto gen
|
|
7990
|
-
class Client$
|
|
8012
|
+
class Client$U extends Client$V {
|
|
7991
8013
|
constructor() {
|
|
7992
8014
|
super(...arguments);
|
|
7993
8015
|
/**
|
|
@@ -8251,7 +8273,7 @@ class Client$T extends Client$U {
|
|
|
8251
8273
|
}
|
|
8252
8274
|
|
|
8253
8275
|
// auto gen
|
|
8254
|
-
class Client$
|
|
8276
|
+
class Client$T extends Client$U {
|
|
8255
8277
|
constructor() {
|
|
8256
8278
|
super(...arguments);
|
|
8257
8279
|
/**
|
|
@@ -8262,7 +8284,7 @@ class Client$S extends Client$T {
|
|
|
8262
8284
|
}
|
|
8263
8285
|
|
|
8264
8286
|
// auto gen
|
|
8265
|
-
class Client$
|
|
8287
|
+
class Client$S extends Client$T {
|
|
8266
8288
|
constructor() {
|
|
8267
8289
|
super(...arguments);
|
|
8268
8290
|
/**
|
|
@@ -9278,7 +9300,7 @@ class Client$R extends Client$S {
|
|
|
9278
9300
|
}
|
|
9279
9301
|
|
|
9280
9302
|
// auto gen
|
|
9281
|
-
class Client$
|
|
9303
|
+
class Client$R extends Client$S {
|
|
9282
9304
|
constructor() {
|
|
9283
9305
|
super(...arguments);
|
|
9284
9306
|
/**
|
|
@@ -12426,7 +12448,7 @@ class Client$Q extends Client$R {
|
|
|
12426
12448
|
}
|
|
12427
12449
|
|
|
12428
12450
|
// auto gen
|
|
12429
|
-
class Client$
|
|
12451
|
+
class Client$Q extends Client$R {
|
|
12430
12452
|
constructor() {
|
|
12431
12453
|
super(...arguments);
|
|
12432
12454
|
/**
|
|
@@ -12604,7 +12626,7 @@ class Client$P extends Client$Q {
|
|
|
12604
12626
|
}
|
|
12605
12627
|
|
|
12606
12628
|
// auto gen
|
|
12607
|
-
class Client$
|
|
12629
|
+
class Client$P extends Client$Q {
|
|
12608
12630
|
constructor() {
|
|
12609
12631
|
super(...arguments);
|
|
12610
12632
|
/**
|
|
@@ -12645,7 +12667,7 @@ class Client$O extends Client$P {
|
|
|
12645
12667
|
}
|
|
12646
12668
|
|
|
12647
12669
|
// auto gen
|
|
12648
|
-
class Client$
|
|
12670
|
+
class Client$O extends Client$P {
|
|
12649
12671
|
constructor() {
|
|
12650
12672
|
super(...arguments);
|
|
12651
12673
|
/**
|
|
@@ -15233,7 +15255,7 @@ class Client$N extends Client$O {
|
|
|
15233
15255
|
}
|
|
15234
15256
|
|
|
15235
15257
|
// auto gen
|
|
15236
|
-
class Client$
|
|
15258
|
+
class Client$N extends Client$O {
|
|
15237
15259
|
constructor() {
|
|
15238
15260
|
super(...arguments);
|
|
15239
15261
|
/**
|
|
@@ -15243,6 +15265,415 @@ class Client$M extends Client$N {
|
|
|
15243
15265
|
}
|
|
15244
15266
|
}
|
|
15245
15267
|
|
|
15268
|
+
// auto gen
|
|
15269
|
+
class Client$M extends Client$N {
|
|
15270
|
+
constructor() {
|
|
15271
|
+
super(...arguments);
|
|
15272
|
+
/**
|
|
15273
|
+
|
|
15274
|
+
*/
|
|
15275
|
+
this.compensation = {
|
|
15276
|
+
v1: {
|
|
15277
|
+
/**
|
|
15278
|
+
* archive
|
|
15279
|
+
*/
|
|
15280
|
+
archive: {
|
|
15281
|
+
/**
|
|
15282
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=archive&apiName=query&version=v1 click to debug }
|
|
15283
|
+
*
|
|
15284
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=compensation&resource=archive&version=v1 document }
|
|
15285
|
+
*/
|
|
15286
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15287
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15288
|
+
return this.httpInstance
|
|
15289
|
+
.request({
|
|
15290
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/archives/query`, path),
|
|
15291
|
+
method: "POST",
|
|
15292
|
+
data,
|
|
15293
|
+
params,
|
|
15294
|
+
headers,
|
|
15295
|
+
})
|
|
15296
|
+
.catch((e) => {
|
|
15297
|
+
this.logger.error(formatErrors(e));
|
|
15298
|
+
throw e;
|
|
15299
|
+
});
|
|
15300
|
+
}),
|
|
15301
|
+
},
|
|
15302
|
+
/**
|
|
15303
|
+
* change_reason
|
|
15304
|
+
*/
|
|
15305
|
+
changeReason: {
|
|
15306
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15307
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15308
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15309
|
+
const res = yield this.httpInstance
|
|
15310
|
+
.request({
|
|
15311
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/change_reasons`, path),
|
|
15312
|
+
method: "GET",
|
|
15313
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
15314
|
+
params: pickBy(innerPayload.params, identity),
|
|
15315
|
+
data,
|
|
15316
|
+
})
|
|
15317
|
+
.catch((e) => {
|
|
15318
|
+
this.logger.error(formatErrors(e));
|
|
15319
|
+
});
|
|
15320
|
+
return res;
|
|
15321
|
+
});
|
|
15322
|
+
const Iterable = {
|
|
15323
|
+
[Symbol.asyncIterator]() {
|
|
15324
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15325
|
+
let hasMore = true;
|
|
15326
|
+
let pageToken;
|
|
15327
|
+
while (hasMore) {
|
|
15328
|
+
try {
|
|
15329
|
+
const res = yield __await(sendRequest({
|
|
15330
|
+
headers,
|
|
15331
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15332
|
+
data,
|
|
15333
|
+
}));
|
|
15334
|
+
const _b = get(res, "data") || {}, {
|
|
15335
|
+
// @ts-ignore
|
|
15336
|
+
has_more,
|
|
15337
|
+
// @ts-ignore
|
|
15338
|
+
page_token,
|
|
15339
|
+
// @ts-ignore
|
|
15340
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15341
|
+
yield yield __await(rest);
|
|
15342
|
+
hasMore = Boolean(has_more);
|
|
15343
|
+
pageToken = page_token || next_page_token;
|
|
15344
|
+
}
|
|
15345
|
+
catch (e) {
|
|
15346
|
+
yield yield __await(null);
|
|
15347
|
+
break;
|
|
15348
|
+
}
|
|
15349
|
+
}
|
|
15350
|
+
});
|
|
15351
|
+
},
|
|
15352
|
+
};
|
|
15353
|
+
return Iterable;
|
|
15354
|
+
}),
|
|
15355
|
+
/**
|
|
15356
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=change_reason&apiName=list&version=v1 click to debug }
|
|
15357
|
+
*
|
|
15358
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=change_reason&version=v1 document }
|
|
15359
|
+
*/
|
|
15360
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15361
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15362
|
+
return this.httpInstance
|
|
15363
|
+
.request({
|
|
15364
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/change_reasons`, path),
|
|
15365
|
+
method: "GET",
|
|
15366
|
+
data,
|
|
15367
|
+
params,
|
|
15368
|
+
headers,
|
|
15369
|
+
})
|
|
15370
|
+
.catch((e) => {
|
|
15371
|
+
this.logger.error(formatErrors(e));
|
|
15372
|
+
throw e;
|
|
15373
|
+
});
|
|
15374
|
+
}),
|
|
15375
|
+
},
|
|
15376
|
+
/**
|
|
15377
|
+
* indicator
|
|
15378
|
+
*/
|
|
15379
|
+
indicator: {
|
|
15380
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15381
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15382
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15383
|
+
const res = yield this.httpInstance
|
|
15384
|
+
.request({
|
|
15385
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/indicators`, path),
|
|
15386
|
+
method: "GET",
|
|
15387
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
15388
|
+
params: pickBy(innerPayload.params, identity),
|
|
15389
|
+
data,
|
|
15390
|
+
})
|
|
15391
|
+
.catch((e) => {
|
|
15392
|
+
this.logger.error(formatErrors(e));
|
|
15393
|
+
});
|
|
15394
|
+
return res;
|
|
15395
|
+
});
|
|
15396
|
+
const Iterable = {
|
|
15397
|
+
[Symbol.asyncIterator]() {
|
|
15398
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15399
|
+
let hasMore = true;
|
|
15400
|
+
let pageToken;
|
|
15401
|
+
while (hasMore) {
|
|
15402
|
+
try {
|
|
15403
|
+
const res = yield __await(sendRequest({
|
|
15404
|
+
headers,
|
|
15405
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15406
|
+
data,
|
|
15407
|
+
}));
|
|
15408
|
+
const _b = get(res, "data") || {}, {
|
|
15409
|
+
// @ts-ignore
|
|
15410
|
+
has_more,
|
|
15411
|
+
// @ts-ignore
|
|
15412
|
+
page_token,
|
|
15413
|
+
// @ts-ignore
|
|
15414
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15415
|
+
yield yield __await(rest);
|
|
15416
|
+
hasMore = Boolean(has_more);
|
|
15417
|
+
pageToken = page_token || next_page_token;
|
|
15418
|
+
}
|
|
15419
|
+
catch (e) {
|
|
15420
|
+
yield yield __await(null);
|
|
15421
|
+
break;
|
|
15422
|
+
}
|
|
15423
|
+
}
|
|
15424
|
+
});
|
|
15425
|
+
},
|
|
15426
|
+
};
|
|
15427
|
+
return Iterable;
|
|
15428
|
+
}),
|
|
15429
|
+
/**
|
|
15430
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=indicator&apiName=list&version=v1 click to debug }
|
|
15431
|
+
*
|
|
15432
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=indicator&version=v1 document }
|
|
15433
|
+
*/
|
|
15434
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15435
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15436
|
+
return this.httpInstance
|
|
15437
|
+
.request({
|
|
15438
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/indicators`, path),
|
|
15439
|
+
method: "GET",
|
|
15440
|
+
data,
|
|
15441
|
+
params,
|
|
15442
|
+
headers,
|
|
15443
|
+
})
|
|
15444
|
+
.catch((e) => {
|
|
15445
|
+
this.logger.error(formatErrors(e));
|
|
15446
|
+
throw e;
|
|
15447
|
+
});
|
|
15448
|
+
}),
|
|
15449
|
+
},
|
|
15450
|
+
/**
|
|
15451
|
+
* item
|
|
15452
|
+
*/
|
|
15453
|
+
item: {
|
|
15454
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15455
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15456
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15457
|
+
const res = yield this.httpInstance
|
|
15458
|
+
.request({
|
|
15459
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/items`, path),
|
|
15460
|
+
method: "GET",
|
|
15461
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
15462
|
+
params: pickBy(innerPayload.params, identity),
|
|
15463
|
+
data,
|
|
15464
|
+
})
|
|
15465
|
+
.catch((e) => {
|
|
15466
|
+
this.logger.error(formatErrors(e));
|
|
15467
|
+
});
|
|
15468
|
+
return res;
|
|
15469
|
+
});
|
|
15470
|
+
const Iterable = {
|
|
15471
|
+
[Symbol.asyncIterator]() {
|
|
15472
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15473
|
+
let hasMore = true;
|
|
15474
|
+
let pageToken;
|
|
15475
|
+
while (hasMore) {
|
|
15476
|
+
try {
|
|
15477
|
+
const res = yield __await(sendRequest({
|
|
15478
|
+
headers,
|
|
15479
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15480
|
+
data,
|
|
15481
|
+
}));
|
|
15482
|
+
const _b = get(res, "data") || {}, {
|
|
15483
|
+
// @ts-ignore
|
|
15484
|
+
has_more,
|
|
15485
|
+
// @ts-ignore
|
|
15486
|
+
page_token,
|
|
15487
|
+
// @ts-ignore
|
|
15488
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15489
|
+
yield yield __await(rest);
|
|
15490
|
+
hasMore = Boolean(has_more);
|
|
15491
|
+
pageToken = page_token || next_page_token;
|
|
15492
|
+
}
|
|
15493
|
+
catch (e) {
|
|
15494
|
+
yield yield __await(null);
|
|
15495
|
+
break;
|
|
15496
|
+
}
|
|
15497
|
+
}
|
|
15498
|
+
});
|
|
15499
|
+
},
|
|
15500
|
+
};
|
|
15501
|
+
return Iterable;
|
|
15502
|
+
}),
|
|
15503
|
+
/**
|
|
15504
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=item&apiName=list&version=v1 click to debug }
|
|
15505
|
+
*
|
|
15506
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=item&version=v1 document }
|
|
15507
|
+
*/
|
|
15508
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15509
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15510
|
+
return this.httpInstance
|
|
15511
|
+
.request({
|
|
15512
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/items`, path),
|
|
15513
|
+
method: "GET",
|
|
15514
|
+
data,
|
|
15515
|
+
params,
|
|
15516
|
+
headers,
|
|
15517
|
+
})
|
|
15518
|
+
.catch((e) => {
|
|
15519
|
+
this.logger.error(formatErrors(e));
|
|
15520
|
+
throw e;
|
|
15521
|
+
});
|
|
15522
|
+
}),
|
|
15523
|
+
},
|
|
15524
|
+
/**
|
|
15525
|
+
* item_category
|
|
15526
|
+
*/
|
|
15527
|
+
itemCategory: {
|
|
15528
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15529
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15530
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15531
|
+
const res = yield this.httpInstance
|
|
15532
|
+
.request({
|
|
15533
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/item_categories`, path),
|
|
15534
|
+
method: "GET",
|
|
15535
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
15536
|
+
params: pickBy(innerPayload.params, identity),
|
|
15537
|
+
data,
|
|
15538
|
+
})
|
|
15539
|
+
.catch((e) => {
|
|
15540
|
+
this.logger.error(formatErrors(e));
|
|
15541
|
+
});
|
|
15542
|
+
return res;
|
|
15543
|
+
});
|
|
15544
|
+
const Iterable = {
|
|
15545
|
+
[Symbol.asyncIterator]() {
|
|
15546
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15547
|
+
let hasMore = true;
|
|
15548
|
+
let pageToken;
|
|
15549
|
+
while (hasMore) {
|
|
15550
|
+
try {
|
|
15551
|
+
const res = yield __await(sendRequest({
|
|
15552
|
+
headers,
|
|
15553
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15554
|
+
data,
|
|
15555
|
+
}));
|
|
15556
|
+
const _b = get(res, "data") || {}, {
|
|
15557
|
+
// @ts-ignore
|
|
15558
|
+
has_more,
|
|
15559
|
+
// @ts-ignore
|
|
15560
|
+
page_token,
|
|
15561
|
+
// @ts-ignore
|
|
15562
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15563
|
+
yield yield __await(rest);
|
|
15564
|
+
hasMore = Boolean(has_more);
|
|
15565
|
+
pageToken = page_token || next_page_token;
|
|
15566
|
+
}
|
|
15567
|
+
catch (e) {
|
|
15568
|
+
yield yield __await(null);
|
|
15569
|
+
break;
|
|
15570
|
+
}
|
|
15571
|
+
}
|
|
15572
|
+
});
|
|
15573
|
+
},
|
|
15574
|
+
};
|
|
15575
|
+
return Iterable;
|
|
15576
|
+
}),
|
|
15577
|
+
/**
|
|
15578
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=item_category&apiName=list&version=v1 click to debug }
|
|
15579
|
+
*
|
|
15580
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=item_category&version=v1 document }
|
|
15581
|
+
*/
|
|
15582
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15583
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15584
|
+
return this.httpInstance
|
|
15585
|
+
.request({
|
|
15586
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/item_categories`, path),
|
|
15587
|
+
method: "GET",
|
|
15588
|
+
data,
|
|
15589
|
+
params,
|
|
15590
|
+
headers,
|
|
15591
|
+
})
|
|
15592
|
+
.catch((e) => {
|
|
15593
|
+
this.logger.error(formatErrors(e));
|
|
15594
|
+
throw e;
|
|
15595
|
+
});
|
|
15596
|
+
}),
|
|
15597
|
+
},
|
|
15598
|
+
/**
|
|
15599
|
+
* plan
|
|
15600
|
+
*/
|
|
15601
|
+
plan: {
|
|
15602
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15603
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15604
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15605
|
+
const res = yield this.httpInstance
|
|
15606
|
+
.request({
|
|
15607
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/plans`, path),
|
|
15608
|
+
method: "GET",
|
|
15609
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
15610
|
+
params: pickBy(innerPayload.params, identity),
|
|
15611
|
+
data,
|
|
15612
|
+
})
|
|
15613
|
+
.catch((e) => {
|
|
15614
|
+
this.logger.error(formatErrors(e));
|
|
15615
|
+
});
|
|
15616
|
+
return res;
|
|
15617
|
+
});
|
|
15618
|
+
const Iterable = {
|
|
15619
|
+
[Symbol.asyncIterator]() {
|
|
15620
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15621
|
+
let hasMore = true;
|
|
15622
|
+
let pageToken;
|
|
15623
|
+
while (hasMore) {
|
|
15624
|
+
try {
|
|
15625
|
+
const res = yield __await(sendRequest({
|
|
15626
|
+
headers,
|
|
15627
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15628
|
+
data,
|
|
15629
|
+
}));
|
|
15630
|
+
const _b = get(res, "data") || {}, {
|
|
15631
|
+
// @ts-ignore
|
|
15632
|
+
has_more,
|
|
15633
|
+
// @ts-ignore
|
|
15634
|
+
page_token,
|
|
15635
|
+
// @ts-ignore
|
|
15636
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15637
|
+
yield yield __await(rest);
|
|
15638
|
+
hasMore = Boolean(has_more);
|
|
15639
|
+
pageToken = page_token || next_page_token;
|
|
15640
|
+
}
|
|
15641
|
+
catch (e) {
|
|
15642
|
+
yield yield __await(null);
|
|
15643
|
+
break;
|
|
15644
|
+
}
|
|
15645
|
+
}
|
|
15646
|
+
});
|
|
15647
|
+
},
|
|
15648
|
+
};
|
|
15649
|
+
return Iterable;
|
|
15650
|
+
}),
|
|
15651
|
+
/**
|
|
15652
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=plan&apiName=list&version=v1 click to debug }
|
|
15653
|
+
*
|
|
15654
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=plan&version=v1 document }
|
|
15655
|
+
*/
|
|
15656
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15657
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15658
|
+
return this.httpInstance
|
|
15659
|
+
.request({
|
|
15660
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/plans`, path),
|
|
15661
|
+
method: "GET",
|
|
15662
|
+
data,
|
|
15663
|
+
params,
|
|
15664
|
+
headers,
|
|
15665
|
+
})
|
|
15666
|
+
.catch((e) => {
|
|
15667
|
+
this.logger.error(formatErrors(e));
|
|
15668
|
+
throw e;
|
|
15669
|
+
});
|
|
15670
|
+
}),
|
|
15671
|
+
},
|
|
15672
|
+
},
|
|
15673
|
+
};
|
|
15674
|
+
}
|
|
15675
|
+
}
|
|
15676
|
+
|
|
15246
15677
|
// auto gen
|
|
15247
15678
|
class Client$L extends Client$M {
|
|
15248
15679
|
constructor() {
|
|
@@ -20130,6 +20561,55 @@ class Client$I extends Client$J {
|
|
|
20130
20561
|
});
|
|
20131
20562
|
}),
|
|
20132
20563
|
},
|
|
20564
|
+
/**
|
|
20565
|
+
* authorization
|
|
20566
|
+
*/
|
|
20567
|
+
authorization: {
|
|
20568
|
+
/**
|
|
20569
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=get_by_param&version=v1 click to debug }
|
|
20570
|
+
*
|
|
20571
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get_by_param&project=corehr&resource=authorization&version=v1 document }
|
|
20572
|
+
*
|
|
20573
|
+
* 根据ID查询单个用户授权
|
|
20574
|
+
*/
|
|
20575
|
+
getByParam: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
20576
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
20577
|
+
return this.httpInstance
|
|
20578
|
+
.request({
|
|
20579
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/get_by_param`, path),
|
|
20580
|
+
method: "GET",
|
|
20581
|
+
data,
|
|
20582
|
+
params,
|
|
20583
|
+
headers,
|
|
20584
|
+
})
|
|
20585
|
+
.catch((e) => {
|
|
20586
|
+
this.logger.error(formatErrors(e));
|
|
20587
|
+
throw e;
|
|
20588
|
+
});
|
|
20589
|
+
}),
|
|
20590
|
+
/**
|
|
20591
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=query&version=v1 click to debug }
|
|
20592
|
+
*
|
|
20593
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=authorization&version=v1 document }
|
|
20594
|
+
*
|
|
20595
|
+
* 批量查询用户授权
|
|
20596
|
+
*/
|
|
20597
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
20598
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
20599
|
+
return this.httpInstance
|
|
20600
|
+
.request({
|
|
20601
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/query`, path),
|
|
20602
|
+
method: "GET",
|
|
20603
|
+
data,
|
|
20604
|
+
params,
|
|
20605
|
+
headers,
|
|
20606
|
+
})
|
|
20607
|
+
.catch((e) => {
|
|
20608
|
+
this.logger.error(formatErrors(e));
|
|
20609
|
+
throw e;
|
|
20610
|
+
});
|
|
20611
|
+
}),
|
|
20612
|
+
},
|
|
20133
20613
|
/**
|
|
20134
20614
|
* common_data.id
|
|
20135
20615
|
*/
|
|
@@ -21993,6 +22473,30 @@ class Client$I extends Client$J {
|
|
|
21993
22473
|
* 个人信息
|
|
21994
22474
|
*/
|
|
21995
22475
|
person: {
|
|
22476
|
+
/**
|
|
22477
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=create&version=v1 click to debug }
|
|
22478
|
+
*
|
|
22479
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/create document }
|
|
22480
|
+
*
|
|
22481
|
+
* 创建个人信息
|
|
22482
|
+
*
|
|
22483
|
+
* 创建人员的个人信息
|
|
22484
|
+
*/
|
|
22485
|
+
create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
22486
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
22487
|
+
return this.httpInstance
|
|
22488
|
+
.request({
|
|
22489
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons`, path),
|
|
22490
|
+
method: "POST",
|
|
22491
|
+
data,
|
|
22492
|
+
params,
|
|
22493
|
+
headers,
|
|
22494
|
+
})
|
|
22495
|
+
.catch((e) => {
|
|
22496
|
+
this.logger.error(formatErrors(e));
|
|
22497
|
+
throw e;
|
|
22498
|
+
});
|
|
22499
|
+
}),
|
|
21996
22500
|
/**
|
|
21997
22501
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=delete&version=v1 click to debug }
|
|
21998
22502
|
*
|
|
@@ -22041,6 +22545,30 @@ class Client$I extends Client$J {
|
|
|
22041
22545
|
throw e;
|
|
22042
22546
|
});
|
|
22043
22547
|
}),
|
|
22548
|
+
/**
|
|
22549
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=patch&version=v1 click to debug }
|
|
22550
|
+
*
|
|
22551
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/patch document }
|
|
22552
|
+
*
|
|
22553
|
+
* 更新个人信息
|
|
22554
|
+
*
|
|
22555
|
+
* 更新个人信息
|
|
22556
|
+
*/
|
|
22557
|
+
patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
22558
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
22559
|
+
return this.httpInstance
|
|
22560
|
+
.request({
|
|
22561
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons/:person_id`, path),
|
|
22562
|
+
method: "PATCH",
|
|
22563
|
+
data,
|
|
22564
|
+
params,
|
|
22565
|
+
headers,
|
|
22566
|
+
})
|
|
22567
|
+
.catch((e) => {
|
|
22568
|
+
this.logger.error(formatErrors(e));
|
|
22569
|
+
throw e;
|
|
22570
|
+
});
|
|
22571
|
+
}),
|
|
22044
22572
|
/**
|
|
22045
22573
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=upload&version=v1 click to debug }
|
|
22046
22574
|
*
|
|
@@ -22569,6 +23097,55 @@ class Client$I extends Client$J {
|
|
|
22569
23097
|
});
|
|
22570
23098
|
}),
|
|
22571
23099
|
},
|
|
23100
|
+
/**
|
|
23101
|
+
* authorization
|
|
23102
|
+
*/
|
|
23103
|
+
authorization: {
|
|
23104
|
+
/**
|
|
23105
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=get_by_param&version=v1 click to debug }
|
|
23106
|
+
*
|
|
23107
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get_by_param&project=corehr&resource=authorization&version=v1 document }
|
|
23108
|
+
*
|
|
23109
|
+
* 根据ID查询单个用户授权
|
|
23110
|
+
*/
|
|
23111
|
+
getByParam: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
23112
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
23113
|
+
return this.httpInstance
|
|
23114
|
+
.request({
|
|
23115
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/get_by_param`, path),
|
|
23116
|
+
method: "GET",
|
|
23117
|
+
data,
|
|
23118
|
+
params,
|
|
23119
|
+
headers,
|
|
23120
|
+
})
|
|
23121
|
+
.catch((e) => {
|
|
23122
|
+
this.logger.error(formatErrors(e));
|
|
23123
|
+
throw e;
|
|
23124
|
+
});
|
|
23125
|
+
}),
|
|
23126
|
+
/**
|
|
23127
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=query&version=v1 click to debug }
|
|
23128
|
+
*
|
|
23129
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=authorization&version=v1 document }
|
|
23130
|
+
*
|
|
23131
|
+
* 批量查询用户授权
|
|
23132
|
+
*/
|
|
23133
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
23134
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
23135
|
+
return this.httpInstance
|
|
23136
|
+
.request({
|
|
23137
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/query`, path),
|
|
23138
|
+
method: "GET",
|
|
23139
|
+
data,
|
|
23140
|
+
params,
|
|
23141
|
+
headers,
|
|
23142
|
+
})
|
|
23143
|
+
.catch((e) => {
|
|
23144
|
+
this.logger.error(formatErrors(e));
|
|
23145
|
+
throw e;
|
|
23146
|
+
});
|
|
23147
|
+
}),
|
|
23148
|
+
},
|
|
22572
23149
|
/**
|
|
22573
23150
|
* common_data.id
|
|
22574
23151
|
*/
|
|
@@ -24432,6 +25009,30 @@ class Client$I extends Client$J {
|
|
|
24432
25009
|
* 个人信息
|
|
24433
25010
|
*/
|
|
24434
25011
|
person: {
|
|
25012
|
+
/**
|
|
25013
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=create&version=v1 click to debug }
|
|
25014
|
+
*
|
|
25015
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/create document }
|
|
25016
|
+
*
|
|
25017
|
+
* 创建个人信息
|
|
25018
|
+
*
|
|
25019
|
+
* 创建人员的个人信息
|
|
25020
|
+
*/
|
|
25021
|
+
create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
25022
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
25023
|
+
return this.httpInstance
|
|
25024
|
+
.request({
|
|
25025
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons`, path),
|
|
25026
|
+
method: "POST",
|
|
25027
|
+
data,
|
|
25028
|
+
params,
|
|
25029
|
+
headers,
|
|
25030
|
+
})
|
|
25031
|
+
.catch((e) => {
|
|
25032
|
+
this.logger.error(formatErrors(e));
|
|
25033
|
+
throw e;
|
|
25034
|
+
});
|
|
25035
|
+
}),
|
|
24435
25036
|
/**
|
|
24436
25037
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=delete&version=v1 click to debug }
|
|
24437
25038
|
*
|
|
@@ -24480,6 +25081,30 @@ class Client$I extends Client$J {
|
|
|
24480
25081
|
throw e;
|
|
24481
25082
|
});
|
|
24482
25083
|
}),
|
|
25084
|
+
/**
|
|
25085
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=patch&version=v1 click to debug }
|
|
25086
|
+
*
|
|
25087
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/patch document }
|
|
25088
|
+
*
|
|
25089
|
+
* 更新个人信息
|
|
25090
|
+
*
|
|
25091
|
+
* 更新个人信息
|
|
25092
|
+
*/
|
|
25093
|
+
patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
25094
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
25095
|
+
return this.httpInstance
|
|
25096
|
+
.request({
|
|
25097
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons/:person_id`, path),
|
|
25098
|
+
method: "PATCH",
|
|
25099
|
+
data,
|
|
25100
|
+
params,
|
|
25101
|
+
headers,
|
|
25102
|
+
})
|
|
25103
|
+
.catch((e) => {
|
|
25104
|
+
this.logger.error(formatErrors(e));
|
|
25105
|
+
throw e;
|
|
25106
|
+
});
|
|
25107
|
+
}),
|
|
24483
25108
|
/**
|
|
24484
25109
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=upload&version=v1 click to debug }
|
|
24485
25110
|
*
|
|
@@ -25977,6 +26602,28 @@ class Client$I extends Client$J {
|
|
|
25977
26602
|
throw e;
|
|
25978
26603
|
});
|
|
25979
26604
|
}),
|
|
26605
|
+
/**
|
|
26606
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=department&apiName=query_multi_timeline&version=v2 click to debug }
|
|
26607
|
+
*
|
|
26608
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query_multi_timeline&project=corehr&resource=department&version=v2 document }
|
|
26609
|
+
*
|
|
26610
|
+
* 查询任意日期部门信息
|
|
26611
|
+
*/
|
|
26612
|
+
queryMultiTimeline: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
26613
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
26614
|
+
return this.httpInstance
|
|
26615
|
+
.request({
|
|
26616
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v2/departments/query_multi_timeline`, path),
|
|
26617
|
+
method: "POST",
|
|
26618
|
+
data,
|
|
26619
|
+
params,
|
|
26620
|
+
headers,
|
|
26621
|
+
})
|
|
26622
|
+
.catch((e) => {
|
|
26623
|
+
this.logger.error(formatErrors(e));
|
|
26624
|
+
throw e;
|
|
26625
|
+
});
|
|
26626
|
+
}),
|
|
25980
26627
|
/**
|
|
25981
26628
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=department&apiName=query_timeline&version=v2 click to debug }
|
|
25982
26629
|
*
|
|
@@ -26391,6 +27038,33 @@ class Client$I extends Client$J {
|
|
|
26391
27038
|
});
|
|
26392
27039
|
}),
|
|
26393
27040
|
},
|
|
27041
|
+
/**
|
|
27042
|
+
* job_grade
|
|
27043
|
+
*/
|
|
27044
|
+
jobGrade: {
|
|
27045
|
+
/**
|
|
27046
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=job_grade&apiName=query&version=v2 click to debug }
|
|
27047
|
+
*
|
|
27048
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=job_grade&version=v2 document }
|
|
27049
|
+
*
|
|
27050
|
+
* 查询职等信息
|
|
27051
|
+
*/
|
|
27052
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
27053
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
27054
|
+
return this.httpInstance
|
|
27055
|
+
.request({
|
|
27056
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v2/job_grades/query`, path),
|
|
27057
|
+
method: "POST",
|
|
27058
|
+
data,
|
|
27059
|
+
params,
|
|
27060
|
+
headers,
|
|
27061
|
+
})
|
|
27062
|
+
.catch((e) => {
|
|
27063
|
+
this.logger.error(formatErrors(e));
|
|
27064
|
+
throw e;
|
|
27065
|
+
});
|
|
27066
|
+
}),
|
|
27067
|
+
},
|
|
26394
27068
|
/**
|
|
26395
27069
|
* job_level
|
|
26396
27070
|
*/
|
|
@@ -28613,7 +29287,7 @@ class Client$E extends Client$F {
|
|
|
28613
29287
|
}),
|
|
28614
29288
|
},
|
|
28615
29289
|
/**
|
|
28616
|
-
*
|
|
29290
|
+
* 异步任务状态
|
|
28617
29291
|
*/
|
|
28618
29292
|
file: {
|
|
28619
29293
|
/**
|
|
@@ -30312,7 +30986,7 @@ class Client$E extends Client$F {
|
|
|
30312
30986
|
}),
|
|
30313
30987
|
},
|
|
30314
30988
|
/**
|
|
30315
|
-
*
|
|
30989
|
+
* 异步任务状态
|
|
30316
30990
|
*/
|
|
30317
30991
|
file: {
|
|
30318
30992
|
/**
|
|
@@ -37443,6 +38117,31 @@ class Client$u extends Client$v {
|
|
|
37443
38117
|
});
|
|
37444
38118
|
}),
|
|
37445
38119
|
},
|
|
38120
|
+
/**
|
|
38121
|
+
* role
|
|
38122
|
+
*/
|
|
38123
|
+
role: {
|
|
38124
|
+
/**
|
|
38125
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=role&apiName=get&version=v1 click to debug }
|
|
38126
|
+
*
|
|
38127
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=hire&resource=role&version=v1 document }
|
|
38128
|
+
*/
|
|
38129
|
+
get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
38130
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
38131
|
+
return this.httpInstance
|
|
38132
|
+
.request({
|
|
38133
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/roles/:role_id`, path),
|
|
38134
|
+
method: "GET",
|
|
38135
|
+
data,
|
|
38136
|
+
params,
|
|
38137
|
+
headers,
|
|
38138
|
+
})
|
|
38139
|
+
.catch((e) => {
|
|
38140
|
+
this.logger.error(formatErrors(e));
|
|
38141
|
+
throw e;
|
|
38142
|
+
});
|
|
38143
|
+
}),
|
|
38144
|
+
},
|
|
37446
38145
|
/**
|
|
37447
38146
|
* 人才
|
|
37448
38147
|
*/
|
|
@@ -39613,91 +40312,169 @@ class Client$u extends Client$v {
|
|
|
39613
40312
|
return Iterable;
|
|
39614
40313
|
}),
|
|
39615
40314
|
/**
|
|
39616
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=referral_website.job_post&apiName=list&version=v1 click to debug }
|
|
40315
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=referral_website.job_post&apiName=list&version=v1 click to debug }
|
|
40316
|
+
*
|
|
40317
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=hire&resource=referral_website.job_post&version=v1 document }
|
|
40318
|
+
*
|
|
40319
|
+
* 获取内推官网下的职位列表。自定义数据暂不支持列表获取,请从「获取内推官网下职位广告详情」接口获取
|
|
40320
|
+
*/
|
|
40321
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40322
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40323
|
+
return this.httpInstance
|
|
40324
|
+
.request({
|
|
40325
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/referral_websites/job_posts`, path),
|
|
40326
|
+
method: "GET",
|
|
40327
|
+
data,
|
|
40328
|
+
params,
|
|
40329
|
+
headers,
|
|
40330
|
+
})
|
|
40331
|
+
.catch((e) => {
|
|
40332
|
+
this.logger.error(formatErrors(e));
|
|
40333
|
+
throw e;
|
|
40334
|
+
});
|
|
40335
|
+
}),
|
|
40336
|
+
},
|
|
40337
|
+
/**
|
|
40338
|
+
* registration_schema
|
|
40339
|
+
*/
|
|
40340
|
+
registrationSchema: {
|
|
40341
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40342
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40343
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
40344
|
+
const res = yield this.httpInstance
|
|
40345
|
+
.request({
|
|
40346
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
40347
|
+
method: "GET",
|
|
40348
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
40349
|
+
params: pickBy(innerPayload.params, identity),
|
|
40350
|
+
data,
|
|
40351
|
+
})
|
|
40352
|
+
.catch((e) => {
|
|
40353
|
+
this.logger.error(formatErrors(e));
|
|
40354
|
+
});
|
|
40355
|
+
return res;
|
|
40356
|
+
});
|
|
40357
|
+
const Iterable = {
|
|
40358
|
+
[Symbol.asyncIterator]() {
|
|
40359
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
40360
|
+
let hasMore = true;
|
|
40361
|
+
let pageToken;
|
|
40362
|
+
while (hasMore) {
|
|
40363
|
+
try {
|
|
40364
|
+
const res = yield __await(sendRequest({
|
|
40365
|
+
headers,
|
|
40366
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
40367
|
+
data,
|
|
40368
|
+
}));
|
|
40369
|
+
const _b = get(res, "data") || {}, {
|
|
40370
|
+
// @ts-ignore
|
|
40371
|
+
has_more,
|
|
40372
|
+
// @ts-ignore
|
|
40373
|
+
page_token,
|
|
40374
|
+
// @ts-ignore
|
|
40375
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
40376
|
+
yield yield __await(rest);
|
|
40377
|
+
hasMore = Boolean(has_more);
|
|
40378
|
+
pageToken = page_token || next_page_token;
|
|
40379
|
+
}
|
|
40380
|
+
catch (e) {
|
|
40381
|
+
yield yield __await(null);
|
|
40382
|
+
break;
|
|
40383
|
+
}
|
|
40384
|
+
}
|
|
40385
|
+
});
|
|
40386
|
+
},
|
|
40387
|
+
};
|
|
40388
|
+
return Iterable;
|
|
40389
|
+
}),
|
|
40390
|
+
/**
|
|
40391
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=registration_schema&apiName=list&version=v1 click to debug }
|
|
40392
|
+
*
|
|
40393
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=hire&resource=registration_schema&version=v1 document }
|
|
40394
|
+
*/
|
|
40395
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40396
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40397
|
+
return this.httpInstance
|
|
40398
|
+
.request({
|
|
40399
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
40400
|
+
method: "GET",
|
|
40401
|
+
data,
|
|
40402
|
+
params,
|
|
40403
|
+
headers,
|
|
40404
|
+
})
|
|
40405
|
+
.catch((e) => {
|
|
40406
|
+
this.logger.error(formatErrors(e));
|
|
40407
|
+
throw e;
|
|
40408
|
+
});
|
|
40409
|
+
}),
|
|
40410
|
+
},
|
|
40411
|
+
/**
|
|
40412
|
+
* 简历来源
|
|
40413
|
+
*/
|
|
40414
|
+
resumeSource: {
|
|
40415
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40416
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40417
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
40418
|
+
const res = yield this.httpInstance
|
|
40419
|
+
.request({
|
|
40420
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
40421
|
+
method: "GET",
|
|
40422
|
+
headers: pickBy(innerPayload.headers, identity),
|
|
40423
|
+
params: pickBy(innerPayload.params, identity),
|
|
40424
|
+
data,
|
|
40425
|
+
})
|
|
40426
|
+
.catch((e) => {
|
|
40427
|
+
this.logger.error(formatErrors(e));
|
|
40428
|
+
});
|
|
40429
|
+
return res;
|
|
40430
|
+
});
|
|
40431
|
+
const Iterable = {
|
|
40432
|
+
[Symbol.asyncIterator]() {
|
|
40433
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
40434
|
+
let hasMore = true;
|
|
40435
|
+
let pageToken;
|
|
40436
|
+
while (hasMore) {
|
|
40437
|
+
try {
|
|
40438
|
+
const res = yield __await(sendRequest({
|
|
40439
|
+
headers,
|
|
40440
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
40441
|
+
data,
|
|
40442
|
+
}));
|
|
40443
|
+
const _b = get(res, "data") || {}, {
|
|
40444
|
+
// @ts-ignore
|
|
40445
|
+
has_more,
|
|
40446
|
+
// @ts-ignore
|
|
40447
|
+
page_token,
|
|
40448
|
+
// @ts-ignore
|
|
40449
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
40450
|
+
yield yield __await(rest);
|
|
40451
|
+
hasMore = Boolean(has_more);
|
|
40452
|
+
pageToken = page_token || next_page_token;
|
|
40453
|
+
}
|
|
40454
|
+
catch (e) {
|
|
40455
|
+
yield yield __await(null);
|
|
40456
|
+
break;
|
|
40457
|
+
}
|
|
40458
|
+
}
|
|
40459
|
+
});
|
|
40460
|
+
},
|
|
40461
|
+
};
|
|
40462
|
+
return Iterable;
|
|
40463
|
+
}),
|
|
40464
|
+
/**
|
|
40465
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=resume_source&apiName=list&version=v1 click to debug }
|
|
39617
40466
|
*
|
|
39618
|
-
* {@link https://open.feishu.cn/
|
|
40467
|
+
* {@link https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/resume_source/list document }
|
|
39619
40468
|
*
|
|
39620
|
-
*
|
|
39621
|
-
*/
|
|
39622
|
-
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39623
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39624
|
-
return this.httpInstance
|
|
39625
|
-
.request({
|
|
39626
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/referral_websites/job_posts`, path),
|
|
39627
|
-
method: "GET",
|
|
39628
|
-
data,
|
|
39629
|
-
params,
|
|
39630
|
-
headers,
|
|
39631
|
-
})
|
|
39632
|
-
.catch((e) => {
|
|
39633
|
-
this.logger.error(formatErrors(e));
|
|
39634
|
-
throw e;
|
|
39635
|
-
});
|
|
39636
|
-
}),
|
|
39637
|
-
},
|
|
39638
|
-
/**
|
|
39639
|
-
* registration_schema
|
|
39640
|
-
*/
|
|
39641
|
-
registrationSchema: {
|
|
39642
|
-
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39643
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39644
|
-
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
39645
|
-
const res = yield this.httpInstance
|
|
39646
|
-
.request({
|
|
39647
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
39648
|
-
method: "GET",
|
|
39649
|
-
headers: pickBy(innerPayload.headers, identity),
|
|
39650
|
-
params: pickBy(innerPayload.params, identity),
|
|
39651
|
-
data,
|
|
39652
|
-
})
|
|
39653
|
-
.catch((e) => {
|
|
39654
|
-
this.logger.error(formatErrors(e));
|
|
39655
|
-
});
|
|
39656
|
-
return res;
|
|
39657
|
-
});
|
|
39658
|
-
const Iterable = {
|
|
39659
|
-
[Symbol.asyncIterator]() {
|
|
39660
|
-
return __asyncGenerator(this, arguments, function* _a() {
|
|
39661
|
-
let hasMore = true;
|
|
39662
|
-
let pageToken;
|
|
39663
|
-
while (hasMore) {
|
|
39664
|
-
try {
|
|
39665
|
-
const res = yield __await(sendRequest({
|
|
39666
|
-
headers,
|
|
39667
|
-
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
39668
|
-
data,
|
|
39669
|
-
}));
|
|
39670
|
-
const _b = get(res, "data") || {}, {
|
|
39671
|
-
// @ts-ignore
|
|
39672
|
-
has_more,
|
|
39673
|
-
// @ts-ignore
|
|
39674
|
-
page_token,
|
|
39675
|
-
// @ts-ignore
|
|
39676
|
-
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
39677
|
-
yield yield __await(rest);
|
|
39678
|
-
hasMore = Boolean(has_more);
|
|
39679
|
-
pageToken = page_token || next_page_token;
|
|
39680
|
-
}
|
|
39681
|
-
catch (e) {
|
|
39682
|
-
yield yield __await(null);
|
|
39683
|
-
break;
|
|
39684
|
-
}
|
|
39685
|
-
}
|
|
39686
|
-
});
|
|
39687
|
-
},
|
|
39688
|
-
};
|
|
39689
|
-
return Iterable;
|
|
39690
|
-
}),
|
|
39691
|
-
/**
|
|
39692
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=registration_schema&apiName=list&version=v1 click to debug }
|
|
40469
|
+
* 获取简历来源列表
|
|
39693
40470
|
*
|
|
39694
|
-
*
|
|
40471
|
+
* 获取简历来源列表
|
|
39695
40472
|
*/
|
|
39696
40473
|
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39697
40474
|
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39698
40475
|
return this.httpInstance
|
|
39699
40476
|
.request({
|
|
39700
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/
|
|
40477
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
39701
40478
|
method: "GET",
|
|
39702
40479
|
data,
|
|
39703
40480
|
params,
|
|
@@ -39710,72 +40487,19 @@ class Client$u extends Client$v {
|
|
|
39710
40487
|
}),
|
|
39711
40488
|
},
|
|
39712
40489
|
/**
|
|
39713
|
-
*
|
|
40490
|
+
* role
|
|
39714
40491
|
*/
|
|
39715
|
-
|
|
39716
|
-
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39717
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39718
|
-
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
39719
|
-
const res = yield this.httpInstance
|
|
39720
|
-
.request({
|
|
39721
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
39722
|
-
method: "GET",
|
|
39723
|
-
headers: pickBy(innerPayload.headers, identity),
|
|
39724
|
-
params: pickBy(innerPayload.params, identity),
|
|
39725
|
-
data,
|
|
39726
|
-
})
|
|
39727
|
-
.catch((e) => {
|
|
39728
|
-
this.logger.error(formatErrors(e));
|
|
39729
|
-
});
|
|
39730
|
-
return res;
|
|
39731
|
-
});
|
|
39732
|
-
const Iterable = {
|
|
39733
|
-
[Symbol.asyncIterator]() {
|
|
39734
|
-
return __asyncGenerator(this, arguments, function* _a() {
|
|
39735
|
-
let hasMore = true;
|
|
39736
|
-
let pageToken;
|
|
39737
|
-
while (hasMore) {
|
|
39738
|
-
try {
|
|
39739
|
-
const res = yield __await(sendRequest({
|
|
39740
|
-
headers,
|
|
39741
|
-
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
39742
|
-
data,
|
|
39743
|
-
}));
|
|
39744
|
-
const _b = get(res, "data") || {}, {
|
|
39745
|
-
// @ts-ignore
|
|
39746
|
-
has_more,
|
|
39747
|
-
// @ts-ignore
|
|
39748
|
-
page_token,
|
|
39749
|
-
// @ts-ignore
|
|
39750
|
-
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
39751
|
-
yield yield __await(rest);
|
|
39752
|
-
hasMore = Boolean(has_more);
|
|
39753
|
-
pageToken = page_token || next_page_token;
|
|
39754
|
-
}
|
|
39755
|
-
catch (e) {
|
|
39756
|
-
yield yield __await(null);
|
|
39757
|
-
break;
|
|
39758
|
-
}
|
|
39759
|
-
}
|
|
39760
|
-
});
|
|
39761
|
-
},
|
|
39762
|
-
};
|
|
39763
|
-
return Iterable;
|
|
39764
|
-
}),
|
|
40492
|
+
role: {
|
|
39765
40493
|
/**
|
|
39766
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=
|
|
39767
|
-
*
|
|
39768
|
-
* {@link https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/resume_source/list document }
|
|
39769
|
-
*
|
|
39770
|
-
* 获取简历来源列表
|
|
40494
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=role&apiName=get&version=v1 click to debug }
|
|
39771
40495
|
*
|
|
39772
|
-
*
|
|
40496
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=hire&resource=role&version=v1 document }
|
|
39773
40497
|
*/
|
|
39774
|
-
|
|
40498
|
+
get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39775
40499
|
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39776
40500
|
return this.httpInstance
|
|
39777
40501
|
.request({
|
|
39778
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/
|
|
40502
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/roles/:role_id`, path),
|
|
39779
40503
|
method: "GET",
|
|
39780
40504
|
data,
|
|
39781
40505
|
params,
|
|
@@ -41335,7 +42059,7 @@ class Client$s extends Client$t {
|
|
|
41335
42059
|
}),
|
|
41336
42060
|
},
|
|
41337
42061
|
/**
|
|
41338
|
-
*
|
|
42062
|
+
* 消息
|
|
41339
42063
|
*/
|
|
41340
42064
|
message: {
|
|
41341
42065
|
/**
|
|
@@ -43405,7 +44129,7 @@ class Client$s extends Client$t {
|
|
|
43405
44129
|
}),
|
|
43406
44130
|
},
|
|
43407
44131
|
/**
|
|
43408
|
-
*
|
|
44132
|
+
* 消息
|
|
43409
44133
|
*/
|
|
43410
44134
|
message: {
|
|
43411
44135
|
/**
|
|
@@ -60409,6 +61133,135 @@ class TokenManager {
|
|
|
60409
61133
|
}
|
|
60410
61134
|
}
|
|
60411
61135
|
|
|
61136
|
+
const mergeObject = (obj1, obj2) => {
|
|
61137
|
+
const mergedObject = Object.assign({}, obj1);
|
|
61138
|
+
for (let [key, value] of Object.entries(obj2)) {
|
|
61139
|
+
if (value !== undefined) {
|
|
61140
|
+
mergedObject[key] = value;
|
|
61141
|
+
}
|
|
61142
|
+
}
|
|
61143
|
+
return mergedObject;
|
|
61144
|
+
};
|
|
61145
|
+
|
|
61146
|
+
class UserAccessToken {
|
|
61147
|
+
constructor(params) {
|
|
61148
|
+
this.client = params.client;
|
|
61149
|
+
}
|
|
61150
|
+
getCacheKey(key, options) {
|
|
61151
|
+
const namespace = get(options, 'namespace', this.client.appId);
|
|
61152
|
+
return `${namespace}/${CUserAccessToken.toString()}/${key}`;
|
|
61153
|
+
}
|
|
61154
|
+
// the unit of time is seconds
|
|
61155
|
+
calibrateTime(time) {
|
|
61156
|
+
// Due to the time-consuming network, the time needs to be 3 minutes earlier
|
|
61157
|
+
return new Date().getTime() + (time || 0) * 1000 - 3 * 60 * 1000;
|
|
61158
|
+
}
|
|
61159
|
+
initWithCode(key2Code, options) {
|
|
61160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61161
|
+
const key2Info = {};
|
|
61162
|
+
for (const [key, code] of Object.entries(key2Code)) {
|
|
61163
|
+
const oidcAccessInfo = yield this.client.authen.oidcAccessToken.create({
|
|
61164
|
+
data: {
|
|
61165
|
+
grant_type: 'authorization_code',
|
|
61166
|
+
code
|
|
61167
|
+
}
|
|
61168
|
+
});
|
|
61169
|
+
if (oidcAccessInfo.code !== 0) {
|
|
61170
|
+
// @ts-ignore
|
|
61171
|
+
this.client.logger.error('init user access token error', key, oidcAccessInfo.msg || oidcAccessInfo.message);
|
|
61172
|
+
continue;
|
|
61173
|
+
}
|
|
61174
|
+
// code expired
|
|
61175
|
+
if (!oidcAccessInfo.data) {
|
|
61176
|
+
this.client.logger.error('user access code expired', key, code);
|
|
61177
|
+
continue;
|
|
61178
|
+
}
|
|
61179
|
+
key2Info[key] = {
|
|
61180
|
+
code,
|
|
61181
|
+
token: oidcAccessInfo.data.access_token,
|
|
61182
|
+
refreshToken: oidcAccessInfo.data.refresh_token,
|
|
61183
|
+
expiredTime: this.calibrateTime(oidcAccessInfo.data.expires_in)
|
|
61184
|
+
};
|
|
61185
|
+
}
|
|
61186
|
+
yield this.update(key2Info, { namespace: get(options, 'namespace') });
|
|
61187
|
+
return key2Info;
|
|
61188
|
+
});
|
|
61189
|
+
}
|
|
61190
|
+
update(key2Info, options) {
|
|
61191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61192
|
+
for (const [key, info] of Object.entries(key2Info)) {
|
|
61193
|
+
const cacheKey = this.getCacheKey(key, { namespace: get(options, 'namespace') });
|
|
61194
|
+
const cacheValue = (yield this.client.cache.get(cacheKey)) || {};
|
|
61195
|
+
const { code, token, refreshToken, expiredTime } = info;
|
|
61196
|
+
const targetValue = mergeObject(cacheValue, { code, token, refreshToken, expiredTime });
|
|
61197
|
+
yield this.client.cache.set(cacheKey, targetValue, Infinity);
|
|
61198
|
+
}
|
|
61199
|
+
});
|
|
61200
|
+
}
|
|
61201
|
+
get(key, options) {
|
|
61202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61203
|
+
const cacheKey = this.getCacheKey(key, { namespace: get(options, 'namespace') });
|
|
61204
|
+
const cacheInfo = yield this.client.cache.get(cacheKey);
|
|
61205
|
+
// cacheInfo是否存在
|
|
61206
|
+
if (!cacheInfo) {
|
|
61207
|
+
this.client.logger.error('user access token needs to be initialized or updated first');
|
|
61208
|
+
return;
|
|
61209
|
+
}
|
|
61210
|
+
const { token, code, refreshToken, expiredTime } = cacheInfo;
|
|
61211
|
+
// step1 token存在且未过期
|
|
61212
|
+
if (token && expiredTime && expiredTime - new Date().getTime() > 0) {
|
|
61213
|
+
return token;
|
|
61214
|
+
}
|
|
61215
|
+
// step2 refresh token存在,刷新token
|
|
61216
|
+
if (refreshToken) {
|
|
61217
|
+
const refreshAccessInfo = yield this.client.authen.oidcRefreshAccessToken.create({
|
|
61218
|
+
data: {
|
|
61219
|
+
grant_type: 'refresh_token',
|
|
61220
|
+
refresh_token: refreshToken
|
|
61221
|
+
}
|
|
61222
|
+
});
|
|
61223
|
+
if (refreshAccessInfo.code === 0 && refreshAccessInfo.data) {
|
|
61224
|
+
yield this.update({
|
|
61225
|
+
key: {
|
|
61226
|
+
token: refreshAccessInfo.data.access_token,
|
|
61227
|
+
refreshToken: refreshAccessInfo.data.refresh_token,
|
|
61228
|
+
expiredTime: this.calibrateTime(refreshAccessInfo.data.expires_in)
|
|
61229
|
+
}
|
|
61230
|
+
});
|
|
61231
|
+
return refreshAccessInfo.data.access_token;
|
|
61232
|
+
}
|
|
61233
|
+
else {
|
|
61234
|
+
this.client.logger.error('get user access token by refresh token failed.', refreshAccessInfo.msg);
|
|
61235
|
+
return;
|
|
61236
|
+
}
|
|
61237
|
+
}
|
|
61238
|
+
// step3 code存在的话,用code重新获取
|
|
61239
|
+
if (code) {
|
|
61240
|
+
const oidcAccessInfo = yield this.client.authen.oidcAccessToken.create({
|
|
61241
|
+
data: {
|
|
61242
|
+
grant_type: "authorization_code",
|
|
61243
|
+
code: code
|
|
61244
|
+
}
|
|
61245
|
+
});
|
|
61246
|
+
if (oidcAccessInfo.code === 0 && oidcAccessInfo.data) {
|
|
61247
|
+
yield this.update({
|
|
61248
|
+
key: {
|
|
61249
|
+
token: oidcAccessInfo.data.access_token,
|
|
61250
|
+
refreshToken: oidcAccessInfo.data.refresh_token,
|
|
61251
|
+
expiredTime: this.calibrateTime(oidcAccessInfo.data.expires_in)
|
|
61252
|
+
}
|
|
61253
|
+
});
|
|
61254
|
+
}
|
|
61255
|
+
else {
|
|
61256
|
+
this.client.logger.error('get user access token by code failed.', oidcAccessInfo.msg);
|
|
61257
|
+
}
|
|
61258
|
+
}
|
|
61259
|
+
// step4 重试完毕没结果后,返回undefine
|
|
61260
|
+
return;
|
|
61261
|
+
});
|
|
61262
|
+
}
|
|
61263
|
+
}
|
|
61264
|
+
|
|
60412
61265
|
class Client extends Client$1 {
|
|
60413
61266
|
constructor(params) {
|
|
60414
61267
|
super();
|
|
@@ -60439,6 +61292,7 @@ class Client extends Client$1 {
|
|
|
60439
61292
|
appType: this.appType,
|
|
60440
61293
|
httpInstance: this.httpInstance,
|
|
60441
61294
|
});
|
|
61295
|
+
this.userAccessToken = new UserAccessToken({ client: this });
|
|
60442
61296
|
this.logger.info('client ready');
|
|
60443
61297
|
}
|
|
60444
61298
|
formatPayload(payload, options) {
|
|
@@ -62042,4 +62896,265 @@ class WSClient {
|
|
|
62042
62896
|
}
|
|
62043
62897
|
}
|
|
62044
62898
|
|
|
62045
|
-
|
|
62899
|
+
class SessionCache {
|
|
62900
|
+
constructor() {
|
|
62901
|
+
this.sessions = new Map();
|
|
62902
|
+
}
|
|
62903
|
+
set(key, value) {
|
|
62904
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62905
|
+
const sessions = this.sessions.get(key.toString()) || {};
|
|
62906
|
+
const mergedSessions = mergeObject(sessions, value);
|
|
62907
|
+
this.sessions.set(key.toString(), mergedSessions);
|
|
62908
|
+
return true;
|
|
62909
|
+
});
|
|
62910
|
+
}
|
|
62911
|
+
get(key) {
|
|
62912
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62913
|
+
return this.sessions.get(key.toString());
|
|
62914
|
+
});
|
|
62915
|
+
}
|
|
62916
|
+
}
|
|
62917
|
+
|
|
62918
|
+
var EExecStatus;
|
|
62919
|
+
(function (EExecStatus) {
|
|
62920
|
+
EExecStatus[EExecStatus["ERROR"] = -1] = "ERROR";
|
|
62921
|
+
EExecStatus[EExecStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
62922
|
+
EExecStatus[EExecStatus["EXPIRED"] = 1] = "EXPIRED";
|
|
62923
|
+
EExecStatus[EExecStatus["CANCELLED"] = 2] = "CANCELLED";
|
|
62924
|
+
EExecStatus[EExecStatus["FAILED"] = 3] = "FAILED";
|
|
62925
|
+
EExecStatus[EExecStatus["OTHER"] = 4] = "OTHER";
|
|
62926
|
+
})(EExecStatus || (EExecStatus = {}));
|
|
62927
|
+
class Aily {
|
|
62928
|
+
constructor(params) {
|
|
62929
|
+
this.completions = {
|
|
62930
|
+
create: this.create.bind(this),
|
|
62931
|
+
createWithStream: this.createWithStream.bind(this),
|
|
62932
|
+
sessionRecords: {
|
|
62933
|
+
get: this.getRecords.bind(this),
|
|
62934
|
+
update: this.updateRecords.bind(this)
|
|
62935
|
+
}
|
|
62936
|
+
};
|
|
62937
|
+
this.client = params.client;
|
|
62938
|
+
this.logger = params.client.logger;
|
|
62939
|
+
this.cache = params.cache || new SessionCache();
|
|
62940
|
+
}
|
|
62941
|
+
getSessionId(params) {
|
|
62942
|
+
var _a;
|
|
62943
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62944
|
+
const { sessionId, payload, options } = params;
|
|
62945
|
+
const records = yield this.getRecords();
|
|
62946
|
+
if (sessionId && sessionId in records) {
|
|
62947
|
+
return records[sessionId];
|
|
62948
|
+
}
|
|
62949
|
+
const ailySession = yield this.client.aily.v1.ailySession.create({ data: payload }, options);
|
|
62950
|
+
if (ailySession.code === 0 && ailySession.data) {
|
|
62951
|
+
const ailySessionId = (_a = ailySession.data.session) === null || _a === void 0 ? void 0 : _a.id;
|
|
62952
|
+
if (sessionId) {
|
|
62953
|
+
yield this.updateRecords({ [sessionId]: ailySessionId });
|
|
62954
|
+
}
|
|
62955
|
+
return ailySessionId;
|
|
62956
|
+
}
|
|
62957
|
+
else {
|
|
62958
|
+
this.logger.error('get aily session id error', ailySession.msg);
|
|
62959
|
+
return undefined;
|
|
62960
|
+
}
|
|
62961
|
+
});
|
|
62962
|
+
}
|
|
62963
|
+
waitReply(params, options) {
|
|
62964
|
+
var _a, _b;
|
|
62965
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62966
|
+
const { sessionId, ailyAppId, message, sessionInfo, messageInfo, runInfo, skillId } = params;
|
|
62967
|
+
// step1 get aily session id
|
|
62968
|
+
const ailySessionId = yield this.getSessionId({ sessionId, payload: sessionInfo, options });
|
|
62969
|
+
if (!ailySessionId) {
|
|
62970
|
+
throw EExecStatus.ERROR;
|
|
62971
|
+
}
|
|
62972
|
+
// step2 create message and run
|
|
62973
|
+
const ailySessionMessage = yield this.client.aily.v1.ailySessionAilyMessage.create({
|
|
62974
|
+
path: {
|
|
62975
|
+
aily_session_id: ailySessionId
|
|
62976
|
+
},
|
|
62977
|
+
data: Object.assign(Object.assign({}, messageInfo), { content: message, idempotent_id: `${Date.now()}`, content_type: 'MDX' })
|
|
62978
|
+
}, options);
|
|
62979
|
+
if (!(ailySessionMessage.code === 0 && ailySessionMessage.data)) {
|
|
62980
|
+
this.logger.error('create aily message error', ailySessionMessage.msg);
|
|
62981
|
+
throw EExecStatus.ERROR;
|
|
62982
|
+
}
|
|
62983
|
+
const messageId = (_a = ailySessionMessage.data.message) === null || _a === void 0 ? void 0 : _a.id;
|
|
62984
|
+
const ailySessionRun = yield this.client.aily.v1.ailySessionRun.create({
|
|
62985
|
+
path: {
|
|
62986
|
+
aily_session_id: ailySessionId
|
|
62987
|
+
},
|
|
62988
|
+
data: Object.assign({ app_id: ailyAppId, skill_id: skillId }, runInfo)
|
|
62989
|
+
}, options);
|
|
62990
|
+
if (!(ailySessionRun.code === 0 && ailySessionRun.data)) {
|
|
62991
|
+
this.logger.error('create aily session run error', ailySessionRun.msg);
|
|
62992
|
+
throw EExecStatus.ERROR;
|
|
62993
|
+
}
|
|
62994
|
+
const runId = (_b = ailySessionRun.data.run) === null || _b === void 0 ? void 0 : _b.id;
|
|
62995
|
+
if (!runId) {
|
|
62996
|
+
this.logger.error('run id is empty');
|
|
62997
|
+
throw EExecStatus.ERROR;
|
|
62998
|
+
}
|
|
62999
|
+
// step3 wait run complete
|
|
63000
|
+
const polling = () => __awaiter(this, void 0, void 0, function* () {
|
|
63001
|
+
return new Promise((resolve) => {
|
|
63002
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
63003
|
+
var _a, _b;
|
|
63004
|
+
const runStatusInfo = yield this.client.aily.v1.ailySessionRun.get({
|
|
63005
|
+
path: {
|
|
63006
|
+
aily_session_id: ailySessionId,
|
|
63007
|
+
run_id: runId
|
|
63008
|
+
}
|
|
63009
|
+
}, options);
|
|
63010
|
+
if (!(runStatusInfo.code === 0 && runStatusInfo.data)) {
|
|
63011
|
+
resolve(3);
|
|
63012
|
+
return;
|
|
63013
|
+
}
|
|
63014
|
+
const status = (_b = (_a = runStatusInfo.data) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.status;
|
|
63015
|
+
switch (status) {
|
|
63016
|
+
case 'QUEUED':
|
|
63017
|
+
case 'IN_PROGRESS': yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
63018
|
+
const ret = yield polling();
|
|
63019
|
+
resolve(ret);
|
|
63020
|
+
}))();
|
|
63021
|
+
case 'COMPLETED': resolve(EExecStatus.SUCCESS);
|
|
63022
|
+
case 'EXPIRED': resolve(EExecStatus.EXPIRED);
|
|
63023
|
+
case 'CANCELLED': resolve(EExecStatus.CANCELLED);
|
|
63024
|
+
case 'FAILED': resolve(EExecStatus.FAILED);
|
|
63025
|
+
default: resolve(EExecStatus.OTHER);
|
|
63026
|
+
}
|
|
63027
|
+
}), 500);
|
|
63028
|
+
});
|
|
63029
|
+
});
|
|
63030
|
+
const pollingRet = yield polling();
|
|
63031
|
+
if (pollingRet !== EExecStatus.SUCCESS) {
|
|
63032
|
+
this.logger.error('aily run error');
|
|
63033
|
+
throw pollingRet;
|
|
63034
|
+
}
|
|
63035
|
+
return {
|
|
63036
|
+
ailySessionId,
|
|
63037
|
+
runId,
|
|
63038
|
+
messageId
|
|
63039
|
+
};
|
|
63040
|
+
});
|
|
63041
|
+
}
|
|
63042
|
+
create(params, options) {
|
|
63043
|
+
var _a, e_1, _b, _c;
|
|
63044
|
+
var _d;
|
|
63045
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63046
|
+
const { ailySessionId, runId } = yield this.waitReply(params, options);
|
|
63047
|
+
let reply;
|
|
63048
|
+
try {
|
|
63049
|
+
for (var _e = true, _f = __asyncValues(yield this.client.aily.v1.ailySessionAilyMessage.listWithIterator({
|
|
63050
|
+
path: {
|
|
63051
|
+
aily_session_id: ailySessionId,
|
|
63052
|
+
},
|
|
63053
|
+
params: {
|
|
63054
|
+
run_id: runId,
|
|
63055
|
+
with_partial_message: false,
|
|
63056
|
+
}
|
|
63057
|
+
}, options)), _g; _g = yield _f.next(), _a = _g.done, !_a;) {
|
|
63058
|
+
_c = _g.value;
|
|
63059
|
+
_e = false;
|
|
63060
|
+
try {
|
|
63061
|
+
const items = _c;
|
|
63062
|
+
if (!items) {
|
|
63063
|
+
continue;
|
|
63064
|
+
}
|
|
63065
|
+
(_d = items === null || items === void 0 ? void 0 : items.messages) === null || _d === void 0 ? void 0 : _d.forEach(message => {
|
|
63066
|
+
var _a;
|
|
63067
|
+
if (((_a = message.sender) === null || _a === void 0 ? void 0 : _a.sender_type) === 'ASSISTANT') {
|
|
63068
|
+
reply = message;
|
|
63069
|
+
}
|
|
63070
|
+
});
|
|
63071
|
+
}
|
|
63072
|
+
finally {
|
|
63073
|
+
_e = true;
|
|
63074
|
+
}
|
|
63075
|
+
}
|
|
63076
|
+
}
|
|
63077
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
63078
|
+
finally {
|
|
63079
|
+
try {
|
|
63080
|
+
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
|
63081
|
+
}
|
|
63082
|
+
finally { if (e_1) throw e_1.error; }
|
|
63083
|
+
}
|
|
63084
|
+
if (!reply) {
|
|
63085
|
+
this.logger.error('no aily reply');
|
|
63086
|
+
throw EExecStatus.ERROR;
|
|
63087
|
+
}
|
|
63088
|
+
return reply;
|
|
63089
|
+
});
|
|
63090
|
+
}
|
|
63091
|
+
createWithStream(params, options) {
|
|
63092
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63093
|
+
const { ailySessionId, runId, messageId } = yield this.waitReply(params, options);
|
|
63094
|
+
const listMessages = () => this.client.aily.v1.ailySessionAilyMessage.listWithIterator({
|
|
63095
|
+
path: {
|
|
63096
|
+
aily_session_id: ailySessionId,
|
|
63097
|
+
},
|
|
63098
|
+
params: {
|
|
63099
|
+
run_id: runId,
|
|
63100
|
+
with_partial_message: true,
|
|
63101
|
+
}
|
|
63102
|
+
}, options);
|
|
63103
|
+
let startOutput = false;
|
|
63104
|
+
const Iterable = {
|
|
63105
|
+
[Symbol.asyncIterator]() {
|
|
63106
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
63107
|
+
var _b, e_2, _c, _d;
|
|
63108
|
+
try {
|
|
63109
|
+
for (var _e = true, _f = __asyncValues(yield __await(listMessages())), _g; _g = yield __await(_f.next()), _b = _g.done, !_b;) {
|
|
63110
|
+
_d = _g.value;
|
|
63111
|
+
_e = false;
|
|
63112
|
+
try {
|
|
63113
|
+
const items = _d;
|
|
63114
|
+
if (!items) {
|
|
63115
|
+
continue;
|
|
63116
|
+
}
|
|
63117
|
+
for (const message of items.messages || []) {
|
|
63118
|
+
if (startOutput) {
|
|
63119
|
+
yield yield __await(message);
|
|
63120
|
+
if (message.status === 'COMPLETED') {
|
|
63121
|
+
return yield __await(void 0);
|
|
63122
|
+
}
|
|
63123
|
+
}
|
|
63124
|
+
else if (message.id === messageId && message.status === 'COMPLETED') {
|
|
63125
|
+
startOutput = true;
|
|
63126
|
+
}
|
|
63127
|
+
}
|
|
63128
|
+
}
|
|
63129
|
+
finally {
|
|
63130
|
+
_e = true;
|
|
63131
|
+
}
|
|
63132
|
+
}
|
|
63133
|
+
}
|
|
63134
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
63135
|
+
finally {
|
|
63136
|
+
try {
|
|
63137
|
+
if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
|
|
63138
|
+
}
|
|
63139
|
+
finally { if (e_2) throw e_2.error; }
|
|
63140
|
+
}
|
|
63141
|
+
});
|
|
63142
|
+
}
|
|
63143
|
+
};
|
|
63144
|
+
return Iterable;
|
|
63145
|
+
});
|
|
63146
|
+
}
|
|
63147
|
+
getRecords() {
|
|
63148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63149
|
+
const sessions = (yield this.cache.get(CAilySessionRecord)) || {};
|
|
63150
|
+
return sessions;
|
|
63151
|
+
});
|
|
63152
|
+
}
|
|
63153
|
+
updateRecords(records) {
|
|
63154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63155
|
+
yield this.cache.set(CAilySessionRecord, records);
|
|
63156
|
+
});
|
|
63157
|
+
}
|
|
63158
|
+
}
|
|
63159
|
+
|
|
63160
|
+
export { AESCipher, Aily, AppType, CAppTicket, CTenantAccessToken, CardActionHandler, Client, Domain, EventDispatcher, LoggerLevel, WSClient, adaptDefault, adaptExpress, adaptKoa, adaptKoaRouter, defaultHttpInstance, generateChallenge, messageCard, withAll, withHelpDeskCredential, withTenantKey, withTenantToken, withUserAccessToken };
|