@plyaz/api 1.1.1 → 1.2.1
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/api/client/helpers/interceptors.d.ts +2 -2
- package/dist/api/client/helpers/interceptors.d.ts.map +1 -1
- package/dist/api/debugger/UnifiedDebugger.d.ts.map +1 -1
- package/dist/api/encryption/crypto.d.ts +56 -0
- package/dist/api/encryption/crypto.d.ts.map +1 -0
- package/dist/api/encryption/field-path.d.ts +74 -0
- package/dist/api/encryption/field-path.d.ts.map +1 -0
- package/dist/api/encryption/index.d.ts +8 -0
- package/dist/api/encryption/index.d.ts.map +1 -0
- package/dist/api/encryption/interceptors.d.ts +103 -0
- package/dist/api/encryption/interceptors.d.ts.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/queue/EventQueueManager.d.ts.map +1 -1
- package/dist/index.cjs +727 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +700 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -612,7 +612,7 @@ function getCrypto() {
|
|
|
612
612
|
}
|
|
613
613
|
__name(getCrypto, "getCrypto");
|
|
614
614
|
function generateUUID() {
|
|
615
|
-
const
|
|
615
|
+
const crypto2 = getCrypto();
|
|
616
616
|
const UUID_CONSTANTS = {
|
|
617
617
|
BYTES: 16,
|
|
618
618
|
VERSION_POSITION: 6,
|
|
@@ -629,12 +629,12 @@ function generateUUID() {
|
|
|
629
629
|
// eslint-disable-next-line no-magic-numbers
|
|
630
630
|
POSITIONS: [8, 12, 16, 20, 32]
|
|
631
631
|
};
|
|
632
|
-
if (
|
|
633
|
-
return
|
|
632
|
+
if (crypto2 && typeof crypto2.randomUUID === "function") {
|
|
633
|
+
return crypto2.randomUUID();
|
|
634
634
|
}
|
|
635
|
-
if (
|
|
635
|
+
if (crypto2?.getRandomValues) {
|
|
636
636
|
const bytes = new Uint8Array(UUID_CONSTANTS.BYTES);
|
|
637
|
-
|
|
637
|
+
crypto2.getRandomValues(bytes);
|
|
638
638
|
bytes[UUID_CONSTANTS.VERSION_POSITION] = bytes[UUID_CONSTANTS.VERSION_POSITION] & UUID_CONSTANTS.VERSION_MASK | UUID_CONSTANTS.VERSION_VALUE;
|
|
639
639
|
bytes[UUID_CONSTANTS.VARIANT_POSITION] = bytes[UUID_CONSTANTS.VARIANT_POSITION] & UUID_CONSTANTS.VARIANT_MASK | UUID_CONSTANTS.VARIANT_VALUE;
|
|
640
640
|
const hex = Array.from(
|
|
@@ -10462,7 +10462,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10462
10462
|
default: "default configuration",
|
|
10463
10463
|
client: "client configuration",
|
|
10464
10464
|
interceptor: "interceptor configuration",
|
|
10465
|
-
contextHeaders: "context header configuration"
|
|
10465
|
+
contextHeaders: "context header configuration",
|
|
10466
|
+
encryption: "encryption configuration for sensitive data"
|
|
10466
10467
|
};
|
|
10467
10468
|
return reasons[winningSource] || `${winningSource} has higher precedence than ${losingSource}`;
|
|
10468
10469
|
}
|
|
@@ -22185,6 +22186,669 @@ function createPreservedConfig(options) {
|
|
|
22185
22186
|
} : void 0);
|
|
22186
22187
|
}
|
|
22187
22188
|
__name(createPreservedConfig, "createPreservedConfig");
|
|
22189
|
+
|
|
22190
|
+
// src/api/encryption/crypto.ts
|
|
22191
|
+
var AES_256_KEY_SIZE_BYTES = 32;
|
|
22192
|
+
var BITS_PER_BYTE = 8;
|
|
22193
|
+
var ALGORITHM_PARAMS = {
|
|
22194
|
+
"AES-GCM": {
|
|
22195
|
+
name: "AES-GCM",
|
|
22196
|
+
length: 256,
|
|
22197
|
+
ivLength: 12,
|
|
22198
|
+
// 96 bits recommended for GCM
|
|
22199
|
+
tagLength: 128
|
|
22200
|
+
// 128 bits authentication tag
|
|
22201
|
+
},
|
|
22202
|
+
"AES-CBC": {
|
|
22203
|
+
name: "AES-CBC",
|
|
22204
|
+
length: 256,
|
|
22205
|
+
ivLength: 16
|
|
22206
|
+
// 128 bits for CBC
|
|
22207
|
+
},
|
|
22208
|
+
"ChaCha20-Poly1305": {
|
|
22209
|
+
name: "ChaCha20-Poly1305",
|
|
22210
|
+
length: 256,
|
|
22211
|
+
ivLength: 12
|
|
22212
|
+
// 96 bits nonce
|
|
22213
|
+
}
|
|
22214
|
+
};
|
|
22215
|
+
function isCryptoAvailable() {
|
|
22216
|
+
return typeof crypto !== "undefined" && crypto.subtle !== void 0;
|
|
22217
|
+
}
|
|
22218
|
+
__name(isCryptoAvailable, "isCryptoAvailable");
|
|
22219
|
+
function generateIV(algorithm) {
|
|
22220
|
+
if (!isCryptoAvailable()) {
|
|
22221
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22222
|
+
}
|
|
22223
|
+
const params = ALGORITHM_PARAMS[algorithm];
|
|
22224
|
+
return crypto.getRandomValues(new Uint8Array(params.ivLength));
|
|
22225
|
+
}
|
|
22226
|
+
__name(generateIV, "generateIV");
|
|
22227
|
+
function base64ToBytes(base64) {
|
|
22228
|
+
const normalized = base64.replace(/-/g, "+").replace(/_/g, "/");
|
|
22229
|
+
const binary = atob(normalized);
|
|
22230
|
+
const bytes = new Uint8Array(binary.length);
|
|
22231
|
+
for (let i = 0; i < binary.length; i++) {
|
|
22232
|
+
bytes[i] = binary.charCodeAt(i);
|
|
22233
|
+
}
|
|
22234
|
+
return bytes;
|
|
22235
|
+
}
|
|
22236
|
+
__name(base64ToBytes, "base64ToBytes");
|
|
22237
|
+
function bytesToBase64(bytes) {
|
|
22238
|
+
let binary = "";
|
|
22239
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
22240
|
+
binary += String.fromCharCode(bytes[i]);
|
|
22241
|
+
}
|
|
22242
|
+
return btoa(binary);
|
|
22243
|
+
}
|
|
22244
|
+
__name(bytesToBase64, "bytesToBase64");
|
|
22245
|
+
async function importJwkKey(key, algorithmParams) {
|
|
22246
|
+
return await crypto.subtle.importKey(
|
|
22247
|
+
"jwk",
|
|
22248
|
+
key,
|
|
22249
|
+
algorithmParams,
|
|
22250
|
+
true,
|
|
22251
|
+
// extractable for key rotation and backup
|
|
22252
|
+
["encrypt", "decrypt"]
|
|
22253
|
+
);
|
|
22254
|
+
}
|
|
22255
|
+
__name(importJwkKey, "importJwkKey");
|
|
22256
|
+
async function importStringKey(key, format, algorithmParams) {
|
|
22257
|
+
const keyBytes = format === "base64" ? base64ToBytes(key) : new TextEncoder().encode(key);
|
|
22258
|
+
if (keyBytes.length !== AES_256_KEY_SIZE_BYTES) {
|
|
22259
|
+
throw new ApiPackageError(
|
|
22260
|
+
`Invalid key length: expected ${AES_256_KEY_SIZE_BYTES} bytes (256 bits), got ${keyBytes.length} bytes`
|
|
22261
|
+
);
|
|
22262
|
+
}
|
|
22263
|
+
return await crypto.subtle.importKey(
|
|
22264
|
+
"raw",
|
|
22265
|
+
keyBytes,
|
|
22266
|
+
algorithmParams,
|
|
22267
|
+
true,
|
|
22268
|
+
// extractable for key rotation and backup
|
|
22269
|
+
["encrypt", "decrypt"]
|
|
22270
|
+
);
|
|
22271
|
+
}
|
|
22272
|
+
__name(importStringKey, "importStringKey");
|
|
22273
|
+
function isCryptoKey(key) {
|
|
22274
|
+
return key instanceof CryptoKey || typeof key === "object" && key !== null && "type" in key;
|
|
22275
|
+
}
|
|
22276
|
+
__name(isCryptoKey, "isCryptoKey");
|
|
22277
|
+
async function importKey(key, algorithm, format = "raw") {
|
|
22278
|
+
if (isCryptoKey(key)) {
|
|
22279
|
+
return key;
|
|
22280
|
+
}
|
|
22281
|
+
if (!isCryptoAvailable()) {
|
|
22282
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22283
|
+
}
|
|
22284
|
+
const algorithmParams = {
|
|
22285
|
+
name: ALGORITHM_PARAMS[algorithm].name,
|
|
22286
|
+
length: ALGORITHM_PARAMS[algorithm].length
|
|
22287
|
+
};
|
|
22288
|
+
if (format === "jwk" && typeof key === "object") {
|
|
22289
|
+
return await importJwkKey(key, algorithmParams);
|
|
22290
|
+
}
|
|
22291
|
+
if (typeof key === "string") {
|
|
22292
|
+
return await importStringKey(key, format, algorithmParams);
|
|
22293
|
+
}
|
|
22294
|
+
throw new ApiPackageError(`Unsupported key format: ${format}`);
|
|
22295
|
+
}
|
|
22296
|
+
__name(importKey, "importKey");
|
|
22297
|
+
async function encrypt(data, encryptionKey) {
|
|
22298
|
+
if (!isCryptoAvailable()) {
|
|
22299
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22300
|
+
}
|
|
22301
|
+
const { algorithm, key, format, id: keyId } = encryptionKey;
|
|
22302
|
+
const params = ALGORITHM_PARAMS[algorithm];
|
|
22303
|
+
const cryptoKey = await importKey(key, algorithm, format);
|
|
22304
|
+
const iv = generateIV(algorithm);
|
|
22305
|
+
const dataString = typeof data === "string" ? data : JSON.stringify(data);
|
|
22306
|
+
const dataBytes = new TextEncoder().encode(dataString);
|
|
22307
|
+
const algorithmParams = {
|
|
22308
|
+
name: params.name,
|
|
22309
|
+
iv,
|
|
22310
|
+
...algorithm === "AES-GCM" && "tagLength" in params && { tagLength: params.tagLength }
|
|
22311
|
+
};
|
|
22312
|
+
const encryptedBuffer = await crypto.subtle.encrypt(algorithmParams, cryptoKey, dataBytes);
|
|
22313
|
+
const encryptedBytes = new Uint8Array(encryptedBuffer);
|
|
22314
|
+
let authTag;
|
|
22315
|
+
let ciphertext = encryptedBytes;
|
|
22316
|
+
if (algorithm === "AES-GCM" && "tagLength" in params) {
|
|
22317
|
+
const tagLength = params.tagLength / BITS_PER_BYTE;
|
|
22318
|
+
const ciphertextLength = encryptedBytes.length - tagLength;
|
|
22319
|
+
ciphertext = encryptedBytes.slice(0, ciphertextLength);
|
|
22320
|
+
const tagBytes = encryptedBytes.slice(ciphertextLength);
|
|
22321
|
+
authTag = bytesToBase64(tagBytes);
|
|
22322
|
+
}
|
|
22323
|
+
return {
|
|
22324
|
+
encrypted: true,
|
|
22325
|
+
algorithm,
|
|
22326
|
+
keyId,
|
|
22327
|
+
iv: bytesToBase64(iv),
|
|
22328
|
+
value: bytesToBase64(ciphertext),
|
|
22329
|
+
...authTag && { authTag }
|
|
22330
|
+
};
|
|
22331
|
+
}
|
|
22332
|
+
__name(encrypt, "encrypt");
|
|
22333
|
+
function parseDecryptedData(decryptedString) {
|
|
22334
|
+
try {
|
|
22335
|
+
return JSON.parse(decryptedString);
|
|
22336
|
+
} catch {
|
|
22337
|
+
return decryptedString;
|
|
22338
|
+
}
|
|
22339
|
+
}
|
|
22340
|
+
__name(parseDecryptedData, "parseDecryptedData");
|
|
22341
|
+
function prepareCiphertextForDecryption(ciphertext, algorithm, authTag) {
|
|
22342
|
+
if (algorithm === "AES-GCM" && authTag) {
|
|
22343
|
+
const tagBytes = base64ToBytes(authTag);
|
|
22344
|
+
const combined = new Uint8Array(ciphertext.length + tagBytes.length);
|
|
22345
|
+
combined.set(ciphertext);
|
|
22346
|
+
combined.set(tagBytes, ciphertext.length);
|
|
22347
|
+
return combined;
|
|
22348
|
+
}
|
|
22349
|
+
return ciphertext;
|
|
22350
|
+
}
|
|
22351
|
+
__name(prepareCiphertextForDecryption, "prepareCiphertextForDecryption");
|
|
22352
|
+
async function decrypt(encrypted, encryptionKey) {
|
|
22353
|
+
if (!isCryptoAvailable()) {
|
|
22354
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22355
|
+
}
|
|
22356
|
+
if (typeof encrypted === "string") {
|
|
22357
|
+
throw new ApiPackageError(
|
|
22358
|
+
"Cannot decrypt string without metadata. Use EncryptedFieldMetadata format."
|
|
22359
|
+
);
|
|
22360
|
+
}
|
|
22361
|
+
const { algorithm, value, iv: ivBase64, authTag } = encrypted;
|
|
22362
|
+
const { key, format } = encryptionKey;
|
|
22363
|
+
const params = ALGORITHM_PARAMS[algorithm];
|
|
22364
|
+
if (encryptionKey.id !== encrypted.keyId) {
|
|
22365
|
+
throw new ApiPackageError(
|
|
22366
|
+
`Key ID mismatch: expected ${encrypted.keyId}, got ${encryptionKey.id}`
|
|
22367
|
+
);
|
|
22368
|
+
}
|
|
22369
|
+
const cryptoKey = await importKey(key, algorithm, format);
|
|
22370
|
+
const iv = base64ToBytes(ivBase64);
|
|
22371
|
+
const ciphertext = prepareCiphertextForDecryption(base64ToBytes(value), algorithm, authTag);
|
|
22372
|
+
const algorithmParams = {
|
|
22373
|
+
name: params.name,
|
|
22374
|
+
iv,
|
|
22375
|
+
...algorithm === "AES-GCM" && "tagLength" in params && { tagLength: params.tagLength }
|
|
22376
|
+
};
|
|
22377
|
+
try {
|
|
22378
|
+
const decryptedBuffer = await crypto.subtle.decrypt(
|
|
22379
|
+
algorithmParams,
|
|
22380
|
+
cryptoKey,
|
|
22381
|
+
ciphertext
|
|
22382
|
+
);
|
|
22383
|
+
const decryptedBytes = new Uint8Array(decryptedBuffer);
|
|
22384
|
+
const decryptedString = new TextDecoder().decode(decryptedBytes);
|
|
22385
|
+
return parseDecryptedData(decryptedString);
|
|
22386
|
+
} catch (error) {
|
|
22387
|
+
throw new ApiPackageError(
|
|
22388
|
+
`Decryption failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
22389
|
+
);
|
|
22390
|
+
}
|
|
22391
|
+
}
|
|
22392
|
+
__name(decrypt, "decrypt");
|
|
22393
|
+
function isEncryptedMetadata(value) {
|
|
22394
|
+
return typeof value === "object" && value !== null && "encrypted" in value && value.encrypted === true && "algorithm" in value && "keyId" in value && "iv" in value && "value" in value;
|
|
22395
|
+
}
|
|
22396
|
+
__name(isEncryptedMetadata, "isEncryptedMetadata");
|
|
22397
|
+
function generateRandomKey() {
|
|
22398
|
+
if (!isCryptoAvailable()) {
|
|
22399
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22400
|
+
}
|
|
22401
|
+
return crypto.getRandomValues(new Uint8Array(AES_256_KEY_SIZE_BYTES));
|
|
22402
|
+
}
|
|
22403
|
+
__name(generateRandomKey, "generateRandomKey");
|
|
22404
|
+
async function exportKeyToBase64(key) {
|
|
22405
|
+
if (!isCryptoAvailable()) {
|
|
22406
|
+
throw new ApiPackageError("Web Crypto API not available");
|
|
22407
|
+
}
|
|
22408
|
+
const exported = await crypto.subtle.exportKey("raw", key);
|
|
22409
|
+
return bytesToBase64(new Uint8Array(exported));
|
|
22410
|
+
}
|
|
22411
|
+
__name(exportKeyToBase64, "exportKeyToBase64");
|
|
22412
|
+
|
|
22413
|
+
// src/api/encryption/field-path.ts
|
|
22414
|
+
function parseFieldPath(path) {
|
|
22415
|
+
return path.split(".").filter(Boolean);
|
|
22416
|
+
}
|
|
22417
|
+
__name(parseFieldPath, "parseFieldPath");
|
|
22418
|
+
function isWildcard(segment) {
|
|
22419
|
+
return segment === "*";
|
|
22420
|
+
}
|
|
22421
|
+
__name(isWildcard, "isWildcard");
|
|
22422
|
+
function matchFieldPath(path, pattern) {
|
|
22423
|
+
if (pattern.length !== path.length) {
|
|
22424
|
+
return false;
|
|
22425
|
+
}
|
|
22426
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
22427
|
+
if (!isWildcard(pattern[i]) && pattern[i] !== path[i]) {
|
|
22428
|
+
return false;
|
|
22429
|
+
}
|
|
22430
|
+
}
|
|
22431
|
+
return true;
|
|
22432
|
+
}
|
|
22433
|
+
__name(matchFieldPath, "matchFieldPath");
|
|
22434
|
+
function getAllFieldPaths(obj, prefix = "") {
|
|
22435
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22436
|
+
return [];
|
|
22437
|
+
}
|
|
22438
|
+
const paths = [];
|
|
22439
|
+
if (Array.isArray(obj)) {
|
|
22440
|
+
obj.forEach((item, index) => {
|
|
22441
|
+
const itemPrefix = prefix ? `${prefix}.${index}` : `${index}`;
|
|
22442
|
+
paths.push(itemPrefix);
|
|
22443
|
+
paths.push(...getAllFieldPaths(item, itemPrefix));
|
|
22444
|
+
});
|
|
22445
|
+
} else {
|
|
22446
|
+
Object.keys(obj).forEach((key) => {
|
|
22447
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
22448
|
+
paths.push(fullPath);
|
|
22449
|
+
paths.push(...getAllFieldPaths(obj[key], fullPath));
|
|
22450
|
+
});
|
|
22451
|
+
}
|
|
22452
|
+
return paths;
|
|
22453
|
+
}
|
|
22454
|
+
__name(getAllFieldPaths, "getAllFieldPaths");
|
|
22455
|
+
function getFieldValue(obj, path) {
|
|
22456
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22457
|
+
return void 0;
|
|
22458
|
+
}
|
|
22459
|
+
const segments = parseFieldPath(path);
|
|
22460
|
+
let current = obj;
|
|
22461
|
+
for (const segment of segments) {
|
|
22462
|
+
if (typeof current !== "object" || current === null) {
|
|
22463
|
+
return void 0;
|
|
22464
|
+
}
|
|
22465
|
+
current = current[segment];
|
|
22466
|
+
}
|
|
22467
|
+
return current;
|
|
22468
|
+
}
|
|
22469
|
+
__name(getFieldValue, "getFieldValue");
|
|
22470
|
+
function setFieldValue(obj, path, value) {
|
|
22471
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22472
|
+
return;
|
|
22473
|
+
}
|
|
22474
|
+
const segments = parseFieldPath(path);
|
|
22475
|
+
let current = obj;
|
|
22476
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
22477
|
+
const segment = segments[i];
|
|
22478
|
+
if (!(segment in current) || typeof current[segment] !== "object" || current[segment] === null) {
|
|
22479
|
+
current[segment] = {};
|
|
22480
|
+
}
|
|
22481
|
+
current = current[segment];
|
|
22482
|
+
}
|
|
22483
|
+
const lastSegment = segments[segments.length - 1];
|
|
22484
|
+
current[lastSegment] = value;
|
|
22485
|
+
}
|
|
22486
|
+
__name(setFieldValue, "setFieldValue");
|
|
22487
|
+
function findMatchingPaths(obj, pattern) {
|
|
22488
|
+
const allPaths = getAllFieldPaths(obj);
|
|
22489
|
+
const patternSegments = parseFieldPath(pattern);
|
|
22490
|
+
return allPaths.filter((path) => {
|
|
22491
|
+
const pathSegments = parseFieldPath(path);
|
|
22492
|
+
return matchFieldPath(pathSegments, patternSegments);
|
|
22493
|
+
});
|
|
22494
|
+
}
|
|
22495
|
+
__name(findMatchingPaths, "findMatchingPaths");
|
|
22496
|
+
async function transformFields(obj, patterns, transform, excludePatterns) {
|
|
22497
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22498
|
+
return obj;
|
|
22499
|
+
}
|
|
22500
|
+
const result = JSON.parse(JSON.stringify(obj));
|
|
22501
|
+
const matchingPaths = [];
|
|
22502
|
+
for (const pattern of patterns) {
|
|
22503
|
+
matchingPaths.push(...findMatchingPaths(result, pattern));
|
|
22504
|
+
}
|
|
22505
|
+
let pathsToTransform = matchingPaths;
|
|
22506
|
+
if (excludePatterns && excludePatterns.length > 0) {
|
|
22507
|
+
const excludedPaths = /* @__PURE__ */ new Set();
|
|
22508
|
+
for (const excludePattern of excludePatterns) {
|
|
22509
|
+
findMatchingPaths(result, excludePattern).forEach((path) => excludedPaths.add(path));
|
|
22510
|
+
}
|
|
22511
|
+
pathsToTransform = matchingPaths.filter((path) => !excludedPaths.has(path));
|
|
22512
|
+
}
|
|
22513
|
+
for (const path of pathsToTransform) {
|
|
22514
|
+
const value = getFieldValue(result, path);
|
|
22515
|
+
const transformed = await transform(value, path);
|
|
22516
|
+
setFieldValue(result, path, transformed);
|
|
22517
|
+
}
|
|
22518
|
+
return result;
|
|
22519
|
+
}
|
|
22520
|
+
__name(transformFields, "transformFields");
|
|
22521
|
+
function extractFields(obj, patterns) {
|
|
22522
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22523
|
+
return obj;
|
|
22524
|
+
}
|
|
22525
|
+
const result = {};
|
|
22526
|
+
for (const pattern of patterns) {
|
|
22527
|
+
const matchingPaths = findMatchingPaths(obj, pattern);
|
|
22528
|
+
for (const path of matchingPaths) {
|
|
22529
|
+
const value = getFieldValue(obj, path);
|
|
22530
|
+
setFieldValue(result, path, value);
|
|
22531
|
+
}
|
|
22532
|
+
}
|
|
22533
|
+
return result;
|
|
22534
|
+
}
|
|
22535
|
+
__name(extractFields, "extractFields");
|
|
22536
|
+
function hasMatchingFields(obj, patterns) {
|
|
22537
|
+
if (typeof obj !== "object" || obj === null) {
|
|
22538
|
+
return false;
|
|
22539
|
+
}
|
|
22540
|
+
for (const pattern of patterns) {
|
|
22541
|
+
const matching = findMatchingPaths(obj, pattern);
|
|
22542
|
+
if (matching.length > 0) {
|
|
22543
|
+
return true;
|
|
22544
|
+
}
|
|
22545
|
+
}
|
|
22546
|
+
return false;
|
|
22547
|
+
}
|
|
22548
|
+
__name(hasMatchingFields, "hasMatchingFields");
|
|
22549
|
+
function isValidFieldPath(path) {
|
|
22550
|
+
if (!path || typeof path !== "string") {
|
|
22551
|
+
return false;
|
|
22552
|
+
}
|
|
22553
|
+
if (/[^a-zA-Z0-9._*-]/.test(path)) {
|
|
22554
|
+
return false;
|
|
22555
|
+
}
|
|
22556
|
+
if (path.includes("..") || path.startsWith(".") || path.endsWith(".")) {
|
|
22557
|
+
return false;
|
|
22558
|
+
}
|
|
22559
|
+
const segments = parseFieldPath(path);
|
|
22560
|
+
if (segments.length === 0) {
|
|
22561
|
+
return false;
|
|
22562
|
+
}
|
|
22563
|
+
return true;
|
|
22564
|
+
}
|
|
22565
|
+
__name(isValidFieldPath, "isValidFieldPath");
|
|
22566
|
+
|
|
22567
|
+
// src/api/encryption/interceptors.ts
|
|
22568
|
+
async function resolveEncryptionKey(keyOrProvider, context) {
|
|
22569
|
+
if (typeof keyOrProvider === "function") {
|
|
22570
|
+
return await keyOrProvider(context);
|
|
22571
|
+
}
|
|
22572
|
+
return keyOrProvider;
|
|
22573
|
+
}
|
|
22574
|
+
__name(resolveEncryptionKey, "resolveEncryptionKey");
|
|
22575
|
+
function shouldEncryptTarget(target, targets) {
|
|
22576
|
+
if (!targets) {
|
|
22577
|
+
return true;
|
|
22578
|
+
}
|
|
22579
|
+
if (Array.isArray(targets)) {
|
|
22580
|
+
return targets.includes(target);
|
|
22581
|
+
}
|
|
22582
|
+
return targets === target;
|
|
22583
|
+
}
|
|
22584
|
+
__name(shouldEncryptTarget, "shouldEncryptTarget");
|
|
22585
|
+
function handleEncryptionError(error, path, value, onError) {
|
|
22586
|
+
const errorMessage = `Failed to encrypt field '${path}': ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
22587
|
+
if (onError === "throw") {
|
|
22588
|
+
throw new ApiPackageError(errorMessage);
|
|
22589
|
+
}
|
|
22590
|
+
if (onError === "skip") {
|
|
22591
|
+
return value;
|
|
22592
|
+
}
|
|
22593
|
+
return "[ENCRYPTION_FAILED]";
|
|
22594
|
+
}
|
|
22595
|
+
__name(handleEncryptionError, "handleEncryptionError");
|
|
22596
|
+
async function encryptFieldValue(value, path, config) {
|
|
22597
|
+
try {
|
|
22598
|
+
const encrypted = await encrypt(value, config.encryptionKey);
|
|
22599
|
+
return config.includeMetadata ? encrypted : encrypted.value;
|
|
22600
|
+
} catch (error) {
|
|
22601
|
+
return handleEncryptionError(error, path, value, config.onError);
|
|
22602
|
+
}
|
|
22603
|
+
}
|
|
22604
|
+
__name(encryptFieldValue, "encryptFieldValue");
|
|
22605
|
+
function shouldEncryptObject(obj, fields) {
|
|
22606
|
+
if (!obj || typeof obj !== "object") {
|
|
22607
|
+
return false;
|
|
22608
|
+
}
|
|
22609
|
+
if (!fields || fields.length === 0) {
|
|
22610
|
+
return false;
|
|
22611
|
+
}
|
|
22612
|
+
return true;
|
|
22613
|
+
}
|
|
22614
|
+
__name(shouldEncryptObject, "shouldEncryptObject");
|
|
22615
|
+
async function encryptObject(obj, config, encryptionKey) {
|
|
22616
|
+
if (!shouldEncryptObject(obj, config.fields)) {
|
|
22617
|
+
return obj;
|
|
22618
|
+
}
|
|
22619
|
+
const { fields, excludeFields, onError = "throw", includeMetadata = true } = config;
|
|
22620
|
+
try {
|
|
22621
|
+
return transformFields(
|
|
22622
|
+
obj,
|
|
22623
|
+
fields,
|
|
22624
|
+
async (value, path) => encryptFieldValue(value, path, { encryptionKey, includeMetadata, onError }),
|
|
22625
|
+
excludeFields
|
|
22626
|
+
);
|
|
22627
|
+
} catch (error) {
|
|
22628
|
+
if (onError === "throw") {
|
|
22629
|
+
throw error;
|
|
22630
|
+
}
|
|
22631
|
+
return obj;
|
|
22632
|
+
}
|
|
22633
|
+
}
|
|
22634
|
+
__name(encryptObject, "encryptObject");
|
|
22635
|
+
async function decryptObject(obj, config, encryptionKey) {
|
|
22636
|
+
if (!obj || typeof obj !== "object") {
|
|
22637
|
+
return obj;
|
|
22638
|
+
}
|
|
22639
|
+
const { onError = "throw" } = config;
|
|
22640
|
+
try {
|
|
22641
|
+
return await recursiveDecrypt(obj, encryptionKey, onError);
|
|
22642
|
+
} catch (error) {
|
|
22643
|
+
if (onError === "throw") {
|
|
22644
|
+
throw error;
|
|
22645
|
+
}
|
|
22646
|
+
return obj;
|
|
22647
|
+
}
|
|
22648
|
+
}
|
|
22649
|
+
__name(decryptObject, "decryptObject");
|
|
22650
|
+
function handleDecryptionError(error, obj, onError) {
|
|
22651
|
+
const errorMessage = `Failed to decrypt field: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
22652
|
+
if (onError === "throw") {
|
|
22653
|
+
throw new ApiPackageError(errorMessage);
|
|
22654
|
+
}
|
|
22655
|
+
if (onError === "skip") {
|
|
22656
|
+
return obj;
|
|
22657
|
+
}
|
|
22658
|
+
return "[DECRYPTION_FAILED]";
|
|
22659
|
+
}
|
|
22660
|
+
__name(handleDecryptionError, "handleDecryptionError");
|
|
22661
|
+
async function decryptEncryptedValue(obj, encryptionKey, onError) {
|
|
22662
|
+
try {
|
|
22663
|
+
return await decrypt(obj, encryptionKey);
|
|
22664
|
+
} catch (error) {
|
|
22665
|
+
return handleDecryptionError(error, obj, onError);
|
|
22666
|
+
}
|
|
22667
|
+
}
|
|
22668
|
+
__name(decryptEncryptedValue, "decryptEncryptedValue");
|
|
22669
|
+
async function decryptArray(arr, encryptionKey, onError) {
|
|
22670
|
+
const decrypted = await Promise.all(
|
|
22671
|
+
arr.map((item) => recursiveDecrypt(item, encryptionKey, onError))
|
|
22672
|
+
);
|
|
22673
|
+
return decrypted;
|
|
22674
|
+
}
|
|
22675
|
+
__name(decryptArray, "decryptArray");
|
|
22676
|
+
async function decryptObjectRecursively(obj, encryptionKey, onError) {
|
|
22677
|
+
const result = {};
|
|
22678
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
22679
|
+
result[key] = await recursiveDecrypt(value, encryptionKey, onError);
|
|
22680
|
+
}
|
|
22681
|
+
return result;
|
|
22682
|
+
}
|
|
22683
|
+
__name(decryptObjectRecursively, "decryptObjectRecursively");
|
|
22684
|
+
async function recursiveDecrypt(obj, encryptionKey, onError) {
|
|
22685
|
+
if (obj === null || obj === void 0) {
|
|
22686
|
+
return obj;
|
|
22687
|
+
}
|
|
22688
|
+
if (isEncryptedMetadata(obj)) {
|
|
22689
|
+
return await decryptEncryptedValue(obj, encryptionKey, onError);
|
|
22690
|
+
}
|
|
22691
|
+
if (Array.isArray(obj)) {
|
|
22692
|
+
return await decryptArray(obj, encryptionKey, onError);
|
|
22693
|
+
}
|
|
22694
|
+
if (typeof obj === "object") {
|
|
22695
|
+
const decrypted = await decryptObjectRecursively(
|
|
22696
|
+
obj,
|
|
22697
|
+
encryptionKey,
|
|
22698
|
+
onError
|
|
22699
|
+
);
|
|
22700
|
+
return decrypted;
|
|
22701
|
+
}
|
|
22702
|
+
return obj;
|
|
22703
|
+
}
|
|
22704
|
+
__name(recursiveDecrypt, "recursiveDecrypt");
|
|
22705
|
+
function createEncryptionInterceptor(config) {
|
|
22706
|
+
return async (requestConfig) => {
|
|
22707
|
+
if (!config.enabled) {
|
|
22708
|
+
return requestConfig;
|
|
22709
|
+
}
|
|
22710
|
+
const encryptionKey = await resolveEncryptionKey(config.key, {
|
|
22711
|
+
url: requestConfig.url,
|
|
22712
|
+
method: requestConfig.method
|
|
22713
|
+
});
|
|
22714
|
+
if (shouldEncryptTarget("body", config.target) && requestConfig.body) {
|
|
22715
|
+
requestConfig.body = await encryptObject(
|
|
22716
|
+
requestConfig.body,
|
|
22717
|
+
config,
|
|
22718
|
+
encryptionKey
|
|
22719
|
+
);
|
|
22720
|
+
}
|
|
22721
|
+
if (shouldEncryptTarget("params", config.target) && requestConfig.params) {
|
|
22722
|
+
requestConfig.params = await encryptObject(
|
|
22723
|
+
requestConfig.params,
|
|
22724
|
+
config,
|
|
22725
|
+
encryptionKey
|
|
22726
|
+
);
|
|
22727
|
+
}
|
|
22728
|
+
if (shouldEncryptTarget("headers", config.target) && requestConfig.headers) {
|
|
22729
|
+
requestConfig.headers = await encryptObject(
|
|
22730
|
+
requestConfig.headers,
|
|
22731
|
+
config,
|
|
22732
|
+
encryptionKey
|
|
22733
|
+
);
|
|
22734
|
+
}
|
|
22735
|
+
return requestConfig;
|
|
22736
|
+
};
|
|
22737
|
+
}
|
|
22738
|
+
__name(createEncryptionInterceptor, "createEncryptionInterceptor");
|
|
22739
|
+
function createDecryptionInterceptor(config) {
|
|
22740
|
+
return async (response) => {
|
|
22741
|
+
if (!config.enabled || !config.autoDecrypt) {
|
|
22742
|
+
return response;
|
|
22743
|
+
}
|
|
22744
|
+
if (!response.data) {
|
|
22745
|
+
return response;
|
|
22746
|
+
}
|
|
22747
|
+
const encryptionKey = await resolveEncryptionKey(config.key, {
|
|
22748
|
+
url: response.config?.url,
|
|
22749
|
+
method: response.config?.method
|
|
22750
|
+
});
|
|
22751
|
+
response.data = await decryptObject(response.data, config, encryptionKey);
|
|
22752
|
+
return response;
|
|
22753
|
+
};
|
|
22754
|
+
}
|
|
22755
|
+
__name(createDecryptionInterceptor, "createDecryptionInterceptor");
|
|
22756
|
+
function createEncryptionInterceptors(config) {
|
|
22757
|
+
return {
|
|
22758
|
+
onRequest: createEncryptionInterceptor(config),
|
|
22759
|
+
onResponse: createDecryptionInterceptor(config)
|
|
22760
|
+
};
|
|
22761
|
+
}
|
|
22762
|
+
__name(createEncryptionInterceptors, "createEncryptionInterceptors");
|
|
22763
|
+
function validateEncryptionKey(key) {
|
|
22764
|
+
if (!key) {
|
|
22765
|
+
throw new ApiPackageError("Encryption key is required when encryption is enabled");
|
|
22766
|
+
}
|
|
22767
|
+
}
|
|
22768
|
+
__name(validateEncryptionKey, "validateEncryptionKey");
|
|
22769
|
+
function validateAlgorithm(algorithm) {
|
|
22770
|
+
if (!algorithm) {
|
|
22771
|
+
return;
|
|
22772
|
+
}
|
|
22773
|
+
const validAlgorithms = ["AES-GCM", "AES-CBC", "ChaCha20-Poly1305"];
|
|
22774
|
+
if (!validAlgorithms.includes(algorithm)) {
|
|
22775
|
+
throw new ApiPackageError(
|
|
22776
|
+
`Invalid encryption algorithm: ${algorithm}. Must be one of: ${validAlgorithms.join(", ")}`
|
|
22777
|
+
);
|
|
22778
|
+
}
|
|
22779
|
+
}
|
|
22780
|
+
__name(validateAlgorithm, "validateAlgorithm");
|
|
22781
|
+
function validateErrorStrategy(onError) {
|
|
22782
|
+
if (!onError) {
|
|
22783
|
+
return;
|
|
22784
|
+
}
|
|
22785
|
+
const validStrategies = ["throw", "skip", "placeholder"];
|
|
22786
|
+
if (!validStrategies.includes(onError)) {
|
|
22787
|
+
throw new ApiPackageError(
|
|
22788
|
+
`Invalid error handling strategy: ${onError}. Must be one of: ${validStrategies.join(", ")}`
|
|
22789
|
+
);
|
|
22790
|
+
}
|
|
22791
|
+
}
|
|
22792
|
+
__name(validateErrorStrategy, "validateErrorStrategy");
|
|
22793
|
+
function validateTargets(target) {
|
|
22794
|
+
if (!target) {
|
|
22795
|
+
return;
|
|
22796
|
+
}
|
|
22797
|
+
const validTargets = ["body", "params", "headers"];
|
|
22798
|
+
const targets = Array.isArray(target) ? target : [target];
|
|
22799
|
+
for (const t of targets) {
|
|
22800
|
+
if (!validTargets.includes(t)) {
|
|
22801
|
+
throw new ApiPackageError(
|
|
22802
|
+
`Invalid encryption target: ${t}. Must be one of: ${validTargets.join(", ")}`
|
|
22803
|
+
);
|
|
22804
|
+
}
|
|
22805
|
+
}
|
|
22806
|
+
}
|
|
22807
|
+
__name(validateTargets, "validateTargets");
|
|
22808
|
+
function validateEncryptionConfig(config) {
|
|
22809
|
+
if (!config.enabled) {
|
|
22810
|
+
return;
|
|
22811
|
+
}
|
|
22812
|
+
validateEncryptionKey(config.key);
|
|
22813
|
+
validateAlgorithm(config.algorithm);
|
|
22814
|
+
validateErrorStrategy(config.onError);
|
|
22815
|
+
validateTargets(config.target);
|
|
22816
|
+
}
|
|
22817
|
+
__name(validateEncryptionConfig, "validateEncryptionConfig");
|
|
22818
|
+
function getTargetData(target, requestConfig) {
|
|
22819
|
+
if (target === "body") {
|
|
22820
|
+
return requestConfig.body;
|
|
22821
|
+
}
|
|
22822
|
+
if (target === "params") {
|
|
22823
|
+
return requestConfig.params;
|
|
22824
|
+
}
|
|
22825
|
+
if (target === "headers") {
|
|
22826
|
+
return requestConfig.headers;
|
|
22827
|
+
}
|
|
22828
|
+
return void 0;
|
|
22829
|
+
}
|
|
22830
|
+
__name(getTargetData, "getTargetData");
|
|
22831
|
+
function hasMatchingFieldsInTarget(target, requestConfig, config) {
|
|
22832
|
+
if (!shouldEncryptTarget(target, config.target)) {
|
|
22833
|
+
return false;
|
|
22834
|
+
}
|
|
22835
|
+
const targetData = getTargetData(target, requestConfig);
|
|
22836
|
+
if (!targetData) {
|
|
22837
|
+
return false;
|
|
22838
|
+
}
|
|
22839
|
+
return hasMatchingFields(targetData, config.fields ?? []);
|
|
22840
|
+
}
|
|
22841
|
+
__name(hasMatchingFieldsInTarget, "hasMatchingFieldsInTarget");
|
|
22842
|
+
function hasEncryptableFields(requestConfig, config) {
|
|
22843
|
+
if (!config.enabled || !config.fields || config.fields.length === 0) {
|
|
22844
|
+
return false;
|
|
22845
|
+
}
|
|
22846
|
+
const targets = ["body", "params", "headers"];
|
|
22847
|
+
return targets.some((target) => hasMatchingFieldsInTarget(target, requestConfig, config));
|
|
22848
|
+
}
|
|
22849
|
+
__name(hasEncryptableFields, "hasEncryptableFields");
|
|
22850
|
+
|
|
22851
|
+
// src/api/client/helpers/interceptors.ts
|
|
22188
22852
|
var DEFAULT_MAX_RETRIES = 3;
|
|
22189
22853
|
var DEFAULT_SUCCESS_STATUS = HTTP_STATUS.OK;
|
|
22190
22854
|
function trackHeaderChanges(beforeHeaders, afterHeaders, interceptorIndex) {
|
|
@@ -22246,7 +22910,7 @@ function createOnRetryHandler(handlers) {
|
|
|
22246
22910
|
};
|
|
22247
22911
|
}
|
|
22248
22912
|
__name(createOnRetryHandler, "createOnRetryHandler");
|
|
22249
|
-
function createOnRequestHandler(handlers, enrichedHeadersConfig) {
|
|
22913
|
+
function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig) {
|
|
22250
22914
|
return async (config) => {
|
|
22251
22915
|
const performanceFactory = getPerformanceEventFactory();
|
|
22252
22916
|
const requestId = generateRequestId();
|
|
@@ -22278,6 +22942,16 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig) {
|
|
|
22278
22942
|
console.error("Failed to enrich headers:", error);
|
|
22279
22943
|
}
|
|
22280
22944
|
}
|
|
22945
|
+
if (encryptionConfig?.enabled) {
|
|
22946
|
+
try {
|
|
22947
|
+
validateEncryptionConfig(encryptionConfig);
|
|
22948
|
+
const encryptionInterceptor = createEncryptionInterceptor(encryptionConfig);
|
|
22949
|
+
processedConfig = await encryptionInterceptor(processedConfig);
|
|
22950
|
+
UnifiedDebugger.getInstance().trackConfigChange({ encryption: "applied" }, "encryption");
|
|
22951
|
+
} catch (error) {
|
|
22952
|
+
console.error("Failed to encrypt request:", error);
|
|
22953
|
+
}
|
|
22954
|
+
}
|
|
22281
22955
|
if (handlers && handlers.length > 0) {
|
|
22282
22956
|
for (let i = 0; i < handlers.length; i++) {
|
|
22283
22957
|
const handler = handlers[i];
|
|
@@ -22290,7 +22964,7 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig) {
|
|
|
22290
22964
|
};
|
|
22291
22965
|
}
|
|
22292
22966
|
__name(createOnRequestHandler, "createOnRequestHandler");
|
|
22293
|
-
function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComplete) {
|
|
22967
|
+
function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComplete, encryptionConfig) {
|
|
22294
22968
|
return async (response) => {
|
|
22295
22969
|
const performanceFactory = getPerformanceEventFactory();
|
|
22296
22970
|
performanceFactory.emitRequestComplete({
|
|
@@ -22309,6 +22983,15 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
|
|
|
22309
22983
|
}
|
|
22310
22984
|
}
|
|
22311
22985
|
}
|
|
22986
|
+
if (encryptionConfig?.enabled && encryptionConfig?.autoDecrypt) {
|
|
22987
|
+
try {
|
|
22988
|
+
const decryptionInterceptor = createDecryptionInterceptor(encryptionConfig);
|
|
22989
|
+
processedResponse = await decryptionInterceptor(processedResponse);
|
|
22990
|
+
UnifiedDebugger.getInstance().trackConfigChange({ decryption: "applied" }, "encryption");
|
|
22991
|
+
} catch (error) {
|
|
22992
|
+
console.error("Failed to decrypt response:", error);
|
|
22993
|
+
}
|
|
22994
|
+
}
|
|
22312
22995
|
if (clearOnComplete && clearTemporaryOverrides2) {
|
|
22313
22996
|
clearTemporaryOverrides2();
|
|
22314
22997
|
}
|
|
@@ -22402,9 +23085,15 @@ function setupUnifiedHandlers(params) {
|
|
|
22402
23085
|
clientOptions?.onRetry
|
|
22403
23086
|
);
|
|
22404
23087
|
const clearOnComplete = mergedConfig.configOverride?.clearOnComplete ?? globalConfig?.configOverride?.clearOnComplete ?? clientOptions?.configOverride?.clearOnComplete;
|
|
23088
|
+
const encryptionConfig = mergedConfig.encryption ?? globalConfig?.encryption ?? clientOptions?.encryption;
|
|
22405
23089
|
return {
|
|
22406
|
-
onRequest: createOnRequestHandler(mergedOnRequest, enrichedHeadersConfig),
|
|
22407
|
-
onResponse: createOnResponseHandler(
|
|
23090
|
+
onRequest: createOnRequestHandler(mergedOnRequest, enrichedHeadersConfig, encryptionConfig),
|
|
23091
|
+
onResponse: createOnResponseHandler(
|
|
23092
|
+
mergedOnResponse,
|
|
23093
|
+
clearTemporaryOverrides2,
|
|
23094
|
+
clearOnComplete,
|
|
23095
|
+
encryptionConfig
|
|
23096
|
+
),
|
|
22408
23097
|
onError: createOnErrorHandler(mergedOnError, clearTemporaryOverrides2, clearOnComplete),
|
|
22409
23098
|
onRetry: createOnRetryHandler(mergedOnRetry)
|
|
22410
23099
|
};
|
|
@@ -25068,6 +25757,6 @@ __name(toFetchffRevalidationConfig, "toFetchffRevalidationConfig");
|
|
|
25068
25757
|
resources: revalidationStrategies.static
|
|
25069
25758
|
});
|
|
25070
25759
|
|
|
25071
|
-
export { ALL_EVENTS, ApiPackageError, CACHE_EVENTS2 as CACHE_EVENTS, CLIENT_EVENTS2 as CLIENT_EVENTS, CONFIG_EVENTS2 as CONFIG_EVENTS, ClientHintsInterceptor, ConfigBuilder, DEBUG_EVENTS2 as DEBUG_EVENTS, ERROR_EVENTS2 as ERROR_EVENTS, EVENT_NAMESPACES2 as EVENT_NAMESPACES, EVENT_SCOPES2 as EVENT_SCOPES, EVENT_SCOPES_WITH_TEMPORARY, Environment, EventHelpers, EventManager, HANDLER_SCOPES, HEADER_EVENTS2 as HEADER_EVENTS, HeaderBuilder, IntervalManager, MEDIA_EXTENSIONS, MEDIA_MIME_PREFIXES, MinimumConnectionGuard, NETWORK_EVENTS2 as NETWORK_EVENTS, NetworkConfigurationManager, NetworkDetectionMiddleware, NetworkGuard, NetworkInfoParam, NetworkPresetNames, NetworkProperty, NoDataSaverGuard, PERFORMANCE_EVENTS2 as PERFORMANCE_EVENTS, RequestTracker, UnifiedDebugger, abortAllRequests, abortByPattern, abortRequest, abortSearchRequests, abortUploadRequests, addClientHintsToResponse, addInterval, addTime, analyzeComplianceIssues, analyzeConfigImpact, analyzeConflictPatterns, analyzeEventSystemIssues, analyzeHistoryPatterns, analyzePerformanceIssues, applyConfigOverride, applyConfigPreset, applyConfigUpdate, applyPollingStrategy, applyRetryStrategy, applyRevalidationStrategy, applyTemporaryNetworkOverride, applyUnifiedStrategy, arrayOf, average, buildCacheKey, cacheKeyPatterns, cacheStrategies, calculateCacheDuration, calculatePerformanceImpact, calculatePollingDuration, calculateRequestMetrics, canPerformHeavyOperation, clamp, clampedPercentage, clearErrorHandlers, clearNetworkDebugData, clearTemporaryOverrides, cloneConfig, compactHistory, configConflictDetector, configureForEnvironment, containsAny, convertEndpointsToFetchff, createAbortError, createAdaptiveResponse, createApiClient, createCachePattern, createCacheStrategy, createCampaign, createComplianceReport, createConditionalInterval, createConditionalPolling, createConfigBuilder, createConfigHistoryEntry, createConfigState, createConflict, createCorrelationIdGenerator, createCustomPreset, createCustomUnifiedStrategy, createDate, createDebouncedAbort, createDebugReport, createDelay, createEventEmitter, createHistoryEntry, createHistorySummary, createIdGenerator, createLimitedInterval, createManagedInterval, createNetworkDetectionMiddleware, createPerformanceAnalysis, createPerformanceBenchmark, createPollingStrategy, createProgressivePolling, createRequestIdGenerator, createRetryConfig, createRetryStrategy, createRevalidationKey, createRevalidationStrategy, createRouteGuard, createRouteScope, createScopedAbort, createStatusCodeLimits, createThrottledAbort, createTypedSubscription, createVisibilityAwarePolling, dateDiff, debounce, deepMerge, deleteCache, deleteCampaign, detectConfigConflicts, detectConflicts, detectPlatform, determinePrecedenceReason, disableNetworkConfigDebug, enableNetworkConfigDebug, endOfDay, eventManager, extendPresets as extendRevalidationPresets, extractBaseCorrelationId, extractBaseId, extractBaseRequestId, extractCorrelationType, extractLinkedCorrelationIds, fetchCampaign, fetchCampaignParticipants, fetchCampaignStats, fetchCampaigns, filterHistory, filterObject, flattenObject, formatDuration, formatReportForConsole, formatTimeForInterval, fromFetchffConfig, fromISOString, fromUnixTimestamp, generateApiCorrelationId, generateBaseId, generateComprehensiveReport, generateContextualCorrelationId, generateContextualId, generateContextualRequestId, generateCorrelationId, generateIssueBreakdown, generateNetworkCorrelationId, generateRecommendations, generateRequestId, generateSessionCorrelationId, generateShortRequestId, generateTraceCorrelationId, generateUUID, getActiveOverrideKeys, getAdaptiveApiConfig, getAdaptiveBatchSize, getAdaptiveCacheDuration, getAdaptiveConfig, getAdaptivePageSize, getAdaptiveTimeout, getAllMediaExtensions, getAppVersion, getAuthenticationType, getCache, getCacheAffectingHeaders, getCacheStrategy, getClientHintHeaders, getConfigHierarchy, getConnection, getConnectionType, getConsole, getContextHeaders, getCrypto, getDefaultApiClient, getDeviceId, getDeviceInfo, getDocument, getEffectiveConfig, getEffectiveConnectionType, getEnhancedClientHints, getEntries, getEnv, getEnvironmentInfo, getEnvironmentName, getErrorCategory, getErrorCodeByStatus, getErrorDefinition, getErrorHandlers, getEventManager, getExtendedEnvironmentInfo, getFileExtension, getFrameworkAdaptiveBatchSize, getFrameworkAdaptiveTimeout, getGlobal, getGlobalConfig, getHeaderFingerprint, getHeaderSummary, getISOWeek, getIntervalBoundaries, getIntervalDifference, getIntervalEnd, getIntervalStart, getJSONSize, getKeys, getLocalStorage, getLocation, getMatchingPresets, getNavigator, getNetworkConfigFromHeaders, getNetworkDebugStats, getNetworkEventStats, getNetworkInfo, getNetworkInfoFromHeaders, getNetworkInfoFromRequest, getNetworkOptimizedConfig, getNetworkPreset, getNetworkQuality, getNetworkQualityFromHeaders, getNetworkQualityScore, getNetworkRTT, getNetworkSpeed, getNonCacheAffectingHeaders, getOptimizedNetworkConfig, getPresetForNetworkInfo, getPresetForQuality, getPresetNames, getProcess, getQuarter, getRelativeTime, getRetryStrategy, getPreset as getRevalidationPreset, getPresets as getRevalidationPresets, getRevalidationStrategy, getRuntimeEnvironment, getSSRSafeConfig, getSSRSafePollingConfig, getSessionStorage, getTimeComponents, getUnifiedDebugger, getUnifiedStrategy, getUnifiedStrategyNames, getUnixTimestamp, getUserAgent, getValues, getWindow, groupBy, handleArrayMerge, handleObjectMerge, hasAnyExtension, hasAuthentication, hasGlobal, hasIndexedDB, hasLocalStorage, hasNavigator, hasNetworkInfo2 as hasNetworkInfoExpress, hasNetworkInfo as hasNetworkInfoNextjs, hasPreset, hasProperty, hasSessionStorage, hasWebGL, hasWebPSupport, headerPresets, headers, headersContext, inBrowser, inRange, inServer, invalidationScenarios, inverseLerp, isAbortError, isArray, isBoolean, isBrowser, isBun, isCI, isCacheValid, isCellularConnection, isDataFresh, isDataSaverEnabled, isDataSaverEnabledFromHeaders, isDebug, isDeno, isDevelopment, isDocumentVisible, isElectron, isEmpty, isEmptyObject, isError, isFunction, isFuture, isInIframe, isInRange, isInteger, isMergeableObject, isMobile, isNetworkAPISupported, isNode, isNonEmptyArray, isNonEmptyObject, isNonEmptyString2 as isNonEmptyString, isNonNegativeNumber, isNotNullish, isNullish, isNumber, isObject, isOffline, isOneOfIgnoreCase, isOnline, isPageFocused, isPast, isPlainObject, isPollingActive, isPositiveNumber, isProduction, isPromise, isReactNative, isRevalidationSupported, isSSR, isSameDay, isSameInterval, isServer, isSlowConnection, isStaging, isString, isTest, isToday, isTouchDevice, isUnifiedStrategyName, isValidCorrelationId, isValidDate, isValidEnumValue, isValidId, isValidJSON, isValidNumber2 as isValidNumber, isValidPollingConfig, isValidRequestId, isValidStrategyName as isValidRevalidationStrategyName, isWebWorker, isWifiConnection, isWithinDedupeWindow, joinCampaign, jsonClone, jsonEquals, keyBy, leaveCampaign, lerp, linkCorrelationIds, logNetworkConfigReport, mapKeys, mapObject, mapRange, matchesAny, max, median, mergeCacheStrategies, mergeConfigs, mergeConflicts, mergeHeaders, mergePollingConfigs, mergePresets, mergeRetryStrategies, mergeRevalidationStrategies, mergeUnifiedStrategy, min, msToSeconds, mutate2 as mutate, networkConfigDebugger, networkConfigManager, networkDetectionMiddleware, networkPresets, networkStatus, normalizeHeaders3 as normalizeHeaders, now, nowInSeconds, omit, onOffline, onOnline, onceErrorHandler, oneOf, parseAndValidateNumber, parseId, percentage, pick, pollingStrategies, prepareRequestConfig, prepareRequestConfigWithEnrichedHeaders, prettyStringify, raceRequests, randomBetween, randomInt, registerErrorHandler, registerErrorHandlers, removeCircularReferences, removeEmpty, removeNullish, removeSensitiveHeaders, removeUndefined, requestTracker, requestWithTimeout, resetGlobalConfig, resetPresets as resetRevalidationPresets, resolveConflict, retryConditions, retryStrategies, genericPresets as revalidationPresets, revalidationStrategies, round, runWithHeaders, runWithHeadersAsync, safeParseJSON, safeStringify, sanitizeHeaders2 as sanitizeHeaders, secondsToMs, sequentialRequests, setCache, setConfigWarnings, setDefaultApiClient, setErrorHandlers, setGlobalConfig, setupClientEvents, setupRouteChangeCleanup, shouldApplyConfig, shouldAutoRefresh, shouldPrefetch, shouldServeHighQuality, shouldUseAggressiveCaching, sleep, sortIssuesByPriority, startNetworkEventMonitoring, startOfDay, startRequestTracking, subscribe, subscribeMultiple, subscribeOnce, subscribeWithTimeout, sum, supportsBroadcastChannel, supportsFetch, supportsGeolocation, supportsIntersectionObserver, supportsLocalStorage, supportsNotifications, supportsPushNotifications, supportsRequestIdleCallback, supportsServiceWorker, supportsSessionStorage, supportsWebSocket, throttle, timeAgo, toFetchffConfig, toFetchffRevalidationConfig, toISOString, trackConfig, trackNetworkOverride, trackableSpread, truncateJSON, unifiedStrategies, unregisterErrorHandlers, updateCampaign, updateGlobalConfig, useAbortableRequest, useApiConfigConflicts, useApiDebugInfo, useApiMonitor, useApiNetworkQuality, useCampaign, useCampaignParticipants, useCampaignStats, useCampaigns, useConditionalSubscription, useCreateCampaign, useDebouncedSubscription, useDeleteCampaign, useJoinCampaign, useLeaveCampaign, useMultipleSubscriptions, useOptimisticUpdate, useRealTimeData, useRequestCleanup, useRequestGroup, useRouteAwareRequest, useSubscription, useSubscriptionState, useUpdateCampaign, validateConfigUpdate, validateHeaders2 as validateHeaders, validatePreset, waitForOnline, withNetworkDetection, withNetworkInfo, withTimeout };
|
|
25760
|
+
export { ALL_EVENTS, ApiPackageError, CACHE_EVENTS2 as CACHE_EVENTS, CLIENT_EVENTS2 as CLIENT_EVENTS, CONFIG_EVENTS2 as CONFIG_EVENTS, ClientHintsInterceptor, ConfigBuilder, DEBUG_EVENTS2 as DEBUG_EVENTS, ERROR_EVENTS2 as ERROR_EVENTS, EVENT_NAMESPACES2 as EVENT_NAMESPACES, EVENT_SCOPES2 as EVENT_SCOPES, EVENT_SCOPES_WITH_TEMPORARY, Environment, EventHelpers, EventManager, HANDLER_SCOPES, HEADER_EVENTS2 as HEADER_EVENTS, HeaderBuilder, IntervalManager, MEDIA_EXTENSIONS, MEDIA_MIME_PREFIXES, MinimumConnectionGuard, NETWORK_EVENTS2 as NETWORK_EVENTS, NetworkConfigurationManager, NetworkDetectionMiddleware, NetworkGuard, NetworkInfoParam, NetworkPresetNames, NetworkProperty, NoDataSaverGuard, PERFORMANCE_EVENTS2 as PERFORMANCE_EVENTS, RequestTracker, UnifiedDebugger, abortAllRequests, abortByPattern, abortRequest, abortSearchRequests, abortUploadRequests, addClientHintsToResponse, addInterval, addTime, analyzeComplianceIssues, analyzeConfigImpact, analyzeConflictPatterns, analyzeEventSystemIssues, analyzeHistoryPatterns, analyzePerformanceIssues, applyConfigOverride, applyConfigPreset, applyConfigUpdate, applyPollingStrategy, applyRetryStrategy, applyRevalidationStrategy, applyTemporaryNetworkOverride, applyUnifiedStrategy, arrayOf, average, base64ToBytes, buildCacheKey, bytesToBase64, cacheKeyPatterns, cacheStrategies, calculateCacheDuration, calculatePerformanceImpact, calculatePollingDuration, calculateRequestMetrics, canPerformHeavyOperation, clamp, clampedPercentage, clearErrorHandlers, clearNetworkDebugData, clearTemporaryOverrides, cloneConfig, compactHistory, configConflictDetector, configureForEnvironment, containsAny, convertEndpointsToFetchff, createAbortError, createAdaptiveResponse, createApiClient, createCachePattern, createCacheStrategy, createCampaign, createComplianceReport, createConditionalInterval, createConditionalPolling, createConfigBuilder, createConfigHistoryEntry, createConfigState, createConflict, createCorrelationIdGenerator, createCustomPreset, createCustomUnifiedStrategy, createDate, createDebouncedAbort, createDebugReport, createDecryptionInterceptor, createDelay, createEncryptionInterceptor, createEncryptionInterceptors, createEventEmitter, createHistoryEntry, createHistorySummary, createIdGenerator, createLimitedInterval, createManagedInterval, createNetworkDetectionMiddleware, createPerformanceAnalysis, createPerformanceBenchmark, createPollingStrategy, createProgressivePolling, createRequestIdGenerator, createRetryConfig, createRetryStrategy, createRevalidationKey, createRevalidationStrategy, createRouteGuard, createRouteScope, createScopedAbort, createStatusCodeLimits, createThrottledAbort, createTypedSubscription, createVisibilityAwarePolling, dateDiff, debounce, decrypt, deepMerge, deleteCache, deleteCampaign, detectConfigConflicts, detectConflicts, detectPlatform, determinePrecedenceReason, disableNetworkConfigDebug, enableNetworkConfigDebug, encrypt, endOfDay, eventManager, exportKeyToBase64, extendPresets as extendRevalidationPresets, extractBaseCorrelationId, extractBaseId, extractBaseRequestId, extractCorrelationType, extractFields, extractLinkedCorrelationIds, fetchCampaign, fetchCampaignParticipants, fetchCampaignStats, fetchCampaigns, filterHistory, filterObject, findMatchingPaths, flattenObject, formatDuration, formatReportForConsole, formatTimeForInterval, fromFetchffConfig, fromISOString, fromUnixTimestamp, generateApiCorrelationId, generateBaseId, generateComprehensiveReport, generateContextualCorrelationId, generateContextualId, generateContextualRequestId, generateCorrelationId, generateIV, generateIssueBreakdown, generateNetworkCorrelationId, generateRandomKey, generateRecommendations, generateRequestId, generateSessionCorrelationId, generateShortRequestId, generateTraceCorrelationId, generateUUID, getActiveOverrideKeys, getAdaptiveApiConfig, getAdaptiveBatchSize, getAdaptiveCacheDuration, getAdaptiveConfig, getAdaptivePageSize, getAdaptiveTimeout, getAllFieldPaths, getAllMediaExtensions, getAppVersion, getAuthenticationType, getCache, getCacheAffectingHeaders, getCacheStrategy, getClientHintHeaders, getConfigHierarchy, getConnection, getConnectionType, getConsole, getContextHeaders, getCrypto, getDefaultApiClient, getDeviceId, getDeviceInfo, getDocument, getEffectiveConfig, getEffectiveConnectionType, getEnhancedClientHints, getEntries, getEnv, getEnvironmentInfo, getEnvironmentName, getErrorCategory, getErrorCodeByStatus, getErrorDefinition, getErrorHandlers, getEventManager, getExtendedEnvironmentInfo, getFieldValue, getFileExtension, getFrameworkAdaptiveBatchSize, getFrameworkAdaptiveTimeout, getGlobal, getGlobalConfig, getHeaderFingerprint, getHeaderSummary, getISOWeek, getIntervalBoundaries, getIntervalDifference, getIntervalEnd, getIntervalStart, getJSONSize, getKeys, getLocalStorage, getLocation, getMatchingPresets, getNavigator, getNetworkConfigFromHeaders, getNetworkDebugStats, getNetworkEventStats, getNetworkInfo, getNetworkInfoFromHeaders, getNetworkInfoFromRequest, getNetworkOptimizedConfig, getNetworkPreset, getNetworkQuality, getNetworkQualityFromHeaders, getNetworkQualityScore, getNetworkRTT, getNetworkSpeed, getNonCacheAffectingHeaders, getOptimizedNetworkConfig, getPresetForNetworkInfo, getPresetForQuality, getPresetNames, getProcess, getQuarter, getRelativeTime, getRetryStrategy, getPreset as getRevalidationPreset, getPresets as getRevalidationPresets, getRevalidationStrategy, getRuntimeEnvironment, getSSRSafeConfig, getSSRSafePollingConfig, getSessionStorage, getTimeComponents, getUnifiedDebugger, getUnifiedStrategy, getUnifiedStrategyNames, getUnixTimestamp, getUserAgent, getValues, getWindow, groupBy, handleArrayMerge, handleObjectMerge, hasAnyExtension, hasAuthentication, hasEncryptableFields, hasGlobal, hasIndexedDB, hasLocalStorage, hasMatchingFields, hasNavigator, hasNetworkInfo2 as hasNetworkInfoExpress, hasNetworkInfo as hasNetworkInfoNextjs, hasPreset, hasProperty, hasSessionStorage, hasWebGL, hasWebPSupport, headerPresets, headers, headersContext, importKey, inBrowser, inRange, inServer, invalidationScenarios, inverseLerp, isAbortError, isArray, isBoolean, isBrowser, isBun, isCI, isCacheValid, isCellularConnection, isCryptoAvailable, isDataFresh, isDataSaverEnabled, isDataSaverEnabledFromHeaders, isDebug, isDeno, isDevelopment, isDocumentVisible, isElectron, isEmpty, isEmptyObject, isEncryptedMetadata, isError, isFunction, isFuture, isInIframe, isInRange, isInteger, isMergeableObject, isMobile, isNetworkAPISupported, isNode, isNonEmptyArray, isNonEmptyObject, isNonEmptyString2 as isNonEmptyString, isNonNegativeNumber, isNotNullish, isNullish, isNumber, isObject, isOffline, isOneOfIgnoreCase, isOnline, isPageFocused, isPast, isPlainObject, isPollingActive, isPositiveNumber, isProduction, isPromise, isReactNative, isRevalidationSupported, isSSR, isSameDay, isSameInterval, isServer, isSlowConnection, isStaging, isString, isTest, isToday, isTouchDevice, isUnifiedStrategyName, isValidCorrelationId, isValidDate, isValidEnumValue, isValidFieldPath, isValidId, isValidJSON, isValidNumber2 as isValidNumber, isValidPollingConfig, isValidRequestId, isValidStrategyName as isValidRevalidationStrategyName, isWebWorker, isWifiConnection, isWildcard, isWithinDedupeWindow, joinCampaign, jsonClone, jsonEquals, keyBy, leaveCampaign, lerp, linkCorrelationIds, logNetworkConfigReport, mapKeys, mapObject, mapRange, matchFieldPath, matchesAny, max, median, mergeCacheStrategies, mergeConfigs, mergeConflicts, mergeHeaders, mergePollingConfigs, mergePresets, mergeRetryStrategies, mergeRevalidationStrategies, mergeUnifiedStrategy, min, msToSeconds, mutate2 as mutate, networkConfigDebugger, networkConfigManager, networkDetectionMiddleware, networkPresets, networkStatus, normalizeHeaders3 as normalizeHeaders, now, nowInSeconds, omit, onOffline, onOnline, onceErrorHandler, oneOf, parseAndValidateNumber, parseFieldPath, parseId, percentage, pick, pollingStrategies, prepareRequestConfig, prepareRequestConfigWithEnrichedHeaders, prettyStringify, raceRequests, randomBetween, randomInt, registerErrorHandler, registerErrorHandlers, removeCircularReferences, removeEmpty, removeNullish, removeSensitiveHeaders, removeUndefined, requestTracker, requestWithTimeout, resetGlobalConfig, resetPresets as resetRevalidationPresets, resolveConflict, retryConditions, retryStrategies, genericPresets as revalidationPresets, revalidationStrategies, round, runWithHeaders, runWithHeadersAsync, safeParseJSON, safeStringify, sanitizeHeaders2 as sanitizeHeaders, secondsToMs, sequentialRequests, setCache, setConfigWarnings, setDefaultApiClient, setErrorHandlers, setFieldValue, setGlobalConfig, setupClientEvents, setupRouteChangeCleanup, shouldApplyConfig, shouldAutoRefresh, shouldPrefetch, shouldServeHighQuality, shouldUseAggressiveCaching, sleep, sortIssuesByPriority, startNetworkEventMonitoring, startOfDay, startRequestTracking, subscribe, subscribeMultiple, subscribeOnce, subscribeWithTimeout, sum, supportsBroadcastChannel, supportsFetch, supportsGeolocation, supportsIntersectionObserver, supportsLocalStorage, supportsNotifications, supportsPushNotifications, supportsRequestIdleCallback, supportsServiceWorker, supportsSessionStorage, supportsWebSocket, throttle, timeAgo, toFetchffConfig, toFetchffRevalidationConfig, toISOString, trackConfig, trackNetworkOverride, trackableSpread, transformFields, truncateJSON, unifiedStrategies, unregisterErrorHandlers, updateCampaign, updateGlobalConfig, useAbortableRequest, useApiConfigConflicts, useApiDebugInfo, useApiMonitor, useApiNetworkQuality, useCampaign, useCampaignParticipants, useCampaignStats, useCampaigns, useConditionalSubscription, useCreateCampaign, useDebouncedSubscription, useDeleteCampaign, useJoinCampaign, useLeaveCampaign, useMultipleSubscriptions, useOptimisticUpdate, useRealTimeData, useRequestCleanup, useRequestGroup, useRouteAwareRequest, useSubscription, useSubscriptionState, useUpdateCampaign, validateConfigUpdate, validateEncryptionConfig, validateHeaders2 as validateHeaders, validatePreset, waitForOnline, withNetworkDetection, withNetworkInfo, withTimeout };
|
|
25072
25761
|
//# sourceMappingURL=index.mjs.map
|
|
25073
25762
|
//# sourceMappingURL=index.mjs.map
|