@workglow/util 0.0.103 → 0.0.104
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.js +338 -84
- package/dist/browser.js.map +11 -5
- package/dist/bun.js +338 -80
- package/dist/bun.js.map +11 -5
- package/dist/common.d.ts +3 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/credentials/ChainedCredentialStore.d.ts +34 -0
- package/dist/credentials/ChainedCredentialStore.d.ts.map +1 -0
- package/dist/credentials/CredentialStoreRegistry.d.ts +27 -0
- package/dist/credentials/CredentialStoreRegistry.d.ts.map +1 -0
- package/dist/credentials/EnvCredentialStore.d.ts +41 -0
- package/dist/credentials/EnvCredentialStore.d.ts.map +1 -0
- package/dist/credentials/ICredentialStore.d.ts +95 -0
- package/dist/credentials/ICredentialStore.d.ts.map +1 -0
- package/dist/credentials/InMemoryCredentialStore.d.ts +23 -0
- package/dist/credentials/InMemoryCredentialStore.d.ts.map +1 -0
- package/dist/credentials/index.d.ts +11 -0
- package/dist/credentials/index.d.ts.map +1 -0
- package/dist/crypto/{Crypto.bun.d.ts → Crypto.d.ts} +1 -1
- package/dist/crypto/Crypto.d.ts.map +1 -0
- package/dist/crypto/WebCrypto.d.ts +29 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -0
- package/dist/node.js +338 -81
- package/dist/node.js.map +11 -5
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/crypto/Crypto.browser.d.ts +0 -10
- package/dist/crypto/Crypto.browser.d.ts.map +0 -1
- package/dist/crypto/Crypto.bun.d.ts.map +0 -1
- package/dist/crypto/Crypto.node.d.ts +0 -10
- package/dist/crypto/Crypto.node.d.ts.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
+
// src/utilities/Misc.ts
|
|
2
|
+
function forceArray(input) {
|
|
3
|
+
if (Array.isArray(input))
|
|
4
|
+
return input;
|
|
5
|
+
return [input];
|
|
6
|
+
}
|
|
7
|
+
async function sleep(ms) {
|
|
8
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
}
|
|
10
|
+
function collectPropertyValues(input) {
|
|
11
|
+
const output = {};
|
|
12
|
+
(input || []).forEach((item) => {
|
|
13
|
+
Object.keys(item).forEach((key) => {
|
|
14
|
+
const value = item[key];
|
|
15
|
+
if (output[key]) {
|
|
16
|
+
output[key].push(value);
|
|
17
|
+
} else {
|
|
18
|
+
output[key] = [value];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
return output;
|
|
23
|
+
}
|
|
24
|
+
function toSQLiteTimestamp(date) {
|
|
25
|
+
if (!date)
|
|
26
|
+
return null;
|
|
27
|
+
const pad = (number) => number < 10 ? "0" + number : number;
|
|
28
|
+
const year = date.getUTCFullYear();
|
|
29
|
+
const month = pad(date.getUTCMonth() + 1);
|
|
30
|
+
const day = pad(date.getUTCDate());
|
|
31
|
+
const hours = pad(date.getUTCHours());
|
|
32
|
+
const minutes = pad(date.getUTCMinutes());
|
|
33
|
+
const seconds = pad(date.getUTCSeconds());
|
|
34
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
35
|
+
}
|
|
36
|
+
function deepEqual(a, b) {
|
|
37
|
+
if (a === b) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const keysA = Object.keys(a);
|
|
44
|
+
const keysB = Object.keys(b);
|
|
45
|
+
if (keysA.length !== keysB.length) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
for (const key of keysA) {
|
|
49
|
+
if (!keysB.includes(key)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (!deepEqual(a[key], b[key])) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
function sortObject(obj) {
|
|
59
|
+
return Object.keys(obj).sort().reduce((result, key) => {
|
|
60
|
+
result[key] = obj[key];
|
|
61
|
+
return result;
|
|
62
|
+
}, {});
|
|
63
|
+
}
|
|
64
|
+
function serialize(obj) {
|
|
65
|
+
const sortedObj = sortObject(obj);
|
|
66
|
+
return JSON.stringify(sortedObj);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/crypto/Crypto.ts
|
|
70
|
+
async function sha256(data) {
|
|
71
|
+
const encoder = new TextEncoder;
|
|
72
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", encoder.encode(data));
|
|
73
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
74
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
75
|
+
}
|
|
76
|
+
async function makeFingerprint(input) {
|
|
77
|
+
const serializedObj = serialize(input);
|
|
78
|
+
const hash = await sha256(serializedObj);
|
|
79
|
+
return hash;
|
|
80
|
+
}
|
|
81
|
+
function uuid4() {
|
|
82
|
+
return crypto.randomUUID();
|
|
83
|
+
}
|
|
1
84
|
// src/di/Container.ts
|
|
2
85
|
class Container {
|
|
3
86
|
services = new Map;
|
|
@@ -1251,73 +1334,6 @@ function closeStack(text, stack) {
|
|
|
1251
1334
|
}
|
|
1252
1335
|
return result;
|
|
1253
1336
|
}
|
|
1254
|
-
// src/utilities/Misc.ts
|
|
1255
|
-
function forceArray(input) {
|
|
1256
|
-
if (Array.isArray(input))
|
|
1257
|
-
return input;
|
|
1258
|
-
return [input];
|
|
1259
|
-
}
|
|
1260
|
-
async function sleep(ms) {
|
|
1261
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1262
|
-
}
|
|
1263
|
-
function collectPropertyValues(input) {
|
|
1264
|
-
const output = {};
|
|
1265
|
-
(input || []).forEach((item) => {
|
|
1266
|
-
Object.keys(item).forEach((key) => {
|
|
1267
|
-
const value = item[key];
|
|
1268
|
-
if (output[key]) {
|
|
1269
|
-
output[key].push(value);
|
|
1270
|
-
} else {
|
|
1271
|
-
output[key] = [value];
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
});
|
|
1275
|
-
return output;
|
|
1276
|
-
}
|
|
1277
|
-
function toSQLiteTimestamp(date) {
|
|
1278
|
-
if (!date)
|
|
1279
|
-
return null;
|
|
1280
|
-
const pad = (number) => number < 10 ? "0" + number : number;
|
|
1281
|
-
const year = date.getUTCFullYear();
|
|
1282
|
-
const month = pad(date.getUTCMonth() + 1);
|
|
1283
|
-
const day = pad(date.getUTCDate());
|
|
1284
|
-
const hours = pad(date.getUTCHours());
|
|
1285
|
-
const minutes = pad(date.getUTCMinutes());
|
|
1286
|
-
const seconds = pad(date.getUTCSeconds());
|
|
1287
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
1288
|
-
}
|
|
1289
|
-
function deepEqual(a, b) {
|
|
1290
|
-
if (a === b) {
|
|
1291
|
-
return true;
|
|
1292
|
-
}
|
|
1293
|
-
if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
|
|
1294
|
-
return false;
|
|
1295
|
-
}
|
|
1296
|
-
const keysA = Object.keys(a);
|
|
1297
|
-
const keysB = Object.keys(b);
|
|
1298
|
-
if (keysA.length !== keysB.length) {
|
|
1299
|
-
return false;
|
|
1300
|
-
}
|
|
1301
|
-
for (const key of keysA) {
|
|
1302
|
-
if (!keysB.includes(key)) {
|
|
1303
|
-
return false;
|
|
1304
|
-
}
|
|
1305
|
-
if (!deepEqual(a[key], b[key])) {
|
|
1306
|
-
return false;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
return true;
|
|
1310
|
-
}
|
|
1311
|
-
function sortObject(obj) {
|
|
1312
|
-
return Object.keys(obj).sort().reduce((result, key) => {
|
|
1313
|
-
result[key] = obj[key];
|
|
1314
|
-
return result;
|
|
1315
|
-
}, {});
|
|
1316
|
-
}
|
|
1317
|
-
function serialize(obj) {
|
|
1318
|
-
const sortedObj = sortObject(obj);
|
|
1319
|
-
return JSON.stringify(sortedObj);
|
|
1320
|
-
}
|
|
1321
1337
|
// src/utilities/objectOfArraysAsArrayOfObjects.ts
|
|
1322
1338
|
function objectOfArraysAsArrayOfObjects(data) {
|
|
1323
1339
|
const keys = Object.keys(data);
|
|
@@ -2239,6 +2255,248 @@ class WorkerServer {
|
|
|
2239
2255
|
}
|
|
2240
2256
|
var WORKER_SERVER = createServiceToken("worker.server");
|
|
2241
2257
|
globalServiceRegistry.register(WORKER_SERVER, () => new WorkerServer, true);
|
|
2258
|
+
// src/credentials/ICredentialStore.ts
|
|
2259
|
+
var CREDENTIAL_STORE = createServiceToken("credential.store");
|
|
2260
|
+
// src/credentials/InMemoryCredentialStore.ts
|
|
2261
|
+
class InMemoryCredentialStore {
|
|
2262
|
+
store = new Map;
|
|
2263
|
+
async get(key) {
|
|
2264
|
+
const entry = this.store.get(key);
|
|
2265
|
+
if (!entry)
|
|
2266
|
+
return;
|
|
2267
|
+
if (entry.metadata.expiresAt && entry.metadata.expiresAt <= new Date) {
|
|
2268
|
+
this.store.delete(key);
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
return entry.value;
|
|
2272
|
+
}
|
|
2273
|
+
async put(key, value, options) {
|
|
2274
|
+
const now = new Date;
|
|
2275
|
+
const existing = this.store.get(key);
|
|
2276
|
+
const metadata = {
|
|
2277
|
+
label: options?.label ?? existing?.metadata.label,
|
|
2278
|
+
provider: options?.provider ?? existing?.metadata.provider,
|
|
2279
|
+
createdAt: existing?.metadata.createdAt ?? now,
|
|
2280
|
+
updatedAt: now,
|
|
2281
|
+
expiresAt: options?.expiresAt ?? existing?.metadata.expiresAt
|
|
2282
|
+
};
|
|
2283
|
+
this.store.set(key, { key, value, metadata });
|
|
2284
|
+
}
|
|
2285
|
+
async delete(key) {
|
|
2286
|
+
return this.store.delete(key);
|
|
2287
|
+
}
|
|
2288
|
+
async has(key) {
|
|
2289
|
+
const entry = this.store.get(key);
|
|
2290
|
+
if (!entry)
|
|
2291
|
+
return false;
|
|
2292
|
+
if (entry.metadata.expiresAt && entry.metadata.expiresAt <= new Date) {
|
|
2293
|
+
this.store.delete(key);
|
|
2294
|
+
return false;
|
|
2295
|
+
}
|
|
2296
|
+
return true;
|
|
2297
|
+
}
|
|
2298
|
+
async keys() {
|
|
2299
|
+
const now = new Date;
|
|
2300
|
+
const result = [];
|
|
2301
|
+
for (const [key, entry] of this.store) {
|
|
2302
|
+
if (entry.metadata.expiresAt && entry.metadata.expiresAt <= now) {
|
|
2303
|
+
this.store.delete(key);
|
|
2304
|
+
continue;
|
|
2305
|
+
}
|
|
2306
|
+
result.push(key);
|
|
2307
|
+
}
|
|
2308
|
+
return result;
|
|
2309
|
+
}
|
|
2310
|
+
async deleteAll() {
|
|
2311
|
+
this.store.clear();
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
// src/credentials/EnvCredentialStore.ts
|
|
2315
|
+
class EnvCredentialStore {
|
|
2316
|
+
keyToEnvVar;
|
|
2317
|
+
prefix;
|
|
2318
|
+
constructor(mapping = {}, prefix) {
|
|
2319
|
+
this.keyToEnvVar = new Map(Object.entries(mapping));
|
|
2320
|
+
this.prefix = prefix;
|
|
2321
|
+
}
|
|
2322
|
+
resolveEnvVar(key) {
|
|
2323
|
+
const explicit = this.keyToEnvVar.get(key);
|
|
2324
|
+
if (explicit)
|
|
2325
|
+
return explicit;
|
|
2326
|
+
if (this.prefix) {
|
|
2327
|
+
return `${this.prefix}_${key.toUpperCase().replace(/-/g, "_")}`;
|
|
2328
|
+
}
|
|
2329
|
+
return key.toUpperCase().replace(/-/g, "_");
|
|
2330
|
+
}
|
|
2331
|
+
getEnv(envVar) {
|
|
2332
|
+
if (typeof process !== "undefined" && process.env) {
|
|
2333
|
+
return process.env[envVar];
|
|
2334
|
+
}
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
async get(key) {
|
|
2338
|
+
const envVar = this.resolveEnvVar(key);
|
|
2339
|
+
return this.getEnv(envVar);
|
|
2340
|
+
}
|
|
2341
|
+
async put(key, value, _options) {
|
|
2342
|
+
const envVar = this.resolveEnvVar(key);
|
|
2343
|
+
if (typeof process !== "undefined" && process.env) {
|
|
2344
|
+
process.env[envVar] = value;
|
|
2345
|
+
}
|
|
2346
|
+
if (!this.keyToEnvVar.has(key)) {
|
|
2347
|
+
this.keyToEnvVar.set(key, envVar);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
async delete(key) {
|
|
2351
|
+
const envVar = this.resolveEnvVar(key);
|
|
2352
|
+
if (typeof process !== "undefined" && process.env && envVar in process.env) {
|
|
2353
|
+
delete process.env[envVar];
|
|
2354
|
+
return true;
|
|
2355
|
+
}
|
|
2356
|
+
return false;
|
|
2357
|
+
}
|
|
2358
|
+
async has(key) {
|
|
2359
|
+
const envVar = this.resolveEnvVar(key);
|
|
2360
|
+
return this.getEnv(envVar) !== undefined;
|
|
2361
|
+
}
|
|
2362
|
+
async keys() {
|
|
2363
|
+
const result = [];
|
|
2364
|
+
for (const [credKey] of this.keyToEnvVar) {
|
|
2365
|
+
if (await this.has(credKey)) {
|
|
2366
|
+
result.push(credKey);
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
return result;
|
|
2370
|
+
}
|
|
2371
|
+
async deleteAll() {
|
|
2372
|
+
for (const [credKey] of this.keyToEnvVar) {
|
|
2373
|
+
await this.delete(credKey);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
// src/credentials/ChainedCredentialStore.ts
|
|
2378
|
+
class ChainedCredentialStore {
|
|
2379
|
+
stores;
|
|
2380
|
+
constructor(stores) {
|
|
2381
|
+
this.stores = stores;
|
|
2382
|
+
if (stores.length === 0) {
|
|
2383
|
+
throw new Error("ChainedCredentialStore requires at least one store.");
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
async get(key) {
|
|
2387
|
+
for (const store of this.stores) {
|
|
2388
|
+
const value = await store.get(key);
|
|
2389
|
+
if (value !== undefined)
|
|
2390
|
+
return value;
|
|
2391
|
+
}
|
|
2392
|
+
return;
|
|
2393
|
+
}
|
|
2394
|
+
async put(key, value, options) {
|
|
2395
|
+
await this.stores[0].put(key, value, options);
|
|
2396
|
+
}
|
|
2397
|
+
async delete(key) {
|
|
2398
|
+
let deleted = false;
|
|
2399
|
+
for (const store of this.stores) {
|
|
2400
|
+
if (await store.delete(key)) {
|
|
2401
|
+
deleted = true;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
return deleted;
|
|
2405
|
+
}
|
|
2406
|
+
async has(key) {
|
|
2407
|
+
for (const store of this.stores) {
|
|
2408
|
+
if (await store.has(key))
|
|
2409
|
+
return true;
|
|
2410
|
+
}
|
|
2411
|
+
return false;
|
|
2412
|
+
}
|
|
2413
|
+
async keys() {
|
|
2414
|
+
const seen = new Set;
|
|
2415
|
+
for (const store of this.stores) {
|
|
2416
|
+
for (const key of await store.keys()) {
|
|
2417
|
+
seen.add(key);
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
return [...seen];
|
|
2421
|
+
}
|
|
2422
|
+
async deleteAll() {
|
|
2423
|
+
await Promise.all(this.stores.map((s) => s.deleteAll()));
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
// src/credentials/CredentialStoreRegistry.ts
|
|
2427
|
+
if (!globalServiceRegistry.has(CREDENTIAL_STORE)) {
|
|
2428
|
+
globalServiceRegistry.register(CREDENTIAL_STORE, () => new InMemoryCredentialStore, true);
|
|
2429
|
+
}
|
|
2430
|
+
function getGlobalCredentialStore() {
|
|
2431
|
+
return globalServiceRegistry.get(CREDENTIAL_STORE);
|
|
2432
|
+
}
|
|
2433
|
+
function setGlobalCredentialStore(store) {
|
|
2434
|
+
globalServiceRegistry.registerInstance(CREDENTIAL_STORE, store);
|
|
2435
|
+
}
|
|
2436
|
+
async function resolveCredential(key, registry) {
|
|
2437
|
+
const store = registry && registry.has(CREDENTIAL_STORE) ? registry.get(CREDENTIAL_STORE) : getGlobalCredentialStore();
|
|
2438
|
+
return store.get(key);
|
|
2439
|
+
}
|
|
2440
|
+
registerInputResolver("credential", async (id, _format, registry) => {
|
|
2441
|
+
return await resolveCredential(id, registry) ?? id;
|
|
2442
|
+
});
|
|
2443
|
+
// src/crypto/WebCrypto.ts
|
|
2444
|
+
var SALT_LENGTH = 16;
|
|
2445
|
+
async function deriveKey(passphrase, salt) {
|
|
2446
|
+
const enc = new TextEncoder;
|
|
2447
|
+
const keyMaterial = await crypto.subtle.importKey("raw", enc.encode(passphrase), "PBKDF2", false, [
|
|
2448
|
+
"deriveKey"
|
|
2449
|
+
]);
|
|
2450
|
+
return crypto.subtle.deriveKey({ name: "PBKDF2", salt, iterations: 1e5, hash: "SHA-256" }, keyMaterial, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
2451
|
+
}
|
|
2452
|
+
async function encrypt(plaintext, passphrase, keyCache) {
|
|
2453
|
+
const enc = new TextEncoder;
|
|
2454
|
+
const salt = crypto.getRandomValues(new Uint8Array(SALT_LENGTH));
|
|
2455
|
+
const saltB64 = bufToBase64(salt);
|
|
2456
|
+
let key = keyCache.get(saltB64);
|
|
2457
|
+
if (!key) {
|
|
2458
|
+
key = await deriveKey(passphrase, salt);
|
|
2459
|
+
keyCache.set(saltB64, key);
|
|
2460
|
+
}
|
|
2461
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
2462
|
+
const rawCiphertext = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, enc.encode(plaintext));
|
|
2463
|
+
const ciphertextBytes = new Uint8Array(rawCiphertext);
|
|
2464
|
+
const combined = new Uint8Array(SALT_LENGTH + ciphertextBytes.length);
|
|
2465
|
+
combined.set(salt, 0);
|
|
2466
|
+
combined.set(ciphertextBytes, SALT_LENGTH);
|
|
2467
|
+
return {
|
|
2468
|
+
encrypted: bufToBase64(combined),
|
|
2469
|
+
iv: bufToBase64(iv)
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
async function decrypt(encrypted, iv, passphrase, keyCache) {
|
|
2473
|
+
const encryptedBuf = base64ToBuf(encrypted);
|
|
2474
|
+
const salt = encryptedBuf.subarray(0, SALT_LENGTH);
|
|
2475
|
+
const ciphertextBytes = encryptedBuf.subarray(SALT_LENGTH);
|
|
2476
|
+
const saltB64 = bufToBase64(salt);
|
|
2477
|
+
let key = keyCache.get(saltB64);
|
|
2478
|
+
if (!key) {
|
|
2479
|
+
key = await deriveKey(passphrase, salt);
|
|
2480
|
+
keyCache.set(saltB64, key);
|
|
2481
|
+
}
|
|
2482
|
+
const plainBuf = await crypto.subtle.decrypt({ name: "AES-GCM", iv: base64ToBuf(iv) }, key, ciphertextBytes);
|
|
2483
|
+
return new TextDecoder().decode(plainBuf);
|
|
2484
|
+
}
|
|
2485
|
+
function bufToBase64(buf) {
|
|
2486
|
+
let binary = "";
|
|
2487
|
+
for (let i = 0;i < buf.length; i++) {
|
|
2488
|
+
binary += String.fromCharCode(buf[i]);
|
|
2489
|
+
}
|
|
2490
|
+
return btoa(binary);
|
|
2491
|
+
}
|
|
2492
|
+
function base64ToBuf(b64) {
|
|
2493
|
+
const binary = atob(b64);
|
|
2494
|
+
const buf = new Uint8Array(binary.length);
|
|
2495
|
+
for (let i = 0;i < binary.length; i++) {
|
|
2496
|
+
buf[i] = binary.charCodeAt(i);
|
|
2497
|
+
}
|
|
2498
|
+
return buf;
|
|
2499
|
+
}
|
|
2242
2500
|
// src/compress/compress.node.ts
|
|
2243
2501
|
import { promisify } from "util";
|
|
2244
2502
|
import zlib from "zlib";
|
|
@@ -2258,19 +2516,6 @@ async function decompress(input, algorithm = "gzip") {
|
|
|
2258
2516
|
const resultBuffer = await decompressAsyncTyped(sourceBuffer);
|
|
2259
2517
|
return resultBuffer.toString();
|
|
2260
2518
|
}
|
|
2261
|
-
// src/crypto/Crypto.node.ts
|
|
2262
|
-
import { createHash } from "node:crypto";
|
|
2263
|
-
async function sha256(data) {
|
|
2264
|
-
return createHash("sha256").update(data).digest("hex");
|
|
2265
|
-
}
|
|
2266
|
-
async function makeFingerprint(input) {
|
|
2267
|
-
const serializedObj = serialize(input);
|
|
2268
|
-
const hash = await sha256(serializedObj);
|
|
2269
|
-
return hash;
|
|
2270
|
-
}
|
|
2271
|
-
function uuid4() {
|
|
2272
|
-
return crypto.randomUUID();
|
|
2273
|
-
}
|
|
2274
2519
|
// src/mcp/McpClientUtil.node.ts
|
|
2275
2520
|
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
2276
2521
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
@@ -2417,7 +2662,9 @@ export {
|
|
|
2417
2662
|
sleep,
|
|
2418
2663
|
sha256,
|
|
2419
2664
|
setLogger,
|
|
2665
|
+
setGlobalCredentialStore,
|
|
2420
2666
|
serialize,
|
|
2667
|
+
resolveCredential,
|
|
2421
2668
|
registerInputResolver,
|
|
2422
2669
|
parsePartialJson,
|
|
2423
2670
|
parseDataUri,
|
|
@@ -2439,8 +2686,12 @@ export {
|
|
|
2439
2686
|
globalContainer,
|
|
2440
2687
|
getLogger,
|
|
2441
2688
|
getInputResolvers,
|
|
2689
|
+
getGlobalCredentialStore,
|
|
2442
2690
|
forceArray,
|
|
2691
|
+
encrypt,
|
|
2692
|
+
deriveKey,
|
|
2443
2693
|
deepEqual,
|
|
2694
|
+
decrypt,
|
|
2444
2695
|
decompress,
|
|
2445
2696
|
createTypedArrayFrom,
|
|
2446
2697
|
createServiceToken,
|
|
@@ -2450,6 +2701,8 @@ export {
|
|
|
2450
2701
|
compress,
|
|
2451
2702
|
compileSchema,
|
|
2452
2703
|
collectPropertyValues,
|
|
2704
|
+
bufToBase64,
|
|
2705
|
+
base64ToBuf,
|
|
2453
2706
|
areSemanticallyCompatible,
|
|
2454
2707
|
areObjectSchemasSemanticallyCompatible,
|
|
2455
2708
|
WorkerServer,
|
|
@@ -2465,16 +2718,20 @@ export {
|
|
|
2465
2718
|
NodeDoesntExistError,
|
|
2466
2719
|
NodeAlreadyExistsError,
|
|
2467
2720
|
LOGGER,
|
|
2721
|
+
InMemoryCredentialStore,
|
|
2468
2722
|
INPUT_RESOLVERS,
|
|
2469
2723
|
Graph,
|
|
2470
2724
|
FromSchemaDefaultOptions,
|
|
2471
2725
|
EventEmitter,
|
|
2726
|
+
EnvCredentialStore,
|
|
2472
2727
|
DirectedGraph,
|
|
2473
2728
|
DirectedAcyclicGraph,
|
|
2474
2729
|
CycleError,
|
|
2475
2730
|
Container,
|
|
2476
2731
|
ConsoleLogger,
|
|
2732
|
+
ChainedCredentialStore,
|
|
2733
|
+
CREDENTIAL_STORE,
|
|
2477
2734
|
BaseError
|
|
2478
2735
|
};
|
|
2479
2736
|
|
|
2480
|
-
//# debugId=
|
|
2737
|
+
//# debugId=AA942AD3DE6A9D8664756E2164756E21
|