@io-orkes/conductor-javascript 1.2.0-rc.1 → 1.2.0-rc.3
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/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +53 -11
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +53 -11
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +276 -152
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +292 -144
- package/dist/index.mjs.map +1 -1
- package/dist/{types-e3d6bb0f.d.ts → types-7f82aacc.d.ts} +4 -2
- package/package.json +16 -2
package/dist/index.mjs
CHANGED
|
@@ -1,53 +1,243 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
6
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
7
|
+
}) : x)(function(x) {
|
|
8
|
+
if (typeof require !== "undefined")
|
|
9
|
+
return require.apply(this, arguments);
|
|
10
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
11
|
+
});
|
|
12
|
+
var __esm = (fn, res) => function __init() {
|
|
13
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
14
|
+
};
|
|
15
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
18
|
+
var __export = (target, all) => {
|
|
19
|
+
for (var name in all)
|
|
20
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21
|
+
};
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(from))
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
1
32
|
// src/common/ConductorLogger.ts
|
|
2
|
-
var LOG_LEVELS
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
33
|
+
var LOG_LEVELS, DefaultLogger, noopLogger;
|
|
34
|
+
var init_ConductorLogger = __esm({
|
|
35
|
+
"src/common/ConductorLogger.ts"() {
|
|
36
|
+
"use strict";
|
|
37
|
+
LOG_LEVELS = {
|
|
38
|
+
DEBUG: 10,
|
|
39
|
+
INFO: 30,
|
|
40
|
+
ERROR: 60
|
|
41
|
+
};
|
|
42
|
+
DefaultLogger = class {
|
|
43
|
+
constructor(config = {}) {
|
|
44
|
+
this.info = (...args) => {
|
|
45
|
+
this.log("INFO", ...args);
|
|
46
|
+
};
|
|
47
|
+
this.debug = (...args) => {
|
|
48
|
+
this.log("DEBUG", ...args);
|
|
49
|
+
};
|
|
50
|
+
this.error = (...args) => {
|
|
51
|
+
this.log("ERROR", ...args);
|
|
52
|
+
};
|
|
53
|
+
const { level, tags = [] } = config;
|
|
54
|
+
this.tags = tags;
|
|
55
|
+
if (level && level in LOG_LEVELS) {
|
|
56
|
+
this.level = LOG_LEVELS[level];
|
|
57
|
+
} else {
|
|
58
|
+
this.level = LOG_LEVELS.INFO;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
log(level, ...args) {
|
|
62
|
+
let resolvedLevel;
|
|
63
|
+
let name = level;
|
|
64
|
+
if (level in LOG_LEVELS) {
|
|
65
|
+
resolvedLevel = LOG_LEVELS[level];
|
|
66
|
+
} else {
|
|
67
|
+
name = "INFO";
|
|
68
|
+
resolvedLevel = LOG_LEVELS.INFO;
|
|
69
|
+
}
|
|
70
|
+
if (resolvedLevel >= this.level) {
|
|
71
|
+
console.log(name, ...this.tags, ...args);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
11
74
|
};
|
|
12
|
-
|
|
13
|
-
|
|
75
|
+
noopLogger = {
|
|
76
|
+
//eslint-disable-next-line
|
|
77
|
+
debug: (...args) => {
|
|
78
|
+
},
|
|
79
|
+
//eslint-disable-next-line
|
|
80
|
+
info: (...args) => {
|
|
81
|
+
},
|
|
82
|
+
//eslint-disable-next-line
|
|
83
|
+
error: (...args) => {
|
|
84
|
+
}
|
|
14
85
|
};
|
|
15
|
-
|
|
16
|
-
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/orkes/request/fetchCatchDns/DnsResolver.ts
|
|
90
|
+
import { promises } from "dns";
|
|
91
|
+
var DEFAULT_OPTIONS, dnsResolver;
|
|
92
|
+
var init_DnsResolver = __esm({
|
|
93
|
+
"src/orkes/request/fetchCatchDns/DnsResolver.ts"() {
|
|
94
|
+
"use strict";
|
|
95
|
+
init_ConductorLogger();
|
|
96
|
+
DEFAULT_OPTIONS = {
|
|
97
|
+
logger: noopLogger,
|
|
98
|
+
resolver: promises.resolve4
|
|
99
|
+
};
|
|
100
|
+
dnsResolver = async (host, { resolver = promises.resolve4, logger = console } = DEFAULT_OPTIONS) => {
|
|
101
|
+
try {
|
|
102
|
+
const addresses = await resolver(host);
|
|
103
|
+
if (addresses.length > 0)
|
|
104
|
+
return addresses[0];
|
|
105
|
+
} catch (e) {
|
|
106
|
+
logger.error("Could not resolve host: " + host + " error: " + e);
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// src/orkes/request/fetchCatchDns/DnsCache.ts
|
|
114
|
+
var DnsCacheResolver;
|
|
115
|
+
var init_DnsCache = __esm({
|
|
116
|
+
"src/orkes/request/fetchCatchDns/DnsCache.ts"() {
|
|
117
|
+
"use strict";
|
|
118
|
+
init_DnsResolver();
|
|
119
|
+
DnsCacheResolver = class {
|
|
120
|
+
constructor({ initialCache = /* @__PURE__ */ new Map() } = {}) {
|
|
121
|
+
this._cache = /* @__PURE__ */ new Map();
|
|
122
|
+
this._cache = initialCache;
|
|
123
|
+
}
|
|
124
|
+
async resolve(host) {
|
|
125
|
+
const cachedIp = this._cache.get(host);
|
|
126
|
+
if (cachedIp) {
|
|
127
|
+
return cachedIp;
|
|
128
|
+
}
|
|
129
|
+
const ip = await dnsResolver(host);
|
|
130
|
+
if (ip != void 0) {
|
|
131
|
+
this._cache.set(host, ip);
|
|
132
|
+
}
|
|
133
|
+
return ip;
|
|
134
|
+
}
|
|
135
|
+
clearCache() {
|
|
136
|
+
this._cache.clear();
|
|
137
|
+
}
|
|
138
|
+
get cache() {
|
|
139
|
+
return this._cache;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// src/orkes/request/fetchCatchDns/fetchCatchDns.ts
|
|
146
|
+
import { isIP } from "net";
|
|
147
|
+
var isEmpty, toMaybeUrl, DEFAULT_OPTIONS2, fetchCatchDns;
|
|
148
|
+
var init_fetchCatchDns = __esm({
|
|
149
|
+
"src/orkes/request/fetchCatchDns/fetchCatchDns.ts"() {
|
|
150
|
+
"use strict";
|
|
151
|
+
init_DnsCache();
|
|
152
|
+
isEmpty = (value) => {
|
|
153
|
+
return value === void 0 || value.trim().length === 0;
|
|
154
|
+
};
|
|
155
|
+
toMaybeUrl = (originalUrl, modifiedParams) => {
|
|
156
|
+
const urlToHit = new URL(originalUrl.toString());
|
|
157
|
+
urlToHit.host = isEmpty(modifiedParams.port) ? `${modifiedParams.host}:${modifiedParams.port}` : modifiedParams.host;
|
|
158
|
+
return urlToHit;
|
|
159
|
+
};
|
|
160
|
+
DEFAULT_OPTIONS2 = {
|
|
161
|
+
dnsCache: new DnsCacheResolver(),
|
|
162
|
+
headerFactory: (headers) => new Headers(headers || {})
|
|
163
|
+
};
|
|
164
|
+
fetchCatchDns = (fetch2, {
|
|
165
|
+
dnsCache = new DnsCacheResolver(),
|
|
166
|
+
headerFactory = (headers) => new Headers(headers || {})
|
|
167
|
+
} = DEFAULT_OPTIONS2) => {
|
|
168
|
+
const fetchWithDns = async (input, options) => {
|
|
169
|
+
const parsedUrl = new URL(input.toString());
|
|
170
|
+
const { hostname, host, port } = parsedUrl;
|
|
171
|
+
if (isIP(hostname)) {
|
|
172
|
+
return await fetch2(input, options);
|
|
173
|
+
}
|
|
174
|
+
const maybeTargetIp = await dnsCache.resolve(hostname);
|
|
175
|
+
if (isEmpty(maybeTargetIp)) {
|
|
176
|
+
return await fetch2(input, options);
|
|
177
|
+
}
|
|
178
|
+
const target = toMaybeUrl(input, {
|
|
179
|
+
...parsedUrl,
|
|
180
|
+
host: maybeTargetIp,
|
|
181
|
+
port
|
|
182
|
+
});
|
|
183
|
+
const headersOverride = headerFactory(options?.headers ?? {});
|
|
184
|
+
if (!headersOverride.has("Host")) {
|
|
185
|
+
headersOverride.set("Host", host);
|
|
186
|
+
}
|
|
187
|
+
const optionsOverride = {
|
|
188
|
+
...options,
|
|
189
|
+
headers: headersOverride
|
|
190
|
+
};
|
|
191
|
+
const res = await fetch2(target.toString(), optionsOverride);
|
|
192
|
+
return res;
|
|
193
|
+
};
|
|
194
|
+
return fetchWithDns;
|
|
17
195
|
};
|
|
18
|
-
const { level, tags = [] } = config;
|
|
19
|
-
this.tags = tags;
|
|
20
|
-
if (level && level in LOG_LEVELS) {
|
|
21
|
-
this.level = LOG_LEVELS[level];
|
|
22
|
-
} else {
|
|
23
|
-
this.level = LOG_LEVELS.INFO;
|
|
24
|
-
}
|
|
25
196
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// src/orkes/request/fetchCatchDns/index.ts
|
|
200
|
+
var fetchCatchDns_exports = {};
|
|
201
|
+
__export(fetchCatchDns_exports, {
|
|
202
|
+
DnsCacheResolver: () => DnsCacheResolver,
|
|
203
|
+
fetchCatchDns: () => fetchCatchDns,
|
|
204
|
+
toMaybeUrl: () => toMaybeUrl
|
|
205
|
+
});
|
|
206
|
+
var init_fetchCatchDns2 = __esm({
|
|
207
|
+
"src/orkes/request/fetchCatchDns/index.ts"() {
|
|
208
|
+
"use strict";
|
|
209
|
+
init_DnsCache();
|
|
210
|
+
init_fetchCatchDns();
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// src/orkes/fetchImplementation.js
|
|
215
|
+
var require_fetchImplementation = __commonJS({
|
|
216
|
+
"src/orkes/fetchImplementation.js"(exports, module) {
|
|
217
|
+
"use strict";
|
|
218
|
+
var fetchCatchDns2 = (init_fetchCatchDns2(), __toCommonJS(fetchCatchDns_exports)).fetchCatchDns;
|
|
219
|
+
var fetchImplementation = fetch;
|
|
220
|
+
var nodeFetch = __require("node-fetch");
|
|
221
|
+
if (nodeFetch) {
|
|
222
|
+
const nodeFetchWrapper = async (input, options = {}) => {
|
|
223
|
+
const res = await fetch(input.toString(), options);
|
|
224
|
+
return res;
|
|
225
|
+
};
|
|
226
|
+
const fetchCache2 = fetchCatchDns2(nodeFetchWrapper, {
|
|
227
|
+
headerFactory: (headers) => new nodeFetch.Headers(headers || {})
|
|
228
|
+
});
|
|
229
|
+
fetchImplementation = fetchCache2;
|
|
230
|
+
console.log("Using node fetch");
|
|
31
231
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
if (resolvedLevel >= this.level) {
|
|
36
|
-
console.log(name, ...this.tags, ...args);
|
|
232
|
+
fetchImplementation = fetchCatchDns2(fetch);
|
|
233
|
+
console.log("Using native fetch");
|
|
37
234
|
}
|
|
235
|
+
module.exports = fetchImplementation;
|
|
38
236
|
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
//eslint-disable-next-line
|
|
45
|
-
info: (...args) => {
|
|
46
|
-
},
|
|
47
|
-
//eslint-disable-next-line
|
|
48
|
-
error: (...args) => {
|
|
49
|
-
}
|
|
50
|
-
};
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// src/common/index.ts
|
|
240
|
+
init_ConductorLogger();
|
|
51
241
|
|
|
52
242
|
// src/common/types.ts
|
|
53
243
|
var TaskType = /* @__PURE__ */ ((TaskType2) => {
|
|
@@ -2156,7 +2346,11 @@ var ConductorClient = class {
|
|
|
2156
2346
|
this.request = {
|
|
2157
2347
|
config: resolvedConfig,
|
|
2158
2348
|
request: (apiConfig) => {
|
|
2159
|
-
return requestHandler(
|
|
2349
|
+
return requestHandler(
|
|
2350
|
+
request,
|
|
2351
|
+
{ ...resolvedConfig, TOKEN: this.token },
|
|
2352
|
+
apiConfig
|
|
2353
|
+
);
|
|
2160
2354
|
}
|
|
2161
2355
|
};
|
|
2162
2356
|
this.token = config?.TOKEN;
|
|
@@ -2171,6 +2365,8 @@ var ConductorClient = class {
|
|
|
2171
2365
|
this.humanTask = new HumanTaskService(this.request);
|
|
2172
2366
|
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
2173
2367
|
}
|
|
2368
|
+
stop() {
|
|
2369
|
+
}
|
|
2174
2370
|
};
|
|
2175
2371
|
|
|
2176
2372
|
// src/common/open-api/core/BaseHttpRequest.ts
|
|
@@ -3362,95 +3558,6 @@ var workflow = (name, tasks) => ({
|
|
|
3362
3558
|
timeoutSeconds: 0
|
|
3363
3559
|
});
|
|
3364
3560
|
|
|
3365
|
-
// src/orkes/request/fetchCatchDns/DnsResolver.ts
|
|
3366
|
-
import { promises } from "dns";
|
|
3367
|
-
var DEFAULT_OPTIONS = {
|
|
3368
|
-
logger: noopLogger,
|
|
3369
|
-
resolver: promises.resolve4
|
|
3370
|
-
};
|
|
3371
|
-
var dnsResolver = async (host, { resolver = promises.resolve4, logger = console } = DEFAULT_OPTIONS) => {
|
|
3372
|
-
try {
|
|
3373
|
-
const addresses = await resolver(host);
|
|
3374
|
-
if (addresses.length > 0)
|
|
3375
|
-
return addresses[0];
|
|
3376
|
-
} catch (e) {
|
|
3377
|
-
logger.error("Could not resolve host: " + host + " error: " + e);
|
|
3378
|
-
}
|
|
3379
|
-
return void 0;
|
|
3380
|
-
};
|
|
3381
|
-
|
|
3382
|
-
// src/orkes/request/fetchCatchDns/DnsCache.ts
|
|
3383
|
-
var DnsCacheResolver = class {
|
|
3384
|
-
constructor({ initialCache = /* @__PURE__ */ new Map() } = {}) {
|
|
3385
|
-
this._cache = /* @__PURE__ */ new Map();
|
|
3386
|
-
this._cache = initialCache;
|
|
3387
|
-
}
|
|
3388
|
-
async resolve(host) {
|
|
3389
|
-
const cachedIp = this._cache.get(host);
|
|
3390
|
-
if (cachedIp) {
|
|
3391
|
-
return cachedIp;
|
|
3392
|
-
}
|
|
3393
|
-
const ip = await dnsResolver(host);
|
|
3394
|
-
if (ip != void 0) {
|
|
3395
|
-
this._cache.set(host, ip);
|
|
3396
|
-
}
|
|
3397
|
-
return ip;
|
|
3398
|
-
}
|
|
3399
|
-
clearCache() {
|
|
3400
|
-
this._cache.clear();
|
|
3401
|
-
}
|
|
3402
|
-
get cache() {
|
|
3403
|
-
return this._cache;
|
|
3404
|
-
}
|
|
3405
|
-
};
|
|
3406
|
-
|
|
3407
|
-
// src/orkes/request/fetchCatchDns/fetchCatchDns.ts
|
|
3408
|
-
import { isIP } from "net";
|
|
3409
|
-
var isEmpty = (value) => {
|
|
3410
|
-
return value === void 0 || value.trim().length === 0;
|
|
3411
|
-
};
|
|
3412
|
-
var toMaybeUrl = (originalUrl, modifiedParams) => {
|
|
3413
|
-
const urlToHit = new URL(originalUrl.toString());
|
|
3414
|
-
urlToHit.host = isEmpty(modifiedParams.port) ? `${modifiedParams.host}:${modifiedParams.port}` : modifiedParams.host;
|
|
3415
|
-
return urlToHit;
|
|
3416
|
-
};
|
|
3417
|
-
var DEFAULT_OPTIONS2 = {
|
|
3418
|
-
dnsCache: new DnsCacheResolver(),
|
|
3419
|
-
headerFactory: (headers) => new Headers(headers || {})
|
|
3420
|
-
};
|
|
3421
|
-
var fetchCatchDns = (fetch2, {
|
|
3422
|
-
dnsCache = new DnsCacheResolver(),
|
|
3423
|
-
headerFactory = (headers) => new Headers(headers || {})
|
|
3424
|
-
} = DEFAULT_OPTIONS2) => {
|
|
3425
|
-
const fetchWithDns = async (input, options) => {
|
|
3426
|
-
const parsedUrl = new URL(input.toString());
|
|
3427
|
-
const { hostname, host, port } = parsedUrl;
|
|
3428
|
-
if (isIP(hostname)) {
|
|
3429
|
-
return await fetch2(input, options);
|
|
3430
|
-
}
|
|
3431
|
-
const maybeTargetIp = await dnsCache.resolve(hostname);
|
|
3432
|
-
if (isEmpty(maybeTargetIp)) {
|
|
3433
|
-
return await fetch2(input, options);
|
|
3434
|
-
}
|
|
3435
|
-
const target = toMaybeUrl(input, {
|
|
3436
|
-
...parsedUrl,
|
|
3437
|
-
host: maybeTargetIp,
|
|
3438
|
-
port
|
|
3439
|
-
});
|
|
3440
|
-
const headersOverride = headerFactory(options?.headers ?? {});
|
|
3441
|
-
if (!headersOverride.has("Host")) {
|
|
3442
|
-
headersOverride.set("Host", host);
|
|
3443
|
-
}
|
|
3444
|
-
const optionsOverride = {
|
|
3445
|
-
...options,
|
|
3446
|
-
headers: headersOverride
|
|
3447
|
-
};
|
|
3448
|
-
const res = await fetch2(target.toString(), optionsOverride);
|
|
3449
|
-
return res;
|
|
3450
|
-
};
|
|
3451
|
-
return fetchWithDns;
|
|
3452
|
-
};
|
|
3453
|
-
|
|
3454
3561
|
// src/orkes/request/request.ts
|
|
3455
3562
|
var isDefined2 = (value) => {
|
|
3456
3563
|
return value !== void 0 && value !== null;
|
|
@@ -3688,21 +3795,57 @@ var request2 = (config, options, fetchFn = fetch) => {
|
|
|
3688
3795
|
|
|
3689
3796
|
// src/orkes/BaseOrkesConductorClient.ts
|
|
3690
3797
|
var defaultRequestHandler2 = (request3, config, options) => request3(config, options);
|
|
3798
|
+
var REFRESH_TOKEN_IN_MILLISECONDS = 30 * 60 * 1e3;
|
|
3799
|
+
var AuthConductorClient = class extends ConductorClient {
|
|
3800
|
+
constructor(config, requestHandler = defaultRequestHandler2) {
|
|
3801
|
+
super(config, requestHandler);
|
|
3802
|
+
}
|
|
3803
|
+
/**
|
|
3804
|
+
* Stops the interval that refreshes the token
|
|
3805
|
+
*/
|
|
3806
|
+
stop() {
|
|
3807
|
+
if (this.intervalId != null) {
|
|
3808
|
+
clearInterval(this.intervalId);
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
};
|
|
3691
3812
|
var baseOrkesConductorClient = (fetchFn, baseRequestHandler = defaultRequestHandler2) => {
|
|
3813
|
+
const requestTokenForKeySecret = (keyId, keySecret, tokenUrl) => fetchFn(tokenUrl, {
|
|
3814
|
+
headers: {
|
|
3815
|
+
"Content-Type": "application/json",
|
|
3816
|
+
Accept: "application/json"
|
|
3817
|
+
},
|
|
3818
|
+
body: JSON.stringify({ keyId, keySecret }),
|
|
3819
|
+
method: "POST"
|
|
3820
|
+
});
|
|
3692
3821
|
return async (config, requestHandler = baseRequestHandler) => {
|
|
3693
3822
|
if (config?.keySecret != null && config?.keyId != null) {
|
|
3694
|
-
const {
|
|
3823
|
+
const {
|
|
3824
|
+
serverUrl,
|
|
3825
|
+
keyId,
|
|
3826
|
+
keySecret,
|
|
3827
|
+
refreshTokenInterval = REFRESH_TOKEN_IN_MILLISECONDS
|
|
3828
|
+
} = config;
|
|
3695
3829
|
const tokenUrl = `${serverUrl}/token`;
|
|
3696
|
-
const res = await
|
|
3697
|
-
headers: {
|
|
3698
|
-
"Content-Type": "application/json",
|
|
3699
|
-
Accept: "application/json"
|
|
3700
|
-
},
|
|
3701
|
-
body: JSON.stringify({ keyId, keySecret }),
|
|
3702
|
-
method: "POST"
|
|
3703
|
-
});
|
|
3830
|
+
const res = await requestTokenForKeySecret(keyId, keySecret, tokenUrl);
|
|
3704
3831
|
const { token } = await res.json();
|
|
3705
|
-
|
|
3832
|
+
const conductorClientInstance = new AuthConductorClient(
|
|
3833
|
+
{ ...config, TOKEN: token },
|
|
3834
|
+
requestHandler
|
|
3835
|
+
);
|
|
3836
|
+
if (token != null && refreshTokenInterval > 0) {
|
|
3837
|
+
const intervalId = setInterval(async () => {
|
|
3838
|
+
const res2 = await requestTokenForKeySecret(
|
|
3839
|
+
keyId,
|
|
3840
|
+
keySecret,
|
|
3841
|
+
tokenUrl
|
|
3842
|
+
);
|
|
3843
|
+
const { token: token2 } = await res2.json();
|
|
3844
|
+
conductorClientInstance.token = token2;
|
|
3845
|
+
}, refreshTokenInterval);
|
|
3846
|
+
conductorClientInstance.intervalId = intervalId;
|
|
3847
|
+
}
|
|
3848
|
+
return conductorClientInstance;
|
|
3706
3849
|
} else {
|
|
3707
3850
|
return new ConductorClient(config, requestHandler);
|
|
3708
3851
|
}
|
|
@@ -3710,14 +3853,19 @@ var baseOrkesConductorClient = (fetchFn, baseRequestHandler = defaultRequestHand
|
|
|
3710
3853
|
};
|
|
3711
3854
|
|
|
3712
3855
|
// src/orkes/OrkesConductorClient.ts
|
|
3713
|
-
var fetchCache =
|
|
3714
|
-
var defaultRequestHandler3 = (__request, config, options) => request2(config, options,
|
|
3856
|
+
var fetchCache = require_fetchImplementation();
|
|
3857
|
+
var defaultRequestHandler3 = (__request, config, options) => request2(config, options, fetch);
|
|
3715
3858
|
var orkesConductorClient = baseOrkesConductorClient(
|
|
3859
|
+
//@ts-ignore
|
|
3716
3860
|
fetchCache,
|
|
3717
3861
|
defaultRequestHandler3
|
|
3718
3862
|
);
|
|
3863
|
+
|
|
3864
|
+
// src/orkes/index.ts
|
|
3865
|
+
init_fetchCatchDns2();
|
|
3719
3866
|
export {
|
|
3720
3867
|
ApiError,
|
|
3868
|
+
AuthConductorClient,
|
|
3721
3869
|
BaseHttpRequest,
|
|
3722
3870
|
CancelError,
|
|
3723
3871
|
CancelablePromise,
|