@zimic/interceptor 0.17.0-canary.3 → 0.17.0-canary.4
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/{chunk-PURXNE6R.js → chunk-MXHLBRPB.js} +12 -10
- package/dist/{chunk-L75WKVZO.mjs.map → chunk-MXHLBRPB.js.map} +1 -1
- package/dist/{chunk-L75WKVZO.mjs → chunk-OGL76CKO.mjs} +12 -10
- package/dist/chunk-OGL76CKO.mjs.map +1 -0
- package/dist/cli.js +18 -18
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/http.d.ts +9 -2
- package/dist/http.js +33 -10
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +33 -10
- package/dist/http.mjs.map +1 -1
- package/dist/server.js +6 -6
- package/dist/server.mjs +1 -1
- package/package.json +3 -3
- package/src/http/interceptor/LocalHttpInterceptor.ts +2 -2
- package/src/http/interceptor/RemoteHttpInterceptor.ts +35 -4
- package/src/http/interceptor/errors/RunningHttpInterceptorError.ts +1 -1
- package/src/http/interceptor/types/public.ts +11 -3
- package/src/server/utils/auth.ts +14 -11
- package/dist/chunk-PURXNE6R.js.map +0 -1
|
@@ -1429,8 +1429,8 @@ async function readInterceptorTokenFromFile(tokenId, options) {
|
|
|
1429
1429
|
return validation.data.token;
|
|
1430
1430
|
}
|
|
1431
1431
|
chunkWCQVDF3K_js.__name(readInterceptorTokenFromFile, "readInterceptorTokenFromFile");
|
|
1432
|
-
async function createInterceptorToken(options) {
|
|
1433
|
-
const { name, tokensDirectory } = options;
|
|
1432
|
+
async function createInterceptorToken(options = {}) {
|
|
1433
|
+
const { name, tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1434
1434
|
const tokensDirectoryExists = await pathExists(tokensDirectory);
|
|
1435
1435
|
if (!tokensDirectoryExists) {
|
|
1436
1436
|
await createInterceptorTokensDirectory(tokensDirectory);
|
|
@@ -1463,18 +1463,19 @@ async function createInterceptorToken(options) {
|
|
|
1463
1463
|
return token;
|
|
1464
1464
|
}
|
|
1465
1465
|
chunkWCQVDF3K_js.__name(createInterceptorToken, "createInterceptorToken");
|
|
1466
|
-
async function listInterceptorTokens(options) {
|
|
1467
|
-
const
|
|
1466
|
+
async function listInterceptorTokens(options = {}) {
|
|
1467
|
+
const { tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1468
|
+
const tokensDirectoryExists = await pathExists(tokensDirectory);
|
|
1468
1469
|
if (!tokensDirectoryExists) {
|
|
1469
1470
|
return [];
|
|
1470
1471
|
}
|
|
1471
|
-
const files = await fs__default.default.promises.readdir(
|
|
1472
|
+
const files = await fs__default.default.promises.readdir(tokensDirectory);
|
|
1472
1473
|
const tokenReadPromises = files.map(async (file) => {
|
|
1473
1474
|
if (!isValidInterceptorTokenId(file)) {
|
|
1474
1475
|
return null;
|
|
1475
1476
|
}
|
|
1476
1477
|
const tokenId = file;
|
|
1477
|
-
const token = await readInterceptorTokenFromFile(tokenId,
|
|
1478
|
+
const token = await readInterceptorTokenFromFile(tokenId, { tokensDirectory });
|
|
1478
1479
|
return token;
|
|
1479
1480
|
});
|
|
1480
1481
|
const tokenCandidates = await Promise.allSettled(tokenReadPromises);
|
|
@@ -1510,11 +1511,12 @@ async function validateInterceptorToken(tokenValue, options) {
|
|
|
1510
1511
|
}
|
|
1511
1512
|
}
|
|
1512
1513
|
chunkWCQVDF3K_js.__name(validateInterceptorToken, "validateInterceptorToken");
|
|
1513
|
-
async function removeInterceptorToken(tokenId, options) {
|
|
1514
|
+
async function removeInterceptorToken(tokenId, options = {}) {
|
|
1515
|
+
const { tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1514
1516
|
if (!isValidInterceptorTokenId(tokenId)) {
|
|
1515
1517
|
throw new InvalidInterceptorTokenError_default(tokenId);
|
|
1516
1518
|
}
|
|
1517
|
-
const tokenFilePath = path__default.default.join(
|
|
1519
|
+
const tokenFilePath = path__default.default.join(tokensDirectory, tokenId);
|
|
1518
1520
|
await fs__default.default.promises.rm(tokenFilePath, { force: true });
|
|
1519
1521
|
}
|
|
1520
1522
|
chunkWCQVDF3K_js.__name(removeInterceptorToken, "removeInterceptorToken");
|
|
@@ -1882,5 +1884,5 @@ exports.listInterceptorTokens = listInterceptorTokens;
|
|
|
1882
1884
|
exports.logger = logger;
|
|
1883
1885
|
exports.readInterceptorTokenFromFile = readInterceptorTokenFromFile;
|
|
1884
1886
|
exports.removeInterceptorToken = removeInterceptorToken;
|
|
1885
|
-
//# sourceMappingURL=chunk-
|
|
1886
|
-
//# sourceMappingURL=chunk-
|
|
1887
|
+
//# sourceMappingURL=chunk-MXHLBRPB.js.map
|
|
1888
|
+
//# sourceMappingURL=chunk-MXHLBRPB.js.map
|