@zimic/interceptor 0.16.0-canary.11 → 0.16.0-canary.3
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/README.md +2 -1
- package/dist/{chunk-NTRC2S4I.mjs → chunk-2RNFR6TF.mjs} +267 -249
- package/dist/chunk-2RNFR6TF.mjs.map +1 -0
- package/dist/{chunk-O6ZIPCUJ.js → chunk-D7CDDSQE.js} +268 -250
- package/dist/chunk-D7CDDSQE.js.map +1 -0
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +5 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/http.d.ts +141 -180
- package/dist/http.js +69 -102
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +69 -101
- package/dist/http.mjs.map +1 -1
- package/dist/server.d.ts +46 -20
- package/dist/server.js +7 -7
- package/dist/server.mjs +1 -1
- package/package.json +11 -11
- package/src/cli/browser/init.ts +2 -2
- package/src/cli/server/start.ts +2 -2
- package/src/http/index.ts +2 -5
- package/src/http/interceptor/HttpInterceptorClient.ts +15 -30
- package/src/http/interceptor/LocalHttpInterceptor.ts +8 -8
- package/src/http/interceptor/RemoteHttpInterceptor.ts +8 -8
- package/src/http/interceptor/types/options.ts +10 -3
- package/src/http/interceptor/types/public.ts +12 -44
- package/src/http/interceptorWorker/HttpInterceptorWorker.ts +2 -2
- package/src/http/requestHandler/HttpRequestHandlerClient.ts +5 -15
- package/src/http/requestHandler/errors/DisabledRequestSavingError.ts +1 -1
- package/src/http/requestHandler/errors/TimesCheckError.ts +14 -15
- package/src/http/requestHandler/types/public.ts +8 -16
- package/src/server/index.ts +11 -1
- package/src/server/namespace/InterceptorServerNamespace.ts +21 -0
- package/src/utils/console.ts +2 -2
- package/dist/chunk-NTRC2S4I.mjs.map +0 -1
- package/dist/chunk-O6ZIPCUJ.js.map +0 -1
- package/src/http/interceptor/errors/RequestSavingSafeLimitExceededError.ts +0 -22
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/cli/browser/shared/constants.ts","../src/cli/browser/init.ts","../src/utils/processes.ts","../src/cli/server/start.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["exitEvent","yargs"],"mappings":";;;;;;;;;;AAgBE,IAAW,OAAA,GAAA,kBAAA;;;AChBN,IAAM,wBAA2B,GAAA,sBAAA;;;ACQxC,IAAM,aAAA,GAAgB,KAAK,IAAK,CAAA,SAAA,CAAQ,QAAQ,KAAK,CAAA,EAAG,IAAM,EAAA,IAAA,EAAM,IAAI,CAAA;AACjE,IAAM,wBAA2B,GAAA,IAAA,CAAK,IAAK,CAAA,aAAA,EAAe,OAAO,wBAAwB,CAAA;AAMhG,eAAe,8BAAA,CAA+B,EAAE,eAAA,EAAoD,EAAA;AAClG,EAAM,MAAA,uBAAA,GAA0B,IAAK,CAAA,OAAA,CAAQ,eAAe,CAAA;AAC5D,EAAA,MAAM,WAAW,KAAM,CAAA,uBAAA,EAAyB,EAAE,SAAA,EAAW,MAAM,CAAA;AAEnE,EAAA,MAAM,eAAkB,GAAA,IAAA,CAAK,IAAK,CAAA,uBAAA,EAAyB,wBAAwB,CAAA;AACnF,EAAM,MAAA,UAAA,CAAW,QAAS,CAAA,wBAAA,EAA0B,eAAe,CAAA;AAEnE,EAAA,aAAA,CAAc,CAAkC,+BAAA,EAAA,KAAA,CAAM,KAAM,CAAA,eAAe,CAAC,CAAG,CAAA,CAAA,CAAA;AAC/E,EAAA,aAAA,CAAc,uCAAuC,CAAA;AACvD;AATe,MAAA,CAAA,8BAAA,EAAA,gCAAA,CAAA;AAWf,IAAO,YAAQ,GAAA,8BAAA;;;ACxBR,IAAM,mBAAA,GAAsB,OAAO,MAAO,CAAA;AAAA,EAC/C,YAAA;AAAA,EACA,0BAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAU,CAAA;AAKH,IAAM,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A,UACxB,sBAAsB,YAAa,CAAA,oBAAA;AAAA,UACnC,SAAS,cACL,GAAA;AAAA,YACE,OAAA,EAAS,eAAe,QAAS,EAAA;AAAA,YACjC,SAAW,EAAA;AAAA,WAEb,GAAA;AAAA,SACL,CAAA;AAAA;AACH;AACF,IAGD,KAAM,EAAA;AACX;AApFe,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAsFf,IAAO,WAAQ,GAAA,MAAA;;;AC3Ff,KAAK,WAAO,EAAA","file":"cli.mjs","sourcesContent":["{\n \"name\": \"@zimic/interceptor\",\n \"description\": \"Next-gen, TypeScript-first HTTP intercepting and mocking\",\n \"keywords\": [\n \"zimic\",\n \"typescript\",\n \"types\",\n \"typegen\",\n \"validation\",\n \"inference\",\n \"http\",\n \"interceptor\",\n \"mock\",\n \"api\",\n \"static\"\n ],\n \"version\": \"0.16.0-canary.11\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/zimicjs/zimic.git\",\n \"directory\": \"packages/zimic-interceptor\"\n },\n \"author\": {\n \"name\": \"Diego Aquino\",\n \"url\": \"https://github.com/diego-aquino\"\n },\n \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.13.0\"\n },\n \"license\": \"MIT\",\n \"files\": [\n \"package.json\",\n \"README.md\",\n \"LICENSE.md\",\n \"src\",\n \"!src/**/tests\",\n \"!src/**/__tests__\",\n \"!src/**/*.test.ts\",\n \"dist\",\n \"index.d.ts\",\n \"http.d.ts\",\n \"server.d.ts\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"index.d.ts\",\n \"bin\": {\n \"zimic-interceptor\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.js\"\n },\n \"./http\": {\n \"types\": \"./http.d.ts\",\n \"import\": \"./dist/http.mjs\",\n \"require\": \"./dist/http.js\",\n \"default\": \"./dist/http.js\"\n },\n \"./server\": {\n \"types\": \"./server.d.ts\",\n \"import\": \"./dist/server.mjs\",\n \"require\": \"./dist/server.js\",\n \"default\": \"./dist/server.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"cli\": \"node ./dist/cli.js\",\n \"build\": \"tsup\",\n \"lint\": \"eslint --cache --no-error-on-unmatched-pattern --no-warn-ignored --fix\",\n \"lint:turbo\": \"pnpm lint . --max-warnings 0\",\n \"style\": \"prettier --log-level warn --ignore-unknown --no-error-on-unmatched-pattern --cache\",\n \"style:check\": \"pnpm style --check\",\n \"style:format\": \"pnpm style --write\",\n \"test\": \"dotenv -v NODE_ENV=test -v FORCE_COLOR=1 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"deps:install-playwright\": \"playwright install chromium\",\n \"deps:init-msw\": \"msw init ./public --no-save\",\n \"deps:init\": \"pnpm deps:install-playwright && pnpm deps:init-msw\",\n \"postinstall\": \"node -e \\\"try{require('./dist/scripts/postinstall')}catch(error){console.error(error)}\\\"\"\n },\n \"dependencies\": {\n \"@whatwg-node/server\": \"0.10.1\",\n \"execa\": \"9.5.2\",\n \"isomorphic-ws\": \"5.0.0\",\n \"msw\": \"2.7.3\",\n \"picocolors\": \"^1.1.1\",\n \"ws\": \"8.18.1\",\n \"yargs\": \"17.7.2\"\n },\n \"optionalDependencies\": {\n \"bufferutil\": \"4.0.9\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.13.10\",\n \"@types/ws\": \"^8.18.0\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.0.9\",\n \"@vitest/coverage-istanbul\": \"^3.0.9\",\n \"@zimic/eslint-config-node\": \"workspace:*\",\n \"@zimic/lint-staged-config\": \"workspace:*\",\n \"@zimic/tsconfig\": \"workspace:*\",\n \"@zimic/utils\": \"workspace:*\",\n \"dotenv-cli\": \"^8.0.0\",\n \"eslint\": \"^9.22.0\",\n \"playwright\": \"^1.51.1\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.8.2\",\n \"vitest\": \"^3.0.9\"\n },\n \"peerDependencies\": {\n \"@zimic/http\": \"^0.2.0 || ^0.2.0-canary.0\",\n \"typescript\": \">=4.8.0\"\n },\n \"peerDependenciesMeta\": {\n \"typescript\": {\n \"optional\": true\n }\n }\n}\n","export const SERVICE_WORKER_FILE_NAME = 'mockServiceWorker.js';\n","import filesystem from 'fs/promises';\nimport path from 'path';\nimport color from 'picocolors';\n\nimport { logWithPrefix } from '@/utils/console';\n\nimport { SERVICE_WORKER_FILE_NAME } from './shared/constants';\n\nconst MSW_ROOT_PATH = path.join(require.resolve('msw'), '..', '..', '..');\nexport const MOCK_SERVICE_WORKER_PATH = path.join(MSW_ROOT_PATH, 'lib', SERVICE_WORKER_FILE_NAME);\n\ninterface BrowserServiceWorkerInitOptions {\n publicDirectory: string;\n}\n\nasync function initializeBrowserServiceWorker({ publicDirectory }: BrowserServiceWorkerInitOptions) {\n const absolutePublicDirectory = path.resolve(publicDirectory);\n await filesystem.mkdir(absolutePublicDirectory, { recursive: true });\n\n const destinationPath = path.join(absolutePublicDirectory, SERVICE_WORKER_FILE_NAME);\n await filesystem.copyFile(MOCK_SERVICE_WORKER_PATH, destinationPath);\n\n logWithPrefix(`Service worker script saved to ${color.green(destinationPath)}!`);\n logWithPrefix('You can now use browser interceptors!');\n}\n\nexport default initializeBrowserServiceWorker;\n","import createCachedDynamicImport from '@zimic/utils/import/createCachedDynamicImport';\n\nexport const PROCESS_EXIT_EVENTS = Object.freeze([\n 'beforeExit',\n 'uncaughtExceptionMonitor',\n 'SIGINT',\n 'SIGTERM',\n 'SIGHUP',\n 'SIGBREAK',\n] as const);\n\nexport type ProcessExitEvent = (typeof PROCESS_EXIT_EVENTS)[number];\n\n// Having an undefined exit code means that the process will already exit with the default exit code.\nexport const PROCESS_EXIT_CODE_BY_EXIT_EVENT: Record<string, number | undefined> = {\n beforeExit: undefined,\n uncaughtExceptionMonitor: undefined,\n SIGINT: 130,\n SIGTERM: 143,\n SIGHUP: 129,\n SIGBREAK: 131,\n} satisfies Record<ProcessExitEvent, number | undefined>;\n\nexport const importExeca = createCachedDynamicImport(() => import('execa'));\n\ninterface CommandErrorOptions {\n command?: string[];\n exitCode?: number;\n signal?: NodeJS.Signals;\n originalMessage?: string;\n}\n\nexport class CommandError extends Error {\n static readonly DEFAULT_EXIT_CODE = 1;\n\n readonly command: string[];\n readonly exitCode: number;\n readonly signal?: NodeJS.Signals;\n\n constructor(executable: string, options: CommandErrorOptions) {\n const message = CommandError.createMessage(executable, options);\n super(message);\n\n this.name = 'CommandError';\n this.command = options.command ?? [executable];\n this.exitCode = this.getExitCode(options);\n this.signal = options.signal;\n }\n\n private getExitCode(options: CommandErrorOptions): number {\n const existingExitCode = options.exitCode;\n const exitCodeInferredFromSignal =\n options.signal === undefined ? undefined : PROCESS_EXIT_CODE_BY_EXIT_EVENT[options.signal];\n\n return existingExitCode ?? exitCodeInferredFromSignal ?? CommandError.DEFAULT_EXIT_CODE;\n }\n\n private static createMessage(command: string, options: CommandErrorOptions) {\n const suffix = options.originalMessage ? `: ${options.originalMessage}` : '';\n\n if (options.exitCode === undefined && options.signal === undefined) {\n return `Command '${command}' failed${suffix}`;\n }\n\n const prefix = `Command '${command}' exited `;\n const infix = options.exitCode === undefined ? `after signal ${options.signal}` : `with code ${options.exitCode}`;\n\n return `${prefix}${infix}${suffix}`;\n }\n}\n\nexport async function runCommand(command: string, commandArguments: string[]) {\n const { execa: $, ExecaError } = await importExeca();\n\n try {\n await $(command, commandArguments, { stdio: 'inherit' });\n } catch (error) {\n /* istanbul ignore if -- @preserve\n * This is a safeguard if the error is not an ExecaError. It is not expected to run. */\n if (!(error instanceof ExecaError)) {\n throw error;\n }\n\n const commandError = new CommandError(command, {\n command: [command, ...commandArguments],\n exitCode: error.exitCode,\n signal: error.signal,\n originalMessage: error.originalMessage,\n });\n\n throw commandError;\n }\n}\n","import { InterceptorServer, createInterceptorServer } from '@/server';\nimport { InterceptorServerOptions } from '@/server/types/options';\nimport { logWithPrefix } from '@/utils/console';\nimport {\n CommandError,\n PROCESS_EXIT_CODE_BY_EXIT_EVENT,\n PROCESS_EXIT_EVENTS,\n ProcessExitEvent,\n runCommand,\n} from '@/utils/processes';\n\ninterface InterceptorServerStartOptions extends InterceptorServerOptions {\n ephemeral: boolean;\n onReady?: {\n command: string;\n arguments: string[];\n };\n}\n\nexport let serverSingleton: InterceptorServer | undefined;\n\nasync function startInterceptorServer({\n hostname,\n port,\n ephemeral,\n logUnhandledRequests,\n onReady,\n}: InterceptorServerStartOptions) {\n const server = createInterceptorServer({\n hostname,\n port,\n logUnhandledRequests,\n });\n\n async function handleExitEvent(exitEvent: ProcessExitEvent | undefined) {\n await server.stop();\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n for (const { exitEvent, exitHandler } of exitHandlerGroups) {\n process.off(exitEvent, exitHandler);\n }\n\n const exitCode = exitEvent ? PROCESS_EXIT_CODE_BY_EXIT_EVENT[exitEvent] : undefined;\n if (exitCode !== undefined) {\n process.exit(exitCode);\n }\n }\n\n const exitHandlerGroups = PROCESS_EXIT_EVENTS.map((exitEvent) => ({\n exitEvent,\n exitHandler: handleExitEvent.bind(null, exitEvent),\n }));\n\n for (const { exitEvent, exitHandler } of exitHandlerGroups) {\n process.on(exitEvent, exitHandler);\n }\n\n serverSingleton = server;\n\n await server.start();\n\n logWithPrefix(`${ephemeral ? 'Ephemeral s' : 'S'}erver is running on ${server.hostname}:${server.port}`);\n\n if (onReady) {\n try {\n await runCommand(onReady.command, onReady.arguments);\n } catch (error) {\n console.error(error);\n\n /* istanbul ignore if -- @preserve\n * A CommandError is always expected here. */\n if (!(error instanceof CommandError)) {\n throw error;\n }\n\n process.exit(error.exitCode);\n }\n }\n\n if (ephemeral) {\n await handleExitEvent(undefined);\n process.exit(0);\n }\n}\n\nexport default startInterceptorServer;\n","import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport { version } from '@@/package.json';\n\nimport initializeBrowserServiceWorker from './browser/init';\nimport startInterceptorServer from './server/start';\n\nasync function runCLI() {\n await yargs(hideBin(process.argv))\n .scriptName('zimic-interceptor')\n .version(version)\n .showHelpOnFail(false)\n .strict()\n\n .command('browser', 'Manage your browser mock configuration', (yargs) =>\n yargs.demandCommand().command(\n 'init <publicDirectory>',\n 'Initialize the browser service worker configuration.',\n (yargs) =>\n yargs.positional('publicDirectory', {\n type: 'string',\n description: 'The path to the public directory of your application.',\n demandOption: true,\n }),\n async (cliArguments) => {\n await initializeBrowserServiceWorker({\n publicDirectory: cliArguments.publicDirectory,\n });\n },\n ),\n )\n\n .command('server', 'Manage interceptor servers', (yargs) =>\n yargs.demandCommand().command(\n 'start [-- onReady]',\n 'Start an interceptor server.',\n (yargs) =>\n yargs\n .positional('onReady', {\n description: 'A command to run when the server is ready to accept connections.',\n type: 'string',\n })\n .option('hostname', {\n type: 'string',\n description: 'The hostname to start the server on.',\n alias: 'h',\n default: 'localhost',\n })\n .option('port', {\n type: 'number',\n description: 'The port to start the server on.',\n alias: 'p',\n })\n .option('ephemeral', {\n type: 'boolean',\n description:\n 'Whether the server should stop automatically after the on-ready command finishes. ' +\n 'If no on-ready command is provided and ephemeral is true, the server will stop immediately after ' +\n 'starting.',\n alias: 'e',\n default: false,\n })\n .option('log-unhandled-requests', {\n type: 'boolean',\n description:\n 'Whether to log a warning when no interceptors were found for the base URL of a request. ' +\n 'If an interceptor was matched, the logging behavior for that base URL is configured in the ' +\n 'interceptor itself.',\n alias: 'l',\n }),\n async (cliArguments) => {\n const onReadyCommand = cliArguments._.at(2)?.toString();\n const onReadyCommandArguments = cliArguments._.slice(3).map((argument) => argument.toString());\n\n await startInterceptorServer({\n hostname: cliArguments.hostname,\n port: cliArguments.port,\n ephemeral: cliArguments.ephemeral,\n logUnhandledRequests: cliArguments.logUnhandledRequests,\n onReady: onReadyCommand\n ? {\n command: onReadyCommand.toString(),\n arguments: onReadyCommandArguments,\n }\n : undefined,\n });\n },\n ),\n )\n\n .parse();\n}\n\nexport default runCLI;\n","#!/usr/bin/env node\nimport runCLI from './cli';\n\nvoid runCLI();\n"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/cli/browser/shared/constants.ts","../src/cli/browser/init.ts","../src/utils/processes.ts","../src/cli/server/start.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["exitEvent","yargs"],"mappings":";;;;;;;;;;AAgBE,IAAW,OAAA,GAAA,iBAAA;;;AChBN,IAAM,wBAA2B,GAAA,sBAAA;;;ACQxC,IAAM,aAAA,GAAgB,KAAK,IAAK,CAAA,SAAA,CAAQ,QAAQ,KAAK,CAAA,EAAG,IAAM,EAAA,IAAA,EAAM,IAAI,CAAA;AACjE,IAAM,wBAA2B,GAAA,IAAA,CAAK,IAAK,CAAA,aAAA,EAAe,OAAO,wBAAwB,CAAA;AAMhG,eAAe,8BAAA,CAA+B,EAAE,eAAA,EAAoD,EAAA;AAClG,EAAM,MAAA,uBAAA,GAA0B,IAAK,CAAA,OAAA,CAAQ,eAAe,CAAA;AAC5D,EAAA,MAAM,WAAW,KAAM,CAAA,uBAAA,EAAyB,EAAE,SAAA,EAAW,MAAM,CAAA;AAEnE,EAAA,MAAM,eAAkB,GAAA,IAAA,CAAK,IAAK,CAAA,uBAAA,EAAyB,wBAAwB,CAAA;AACnF,EAAM,MAAA,UAAA,CAAW,QAAS,CAAA,wBAAA,EAA0B,eAAe,CAAA;AAEnE,EAAA,aAAA,CAAc,CAAkC,+BAAA,EAAA,KAAA,CAAM,KAAM,CAAA,eAAe,CAAC,CAAG,CAAA,CAAA,CAAA;AAC/E,EAAA,aAAA,CAAc,uCAAuC,CAAA;AACvD;AATe,MAAA,CAAA,8BAAA,EAAA,gCAAA,CAAA;AAWf,IAAO,YAAQ,GAAA,8BAAA;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QAAA,KAAa,QAAS,CAAA,QAAA,EAAU,CAAA;AAE7F,QAAA,MAAM,aAAuB,CAAA;AAAA,UAC3B,UAAU,YAAa,CAAA,QAAA;AAAA,UACvB,MAAM,YAAa,CAAA,IAAA;AAAA,UACnB,WAAW,YAAa,CAAA,SAAA;AAAA,UACxB,sBAAsB,YAAa,CAAA,oBAAA;AAAA,UACnC,SAAS,cACL,GAAA;AAAA,YACE,OAAA,EAAS,eAAe,QAAS,EAAA;AAAA,YACjC,SAAW,EAAA;AAAA,WAEb,GAAA;AAAA,SACL,CAAA;AAAA;AACH;AACF,IAGD,KAAM,EAAA;AACX;AApFe,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAsFf,IAAO,WAAQ,GAAA,MAAA;;;AC3Ff,KAAK,WAAO,EAAA","file":"cli.mjs","sourcesContent":["{\n \"name\": \"@zimic/interceptor\",\n \"description\": \"TypeScript-first HTTP intercepting and mocking\",\n \"keywords\": [\n \"zimic\",\n \"typescript\",\n \"types\",\n \"typegen\",\n \"validation\",\n \"inference\",\n \"http\",\n \"interceptor\",\n \"mock\",\n \"api\",\n \"static\"\n ],\n \"version\": \"0.16.0-canary.3\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/zimicjs/zimic.git\",\n \"directory\": \"packages/zimic-interceptor\"\n },\n \"author\": {\n \"name\": \"Diego Aquino\",\n \"url\": \"https://github.com/diego-aquino\"\n },\n \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.13.0\"\n },\n \"license\": \"MIT\",\n \"files\": [\n \"package.json\",\n \"README.md\",\n \"LICENSE.md\",\n \"src\",\n \"!src/**/tests\",\n \"!src/**/__tests__\",\n \"!src/**/*.test.ts\",\n \"dist\",\n \"index.d.ts\",\n \"http.d.ts\",\n \"server.d.ts\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"index.d.ts\",\n \"bin\": {\n \"zimic-interceptor\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.js\"\n },\n \"./http\": {\n \"types\": \"./http.d.ts\",\n \"import\": \"./dist/http.mjs\",\n \"require\": \"./dist/http.js\",\n \"default\": \"./dist/http.js\"\n },\n \"./server\": {\n \"types\": \"./server.d.ts\",\n \"import\": \"./dist/server.mjs\",\n \"require\": \"./dist/server.js\",\n \"default\": \"./dist/server.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"cli\": \"node ./dist/cli.js\",\n \"build\": \"tsup\",\n \"lint\": \"eslint --cache --no-error-on-unmatched-pattern --no-warn-ignored --fix\",\n \"lint:turbo\": \"pnpm lint . --max-warnings 0\",\n \"style\": \"prettier --log-level warn --ignore-unknown --no-error-on-unmatched-pattern --cache\",\n \"style:check\": \"pnpm style --check\",\n \"style:format\": \"pnpm style --write\",\n \"test\": \"dotenv -v NODE_ENV=test -v FORCE_COLOR=1 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"deps:install-playwright\": \"playwright install chromium\",\n \"deps:init-msw\": \"msw init ./public --no-save\",\n \"deps:init\": \"pnpm deps:install-playwright && pnpm deps:init-msw\",\n \"postinstall\": \"node -e \\\"try{require('./dist/scripts/postinstall')}catch(error){console.error(error)}\\\"\"\n },\n \"dependencies\": {\n \"@whatwg-node/server\": \"0.10.1\",\n \"chalk\": \"4.1.2\",\n \"execa\": \"9.5.2\",\n \"isomorphic-ws\": \"5.0.0\",\n \"msw\": \"2.7.3\",\n \"ws\": \"8.18.1\",\n \"yargs\": \"17.7.2\"\n },\n \"optionalDependencies\": {\n \"bufferutil\": \"4.0.9\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.13.10\",\n \"@types/ws\": \"^8.18.0\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.0.8\",\n \"@vitest/coverage-istanbul\": \"^3.0.8\",\n \"@zimic/eslint-config-node\": \"workspace:*\",\n \"@zimic/lint-staged-config\": \"workspace:*\",\n \"@zimic/tsconfig\": \"workspace:*\",\n \"@zimic/utils\": \"workspace:*\",\n \"dotenv-cli\": \"^8.0.0\",\n \"eslint\": \"^9.22.0\",\n \"playwright\": \"^1.51.0\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.8.2\",\n \"vitest\": \"^3.0.8\"\n },\n \"peerDependencies\": {\n \"@zimic/http\": \"^0.1.0 || ^0.1.0-canary.0\",\n \"typescript\": \">=4.8.0\"\n },\n \"peerDependenciesMeta\": {\n \"typescript\": {\n \"optional\": true\n }\n }\n}\n","export const SERVICE_WORKER_FILE_NAME = 'mockServiceWorker.js';\n","import chalk from 'chalk';\nimport filesystem from 'fs/promises';\nimport path from 'path';\n\nimport { logWithPrefix } from '@/utils/console';\n\nimport { SERVICE_WORKER_FILE_NAME } from './shared/constants';\n\nconst MSW_ROOT_PATH = path.join(require.resolve('msw'), '..', '..', '..');\nexport const MOCK_SERVICE_WORKER_PATH = path.join(MSW_ROOT_PATH, 'lib', SERVICE_WORKER_FILE_NAME);\n\ninterface BrowserServiceWorkerInitOptions {\n publicDirectory: string;\n}\n\nasync function initializeBrowserServiceWorker({ publicDirectory }: BrowserServiceWorkerInitOptions) {\n const absolutePublicDirectory = path.resolve(publicDirectory);\n await filesystem.mkdir(absolutePublicDirectory, { recursive: true });\n\n const destinationPath = path.join(absolutePublicDirectory, SERVICE_WORKER_FILE_NAME);\n await filesystem.copyFile(MOCK_SERVICE_WORKER_PATH, destinationPath);\n\n logWithPrefix(`Service worker script saved to ${chalk.green(destinationPath)}!`);\n logWithPrefix('You can now use browser interceptors!');\n}\n\nexport default initializeBrowserServiceWorker;\n","import createCachedDynamicImport from '@zimic/utils/import/createCachedDynamicImport';\n\nexport const PROCESS_EXIT_EVENTS = Object.freeze([\n 'beforeExit',\n 'uncaughtExceptionMonitor',\n 'SIGINT',\n 'SIGTERM',\n 'SIGHUP',\n 'SIGBREAK',\n] as const);\n\nexport type ProcessExitEvent = (typeof PROCESS_EXIT_EVENTS)[number];\n\n// Having an undefined exit code means that the process will already exit with the default exit code.\nexport const PROCESS_EXIT_CODE_BY_EXIT_EVENT: Record<string, number | undefined> = {\n beforeExit: undefined,\n uncaughtExceptionMonitor: undefined,\n SIGINT: 130,\n SIGTERM: 143,\n SIGHUP: 129,\n SIGBREAK: 131,\n} satisfies Record<ProcessExitEvent, number | undefined>;\n\nexport const importExeca = createCachedDynamicImport(() => import('execa'));\n\ninterface CommandErrorOptions {\n command?: string[];\n exitCode?: number;\n signal?: NodeJS.Signals;\n originalMessage?: string;\n}\n\nexport class CommandError extends Error {\n static readonly DEFAULT_EXIT_CODE = 1;\n\n readonly command: string[];\n readonly exitCode: number;\n readonly signal?: NodeJS.Signals;\n\n constructor(executable: string, options: CommandErrorOptions) {\n const message = CommandError.createMessage(executable, options);\n super(message);\n\n this.name = 'CommandError';\n this.command = options.command ?? [executable];\n this.exitCode = this.getExitCode(options);\n this.signal = options.signal;\n }\n\n private getExitCode(options: CommandErrorOptions): number {\n const existingExitCode = options.exitCode;\n const exitCodeInferredFromSignal =\n options.signal === undefined ? undefined : PROCESS_EXIT_CODE_BY_EXIT_EVENT[options.signal];\n\n return existingExitCode ?? exitCodeInferredFromSignal ?? CommandError.DEFAULT_EXIT_CODE;\n }\n\n private static createMessage(command: string, options: CommandErrorOptions) {\n const suffix = options.originalMessage ? `: ${options.originalMessage}` : '';\n\n if (options.exitCode === undefined && options.signal === undefined) {\n return `Command '${command}' failed${suffix}`;\n }\n\n const prefix = `Command '${command}' exited `;\n const infix = options.exitCode === undefined ? `after signal ${options.signal}` : `with code ${options.exitCode}`;\n\n return `${prefix}${infix}${suffix}`;\n }\n}\n\nexport async function runCommand(command: string, commandArguments: string[]) {\n const { execa: $, ExecaError } = await importExeca();\n\n try {\n await $(command, commandArguments, { stdio: 'inherit' });\n } catch (error) {\n /* istanbul ignore if -- @preserve\n * This is a safeguard if the error is not an ExecaError. It is not expected to run. */\n if (!(error instanceof ExecaError)) {\n throw error;\n }\n\n const commandError = new CommandError(command, {\n command: [command, ...commandArguments],\n exitCode: error.exitCode,\n signal: error.signal,\n originalMessage: error.originalMessage,\n });\n\n throw commandError;\n }\n}\n","import { InterceptorServer, interceptorServer } from '@/server';\nimport { InterceptorServerOptions } from '@/server/types/options';\nimport { logWithPrefix } from '@/utils/console';\nimport {\n CommandError,\n PROCESS_EXIT_CODE_BY_EXIT_EVENT,\n PROCESS_EXIT_EVENTS,\n ProcessExitEvent,\n runCommand,\n} from '@/utils/processes';\n\ninterface InterceptorServerStartOptions extends InterceptorServerOptions {\n ephemeral: boolean;\n onReady?: {\n command: string;\n arguments: string[];\n };\n}\n\nexport let serverSingleton: InterceptorServer | undefined;\n\nasync function startInterceptorServer({\n hostname,\n port,\n ephemeral,\n logUnhandledRequests,\n onReady,\n}: InterceptorServerStartOptions) {\n const server = interceptorServer.create({\n hostname,\n port,\n logUnhandledRequests,\n });\n\n async function handleExitEvent(exitEvent: ProcessExitEvent | undefined) {\n await server.stop();\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n for (const { exitEvent, exitHandler } of exitHandlerGroups) {\n process.off(exitEvent, exitHandler);\n }\n\n const exitCode = exitEvent ? PROCESS_EXIT_CODE_BY_EXIT_EVENT[exitEvent] : undefined;\n if (exitCode !== undefined) {\n process.exit(exitCode);\n }\n }\n\n const exitHandlerGroups = PROCESS_EXIT_EVENTS.map((exitEvent) => ({\n exitEvent,\n exitHandler: handleExitEvent.bind(null, exitEvent),\n }));\n\n for (const { exitEvent, exitHandler } of exitHandlerGroups) {\n process.on(exitEvent, exitHandler);\n }\n\n serverSingleton = server;\n\n await server.start();\n\n logWithPrefix(`${ephemeral ? 'Ephemeral s' : 'S'}erver is running on ${server.hostname}:${server.port}`);\n\n if (onReady) {\n try {\n await runCommand(onReady.command, onReady.arguments);\n } catch (error) {\n console.error(error);\n\n /* istanbul ignore if -- @preserve\n * A CommandError is always expected here. */\n if (!(error instanceof CommandError)) {\n throw error;\n }\n\n process.exit(error.exitCode);\n }\n }\n\n if (ephemeral) {\n await handleExitEvent(undefined);\n process.exit(0);\n }\n}\n\nexport default startInterceptorServer;\n","import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport { version } from '@@/package.json';\n\nimport initializeBrowserServiceWorker from './browser/init';\nimport startInterceptorServer from './server/start';\n\nasync function runCLI() {\n await yargs(hideBin(process.argv))\n .scriptName('zimic-interceptor')\n .version(version)\n .showHelpOnFail(false)\n .strict()\n\n .command('browser', 'Manage your browser mock configuration', (yargs) =>\n yargs.demandCommand().command(\n 'init <publicDirectory>',\n 'Initialize the browser service worker configuration.',\n (yargs) =>\n yargs.positional('publicDirectory', {\n type: 'string',\n description: 'The path to the public directory of your application.',\n demandOption: true,\n }),\n async (cliArguments) => {\n await initializeBrowserServiceWorker({\n publicDirectory: cliArguments.publicDirectory,\n });\n },\n ),\n )\n\n .command('server', 'Manage interceptor servers', (yargs) =>\n yargs.demandCommand().command(\n 'start [-- onReady]',\n 'Start an interceptor server.',\n (yargs) =>\n yargs\n .positional('onReady', {\n description: 'A command to run when the server is ready to accept connections.',\n type: 'string',\n })\n .option('hostname', {\n type: 'string',\n description: 'The hostname to start the server on.',\n alias: 'h',\n default: 'localhost',\n })\n .option('port', {\n type: 'number',\n description: 'The port to start the server on.',\n alias: 'p',\n })\n .option('ephemeral', {\n type: 'boolean',\n description:\n 'Whether the server should stop automatically after the on-ready command finishes. ' +\n 'If no on-ready command is provided and ephemeral is true, the server will stop immediately after ' +\n 'starting.',\n alias: 'e',\n default: false,\n })\n .option('log-unhandled-requests', {\n type: 'boolean',\n description:\n 'Whether to log a warning when no interceptors were found for the base URL of a request. ' +\n 'If an interceptor was matched, the logging behavior for that base URL is configured in the ' +\n 'interceptor itself.',\n alias: 'l',\n }),\n async (cliArguments) => {\n const onReadyCommand = cliArguments._.at(2)?.toString();\n const onReadyCommandArguments = cliArguments._.slice(3).map((argument) => argument.toString());\n\n await startInterceptorServer({\n hostname: cliArguments.hostname,\n port: cliArguments.port,\n ephemeral: cliArguments.ephemeral,\n logUnhandledRequests: cliArguments.logUnhandledRequests,\n onReady: onReadyCommand\n ? {\n command: onReadyCommand.toString(),\n arguments: onReadyCommandArguments,\n }\n : undefined,\n });\n },\n ),\n )\n\n .parse();\n}\n\nexport default runCLI;\n","#!/usr/bin/env node\nimport runCLI from './cli';\n\nvoid runCLI();\n"]}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import { HttpMethodSchema, HttpRequest, HttpHeaders, HttpRequestHeadersSchema, InferPathParams, HttpSearchParams, HttpRequestSearchParamsSchema, HttpRequestBodySchema, HttpStatusCode, HttpResponseSchema, HttpHeadersInit, HttpResponse, HttpResponseHeadersSchema, HttpResponseBodySchema, HttpSchema,
|
|
1
|
+
import { HttpMethodSchema, HttpRequest, HttpHeaders, HttpRequestHeadersSchema, InferPathParams, HttpSearchParams, HttpRequestSearchParamsSchema, HttpRequestBodySchema, HttpStatusCode, HttpResponseSchema, HttpHeadersInit, HttpResponse, HttpResponseHeadersSchema, HttpResponseBodySchema, HttpSchema, HttpSchemaMethod, HttpSchemaPath, HttpHeadersSchema, HttpSearchParamsSchema, HttpBody, HttpFormData, HttpResponseSchemaStatusCode, HttpMethod, LiteralHttpSchemaPathFromNonLiteral } from '@zimic/http';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when a value is not valid JSON. HTTP interceptors might throw this error when trying to parse the body
|
|
5
|
+
* of a request or response with the header `'content-type': 'application/json'`, if the content cannot be parsed to
|
|
6
|
+
* JSON.
|
|
7
|
+
*/
|
|
8
|
+
declare class InvalidJSONError extends SyntaxError {
|
|
9
|
+
constructor(value: string);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when a value is not valid {@link https://developer.mozilla.org/docs/Web/API/FormData FormData}. HTTP
|
|
14
|
+
* interceptors might throw this error when trying to parse the body of a request or response with the header
|
|
15
|
+
* `'content-type': 'multipart/form-data'`, if the content cannot be parsed to form data.
|
|
16
|
+
*/
|
|
17
|
+
declare class InvalidFormDataError extends SyntaxError {
|
|
18
|
+
constructor(value: string);
|
|
19
|
+
}
|
|
2
20
|
|
|
3
21
|
/**
|
|
4
22
|
* An error thrown when the interceptor is running and some operation requires it to be stopped first.
|
|
@@ -36,33 +54,6 @@ declare class UnknownHttpInterceptorTypeError extends TypeError {
|
|
|
36
54
|
constructor(unknownType: unknown);
|
|
37
55
|
}
|
|
38
56
|
|
|
39
|
-
/**
|
|
40
|
-
* Error thrown when the safe limit of saved intercepted requests is exceeded.
|
|
41
|
-
*
|
|
42
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
43
|
-
*/
|
|
44
|
-
declare class RequestSavingSafeLimitExceededError extends TypeError {
|
|
45
|
-
constructor(numberOfSavedRequests: number, safeLimit: number);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Error thrown when a value is not valid {@link https://developer.mozilla.org/docs/Web/API/FormData FormData}. HTTP
|
|
50
|
-
* interceptors might throw this error when trying to parse the body of a request or response with the header
|
|
51
|
-
* `'content-type': 'multipart/form-data'`, if the content cannot be parsed to form data.
|
|
52
|
-
*/
|
|
53
|
-
declare class InvalidFormDataError extends SyntaxError {
|
|
54
|
-
constructor(value: string);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Error thrown when a value is not valid JSON. HTTP interceptors might throw this error when trying to parse the body
|
|
59
|
-
* of a request or response with the header `'content-type': 'application/json'`, if the content cannot be parsed to
|
|
60
|
-
* JSON.
|
|
61
|
-
*/
|
|
62
|
-
declare class InvalidJSONError extends SyntaxError {
|
|
63
|
-
constructor(value: string);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
57
|
/**
|
|
67
58
|
* An error thrown when the browser mock service worker is not found.
|
|
68
59
|
*
|
|
@@ -160,6 +151,97 @@ interface InterceptedHttpInterceptorRequest<Path extends string, MethodSchema ex
|
|
|
160
151
|
response: StatusCode extends [never] ? never : HttpInterceptorResponse<MethodSchema, StatusCode>;
|
|
161
152
|
}
|
|
162
153
|
|
|
154
|
+
type PartialHttpHeadersOrSchema<Schema extends HttpHeadersSchema> = IfNever<Schema, never, Partial<Schema> | HttpHeaders<Partial<Schema>> | HttpHeaders<Schema>>;
|
|
155
|
+
/**
|
|
156
|
+
* A static headers restriction to match intercepted requests.
|
|
157
|
+
*
|
|
158
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
159
|
+
*/
|
|
160
|
+
type HttpRequestHandlerHeadersStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialHttpHeadersOrSchema<HttpRequestHeadersSchema<Default<Schema[Path][Method]>>>;
|
|
161
|
+
type PartialHttpSearchParamsOrSchema<Schema extends HttpSearchParamsSchema> = IfNever<Schema, never, Partial<Schema> | HttpSearchParams<Partial<Schema>> | HttpSearchParams<Schema>>;
|
|
162
|
+
/**
|
|
163
|
+
* A static search params restriction to match intercepted requests.
|
|
164
|
+
*
|
|
165
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
166
|
+
*/
|
|
167
|
+
type HttpRequestHandlerSearchParamsStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialHttpSearchParamsOrSchema<HttpRequestSearchParamsSchema<Default<Schema[Path][Method]>>>;
|
|
168
|
+
type PartialBodyOrSchema<Body extends HttpBody> = Body extends HttpFormData<infer Schema> ? HttpFormData<Partial<Schema>> | HttpFormData<Schema> : Body extends HttpSearchParams<infer Schema> ? HttpSearchParams<Partial<Schema>> | HttpSearchParams<Schema> : Body extends Blob ? Body : DeepPartial<Body>;
|
|
169
|
+
/**
|
|
170
|
+
* A static body restriction to match intercepted requests.
|
|
171
|
+
*
|
|
172
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
173
|
+
*/
|
|
174
|
+
type HttpRequestHandlerBodyStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialBodyOrSchema<HttpRequestBodySchema<Default<Schema[Path][Method]>>>;
|
|
175
|
+
/**
|
|
176
|
+
* A static restriction to match intercepted requests.
|
|
177
|
+
*
|
|
178
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
179
|
+
*/
|
|
180
|
+
interface HttpRequestHandlerStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> {
|
|
181
|
+
/**
|
|
182
|
+
* A set of headers that the intercepted request must contain to match the handler. If exact is `true`, the request
|
|
183
|
+
* must contain exactly these headers and no others.
|
|
184
|
+
*/
|
|
185
|
+
headers?: HttpRequestHandlerHeadersStaticRestriction<Schema, Method, Path>;
|
|
186
|
+
/**
|
|
187
|
+
* A set of search params that the intercepted request must contain to match the handler. If exact is `true`, the
|
|
188
|
+
* request must contain exactly these search params and no others.
|
|
189
|
+
*/
|
|
190
|
+
searchParams?: HttpRequestHandlerSearchParamsStaticRestriction<Schema, Method, Path>;
|
|
191
|
+
/**
|
|
192
|
+
* The body that the intercepted request must contain to match the handler. If exact is `true`, the request must
|
|
193
|
+
* contain exactly this body and no other.
|
|
194
|
+
*/
|
|
195
|
+
body?: HttpRequestHandlerBodyStaticRestriction<Schema, Method, Path>;
|
|
196
|
+
/**
|
|
197
|
+
* If `true`, the request must contain **exactly** the headers, search params, and body declared in this restriction.
|
|
198
|
+
* Otherwise, the request must contain **at least** them.
|
|
199
|
+
*/
|
|
200
|
+
exact?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* A computed restriction to match intercepted requests.
|
|
204
|
+
*
|
|
205
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
206
|
+
*/
|
|
207
|
+
type HttpRequestHandlerComputedRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = (request: HttpInterceptorRequest<Path, Default<Schema[Path][Method]>>) => PossiblePromise<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* A restriction to match intercepted requests.
|
|
210
|
+
*
|
|
211
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
212
|
+
*/
|
|
213
|
+
type HttpRequestHandlerRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = HttpRequestHandlerStaticRestriction<Schema, Method, Path> | HttpRequestHandlerComputedRestriction<Schema, Method, Path>;
|
|
214
|
+
interface RestrictionDiff<Value> {
|
|
215
|
+
expected: Value;
|
|
216
|
+
received: Value;
|
|
217
|
+
}
|
|
218
|
+
interface RestrictionDiffs {
|
|
219
|
+
computed?: RestrictionDiff<boolean>;
|
|
220
|
+
headers?: RestrictionDiff<HttpHeaders<never>>;
|
|
221
|
+
searchParams?: RestrictionDiff<HttpSearchParams<never>>;
|
|
222
|
+
body?: RestrictionDiff<unknown>;
|
|
223
|
+
}
|
|
224
|
+
interface UnmatchedHttpInterceptorRequestGroup {
|
|
225
|
+
request: HttpInterceptorRequest<string, never>;
|
|
226
|
+
diff: RestrictionDiffs;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare class TimesDeclarationPointer extends Error {
|
|
230
|
+
constructor(minNumberOfRequests: number, maxNumberOfRequests?: number);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface TimesCheckErrorOptions {
|
|
234
|
+
requestLimits: Range<number>;
|
|
235
|
+
numberOfMatchedRequests: number;
|
|
236
|
+
declarationPointer: TimesDeclarationPointer | undefined;
|
|
237
|
+
unmatchedRequestGroups: UnmatchedHttpInterceptorRequestGroup[];
|
|
238
|
+
hasRestrictions: boolean;
|
|
239
|
+
hasSavedRequests: boolean;
|
|
240
|
+
}
|
|
241
|
+
declare class TimesCheckError extends TypeError {
|
|
242
|
+
constructor(options: TimesCheckErrorOptions);
|
|
243
|
+
}
|
|
244
|
+
|
|
163
245
|
type UnhandledHttpInterceptorRequestMethodSchema = HttpSchema.Method<{
|
|
164
246
|
request: {
|
|
165
247
|
headers: Record<string, string>;
|
|
@@ -269,12 +351,20 @@ interface SharedHttpInterceptorOptions {
|
|
|
269
351
|
*/
|
|
270
352
|
baseURL: string;
|
|
271
353
|
/**
|
|
272
|
-
*
|
|
354
|
+
* Whether {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httprequesthandler request handlers}
|
|
355
|
+
* should save their intercepted requests in memory and make them accessible through
|
|
356
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests`}.
|
|
357
|
+
*
|
|
358
|
+
* **Important**: If `saveRequests` is true, make sure to regularly clear the interceptor to avoid that the requests
|
|
359
|
+
* accumulate in memory. A common practice is to call
|
|
360
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-interceptorclear `interceptor.clear()`}
|
|
361
|
+
* after each test.
|
|
273
362
|
*
|
|
363
|
+
* @default false
|
|
274
364
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
275
365
|
* @see {@link https://github.com/zimicjs/zimic/wiki/guides‐testing‐interceptor Testing}
|
|
276
366
|
*/
|
|
277
|
-
|
|
367
|
+
saveRequests?: boolean;
|
|
278
368
|
}
|
|
279
369
|
/**
|
|
280
370
|
* The options to create a
|
|
@@ -318,81 +408,6 @@ interface RemoteHttpInterceptorOptions extends SharedHttpInterceptorOptions {
|
|
|
318
408
|
*/
|
|
319
409
|
type HttpInterceptorOptions = LocalHttpInterceptorOptions | RemoteHttpInterceptorOptions;
|
|
320
410
|
|
|
321
|
-
type PartialHttpHeadersOrSchema<Schema extends HttpHeadersSchema> = IfNever<Schema, never, Partial<Schema> | HttpHeaders<Partial<Schema>> | HttpHeaders<Schema>>;
|
|
322
|
-
/**
|
|
323
|
-
* A static headers restriction to match intercepted requests.
|
|
324
|
-
*
|
|
325
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
326
|
-
*/
|
|
327
|
-
type HttpRequestHandlerHeadersStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialHttpHeadersOrSchema<HttpRequestHeadersSchema<Default<Schema[Path][Method]>>>;
|
|
328
|
-
type PartialHttpSearchParamsOrSchema<Schema extends HttpSearchParamsSchema> = IfNever<Schema, never, Partial<Schema> | HttpSearchParams<Partial<Schema>> | HttpSearchParams<Schema>>;
|
|
329
|
-
/**
|
|
330
|
-
* A static search params restriction to match intercepted requests.
|
|
331
|
-
*
|
|
332
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
333
|
-
*/
|
|
334
|
-
type HttpRequestHandlerSearchParamsStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialHttpSearchParamsOrSchema<HttpRequestSearchParamsSchema<Default<Schema[Path][Method]>>>;
|
|
335
|
-
type PartialBodyOrSchema<Body extends HttpBody> = Body extends HttpFormData<infer Schema> ? HttpFormData<Partial<Schema>> | HttpFormData<Schema> : Body extends HttpSearchParams<infer Schema> ? HttpSearchParams<Partial<Schema>> | HttpSearchParams<Schema> : Body extends Blob ? Body : DeepPartial<Body>;
|
|
336
|
-
/**
|
|
337
|
-
* A static body restriction to match intercepted requests.
|
|
338
|
-
*
|
|
339
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
340
|
-
*/
|
|
341
|
-
type HttpRequestHandlerBodyStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = PartialBodyOrSchema<HttpRequestBodySchema<Default<Schema[Path][Method]>>>;
|
|
342
|
-
/**
|
|
343
|
-
* A static restriction to match intercepted requests.
|
|
344
|
-
*
|
|
345
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
346
|
-
*/
|
|
347
|
-
interface HttpRequestHandlerStaticRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> {
|
|
348
|
-
/**
|
|
349
|
-
* A set of headers that the intercepted request must contain to match the handler. If exact is `true`, the request
|
|
350
|
-
* must contain exactly these headers and no others.
|
|
351
|
-
*/
|
|
352
|
-
headers?: HttpRequestHandlerHeadersStaticRestriction<Schema, Method, Path>;
|
|
353
|
-
/**
|
|
354
|
-
* A set of search params that the intercepted request must contain to match the handler. If exact is `true`, the
|
|
355
|
-
* request must contain exactly these search params and no others.
|
|
356
|
-
*/
|
|
357
|
-
searchParams?: HttpRequestHandlerSearchParamsStaticRestriction<Schema, Method, Path>;
|
|
358
|
-
/**
|
|
359
|
-
* The body that the intercepted request must contain to match the handler. If exact is `true`, the request must
|
|
360
|
-
* contain exactly this body and no other.
|
|
361
|
-
*/
|
|
362
|
-
body?: HttpRequestHandlerBodyStaticRestriction<Schema, Method, Path>;
|
|
363
|
-
/**
|
|
364
|
-
* If `true`, the request must contain **exactly** the headers, search params, and body declared in this restriction.
|
|
365
|
-
* Otherwise, the request must contain **at least** them.
|
|
366
|
-
*/
|
|
367
|
-
exact?: boolean;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* A computed restriction to match intercepted requests.
|
|
371
|
-
*
|
|
372
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
373
|
-
*/
|
|
374
|
-
type HttpRequestHandlerComputedRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = (request: HttpInterceptorRequest<Path, Default<Schema[Path][Method]>>) => PossiblePromise<boolean>;
|
|
375
|
-
/**
|
|
376
|
-
* A restriction to match intercepted requests.
|
|
377
|
-
*
|
|
378
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction `handler.with()` API reference}
|
|
379
|
-
*/
|
|
380
|
-
type HttpRequestHandlerRestriction<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema>, Path extends HttpSchemaPath<Schema, Method>> = HttpRequestHandlerStaticRestriction<Schema, Method, Path> | HttpRequestHandlerComputedRestriction<Schema, Method, Path>;
|
|
381
|
-
interface RestrictionDiff<Value> {
|
|
382
|
-
expected: Value;
|
|
383
|
-
received: Value;
|
|
384
|
-
}
|
|
385
|
-
interface RestrictionDiffs {
|
|
386
|
-
computed?: RestrictionDiff<boolean>;
|
|
387
|
-
headers?: RestrictionDiff<HttpHeaders<never>>;
|
|
388
|
-
searchParams?: RestrictionDiff<HttpSearchParams<never>>;
|
|
389
|
-
body?: RestrictionDiff<unknown>;
|
|
390
|
-
}
|
|
391
|
-
interface UnmatchedHttpInterceptorRequestGroup {
|
|
392
|
-
request: HttpInterceptorRequest<string, never>;
|
|
393
|
-
diff: RestrictionDiffs;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
411
|
/**
|
|
397
412
|
* An HTTP request handler to declare responses for intercepted requests.
|
|
398
413
|
*
|
|
@@ -497,9 +512,8 @@ interface LocalHttpRequestHandler<Schema extends HttpSchema, Method extends Http
|
|
|
497
512
|
* that was not satisfied.
|
|
498
513
|
*
|
|
499
514
|
* When
|
|
500
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#
|
|
501
|
-
*
|
|
502
|
-
* `true` in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
515
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
|
|
516
|
+
* is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
503
517
|
* expected and received data. This is useful for debugging requests that did not match a handler with
|
|
504
518
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
|
|
505
519
|
*
|
|
@@ -527,14 +541,11 @@ interface LocalHttpRequestHandler<Schema extends HttpSchema, Method extends Http
|
|
|
527
541
|
* The intercepted requests that matched this handler, along with the responses returned to each of them. This is
|
|
528
542
|
* useful for testing that the correct requests were made by your application.
|
|
529
543
|
*
|
|
530
|
-
* **Important**: This method can only be used if
|
|
531
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests
|
|
532
|
-
* `requestSaving.enabled`} is
|
|
533
|
-
* `true` in the interceptor. See
|
|
544
|
+
* **Important**: This method can only be used if `saveRequests` was set to `true` when creating the interceptor. See
|
|
534
545
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
535
546
|
* for more information.
|
|
536
547
|
*
|
|
537
|
-
* @throws {DisabledRequestSavingError} If the interceptor
|
|
548
|
+
* @throws {DisabledRequestSavingError} If the interceptor was not created with `saveRequests: true`.
|
|
538
549
|
* @readonly
|
|
539
550
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests` API reference}
|
|
540
551
|
*/
|
|
@@ -616,9 +627,8 @@ interface SyncedRemoteHttpRequestHandler<Schema extends HttpSchema, Method exten
|
|
|
616
627
|
* that was not satisfied.
|
|
617
628
|
*
|
|
618
629
|
* When
|
|
619
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#
|
|
620
|
-
*
|
|
621
|
-
* true in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
630
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
|
|
631
|
+
* is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
622
632
|
* expected and received data. This is useful for debugging requests that did not match a handler with
|
|
623
633
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
|
|
624
634
|
*
|
|
@@ -646,14 +656,11 @@ interface SyncedRemoteHttpRequestHandler<Schema extends HttpSchema, Method exten
|
|
|
646
656
|
* The intercepted requests that matched this handler, along with the responses returned to each of them. This is
|
|
647
657
|
* useful for testing that the correct requests were made by your application.
|
|
648
658
|
*
|
|
649
|
-
* **Important**: This method can only be used if
|
|
650
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests
|
|
651
|
-
* `requestSaving.enabled`} is
|
|
652
|
-
* `true` in the interceptor. See
|
|
659
|
+
* **Important**: This method can only be used if `saveRequests` was set to `true` when creating the interceptor. See
|
|
653
660
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
654
661
|
* for more information.
|
|
655
662
|
*
|
|
656
|
-
* @throws {DisabledRequestSavingError} If the interceptor
|
|
663
|
+
* @throws {DisabledRequestSavingError} If the interceptor was not created with `saveRequests: true`.
|
|
657
664
|
* @readonly
|
|
658
665
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests` API reference}
|
|
659
666
|
*/
|
|
@@ -702,43 +709,6 @@ type RemoteHttpRequestHandler<Schema extends HttpSchema, Method extends HttpSche
|
|
|
702
709
|
type SyncHttpInterceptorMethodHandler<Schema extends HttpSchema, Method extends HttpMethod> = Method extends HttpSchemaMethod<Schema> ? <Path extends HttpSchemaPath.NonLiteral<Schema, Method>>(path: Path) => LocalHttpRequestHandler<Schema, Method, LiteralHttpSchemaPathFromNonLiteral<Schema, Method, Path>> : (path: never) => LocalHttpRequestHandler<any, any, never>;
|
|
703
710
|
type AsyncHttpInterceptorMethodHandler<Schema extends HttpSchema, Method extends HttpMethod> = Method extends HttpSchemaMethod<Schema> ? <Path extends HttpSchemaPath.NonLiteral<Schema, Method>>(path: Path) => RemoteHttpRequestHandler<Schema, Method, LiteralHttpSchemaPathFromNonLiteral<Schema, Method, Path>> : (path: never) => RemoteHttpRequestHandler<any, any, never>;
|
|
704
711
|
|
|
705
|
-
/**
|
|
706
|
-
* Configures if the intercepted requests are saved and how they are handled.
|
|
707
|
-
*
|
|
708
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
709
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/guides‐testing‐interceptor Testing}
|
|
710
|
-
*/
|
|
711
|
-
interface HttpInterceptorRequestSaving {
|
|
712
|
-
/**
|
|
713
|
-
* Whether {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httprequesthandler request handlers}
|
|
714
|
-
* should save their intercepted requests in memory and make them accessible through
|
|
715
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests`}.
|
|
716
|
-
*
|
|
717
|
-
* If you are using
|
|
718
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-interceptorchecktimes `interceptor.checkTimes()`}
|
|
719
|
-
* or
|
|
720
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerchecktimes `handler.checkTimes()`}
|
|
721
|
-
* during tests, consider enabling this option to get more detailed information in `TimesCheckError` errors.
|
|
722
|
-
*
|
|
723
|
-
* **Important**: If `requestSaving.enabled` is `true`, make sure to regularly clear the interceptor to avoid requests
|
|
724
|
-
* accumulating in memory. A common practice is to call
|
|
725
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-interceptorclear `interceptor.clear()`}
|
|
726
|
-
* after each test.
|
|
727
|
-
*
|
|
728
|
-
* @default process.env.NODE_ENV === 'test'
|
|
729
|
-
*/
|
|
730
|
-
enabled: boolean;
|
|
731
|
-
/**
|
|
732
|
-
* The safe number of requests to save in memory before logging warnings in the console. If `requestSaving.enabled` is
|
|
733
|
-
* `true` and the interceptor is not regularly cleared with
|
|
734
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-interceptorclear `interceptor.clear()`},
|
|
735
|
-
* the requests may accumulate in memory and cause performance issues. This option does not limit the number of
|
|
736
|
-
* requests saved in memory, only when to log warnings.
|
|
737
|
-
*
|
|
738
|
-
* @default 1000
|
|
739
|
-
*/
|
|
740
|
-
safeLimit: number;
|
|
741
|
-
}
|
|
742
712
|
/**
|
|
743
713
|
* An interceptor to handle HTTP requests and return mock responses. The methods, paths, status codes, parameters, and
|
|
744
714
|
* responses are statically-typed based on the provided service schema.
|
|
@@ -753,12 +723,20 @@ interface HttpInterceptor<_Schema extends HttpSchema> {
|
|
|
753
723
|
*/
|
|
754
724
|
baseURL: string;
|
|
755
725
|
/**
|
|
756
|
-
*
|
|
726
|
+
* Whether {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httprequesthandler request handlers}
|
|
727
|
+
* should save their intercepted requests in memory and make them accessible through
|
|
728
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests`}.
|
|
729
|
+
*
|
|
730
|
+
* **Important**: If `saveRequests` is true, make sure to regularly clear the interceptor to avoid that the requests
|
|
731
|
+
* accumulate in memory. A common practice is to call
|
|
732
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-interceptorclear `interceptor.clear()`}
|
|
733
|
+
* after each test.
|
|
757
734
|
*
|
|
735
|
+
* @default process.env.NODE_ENV === 'test'
|
|
758
736
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#saving-requests Saving intercepted requests}
|
|
759
737
|
* @see {@link https://github.com/zimicjs/zimic/wiki/guides‐testing‐interceptor Testing}
|
|
760
738
|
*/
|
|
761
|
-
|
|
739
|
+
saveRequests: boolean;
|
|
762
740
|
/**
|
|
763
741
|
* The platform the interceptor is running on.
|
|
764
742
|
*
|
|
@@ -806,9 +784,8 @@ interface HttpInterceptor<_Schema extends HttpSchema> {
|
|
|
806
784
|
* of each test.
|
|
807
785
|
*
|
|
808
786
|
* When
|
|
809
|
-
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#
|
|
810
|
-
*
|
|
811
|
-
* `true` in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
787
|
+
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
|
|
788
|
+
* is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
|
|
812
789
|
* expected and received data. This is useful for debugging requests that did not match a handler with
|
|
813
790
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
|
|
814
791
|
*
|
|
@@ -1264,22 +1241,6 @@ interface RemoteHttpInterceptor<Schema extends HttpSchema> extends HttpIntercept
|
|
|
1264
1241
|
clear: () => Promise<void>;
|
|
1265
1242
|
}
|
|
1266
1243
|
|
|
1267
|
-
declare class TimesDeclarationPointer extends Error {
|
|
1268
|
-
constructor(minNumberOfRequests: number, maxNumberOfRequests?: number);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
interface TimesCheckErrorOptions {
|
|
1272
|
-
requestLimits: Range<number>;
|
|
1273
|
-
numberOfMatchedRequests: number;
|
|
1274
|
-
declarationPointer: TimesDeclarationPointer | undefined;
|
|
1275
|
-
unmatchedRequestGroups: UnmatchedHttpInterceptorRequestGroup[];
|
|
1276
|
-
hasRestrictions: boolean;
|
|
1277
|
-
requestSaving: HttpInterceptorRequestSaving;
|
|
1278
|
-
}
|
|
1279
|
-
declare class TimesCheckError extends TypeError {
|
|
1280
|
-
constructor(options: TimesCheckErrorOptions);
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
1244
|
/**
|
|
1284
1245
|
* Infers the schema of an
|
|
1285
1246
|
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptor `HttpInterceptor`}.
|
|
@@ -1324,4 +1285,4 @@ declare function createHttpInterceptor<Schema extends HttpSchema>(options: Local
|
|
|
1324
1285
|
declare function createHttpInterceptor<Schema extends HttpSchema>(options: RemoteHttpInterceptorOptions): RemoteHttpInterceptor<Schema>;
|
|
1325
1286
|
declare function createHttpInterceptor<Schema extends HttpSchema>(options: HttpInterceptorOptions): LocalHttpInterceptor<Schema> | RemoteHttpInterceptor<Schema>;
|
|
1326
1287
|
|
|
1327
|
-
export { DisabledRequestSavingError, type HttpInterceptor, type HttpInterceptorOptions, type HttpInterceptorPlatform, type HttpInterceptorRequest, type HttpInterceptorResponse, type HttpInterceptorType, type HttpRequestHandler, type HttpRequestHandlerBodyStaticRestriction, type HttpRequestHandlerComputedRestriction, type HttpRequestHandlerHeadersStaticRestriction, type HttpRequestHandlerResponseDeclaration, type HttpRequestHandlerResponseDeclarationFactory, type HttpRequestHandlerRestriction, type HttpRequestHandlerSearchParamsStaticRestriction, type HttpRequestHandlerStaticRestriction, type InferHttpInterceptorSchema, type InterceptedHttpInterceptorRequest, InvalidFormDataError, InvalidJSONError, type LocalHttpInterceptor, type LocalHttpInterceptorOptions, type LocalHttpRequestHandler, NotRunningHttpInterceptorError, type PendingRemoteHttpRequestHandler, type RemoteHttpInterceptor, type RemoteHttpInterceptorOptions, type RemoteHttpRequestHandler,
|
|
1288
|
+
export { DisabledRequestSavingError, type HttpInterceptor, type HttpInterceptorOptions, type HttpInterceptorPlatform, type HttpInterceptorRequest, type HttpInterceptorResponse, type HttpInterceptorType, type HttpRequestHandler, type HttpRequestHandlerBodyStaticRestriction, type HttpRequestHandlerComputedRestriction, type HttpRequestHandlerHeadersStaticRestriction, type HttpRequestHandlerResponseDeclaration, type HttpRequestHandlerResponseDeclarationFactory, type HttpRequestHandlerRestriction, type HttpRequestHandlerSearchParamsStaticRestriction, type HttpRequestHandlerStaticRestriction, type InferHttpInterceptorSchema, type InterceptedHttpInterceptorRequest, InvalidFormDataError, InvalidJSONError, type LocalHttpInterceptor, type LocalHttpInterceptorOptions, type LocalHttpRequestHandler, NotRunningHttpInterceptorError, type PendingRemoteHttpRequestHandler, type RemoteHttpInterceptor, type RemoteHttpInterceptorOptions, type RemoteHttpRequestHandler, RunningHttpInterceptorError, type SyncedRemoteHttpRequestHandler, TimesCheckError, type UnhandledHttpInterceptorRequest, UnhandledRequestStrategy, UnknownHttpInterceptorPlatformError, UnknownHttpInterceptorTypeError, UnregisteredBrowserServiceWorkerError, createHttpInterceptor };
|