@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.
@@ -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 tokensDirectoryExists = await pathExists(options.tokensDirectory);
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(options.tokensDirectory);
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, options);
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(options.tokensDirectory, tokenId);
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-PURXNE6R.js.map
1886
- //# sourceMappingURL=chunk-PURXNE6R.js.map
1887
+ //# sourceMappingURL=chunk-MXHLBRPB.js.map
1888
+ //# sourceMappingURL=chunk-MXHLBRPB.js.map