@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/lib/index.js
CHANGED
|
@@ -75,6 +75,18 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function __values(o) {
|
|
79
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
80
|
+
if (m) return m.call(o);
|
|
81
|
+
if (o && typeof o.length === "number") return {
|
|
82
|
+
next: function () {
|
|
83
|
+
if (o && i >= o.length) o = void 0;
|
|
84
|
+
return { value: o && o[i++], done: !o };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
function __await(v) {
|
|
79
91
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
80
92
|
}
|
|
@@ -91,6 +103,14 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
91
103
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
92
104
|
}
|
|
93
105
|
|
|
106
|
+
function __asyncValues(o) {
|
|
107
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
108
|
+
var m = o[Symbol.asyncIterator], i;
|
|
109
|
+
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);
|
|
110
|
+
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); }); }; }
|
|
111
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
112
|
+
}
|
|
113
|
+
|
|
94
114
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
95
115
|
var e = new Error(message);
|
|
96
116
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -131,6 +151,8 @@ const CAppTicket = Symbol('app-ticket');
|
|
|
131
151
|
const CTenantAccessToken = Symbol('tenant-access-token');
|
|
132
152
|
const CWithHelpdeskAuthorization = Symbol('with-helpdesk-authorization');
|
|
133
153
|
const CWithUserAccessToken = Symbol('with-user-access-token');
|
|
154
|
+
const CUserAccessToken = Symbol('user-access-token');
|
|
155
|
+
const CAilySessionRecord = Symbol('aily-session-record');
|
|
134
156
|
|
|
135
157
|
const string2Base64 = (content) => Buffer.from(content).toString('base64');
|
|
136
158
|
|
|
@@ -238,7 +260,7 @@ const formatErrors = (e) => {
|
|
|
238
260
|
};
|
|
239
261
|
|
|
240
262
|
// auto gen
|
|
241
|
-
class Client
|
|
263
|
+
class Client$$ {
|
|
242
264
|
constructor() {
|
|
243
265
|
/**
|
|
244
266
|
* 智能门禁
|
|
@@ -1211,7 +1233,7 @@ class Client$_ {
|
|
|
1211
1233
|
}
|
|
1212
1234
|
|
|
1213
1235
|
// auto gen
|
|
1214
|
-
class Client$
|
|
1236
|
+
class Client$_ extends Client$$ {
|
|
1215
1237
|
constructor() {
|
|
1216
1238
|
super(...arguments);
|
|
1217
1239
|
/**
|
|
@@ -2267,7 +2289,7 @@ class Client$Z extends Client$_ {
|
|
|
2267
2289
|
}
|
|
2268
2290
|
|
|
2269
2291
|
// auto gen
|
|
2270
|
-
class Client$
|
|
2292
|
+
class Client$Z extends Client$_ {
|
|
2271
2293
|
constructor() {
|
|
2272
2294
|
super(...arguments);
|
|
2273
2295
|
/**
|
|
@@ -2636,7 +2658,7 @@ class Client$Y extends Client$Z {
|
|
|
2636
2658
|
}
|
|
2637
2659
|
|
|
2638
2660
|
// auto gen
|
|
2639
|
-
class Client$
|
|
2661
|
+
class Client$Y extends Client$Z {
|
|
2640
2662
|
constructor() {
|
|
2641
2663
|
super(...arguments);
|
|
2642
2664
|
/**
|
|
@@ -3862,7 +3884,7 @@ class Client$X extends Client$Y {
|
|
|
3862
3884
|
}
|
|
3863
3885
|
|
|
3864
3886
|
// auto gen
|
|
3865
|
-
class Client$
|
|
3887
|
+
class Client$X extends Client$Y {
|
|
3866
3888
|
constructor() {
|
|
3867
3889
|
super(...arguments);
|
|
3868
3890
|
/**
|
|
@@ -4155,7 +4177,7 @@ class Client$W extends Client$X {
|
|
|
4155
4177
|
}),
|
|
4156
4178
|
},
|
|
4157
4179
|
/**
|
|
4158
|
-
*
|
|
4180
|
+
* 审批查询
|
|
4159
4181
|
*/
|
|
4160
4182
|
instance: {
|
|
4161
4183
|
/**
|
|
@@ -5124,7 +5146,7 @@ class Client$W extends Client$X {
|
|
|
5124
5146
|
}),
|
|
5125
5147
|
},
|
|
5126
5148
|
/**
|
|
5127
|
-
*
|
|
5149
|
+
* 审批查询
|
|
5128
5150
|
*/
|
|
5129
5151
|
instance: {
|
|
5130
5152
|
/**
|
|
@@ -5812,7 +5834,7 @@ class Client$W extends Client$X {
|
|
|
5812
5834
|
}
|
|
5813
5835
|
|
|
5814
5836
|
// auto gen
|
|
5815
|
-
class Client$
|
|
5837
|
+
class Client$W extends Client$X {
|
|
5816
5838
|
constructor() {
|
|
5817
5839
|
super(...arguments);
|
|
5818
5840
|
/**
|
|
@@ -7760,7 +7782,7 @@ class Client$V extends Client$W {
|
|
|
7760
7782
|
}
|
|
7761
7783
|
|
|
7762
7784
|
// auto gen
|
|
7763
|
-
class Client$
|
|
7785
|
+
class Client$V extends Client$W {
|
|
7764
7786
|
constructor() {
|
|
7765
7787
|
super(...arguments);
|
|
7766
7788
|
/**
|
|
@@ -8004,7 +8026,7 @@ class Client$U extends Client$V {
|
|
|
8004
8026
|
}
|
|
8005
8027
|
|
|
8006
8028
|
// auto gen
|
|
8007
|
-
class Client$
|
|
8029
|
+
class Client$U extends Client$V {
|
|
8008
8030
|
constructor() {
|
|
8009
8031
|
super(...arguments);
|
|
8010
8032
|
/**
|
|
@@ -8268,7 +8290,7 @@ class Client$T extends Client$U {
|
|
|
8268
8290
|
}
|
|
8269
8291
|
|
|
8270
8292
|
// auto gen
|
|
8271
|
-
class Client$
|
|
8293
|
+
class Client$T extends Client$U {
|
|
8272
8294
|
constructor() {
|
|
8273
8295
|
super(...arguments);
|
|
8274
8296
|
/**
|
|
@@ -8279,7 +8301,7 @@ class Client$S extends Client$T {
|
|
|
8279
8301
|
}
|
|
8280
8302
|
|
|
8281
8303
|
// auto gen
|
|
8282
|
-
class Client$
|
|
8304
|
+
class Client$S extends Client$T {
|
|
8283
8305
|
constructor() {
|
|
8284
8306
|
super(...arguments);
|
|
8285
8307
|
/**
|
|
@@ -9295,7 +9317,7 @@ class Client$R extends Client$S {
|
|
|
9295
9317
|
}
|
|
9296
9318
|
|
|
9297
9319
|
// auto gen
|
|
9298
|
-
class Client$
|
|
9320
|
+
class Client$R extends Client$S {
|
|
9299
9321
|
constructor() {
|
|
9300
9322
|
super(...arguments);
|
|
9301
9323
|
/**
|
|
@@ -12443,7 +12465,7 @@ class Client$Q extends Client$R {
|
|
|
12443
12465
|
}
|
|
12444
12466
|
|
|
12445
12467
|
// auto gen
|
|
12446
|
-
class Client$
|
|
12468
|
+
class Client$Q extends Client$R {
|
|
12447
12469
|
constructor() {
|
|
12448
12470
|
super(...arguments);
|
|
12449
12471
|
/**
|
|
@@ -12621,7 +12643,7 @@ class Client$P extends Client$Q {
|
|
|
12621
12643
|
}
|
|
12622
12644
|
|
|
12623
12645
|
// auto gen
|
|
12624
|
-
class Client$
|
|
12646
|
+
class Client$P extends Client$Q {
|
|
12625
12647
|
constructor() {
|
|
12626
12648
|
super(...arguments);
|
|
12627
12649
|
/**
|
|
@@ -12662,7 +12684,7 @@ class Client$O extends Client$P {
|
|
|
12662
12684
|
}
|
|
12663
12685
|
|
|
12664
12686
|
// auto gen
|
|
12665
|
-
class Client$
|
|
12687
|
+
class Client$O extends Client$P {
|
|
12666
12688
|
constructor() {
|
|
12667
12689
|
super(...arguments);
|
|
12668
12690
|
/**
|
|
@@ -15250,7 +15272,7 @@ class Client$N extends Client$O {
|
|
|
15250
15272
|
}
|
|
15251
15273
|
|
|
15252
15274
|
// auto gen
|
|
15253
|
-
class Client$
|
|
15275
|
+
class Client$N extends Client$O {
|
|
15254
15276
|
constructor() {
|
|
15255
15277
|
super(...arguments);
|
|
15256
15278
|
/**
|
|
@@ -15260,6 +15282,415 @@ class Client$M extends Client$N {
|
|
|
15260
15282
|
}
|
|
15261
15283
|
}
|
|
15262
15284
|
|
|
15285
|
+
// auto gen
|
|
15286
|
+
class Client$M extends Client$N {
|
|
15287
|
+
constructor() {
|
|
15288
|
+
super(...arguments);
|
|
15289
|
+
/**
|
|
15290
|
+
|
|
15291
|
+
*/
|
|
15292
|
+
this.compensation = {
|
|
15293
|
+
v1: {
|
|
15294
|
+
/**
|
|
15295
|
+
* archive
|
|
15296
|
+
*/
|
|
15297
|
+
archive: {
|
|
15298
|
+
/**
|
|
15299
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=archive&apiName=query&version=v1 click to debug }
|
|
15300
|
+
*
|
|
15301
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=compensation&resource=archive&version=v1 document }
|
|
15302
|
+
*/
|
|
15303
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15304
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15305
|
+
return this.httpInstance
|
|
15306
|
+
.request({
|
|
15307
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/archives/query`, path),
|
|
15308
|
+
method: "POST",
|
|
15309
|
+
data,
|
|
15310
|
+
params,
|
|
15311
|
+
headers,
|
|
15312
|
+
})
|
|
15313
|
+
.catch((e) => {
|
|
15314
|
+
this.logger.error(formatErrors(e));
|
|
15315
|
+
throw e;
|
|
15316
|
+
});
|
|
15317
|
+
}),
|
|
15318
|
+
},
|
|
15319
|
+
/**
|
|
15320
|
+
* change_reason
|
|
15321
|
+
*/
|
|
15322
|
+
changeReason: {
|
|
15323
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15324
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15325
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15326
|
+
const res = yield this.httpInstance
|
|
15327
|
+
.request({
|
|
15328
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/change_reasons`, path),
|
|
15329
|
+
method: "GET",
|
|
15330
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
15331
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
15332
|
+
data,
|
|
15333
|
+
})
|
|
15334
|
+
.catch((e) => {
|
|
15335
|
+
this.logger.error(formatErrors(e));
|
|
15336
|
+
});
|
|
15337
|
+
return res;
|
|
15338
|
+
});
|
|
15339
|
+
const Iterable = {
|
|
15340
|
+
[Symbol.asyncIterator]() {
|
|
15341
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15342
|
+
let hasMore = true;
|
|
15343
|
+
let pageToken;
|
|
15344
|
+
while (hasMore) {
|
|
15345
|
+
try {
|
|
15346
|
+
const res = yield __await(sendRequest({
|
|
15347
|
+
headers,
|
|
15348
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15349
|
+
data,
|
|
15350
|
+
}));
|
|
15351
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
15352
|
+
// @ts-ignore
|
|
15353
|
+
has_more,
|
|
15354
|
+
// @ts-ignore
|
|
15355
|
+
page_token,
|
|
15356
|
+
// @ts-ignore
|
|
15357
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15358
|
+
yield yield __await(rest);
|
|
15359
|
+
hasMore = Boolean(has_more);
|
|
15360
|
+
pageToken = page_token || next_page_token;
|
|
15361
|
+
}
|
|
15362
|
+
catch (e) {
|
|
15363
|
+
yield yield __await(null);
|
|
15364
|
+
break;
|
|
15365
|
+
}
|
|
15366
|
+
}
|
|
15367
|
+
});
|
|
15368
|
+
},
|
|
15369
|
+
};
|
|
15370
|
+
return Iterable;
|
|
15371
|
+
}),
|
|
15372
|
+
/**
|
|
15373
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=change_reason&apiName=list&version=v1 click to debug }
|
|
15374
|
+
*
|
|
15375
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=change_reason&version=v1 document }
|
|
15376
|
+
*/
|
|
15377
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15378
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15379
|
+
return this.httpInstance
|
|
15380
|
+
.request({
|
|
15381
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/change_reasons`, path),
|
|
15382
|
+
method: "GET",
|
|
15383
|
+
data,
|
|
15384
|
+
params,
|
|
15385
|
+
headers,
|
|
15386
|
+
})
|
|
15387
|
+
.catch((e) => {
|
|
15388
|
+
this.logger.error(formatErrors(e));
|
|
15389
|
+
throw e;
|
|
15390
|
+
});
|
|
15391
|
+
}),
|
|
15392
|
+
},
|
|
15393
|
+
/**
|
|
15394
|
+
* indicator
|
|
15395
|
+
*/
|
|
15396
|
+
indicator: {
|
|
15397
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15398
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15399
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15400
|
+
const res = yield this.httpInstance
|
|
15401
|
+
.request({
|
|
15402
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/indicators`, path),
|
|
15403
|
+
method: "GET",
|
|
15404
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
15405
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
15406
|
+
data,
|
|
15407
|
+
})
|
|
15408
|
+
.catch((e) => {
|
|
15409
|
+
this.logger.error(formatErrors(e));
|
|
15410
|
+
});
|
|
15411
|
+
return res;
|
|
15412
|
+
});
|
|
15413
|
+
const Iterable = {
|
|
15414
|
+
[Symbol.asyncIterator]() {
|
|
15415
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15416
|
+
let hasMore = true;
|
|
15417
|
+
let pageToken;
|
|
15418
|
+
while (hasMore) {
|
|
15419
|
+
try {
|
|
15420
|
+
const res = yield __await(sendRequest({
|
|
15421
|
+
headers,
|
|
15422
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15423
|
+
data,
|
|
15424
|
+
}));
|
|
15425
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
15426
|
+
// @ts-ignore
|
|
15427
|
+
has_more,
|
|
15428
|
+
// @ts-ignore
|
|
15429
|
+
page_token,
|
|
15430
|
+
// @ts-ignore
|
|
15431
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15432
|
+
yield yield __await(rest);
|
|
15433
|
+
hasMore = Boolean(has_more);
|
|
15434
|
+
pageToken = page_token || next_page_token;
|
|
15435
|
+
}
|
|
15436
|
+
catch (e) {
|
|
15437
|
+
yield yield __await(null);
|
|
15438
|
+
break;
|
|
15439
|
+
}
|
|
15440
|
+
}
|
|
15441
|
+
});
|
|
15442
|
+
},
|
|
15443
|
+
};
|
|
15444
|
+
return Iterable;
|
|
15445
|
+
}),
|
|
15446
|
+
/**
|
|
15447
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=indicator&apiName=list&version=v1 click to debug }
|
|
15448
|
+
*
|
|
15449
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=indicator&version=v1 document }
|
|
15450
|
+
*/
|
|
15451
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15452
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15453
|
+
return this.httpInstance
|
|
15454
|
+
.request({
|
|
15455
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/indicators`, path),
|
|
15456
|
+
method: "GET",
|
|
15457
|
+
data,
|
|
15458
|
+
params,
|
|
15459
|
+
headers,
|
|
15460
|
+
})
|
|
15461
|
+
.catch((e) => {
|
|
15462
|
+
this.logger.error(formatErrors(e));
|
|
15463
|
+
throw e;
|
|
15464
|
+
});
|
|
15465
|
+
}),
|
|
15466
|
+
},
|
|
15467
|
+
/**
|
|
15468
|
+
* item
|
|
15469
|
+
*/
|
|
15470
|
+
item: {
|
|
15471
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15472
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15473
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15474
|
+
const res = yield this.httpInstance
|
|
15475
|
+
.request({
|
|
15476
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/items`, path),
|
|
15477
|
+
method: "GET",
|
|
15478
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
15479
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
15480
|
+
data,
|
|
15481
|
+
})
|
|
15482
|
+
.catch((e) => {
|
|
15483
|
+
this.logger.error(formatErrors(e));
|
|
15484
|
+
});
|
|
15485
|
+
return res;
|
|
15486
|
+
});
|
|
15487
|
+
const Iterable = {
|
|
15488
|
+
[Symbol.asyncIterator]() {
|
|
15489
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15490
|
+
let hasMore = true;
|
|
15491
|
+
let pageToken;
|
|
15492
|
+
while (hasMore) {
|
|
15493
|
+
try {
|
|
15494
|
+
const res = yield __await(sendRequest({
|
|
15495
|
+
headers,
|
|
15496
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15497
|
+
data,
|
|
15498
|
+
}));
|
|
15499
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
15500
|
+
// @ts-ignore
|
|
15501
|
+
has_more,
|
|
15502
|
+
// @ts-ignore
|
|
15503
|
+
page_token,
|
|
15504
|
+
// @ts-ignore
|
|
15505
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15506
|
+
yield yield __await(rest);
|
|
15507
|
+
hasMore = Boolean(has_more);
|
|
15508
|
+
pageToken = page_token || next_page_token;
|
|
15509
|
+
}
|
|
15510
|
+
catch (e) {
|
|
15511
|
+
yield yield __await(null);
|
|
15512
|
+
break;
|
|
15513
|
+
}
|
|
15514
|
+
}
|
|
15515
|
+
});
|
|
15516
|
+
},
|
|
15517
|
+
};
|
|
15518
|
+
return Iterable;
|
|
15519
|
+
}),
|
|
15520
|
+
/**
|
|
15521
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=item&apiName=list&version=v1 click to debug }
|
|
15522
|
+
*
|
|
15523
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=item&version=v1 document }
|
|
15524
|
+
*/
|
|
15525
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15526
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15527
|
+
return this.httpInstance
|
|
15528
|
+
.request({
|
|
15529
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/items`, path),
|
|
15530
|
+
method: "GET",
|
|
15531
|
+
data,
|
|
15532
|
+
params,
|
|
15533
|
+
headers,
|
|
15534
|
+
})
|
|
15535
|
+
.catch((e) => {
|
|
15536
|
+
this.logger.error(formatErrors(e));
|
|
15537
|
+
throw e;
|
|
15538
|
+
});
|
|
15539
|
+
}),
|
|
15540
|
+
},
|
|
15541
|
+
/**
|
|
15542
|
+
* item_category
|
|
15543
|
+
*/
|
|
15544
|
+
itemCategory: {
|
|
15545
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15546
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15547
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15548
|
+
const res = yield this.httpInstance
|
|
15549
|
+
.request({
|
|
15550
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/item_categories`, path),
|
|
15551
|
+
method: "GET",
|
|
15552
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
15553
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
15554
|
+
data,
|
|
15555
|
+
})
|
|
15556
|
+
.catch((e) => {
|
|
15557
|
+
this.logger.error(formatErrors(e));
|
|
15558
|
+
});
|
|
15559
|
+
return res;
|
|
15560
|
+
});
|
|
15561
|
+
const Iterable = {
|
|
15562
|
+
[Symbol.asyncIterator]() {
|
|
15563
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15564
|
+
let hasMore = true;
|
|
15565
|
+
let pageToken;
|
|
15566
|
+
while (hasMore) {
|
|
15567
|
+
try {
|
|
15568
|
+
const res = yield __await(sendRequest({
|
|
15569
|
+
headers,
|
|
15570
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15571
|
+
data,
|
|
15572
|
+
}));
|
|
15573
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
15574
|
+
// @ts-ignore
|
|
15575
|
+
has_more,
|
|
15576
|
+
// @ts-ignore
|
|
15577
|
+
page_token,
|
|
15578
|
+
// @ts-ignore
|
|
15579
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15580
|
+
yield yield __await(rest);
|
|
15581
|
+
hasMore = Boolean(has_more);
|
|
15582
|
+
pageToken = page_token || next_page_token;
|
|
15583
|
+
}
|
|
15584
|
+
catch (e) {
|
|
15585
|
+
yield yield __await(null);
|
|
15586
|
+
break;
|
|
15587
|
+
}
|
|
15588
|
+
}
|
|
15589
|
+
});
|
|
15590
|
+
},
|
|
15591
|
+
};
|
|
15592
|
+
return Iterable;
|
|
15593
|
+
}),
|
|
15594
|
+
/**
|
|
15595
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=item_category&apiName=list&version=v1 click to debug }
|
|
15596
|
+
*
|
|
15597
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=item_category&version=v1 document }
|
|
15598
|
+
*/
|
|
15599
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15600
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15601
|
+
return this.httpInstance
|
|
15602
|
+
.request({
|
|
15603
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/item_categories`, path),
|
|
15604
|
+
method: "GET",
|
|
15605
|
+
data,
|
|
15606
|
+
params,
|
|
15607
|
+
headers,
|
|
15608
|
+
})
|
|
15609
|
+
.catch((e) => {
|
|
15610
|
+
this.logger.error(formatErrors(e));
|
|
15611
|
+
throw e;
|
|
15612
|
+
});
|
|
15613
|
+
}),
|
|
15614
|
+
},
|
|
15615
|
+
/**
|
|
15616
|
+
* plan
|
|
15617
|
+
*/
|
|
15618
|
+
plan: {
|
|
15619
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15620
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15621
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
15622
|
+
const res = yield this.httpInstance
|
|
15623
|
+
.request({
|
|
15624
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/plans`, path),
|
|
15625
|
+
method: "GET",
|
|
15626
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
15627
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
15628
|
+
data,
|
|
15629
|
+
})
|
|
15630
|
+
.catch((e) => {
|
|
15631
|
+
this.logger.error(formatErrors(e));
|
|
15632
|
+
});
|
|
15633
|
+
return res;
|
|
15634
|
+
});
|
|
15635
|
+
const Iterable = {
|
|
15636
|
+
[Symbol.asyncIterator]() {
|
|
15637
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
15638
|
+
let hasMore = true;
|
|
15639
|
+
let pageToken;
|
|
15640
|
+
while (hasMore) {
|
|
15641
|
+
try {
|
|
15642
|
+
const res = yield __await(sendRequest({
|
|
15643
|
+
headers,
|
|
15644
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
15645
|
+
data,
|
|
15646
|
+
}));
|
|
15647
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
15648
|
+
// @ts-ignore
|
|
15649
|
+
has_more,
|
|
15650
|
+
// @ts-ignore
|
|
15651
|
+
page_token,
|
|
15652
|
+
// @ts-ignore
|
|
15653
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
15654
|
+
yield yield __await(rest);
|
|
15655
|
+
hasMore = Boolean(has_more);
|
|
15656
|
+
pageToken = page_token || next_page_token;
|
|
15657
|
+
}
|
|
15658
|
+
catch (e) {
|
|
15659
|
+
yield yield __await(null);
|
|
15660
|
+
break;
|
|
15661
|
+
}
|
|
15662
|
+
}
|
|
15663
|
+
});
|
|
15664
|
+
},
|
|
15665
|
+
};
|
|
15666
|
+
return Iterable;
|
|
15667
|
+
}),
|
|
15668
|
+
/**
|
|
15669
|
+
* {@link https://open.feishu.cn/api-explorer?project=compensation&resource=plan&apiName=list&version=v1 click to debug }
|
|
15670
|
+
*
|
|
15671
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=compensation&resource=plan&version=v1 document }
|
|
15672
|
+
*/
|
|
15673
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
15674
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
15675
|
+
return this.httpInstance
|
|
15676
|
+
.request({
|
|
15677
|
+
url: fillApiPath(`${this.domain}/open-apis/compensation/v1/plans`, path),
|
|
15678
|
+
method: "GET",
|
|
15679
|
+
data,
|
|
15680
|
+
params,
|
|
15681
|
+
headers,
|
|
15682
|
+
})
|
|
15683
|
+
.catch((e) => {
|
|
15684
|
+
this.logger.error(formatErrors(e));
|
|
15685
|
+
throw e;
|
|
15686
|
+
});
|
|
15687
|
+
}),
|
|
15688
|
+
},
|
|
15689
|
+
},
|
|
15690
|
+
};
|
|
15691
|
+
}
|
|
15692
|
+
}
|
|
15693
|
+
|
|
15263
15694
|
// auto gen
|
|
15264
15695
|
class Client$L extends Client$M {
|
|
15265
15696
|
constructor() {
|
|
@@ -20147,6 +20578,55 @@ class Client$I extends Client$J {
|
|
|
20147
20578
|
});
|
|
20148
20579
|
}),
|
|
20149
20580
|
},
|
|
20581
|
+
/**
|
|
20582
|
+
* authorization
|
|
20583
|
+
*/
|
|
20584
|
+
authorization: {
|
|
20585
|
+
/**
|
|
20586
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=get_by_param&version=v1 click to debug }
|
|
20587
|
+
*
|
|
20588
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get_by_param&project=corehr&resource=authorization&version=v1 document }
|
|
20589
|
+
*
|
|
20590
|
+
* 根据ID查询单个用户授权
|
|
20591
|
+
*/
|
|
20592
|
+
getByParam: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
20593
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
20594
|
+
return this.httpInstance
|
|
20595
|
+
.request({
|
|
20596
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/get_by_param`, path),
|
|
20597
|
+
method: "GET",
|
|
20598
|
+
data,
|
|
20599
|
+
params,
|
|
20600
|
+
headers,
|
|
20601
|
+
})
|
|
20602
|
+
.catch((e) => {
|
|
20603
|
+
this.logger.error(formatErrors(e));
|
|
20604
|
+
throw e;
|
|
20605
|
+
});
|
|
20606
|
+
}),
|
|
20607
|
+
/**
|
|
20608
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=query&version=v1 click to debug }
|
|
20609
|
+
*
|
|
20610
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=authorization&version=v1 document }
|
|
20611
|
+
*
|
|
20612
|
+
* 批量查询用户授权
|
|
20613
|
+
*/
|
|
20614
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
20615
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
20616
|
+
return this.httpInstance
|
|
20617
|
+
.request({
|
|
20618
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/query`, path),
|
|
20619
|
+
method: "GET",
|
|
20620
|
+
data,
|
|
20621
|
+
params,
|
|
20622
|
+
headers,
|
|
20623
|
+
})
|
|
20624
|
+
.catch((e) => {
|
|
20625
|
+
this.logger.error(formatErrors(e));
|
|
20626
|
+
throw e;
|
|
20627
|
+
});
|
|
20628
|
+
}),
|
|
20629
|
+
},
|
|
20150
20630
|
/**
|
|
20151
20631
|
* common_data.id
|
|
20152
20632
|
*/
|
|
@@ -22010,6 +22490,30 @@ class Client$I extends Client$J {
|
|
|
22010
22490
|
* 个人信息
|
|
22011
22491
|
*/
|
|
22012
22492
|
person: {
|
|
22493
|
+
/**
|
|
22494
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=create&version=v1 click to debug }
|
|
22495
|
+
*
|
|
22496
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/create document }
|
|
22497
|
+
*
|
|
22498
|
+
* 创建个人信息
|
|
22499
|
+
*
|
|
22500
|
+
* 创建人员的个人信息
|
|
22501
|
+
*/
|
|
22502
|
+
create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
22503
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
22504
|
+
return this.httpInstance
|
|
22505
|
+
.request({
|
|
22506
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons`, path),
|
|
22507
|
+
method: "POST",
|
|
22508
|
+
data,
|
|
22509
|
+
params,
|
|
22510
|
+
headers,
|
|
22511
|
+
})
|
|
22512
|
+
.catch((e) => {
|
|
22513
|
+
this.logger.error(formatErrors(e));
|
|
22514
|
+
throw e;
|
|
22515
|
+
});
|
|
22516
|
+
}),
|
|
22013
22517
|
/**
|
|
22014
22518
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=delete&version=v1 click to debug }
|
|
22015
22519
|
*
|
|
@@ -22058,6 +22562,30 @@ class Client$I extends Client$J {
|
|
|
22058
22562
|
throw e;
|
|
22059
22563
|
});
|
|
22060
22564
|
}),
|
|
22565
|
+
/**
|
|
22566
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=patch&version=v1 click to debug }
|
|
22567
|
+
*
|
|
22568
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/patch document }
|
|
22569
|
+
*
|
|
22570
|
+
* 更新个人信息
|
|
22571
|
+
*
|
|
22572
|
+
* 更新个人信息
|
|
22573
|
+
*/
|
|
22574
|
+
patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
22575
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
22576
|
+
return this.httpInstance
|
|
22577
|
+
.request({
|
|
22578
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons/:person_id`, path),
|
|
22579
|
+
method: "PATCH",
|
|
22580
|
+
data,
|
|
22581
|
+
params,
|
|
22582
|
+
headers,
|
|
22583
|
+
})
|
|
22584
|
+
.catch((e) => {
|
|
22585
|
+
this.logger.error(formatErrors(e));
|
|
22586
|
+
throw e;
|
|
22587
|
+
});
|
|
22588
|
+
}),
|
|
22061
22589
|
/**
|
|
22062
22590
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=upload&version=v1 click to debug }
|
|
22063
22591
|
*
|
|
@@ -22586,6 +23114,55 @@ class Client$I extends Client$J {
|
|
|
22586
23114
|
});
|
|
22587
23115
|
}),
|
|
22588
23116
|
},
|
|
23117
|
+
/**
|
|
23118
|
+
* authorization
|
|
23119
|
+
*/
|
|
23120
|
+
authorization: {
|
|
23121
|
+
/**
|
|
23122
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=get_by_param&version=v1 click to debug }
|
|
23123
|
+
*
|
|
23124
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get_by_param&project=corehr&resource=authorization&version=v1 document }
|
|
23125
|
+
*
|
|
23126
|
+
* 根据ID查询单个用户授权
|
|
23127
|
+
*/
|
|
23128
|
+
getByParam: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
23129
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
23130
|
+
return this.httpInstance
|
|
23131
|
+
.request({
|
|
23132
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/get_by_param`, path),
|
|
23133
|
+
method: "GET",
|
|
23134
|
+
data,
|
|
23135
|
+
params,
|
|
23136
|
+
headers,
|
|
23137
|
+
})
|
|
23138
|
+
.catch((e) => {
|
|
23139
|
+
this.logger.error(formatErrors(e));
|
|
23140
|
+
throw e;
|
|
23141
|
+
});
|
|
23142
|
+
}),
|
|
23143
|
+
/**
|
|
23144
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=authorization&apiName=query&version=v1 click to debug }
|
|
23145
|
+
*
|
|
23146
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=authorization&version=v1 document }
|
|
23147
|
+
*
|
|
23148
|
+
* 批量查询用户授权
|
|
23149
|
+
*/
|
|
23150
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
23151
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
23152
|
+
return this.httpInstance
|
|
23153
|
+
.request({
|
|
23154
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/authorizations/query`, path),
|
|
23155
|
+
method: "GET",
|
|
23156
|
+
data,
|
|
23157
|
+
params,
|
|
23158
|
+
headers,
|
|
23159
|
+
})
|
|
23160
|
+
.catch((e) => {
|
|
23161
|
+
this.logger.error(formatErrors(e));
|
|
23162
|
+
throw e;
|
|
23163
|
+
});
|
|
23164
|
+
}),
|
|
23165
|
+
},
|
|
22589
23166
|
/**
|
|
22590
23167
|
* common_data.id
|
|
22591
23168
|
*/
|
|
@@ -24449,6 +25026,30 @@ class Client$I extends Client$J {
|
|
|
24449
25026
|
* 个人信息
|
|
24450
25027
|
*/
|
|
24451
25028
|
person: {
|
|
25029
|
+
/**
|
|
25030
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=create&version=v1 click to debug }
|
|
25031
|
+
*
|
|
25032
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/create document }
|
|
25033
|
+
*
|
|
25034
|
+
* 创建个人信息
|
|
25035
|
+
*
|
|
25036
|
+
* 创建人员的个人信息
|
|
25037
|
+
*/
|
|
25038
|
+
create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
25039
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
25040
|
+
return this.httpInstance
|
|
25041
|
+
.request({
|
|
25042
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons`, path),
|
|
25043
|
+
method: "POST",
|
|
25044
|
+
data,
|
|
25045
|
+
params,
|
|
25046
|
+
headers,
|
|
25047
|
+
})
|
|
25048
|
+
.catch((e) => {
|
|
25049
|
+
this.logger.error(formatErrors(e));
|
|
25050
|
+
throw e;
|
|
25051
|
+
});
|
|
25052
|
+
}),
|
|
24452
25053
|
/**
|
|
24453
25054
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=delete&version=v1 click to debug }
|
|
24454
25055
|
*
|
|
@@ -24497,6 +25098,30 @@ class Client$I extends Client$J {
|
|
|
24497
25098
|
throw e;
|
|
24498
25099
|
});
|
|
24499
25100
|
}),
|
|
25101
|
+
/**
|
|
25102
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=patch&version=v1 click to debug }
|
|
25103
|
+
*
|
|
25104
|
+
* {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/patch document }
|
|
25105
|
+
*
|
|
25106
|
+
* 更新个人信息
|
|
25107
|
+
*
|
|
25108
|
+
* 更新个人信息
|
|
25109
|
+
*/
|
|
25110
|
+
patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
25111
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
25112
|
+
return this.httpInstance
|
|
25113
|
+
.request({
|
|
25114
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v1/persons/:person_id`, path),
|
|
25115
|
+
method: "PATCH",
|
|
25116
|
+
data,
|
|
25117
|
+
params,
|
|
25118
|
+
headers,
|
|
25119
|
+
})
|
|
25120
|
+
.catch((e) => {
|
|
25121
|
+
this.logger.error(formatErrors(e));
|
|
25122
|
+
throw e;
|
|
25123
|
+
});
|
|
25124
|
+
}),
|
|
24500
25125
|
/**
|
|
24501
25126
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=person&apiName=upload&version=v1 click to debug }
|
|
24502
25127
|
*
|
|
@@ -25994,6 +26619,28 @@ class Client$I extends Client$J {
|
|
|
25994
26619
|
throw e;
|
|
25995
26620
|
});
|
|
25996
26621
|
}),
|
|
26622
|
+
/**
|
|
26623
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=department&apiName=query_multi_timeline&version=v2 click to debug }
|
|
26624
|
+
*
|
|
26625
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query_multi_timeline&project=corehr&resource=department&version=v2 document }
|
|
26626
|
+
*
|
|
26627
|
+
* 查询任意日期部门信息
|
|
26628
|
+
*/
|
|
26629
|
+
queryMultiTimeline: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
26630
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
26631
|
+
return this.httpInstance
|
|
26632
|
+
.request({
|
|
26633
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v2/departments/query_multi_timeline`, path),
|
|
26634
|
+
method: "POST",
|
|
26635
|
+
data,
|
|
26636
|
+
params,
|
|
26637
|
+
headers,
|
|
26638
|
+
})
|
|
26639
|
+
.catch((e) => {
|
|
26640
|
+
this.logger.error(formatErrors(e));
|
|
26641
|
+
throw e;
|
|
26642
|
+
});
|
|
26643
|
+
}),
|
|
25997
26644
|
/**
|
|
25998
26645
|
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=department&apiName=query_timeline&version=v2 click to debug }
|
|
25999
26646
|
*
|
|
@@ -26408,6 +27055,33 @@ class Client$I extends Client$J {
|
|
|
26408
27055
|
});
|
|
26409
27056
|
}),
|
|
26410
27057
|
},
|
|
27058
|
+
/**
|
|
27059
|
+
* job_grade
|
|
27060
|
+
*/
|
|
27061
|
+
jobGrade: {
|
|
27062
|
+
/**
|
|
27063
|
+
* {@link https://open.feishu.cn/api-explorer?project=corehr&resource=job_grade&apiName=query&version=v2 click to debug }
|
|
27064
|
+
*
|
|
27065
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=corehr&resource=job_grade&version=v2 document }
|
|
27066
|
+
*
|
|
27067
|
+
* 查询职等信息
|
|
27068
|
+
*/
|
|
27069
|
+
query: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
27070
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
27071
|
+
return this.httpInstance
|
|
27072
|
+
.request({
|
|
27073
|
+
url: fillApiPath(`${this.domain}/open-apis/corehr/v2/job_grades/query`, path),
|
|
27074
|
+
method: "POST",
|
|
27075
|
+
data,
|
|
27076
|
+
params,
|
|
27077
|
+
headers,
|
|
27078
|
+
})
|
|
27079
|
+
.catch((e) => {
|
|
27080
|
+
this.logger.error(formatErrors(e));
|
|
27081
|
+
throw e;
|
|
27082
|
+
});
|
|
27083
|
+
}),
|
|
27084
|
+
},
|
|
26411
27085
|
/**
|
|
26412
27086
|
* job_level
|
|
26413
27087
|
*/
|
|
@@ -28630,7 +29304,7 @@ class Client$E extends Client$F {
|
|
|
28630
29304
|
}),
|
|
28631
29305
|
},
|
|
28632
29306
|
/**
|
|
28633
|
-
*
|
|
29307
|
+
* 异步任务状态
|
|
28634
29308
|
*/
|
|
28635
29309
|
file: {
|
|
28636
29310
|
/**
|
|
@@ -30329,7 +31003,7 @@ class Client$E extends Client$F {
|
|
|
30329
31003
|
}),
|
|
30330
31004
|
},
|
|
30331
31005
|
/**
|
|
30332
|
-
*
|
|
31006
|
+
* 异步任务状态
|
|
30333
31007
|
*/
|
|
30334
31008
|
file: {
|
|
30335
31009
|
/**
|
|
@@ -37460,6 +38134,31 @@ class Client$u extends Client$v {
|
|
|
37460
38134
|
});
|
|
37461
38135
|
}),
|
|
37462
38136
|
},
|
|
38137
|
+
/**
|
|
38138
|
+
* role
|
|
38139
|
+
*/
|
|
38140
|
+
role: {
|
|
38141
|
+
/**
|
|
38142
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=role&apiName=get&version=v1 click to debug }
|
|
38143
|
+
*
|
|
38144
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=hire&resource=role&version=v1 document }
|
|
38145
|
+
*/
|
|
38146
|
+
get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
38147
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
38148
|
+
return this.httpInstance
|
|
38149
|
+
.request({
|
|
38150
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/roles/:role_id`, path),
|
|
38151
|
+
method: "GET",
|
|
38152
|
+
data,
|
|
38153
|
+
params,
|
|
38154
|
+
headers,
|
|
38155
|
+
})
|
|
38156
|
+
.catch((e) => {
|
|
38157
|
+
this.logger.error(formatErrors(e));
|
|
38158
|
+
throw e;
|
|
38159
|
+
});
|
|
38160
|
+
}),
|
|
38161
|
+
},
|
|
37463
38162
|
/**
|
|
37464
38163
|
* 人才
|
|
37465
38164
|
*/
|
|
@@ -39630,91 +40329,169 @@ class Client$u extends Client$v {
|
|
|
39630
40329
|
return Iterable;
|
|
39631
40330
|
}),
|
|
39632
40331
|
/**
|
|
39633
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=referral_website.job_post&apiName=list&version=v1 click to debug }
|
|
40332
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=referral_website.job_post&apiName=list&version=v1 click to debug }
|
|
40333
|
+
*
|
|
40334
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=hire&resource=referral_website.job_post&version=v1 document }
|
|
40335
|
+
*
|
|
40336
|
+
* 获取内推官网下的职位列表。自定义数据暂不支持列表获取,请从「获取内推官网下职位广告详情」接口获取
|
|
40337
|
+
*/
|
|
40338
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40339
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40340
|
+
return this.httpInstance
|
|
40341
|
+
.request({
|
|
40342
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/referral_websites/job_posts`, path),
|
|
40343
|
+
method: "GET",
|
|
40344
|
+
data,
|
|
40345
|
+
params,
|
|
40346
|
+
headers,
|
|
40347
|
+
})
|
|
40348
|
+
.catch((e) => {
|
|
40349
|
+
this.logger.error(formatErrors(e));
|
|
40350
|
+
throw e;
|
|
40351
|
+
});
|
|
40352
|
+
}),
|
|
40353
|
+
},
|
|
40354
|
+
/**
|
|
40355
|
+
* registration_schema
|
|
40356
|
+
*/
|
|
40357
|
+
registrationSchema: {
|
|
40358
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40359
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40360
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
40361
|
+
const res = yield this.httpInstance
|
|
40362
|
+
.request({
|
|
40363
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
40364
|
+
method: "GET",
|
|
40365
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
40366
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
40367
|
+
data,
|
|
40368
|
+
})
|
|
40369
|
+
.catch((e) => {
|
|
40370
|
+
this.logger.error(formatErrors(e));
|
|
40371
|
+
});
|
|
40372
|
+
return res;
|
|
40373
|
+
});
|
|
40374
|
+
const Iterable = {
|
|
40375
|
+
[Symbol.asyncIterator]() {
|
|
40376
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
40377
|
+
let hasMore = true;
|
|
40378
|
+
let pageToken;
|
|
40379
|
+
while (hasMore) {
|
|
40380
|
+
try {
|
|
40381
|
+
const res = yield __await(sendRequest({
|
|
40382
|
+
headers,
|
|
40383
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
40384
|
+
data,
|
|
40385
|
+
}));
|
|
40386
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
40387
|
+
// @ts-ignore
|
|
40388
|
+
has_more,
|
|
40389
|
+
// @ts-ignore
|
|
40390
|
+
page_token,
|
|
40391
|
+
// @ts-ignore
|
|
40392
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
40393
|
+
yield yield __await(rest);
|
|
40394
|
+
hasMore = Boolean(has_more);
|
|
40395
|
+
pageToken = page_token || next_page_token;
|
|
40396
|
+
}
|
|
40397
|
+
catch (e) {
|
|
40398
|
+
yield yield __await(null);
|
|
40399
|
+
break;
|
|
40400
|
+
}
|
|
40401
|
+
}
|
|
40402
|
+
});
|
|
40403
|
+
},
|
|
40404
|
+
};
|
|
40405
|
+
return Iterable;
|
|
40406
|
+
}),
|
|
40407
|
+
/**
|
|
40408
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=registration_schema&apiName=list&version=v1 click to debug }
|
|
40409
|
+
*
|
|
40410
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=hire&resource=registration_schema&version=v1 document }
|
|
40411
|
+
*/
|
|
40412
|
+
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40413
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40414
|
+
return this.httpInstance
|
|
40415
|
+
.request({
|
|
40416
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
40417
|
+
method: "GET",
|
|
40418
|
+
data,
|
|
40419
|
+
params,
|
|
40420
|
+
headers,
|
|
40421
|
+
})
|
|
40422
|
+
.catch((e) => {
|
|
40423
|
+
this.logger.error(formatErrors(e));
|
|
40424
|
+
throw e;
|
|
40425
|
+
});
|
|
40426
|
+
}),
|
|
40427
|
+
},
|
|
40428
|
+
/**
|
|
40429
|
+
* 简历来源
|
|
40430
|
+
*/
|
|
40431
|
+
resumeSource: {
|
|
40432
|
+
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
40433
|
+
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
40434
|
+
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
40435
|
+
const res = yield this.httpInstance
|
|
40436
|
+
.request({
|
|
40437
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
40438
|
+
method: "GET",
|
|
40439
|
+
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
40440
|
+
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
40441
|
+
data,
|
|
40442
|
+
})
|
|
40443
|
+
.catch((e) => {
|
|
40444
|
+
this.logger.error(formatErrors(e));
|
|
40445
|
+
});
|
|
40446
|
+
return res;
|
|
40447
|
+
});
|
|
40448
|
+
const Iterable = {
|
|
40449
|
+
[Symbol.asyncIterator]() {
|
|
40450
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
40451
|
+
let hasMore = true;
|
|
40452
|
+
let pageToken;
|
|
40453
|
+
while (hasMore) {
|
|
40454
|
+
try {
|
|
40455
|
+
const res = yield __await(sendRequest({
|
|
40456
|
+
headers,
|
|
40457
|
+
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
40458
|
+
data,
|
|
40459
|
+
}));
|
|
40460
|
+
const _b = get__default["default"](res, "data") || {}, {
|
|
40461
|
+
// @ts-ignore
|
|
40462
|
+
has_more,
|
|
40463
|
+
// @ts-ignore
|
|
40464
|
+
page_token,
|
|
40465
|
+
// @ts-ignore
|
|
40466
|
+
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
40467
|
+
yield yield __await(rest);
|
|
40468
|
+
hasMore = Boolean(has_more);
|
|
40469
|
+
pageToken = page_token || next_page_token;
|
|
40470
|
+
}
|
|
40471
|
+
catch (e) {
|
|
40472
|
+
yield yield __await(null);
|
|
40473
|
+
break;
|
|
40474
|
+
}
|
|
40475
|
+
}
|
|
40476
|
+
});
|
|
40477
|
+
},
|
|
40478
|
+
};
|
|
40479
|
+
return Iterable;
|
|
40480
|
+
}),
|
|
40481
|
+
/**
|
|
40482
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=resume_source&apiName=list&version=v1 click to debug }
|
|
39634
40483
|
*
|
|
39635
|
-
* {@link https://open.feishu.cn/
|
|
40484
|
+
* {@link https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/resume_source/list document }
|
|
39636
40485
|
*
|
|
39637
|
-
*
|
|
39638
|
-
*/
|
|
39639
|
-
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39640
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39641
|
-
return this.httpInstance
|
|
39642
|
-
.request({
|
|
39643
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/referral_websites/job_posts`, path),
|
|
39644
|
-
method: "GET",
|
|
39645
|
-
data,
|
|
39646
|
-
params,
|
|
39647
|
-
headers,
|
|
39648
|
-
})
|
|
39649
|
-
.catch((e) => {
|
|
39650
|
-
this.logger.error(formatErrors(e));
|
|
39651
|
-
throw e;
|
|
39652
|
-
});
|
|
39653
|
-
}),
|
|
39654
|
-
},
|
|
39655
|
-
/**
|
|
39656
|
-
* registration_schema
|
|
39657
|
-
*/
|
|
39658
|
-
registrationSchema: {
|
|
39659
|
-
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39660
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39661
|
-
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
39662
|
-
const res = yield this.httpInstance
|
|
39663
|
-
.request({
|
|
39664
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/registration_schemas`, path),
|
|
39665
|
-
method: "GET",
|
|
39666
|
-
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
39667
|
-
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
39668
|
-
data,
|
|
39669
|
-
})
|
|
39670
|
-
.catch((e) => {
|
|
39671
|
-
this.logger.error(formatErrors(e));
|
|
39672
|
-
});
|
|
39673
|
-
return res;
|
|
39674
|
-
});
|
|
39675
|
-
const Iterable = {
|
|
39676
|
-
[Symbol.asyncIterator]() {
|
|
39677
|
-
return __asyncGenerator(this, arguments, function* _a() {
|
|
39678
|
-
let hasMore = true;
|
|
39679
|
-
let pageToken;
|
|
39680
|
-
while (hasMore) {
|
|
39681
|
-
try {
|
|
39682
|
-
const res = yield __await(sendRequest({
|
|
39683
|
-
headers,
|
|
39684
|
-
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
39685
|
-
data,
|
|
39686
|
-
}));
|
|
39687
|
-
const _b = get__default["default"](res, "data") || {}, {
|
|
39688
|
-
// @ts-ignore
|
|
39689
|
-
has_more,
|
|
39690
|
-
// @ts-ignore
|
|
39691
|
-
page_token,
|
|
39692
|
-
// @ts-ignore
|
|
39693
|
-
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
39694
|
-
yield yield __await(rest);
|
|
39695
|
-
hasMore = Boolean(has_more);
|
|
39696
|
-
pageToken = page_token || next_page_token;
|
|
39697
|
-
}
|
|
39698
|
-
catch (e) {
|
|
39699
|
-
yield yield __await(null);
|
|
39700
|
-
break;
|
|
39701
|
-
}
|
|
39702
|
-
}
|
|
39703
|
-
});
|
|
39704
|
-
},
|
|
39705
|
-
};
|
|
39706
|
-
return Iterable;
|
|
39707
|
-
}),
|
|
39708
|
-
/**
|
|
39709
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=registration_schema&apiName=list&version=v1 click to debug }
|
|
40486
|
+
* 获取简历来源列表
|
|
39710
40487
|
*
|
|
39711
|
-
*
|
|
40488
|
+
* 获取简历来源列表
|
|
39712
40489
|
*/
|
|
39713
40490
|
list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39714
40491
|
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39715
40492
|
return this.httpInstance
|
|
39716
40493
|
.request({
|
|
39717
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/
|
|
40494
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
39718
40495
|
method: "GET",
|
|
39719
40496
|
data,
|
|
39720
40497
|
params,
|
|
@@ -39727,72 +40504,19 @@ class Client$u extends Client$v {
|
|
|
39727
40504
|
}),
|
|
39728
40505
|
},
|
|
39729
40506
|
/**
|
|
39730
|
-
*
|
|
40507
|
+
* role
|
|
39731
40508
|
*/
|
|
39732
|
-
|
|
39733
|
-
listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39734
|
-
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39735
|
-
const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
39736
|
-
const res = yield this.httpInstance
|
|
39737
|
-
.request({
|
|
39738
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/resume_sources`, path),
|
|
39739
|
-
method: "GET",
|
|
39740
|
-
headers: pickBy__default["default"](innerPayload.headers, identity__default["default"]),
|
|
39741
|
-
params: pickBy__default["default"](innerPayload.params, identity__default["default"]),
|
|
39742
|
-
data,
|
|
39743
|
-
})
|
|
39744
|
-
.catch((e) => {
|
|
39745
|
-
this.logger.error(formatErrors(e));
|
|
39746
|
-
});
|
|
39747
|
-
return res;
|
|
39748
|
-
});
|
|
39749
|
-
const Iterable = {
|
|
39750
|
-
[Symbol.asyncIterator]() {
|
|
39751
|
-
return __asyncGenerator(this, arguments, function* _a() {
|
|
39752
|
-
let hasMore = true;
|
|
39753
|
-
let pageToken;
|
|
39754
|
-
while (hasMore) {
|
|
39755
|
-
try {
|
|
39756
|
-
const res = yield __await(sendRequest({
|
|
39757
|
-
headers,
|
|
39758
|
-
params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
|
|
39759
|
-
data,
|
|
39760
|
-
}));
|
|
39761
|
-
const _b = get__default["default"](res, "data") || {}, {
|
|
39762
|
-
// @ts-ignore
|
|
39763
|
-
has_more,
|
|
39764
|
-
// @ts-ignore
|
|
39765
|
-
page_token,
|
|
39766
|
-
// @ts-ignore
|
|
39767
|
-
next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
|
|
39768
|
-
yield yield __await(rest);
|
|
39769
|
-
hasMore = Boolean(has_more);
|
|
39770
|
-
pageToken = page_token || next_page_token;
|
|
39771
|
-
}
|
|
39772
|
-
catch (e) {
|
|
39773
|
-
yield yield __await(null);
|
|
39774
|
-
break;
|
|
39775
|
-
}
|
|
39776
|
-
}
|
|
39777
|
-
});
|
|
39778
|
-
},
|
|
39779
|
-
};
|
|
39780
|
-
return Iterable;
|
|
39781
|
-
}),
|
|
40509
|
+
role: {
|
|
39782
40510
|
/**
|
|
39783
|
-
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=
|
|
39784
|
-
*
|
|
39785
|
-
* {@link https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/resume_source/list document }
|
|
39786
|
-
*
|
|
39787
|
-
* 获取简历来源列表
|
|
40511
|
+
* {@link https://open.feishu.cn/api-explorer?project=hire&resource=role&apiName=get&version=v1 click to debug }
|
|
39788
40512
|
*
|
|
39789
|
-
*
|
|
40513
|
+
* {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=hire&resource=role&version=v1 document }
|
|
39790
40514
|
*/
|
|
39791
|
-
|
|
40515
|
+
get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
|
|
39792
40516
|
const { headers, params, data, path } = yield this.formatPayload(payload, options);
|
|
39793
40517
|
return this.httpInstance
|
|
39794
40518
|
.request({
|
|
39795
|
-
url: fillApiPath(`${this.domain}/open-apis/hire/v1/
|
|
40519
|
+
url: fillApiPath(`${this.domain}/open-apis/hire/v1/roles/:role_id`, path),
|
|
39796
40520
|
method: "GET",
|
|
39797
40521
|
data,
|
|
39798
40522
|
params,
|
|
@@ -41352,7 +42076,7 @@ class Client$s extends Client$t {
|
|
|
41352
42076
|
}),
|
|
41353
42077
|
},
|
|
41354
42078
|
/**
|
|
41355
|
-
*
|
|
42079
|
+
* 消息
|
|
41356
42080
|
*/
|
|
41357
42081
|
message: {
|
|
41358
42082
|
/**
|
|
@@ -43422,7 +44146,7 @@ class Client$s extends Client$t {
|
|
|
43422
44146
|
}),
|
|
43423
44147
|
},
|
|
43424
44148
|
/**
|
|
43425
|
-
*
|
|
44149
|
+
* 消息
|
|
43426
44150
|
*/
|
|
43427
44151
|
message: {
|
|
43428
44152
|
/**
|
|
@@ -60426,6 +61150,135 @@ class TokenManager {
|
|
|
60426
61150
|
}
|
|
60427
61151
|
}
|
|
60428
61152
|
|
|
61153
|
+
const mergeObject = (obj1, obj2) => {
|
|
61154
|
+
const mergedObject = Object.assign({}, obj1);
|
|
61155
|
+
for (let [key, value] of Object.entries(obj2)) {
|
|
61156
|
+
if (value !== undefined) {
|
|
61157
|
+
mergedObject[key] = value;
|
|
61158
|
+
}
|
|
61159
|
+
}
|
|
61160
|
+
return mergedObject;
|
|
61161
|
+
};
|
|
61162
|
+
|
|
61163
|
+
class UserAccessToken {
|
|
61164
|
+
constructor(params) {
|
|
61165
|
+
this.client = params.client;
|
|
61166
|
+
}
|
|
61167
|
+
getCacheKey(key, options) {
|
|
61168
|
+
const namespace = get__default["default"](options, 'namespace', this.client.appId);
|
|
61169
|
+
return `${namespace}/${CUserAccessToken.toString()}/${key}`;
|
|
61170
|
+
}
|
|
61171
|
+
// the unit of time is seconds
|
|
61172
|
+
calibrateTime(time) {
|
|
61173
|
+
// Due to the time-consuming network, the time needs to be 3 minutes earlier
|
|
61174
|
+
return new Date().getTime() + (time || 0) * 1000 - 3 * 60 * 1000;
|
|
61175
|
+
}
|
|
61176
|
+
initWithCode(key2Code, options) {
|
|
61177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61178
|
+
const key2Info = {};
|
|
61179
|
+
for (const [key, code] of Object.entries(key2Code)) {
|
|
61180
|
+
const oidcAccessInfo = yield this.client.authen.oidcAccessToken.create({
|
|
61181
|
+
data: {
|
|
61182
|
+
grant_type: 'authorization_code',
|
|
61183
|
+
code
|
|
61184
|
+
}
|
|
61185
|
+
});
|
|
61186
|
+
if (oidcAccessInfo.code !== 0) {
|
|
61187
|
+
// @ts-ignore
|
|
61188
|
+
this.client.logger.error('init user access token error', key, oidcAccessInfo.msg || oidcAccessInfo.message);
|
|
61189
|
+
continue;
|
|
61190
|
+
}
|
|
61191
|
+
// code expired
|
|
61192
|
+
if (!oidcAccessInfo.data) {
|
|
61193
|
+
this.client.logger.error('user access code expired', key, code);
|
|
61194
|
+
continue;
|
|
61195
|
+
}
|
|
61196
|
+
key2Info[key] = {
|
|
61197
|
+
code,
|
|
61198
|
+
token: oidcAccessInfo.data.access_token,
|
|
61199
|
+
refreshToken: oidcAccessInfo.data.refresh_token,
|
|
61200
|
+
expiredTime: this.calibrateTime(oidcAccessInfo.data.expires_in)
|
|
61201
|
+
};
|
|
61202
|
+
}
|
|
61203
|
+
yield this.update(key2Info, { namespace: get__default["default"](options, 'namespace') });
|
|
61204
|
+
return key2Info;
|
|
61205
|
+
});
|
|
61206
|
+
}
|
|
61207
|
+
update(key2Info, options) {
|
|
61208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61209
|
+
for (const [key, info] of Object.entries(key2Info)) {
|
|
61210
|
+
const cacheKey = this.getCacheKey(key, { namespace: get__default["default"](options, 'namespace') });
|
|
61211
|
+
const cacheValue = (yield this.client.cache.get(cacheKey)) || {};
|
|
61212
|
+
const { code, token, refreshToken, expiredTime } = info;
|
|
61213
|
+
const targetValue = mergeObject(cacheValue, { code, token, refreshToken, expiredTime });
|
|
61214
|
+
yield this.client.cache.set(cacheKey, targetValue, Infinity);
|
|
61215
|
+
}
|
|
61216
|
+
});
|
|
61217
|
+
}
|
|
61218
|
+
get(key, options) {
|
|
61219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61220
|
+
const cacheKey = this.getCacheKey(key, { namespace: get__default["default"](options, 'namespace') });
|
|
61221
|
+
const cacheInfo = yield this.client.cache.get(cacheKey);
|
|
61222
|
+
// cacheInfo是否存在
|
|
61223
|
+
if (!cacheInfo) {
|
|
61224
|
+
this.client.logger.error('user access token needs to be initialized or updated first');
|
|
61225
|
+
return;
|
|
61226
|
+
}
|
|
61227
|
+
const { token, code, refreshToken, expiredTime } = cacheInfo;
|
|
61228
|
+
// step1 token存在且未过期
|
|
61229
|
+
if (token && expiredTime && expiredTime - new Date().getTime() > 0) {
|
|
61230
|
+
return token;
|
|
61231
|
+
}
|
|
61232
|
+
// step2 refresh token存在,刷新token
|
|
61233
|
+
if (refreshToken) {
|
|
61234
|
+
const refreshAccessInfo = yield this.client.authen.oidcRefreshAccessToken.create({
|
|
61235
|
+
data: {
|
|
61236
|
+
grant_type: 'refresh_token',
|
|
61237
|
+
refresh_token: refreshToken
|
|
61238
|
+
}
|
|
61239
|
+
});
|
|
61240
|
+
if (refreshAccessInfo.code === 0 && refreshAccessInfo.data) {
|
|
61241
|
+
yield this.update({
|
|
61242
|
+
key: {
|
|
61243
|
+
token: refreshAccessInfo.data.access_token,
|
|
61244
|
+
refreshToken: refreshAccessInfo.data.refresh_token,
|
|
61245
|
+
expiredTime: this.calibrateTime(refreshAccessInfo.data.expires_in)
|
|
61246
|
+
}
|
|
61247
|
+
});
|
|
61248
|
+
return refreshAccessInfo.data.access_token;
|
|
61249
|
+
}
|
|
61250
|
+
else {
|
|
61251
|
+
this.client.logger.error('get user access token by refresh token failed.', refreshAccessInfo.msg);
|
|
61252
|
+
return;
|
|
61253
|
+
}
|
|
61254
|
+
}
|
|
61255
|
+
// step3 code存在的话,用code重新获取
|
|
61256
|
+
if (code) {
|
|
61257
|
+
const oidcAccessInfo = yield this.client.authen.oidcAccessToken.create({
|
|
61258
|
+
data: {
|
|
61259
|
+
grant_type: "authorization_code",
|
|
61260
|
+
code: code
|
|
61261
|
+
}
|
|
61262
|
+
});
|
|
61263
|
+
if (oidcAccessInfo.code === 0 && oidcAccessInfo.data) {
|
|
61264
|
+
yield this.update({
|
|
61265
|
+
key: {
|
|
61266
|
+
token: oidcAccessInfo.data.access_token,
|
|
61267
|
+
refreshToken: oidcAccessInfo.data.refresh_token,
|
|
61268
|
+
expiredTime: this.calibrateTime(oidcAccessInfo.data.expires_in)
|
|
61269
|
+
}
|
|
61270
|
+
});
|
|
61271
|
+
}
|
|
61272
|
+
else {
|
|
61273
|
+
this.client.logger.error('get user access token by code failed.', oidcAccessInfo.msg);
|
|
61274
|
+
}
|
|
61275
|
+
}
|
|
61276
|
+
// step4 重试完毕没结果后,返回undefine
|
|
61277
|
+
return;
|
|
61278
|
+
});
|
|
61279
|
+
}
|
|
61280
|
+
}
|
|
61281
|
+
|
|
60429
61282
|
class Client extends Client$1 {
|
|
60430
61283
|
constructor(params) {
|
|
60431
61284
|
super();
|
|
@@ -60456,6 +61309,7 @@ class Client extends Client$1 {
|
|
|
60456
61309
|
appType: this.appType,
|
|
60457
61310
|
httpInstance: this.httpInstance,
|
|
60458
61311
|
});
|
|
61312
|
+
this.userAccessToken = new UserAccessToken({ client: this });
|
|
60459
61313
|
this.logger.info('client ready');
|
|
60460
61314
|
}
|
|
60461
61315
|
formatPayload(payload, options) {
|
|
@@ -62059,7 +62913,269 @@ class WSClient {
|
|
|
62059
62913
|
}
|
|
62060
62914
|
}
|
|
62061
62915
|
|
|
62916
|
+
class SessionCache {
|
|
62917
|
+
constructor() {
|
|
62918
|
+
this.sessions = new Map();
|
|
62919
|
+
}
|
|
62920
|
+
set(key, value) {
|
|
62921
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62922
|
+
const sessions = this.sessions.get(key.toString()) || {};
|
|
62923
|
+
const mergedSessions = mergeObject(sessions, value);
|
|
62924
|
+
this.sessions.set(key.toString(), mergedSessions);
|
|
62925
|
+
return true;
|
|
62926
|
+
});
|
|
62927
|
+
}
|
|
62928
|
+
get(key) {
|
|
62929
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62930
|
+
return this.sessions.get(key.toString());
|
|
62931
|
+
});
|
|
62932
|
+
}
|
|
62933
|
+
}
|
|
62934
|
+
|
|
62935
|
+
var EExecStatus;
|
|
62936
|
+
(function (EExecStatus) {
|
|
62937
|
+
EExecStatus[EExecStatus["ERROR"] = -1] = "ERROR";
|
|
62938
|
+
EExecStatus[EExecStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
62939
|
+
EExecStatus[EExecStatus["EXPIRED"] = 1] = "EXPIRED";
|
|
62940
|
+
EExecStatus[EExecStatus["CANCELLED"] = 2] = "CANCELLED";
|
|
62941
|
+
EExecStatus[EExecStatus["FAILED"] = 3] = "FAILED";
|
|
62942
|
+
EExecStatus[EExecStatus["OTHER"] = 4] = "OTHER";
|
|
62943
|
+
})(EExecStatus || (EExecStatus = {}));
|
|
62944
|
+
class Aily {
|
|
62945
|
+
constructor(params) {
|
|
62946
|
+
this.completions = {
|
|
62947
|
+
create: this.create.bind(this),
|
|
62948
|
+
createWithStream: this.createWithStream.bind(this),
|
|
62949
|
+
sessionRecords: {
|
|
62950
|
+
get: this.getRecords.bind(this),
|
|
62951
|
+
update: this.updateRecords.bind(this)
|
|
62952
|
+
}
|
|
62953
|
+
};
|
|
62954
|
+
this.client = params.client;
|
|
62955
|
+
this.logger = params.client.logger;
|
|
62956
|
+
this.cache = params.cache || new SessionCache();
|
|
62957
|
+
}
|
|
62958
|
+
getSessionId(params) {
|
|
62959
|
+
var _a;
|
|
62960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62961
|
+
const { sessionId, payload, options } = params;
|
|
62962
|
+
const records = yield this.getRecords();
|
|
62963
|
+
if (sessionId && sessionId in records) {
|
|
62964
|
+
return records[sessionId];
|
|
62965
|
+
}
|
|
62966
|
+
const ailySession = yield this.client.aily.v1.ailySession.create({ data: payload }, options);
|
|
62967
|
+
if (ailySession.code === 0 && ailySession.data) {
|
|
62968
|
+
const ailySessionId = (_a = ailySession.data.session) === null || _a === void 0 ? void 0 : _a.id;
|
|
62969
|
+
if (sessionId) {
|
|
62970
|
+
yield this.updateRecords({ [sessionId]: ailySessionId });
|
|
62971
|
+
}
|
|
62972
|
+
return ailySessionId;
|
|
62973
|
+
}
|
|
62974
|
+
else {
|
|
62975
|
+
this.logger.error('get aily session id error', ailySession.msg);
|
|
62976
|
+
return undefined;
|
|
62977
|
+
}
|
|
62978
|
+
});
|
|
62979
|
+
}
|
|
62980
|
+
waitReply(params, options) {
|
|
62981
|
+
var _a, _b;
|
|
62982
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62983
|
+
const { sessionId, ailyAppId, message, sessionInfo, messageInfo, runInfo, skillId } = params;
|
|
62984
|
+
// step1 get aily session id
|
|
62985
|
+
const ailySessionId = yield this.getSessionId({ sessionId, payload: sessionInfo, options });
|
|
62986
|
+
if (!ailySessionId) {
|
|
62987
|
+
throw EExecStatus.ERROR;
|
|
62988
|
+
}
|
|
62989
|
+
// step2 create message and run
|
|
62990
|
+
const ailySessionMessage = yield this.client.aily.v1.ailySessionAilyMessage.create({
|
|
62991
|
+
path: {
|
|
62992
|
+
aily_session_id: ailySessionId
|
|
62993
|
+
},
|
|
62994
|
+
data: Object.assign(Object.assign({}, messageInfo), { content: message, idempotent_id: `${Date.now()}`, content_type: 'MDX' })
|
|
62995
|
+
}, options);
|
|
62996
|
+
if (!(ailySessionMessage.code === 0 && ailySessionMessage.data)) {
|
|
62997
|
+
this.logger.error('create aily message error', ailySessionMessage.msg);
|
|
62998
|
+
throw EExecStatus.ERROR;
|
|
62999
|
+
}
|
|
63000
|
+
const messageId = (_a = ailySessionMessage.data.message) === null || _a === void 0 ? void 0 : _a.id;
|
|
63001
|
+
const ailySessionRun = yield this.client.aily.v1.ailySessionRun.create({
|
|
63002
|
+
path: {
|
|
63003
|
+
aily_session_id: ailySessionId
|
|
63004
|
+
},
|
|
63005
|
+
data: Object.assign({ app_id: ailyAppId, skill_id: skillId }, runInfo)
|
|
63006
|
+
}, options);
|
|
63007
|
+
if (!(ailySessionRun.code === 0 && ailySessionRun.data)) {
|
|
63008
|
+
this.logger.error('create aily session run error', ailySessionRun.msg);
|
|
63009
|
+
throw EExecStatus.ERROR;
|
|
63010
|
+
}
|
|
63011
|
+
const runId = (_b = ailySessionRun.data.run) === null || _b === void 0 ? void 0 : _b.id;
|
|
63012
|
+
if (!runId) {
|
|
63013
|
+
this.logger.error('run id is empty');
|
|
63014
|
+
throw EExecStatus.ERROR;
|
|
63015
|
+
}
|
|
63016
|
+
// step3 wait run complete
|
|
63017
|
+
const polling = () => __awaiter(this, void 0, void 0, function* () {
|
|
63018
|
+
return new Promise((resolve) => {
|
|
63019
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
63020
|
+
var _a, _b;
|
|
63021
|
+
const runStatusInfo = yield this.client.aily.v1.ailySessionRun.get({
|
|
63022
|
+
path: {
|
|
63023
|
+
aily_session_id: ailySessionId,
|
|
63024
|
+
run_id: runId
|
|
63025
|
+
}
|
|
63026
|
+
}, options);
|
|
63027
|
+
if (!(runStatusInfo.code === 0 && runStatusInfo.data)) {
|
|
63028
|
+
resolve(3);
|
|
63029
|
+
return;
|
|
63030
|
+
}
|
|
63031
|
+
const status = (_b = (_a = runStatusInfo.data) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.status;
|
|
63032
|
+
switch (status) {
|
|
63033
|
+
case 'QUEUED':
|
|
63034
|
+
case 'IN_PROGRESS': yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
63035
|
+
const ret = yield polling();
|
|
63036
|
+
resolve(ret);
|
|
63037
|
+
}))();
|
|
63038
|
+
case 'COMPLETED': resolve(EExecStatus.SUCCESS);
|
|
63039
|
+
case 'EXPIRED': resolve(EExecStatus.EXPIRED);
|
|
63040
|
+
case 'CANCELLED': resolve(EExecStatus.CANCELLED);
|
|
63041
|
+
case 'FAILED': resolve(EExecStatus.FAILED);
|
|
63042
|
+
default: resolve(EExecStatus.OTHER);
|
|
63043
|
+
}
|
|
63044
|
+
}), 500);
|
|
63045
|
+
});
|
|
63046
|
+
});
|
|
63047
|
+
const pollingRet = yield polling();
|
|
63048
|
+
if (pollingRet !== EExecStatus.SUCCESS) {
|
|
63049
|
+
this.logger.error('aily run error');
|
|
63050
|
+
throw pollingRet;
|
|
63051
|
+
}
|
|
63052
|
+
return {
|
|
63053
|
+
ailySessionId,
|
|
63054
|
+
runId,
|
|
63055
|
+
messageId
|
|
63056
|
+
};
|
|
63057
|
+
});
|
|
63058
|
+
}
|
|
63059
|
+
create(params, options) {
|
|
63060
|
+
var _a, e_1, _b, _c;
|
|
63061
|
+
var _d;
|
|
63062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63063
|
+
const { ailySessionId, runId } = yield this.waitReply(params, options);
|
|
63064
|
+
let reply;
|
|
63065
|
+
try {
|
|
63066
|
+
for (var _e = true, _f = __asyncValues(yield this.client.aily.v1.ailySessionAilyMessage.listWithIterator({
|
|
63067
|
+
path: {
|
|
63068
|
+
aily_session_id: ailySessionId,
|
|
63069
|
+
},
|
|
63070
|
+
params: {
|
|
63071
|
+
run_id: runId,
|
|
63072
|
+
with_partial_message: false,
|
|
63073
|
+
}
|
|
63074
|
+
}, options)), _g; _g = yield _f.next(), _a = _g.done, !_a;) {
|
|
63075
|
+
_c = _g.value;
|
|
63076
|
+
_e = false;
|
|
63077
|
+
try {
|
|
63078
|
+
const items = _c;
|
|
63079
|
+
if (!items) {
|
|
63080
|
+
continue;
|
|
63081
|
+
}
|
|
63082
|
+
(_d = items === null || items === void 0 ? void 0 : items.messages) === null || _d === void 0 ? void 0 : _d.forEach(message => {
|
|
63083
|
+
var _a;
|
|
63084
|
+
if (((_a = message.sender) === null || _a === void 0 ? void 0 : _a.sender_type) === 'ASSISTANT') {
|
|
63085
|
+
reply = message;
|
|
63086
|
+
}
|
|
63087
|
+
});
|
|
63088
|
+
}
|
|
63089
|
+
finally {
|
|
63090
|
+
_e = true;
|
|
63091
|
+
}
|
|
63092
|
+
}
|
|
63093
|
+
}
|
|
63094
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
63095
|
+
finally {
|
|
63096
|
+
try {
|
|
63097
|
+
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
|
63098
|
+
}
|
|
63099
|
+
finally { if (e_1) throw e_1.error; }
|
|
63100
|
+
}
|
|
63101
|
+
if (!reply) {
|
|
63102
|
+
this.logger.error('no aily reply');
|
|
63103
|
+
throw EExecStatus.ERROR;
|
|
63104
|
+
}
|
|
63105
|
+
return reply;
|
|
63106
|
+
});
|
|
63107
|
+
}
|
|
63108
|
+
createWithStream(params, options) {
|
|
63109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63110
|
+
const { ailySessionId, runId, messageId } = yield this.waitReply(params, options);
|
|
63111
|
+
const listMessages = () => this.client.aily.v1.ailySessionAilyMessage.listWithIterator({
|
|
63112
|
+
path: {
|
|
63113
|
+
aily_session_id: ailySessionId,
|
|
63114
|
+
},
|
|
63115
|
+
params: {
|
|
63116
|
+
run_id: runId,
|
|
63117
|
+
with_partial_message: true,
|
|
63118
|
+
}
|
|
63119
|
+
}, options);
|
|
63120
|
+
let startOutput = false;
|
|
63121
|
+
const Iterable = {
|
|
63122
|
+
[Symbol.asyncIterator]() {
|
|
63123
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
63124
|
+
var _b, e_2, _c, _d;
|
|
63125
|
+
try {
|
|
63126
|
+
for (var _e = true, _f = __asyncValues(yield __await(listMessages())), _g; _g = yield __await(_f.next()), _b = _g.done, !_b;) {
|
|
63127
|
+
_d = _g.value;
|
|
63128
|
+
_e = false;
|
|
63129
|
+
try {
|
|
63130
|
+
const items = _d;
|
|
63131
|
+
if (!items) {
|
|
63132
|
+
continue;
|
|
63133
|
+
}
|
|
63134
|
+
for (const message of items.messages || []) {
|
|
63135
|
+
if (startOutput) {
|
|
63136
|
+
yield yield __await(message);
|
|
63137
|
+
if (message.status === 'COMPLETED') {
|
|
63138
|
+
return yield __await(void 0);
|
|
63139
|
+
}
|
|
63140
|
+
}
|
|
63141
|
+
else if (message.id === messageId && message.status === 'COMPLETED') {
|
|
63142
|
+
startOutput = true;
|
|
63143
|
+
}
|
|
63144
|
+
}
|
|
63145
|
+
}
|
|
63146
|
+
finally {
|
|
63147
|
+
_e = true;
|
|
63148
|
+
}
|
|
63149
|
+
}
|
|
63150
|
+
}
|
|
63151
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
63152
|
+
finally {
|
|
63153
|
+
try {
|
|
63154
|
+
if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
|
|
63155
|
+
}
|
|
63156
|
+
finally { if (e_2) throw e_2.error; }
|
|
63157
|
+
}
|
|
63158
|
+
});
|
|
63159
|
+
}
|
|
63160
|
+
};
|
|
63161
|
+
return Iterable;
|
|
63162
|
+
});
|
|
63163
|
+
}
|
|
63164
|
+
getRecords() {
|
|
63165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63166
|
+
const sessions = (yield this.cache.get(CAilySessionRecord)) || {};
|
|
63167
|
+
return sessions;
|
|
63168
|
+
});
|
|
63169
|
+
}
|
|
63170
|
+
updateRecords(records) {
|
|
63171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63172
|
+
yield this.cache.set(CAilySessionRecord, records);
|
|
63173
|
+
});
|
|
63174
|
+
}
|
|
63175
|
+
}
|
|
63176
|
+
|
|
62062
63177
|
exports.AESCipher = AESCipher;
|
|
63178
|
+
exports.Aily = Aily;
|
|
62063
63179
|
exports.CAppTicket = CAppTicket;
|
|
62064
63180
|
exports.CTenantAccessToken = CTenantAccessToken;
|
|
62065
63181
|
exports.CardActionHandler = CardActionHandler;
|