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