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AA,YACpB,QAAQ,YAAA,CAAa,MAAA;AAAA,YACrB,aAAa,YAAA,CAAa,WAAA;AAAA,YAC1B,iBAAiB,YAAA,CAAa,QAAA;AAAA,YAC9B,OAAO,YAAA,CAAa,KAAA;AAAA,YACpB,SAAS,YAAA,CAAa,MAAA;AAAA,YACtB,YAAY,YAAA,CAAa;AAAA,WAC1B,CAAA;AAAA,QACH,CAAC,CAAA;AAED,QAAA,MAAM,iBAAiB,YAAA,CAAa,MAAA;AAEpC,QAAA,MAAM,cAAA,GACJ,GAAG,KAAA,CAAM,KAAA,CAAM,MAAM,IAAA,CAAK,QAAG,CAAC,CAAC,CAAA,WAAA,EAC5B,cAAA,GAAiB,MAAM,KAAA,CAAM,cAAc,IAAI,CAAA,GAAA,EAAM,KAAA,CAAM,OAAO,QAAQ,CAAC,CAAA,CAAE,CAAA,CAAA,EAAI,KAAA,CAAM,GAAA;AAAA,UACxF,CAAA,CAAA,EAAI,iBAAA,CAAkB,gBAAA,CAAiB,WAAW,CAAC,CAAA,CAAA;AAAA,SACpD,CAAA,CAAA;AAEH,QAAA,MAAM,qBAAqB,cAAA,KAAmB,MAAA;AAC9C,QAAA,MAAA,CAAO,kBAAA,GAAqB,MAAA,GAAS,MAAM,CAAA,CAAE,cAAc,CAAA;AAAA,MAC7D;AAAA;AACF,IAGD,KAAA,EAAM;AACX;AAEA,IAAO,WAAA,GAAQ,MAAA;;;AC9Gf,KAAK,WAAA,EAAO","file":"cli.mjs","sourcesContent":["{\n  \"name\": \"@zimic/http\",\n  \"description\": \"Next-gen TypeScript-first HTTP utilities\",\n  \"keywords\": [\n    \"zimic\",\n    \"typescript\",\n    \"types\",\n    \"typegen\",\n    \"validation\",\n    \"inference\",\n    \"http\",\n    \"api\",\n    \"static\"\n  ],\n  \"version\": \"1.4.1\",\n  \"homepage\": \"https://zimic.dev/docs/http\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/zimicjs/zimic.git\",\n    \"directory\": \"packages/zimic-http\"\n  },\n  \"author\": {\n    \"name\": \"Diego Aquino\",\n    \"url\": \"https://github.com/diego-aquino\"\n  },\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/zimicjs\"\n  },\n  \"private\": false,\n  \"publishConfig\": {\n    \"access\": \"public\",\n    \"provenance\": true\n  },\n  \"engines\": {\n    \"node\": \">=22.0.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    \"bin\",\n    \"dist\",\n    \"index.d.ts\",\n    \"typegen.d.ts\"\n  ],\n  \"sideEffects\": false,\n  \"main\": \"./dist/index.js\",\n  \"module\": \"./dist/index.mjs\",\n  \"types\": \"index.d.ts\",\n  \"bin\": {\n    \"zimic-http\": \"./bin/zimic-http.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    \"./typegen\": {\n      \"types\": \"./typegen.d.ts\",\n      \"import\": \"./dist/typegen.mjs\",\n      \"require\": \"./dist/typegen.js\",\n      \"default\": \"./dist/typegen.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"scripts\": {\n    \"setup\": \"playwright install chromium\",\n    \"dev\": \"tsup --watch\",\n    \"cli\": \"node --enable-source-maps ./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 --coverage --reporter verbose\",\n    \"types:check\": \"tsc --noEmit\",\n    \"typegen:fixtures\": \"tsx ./scripts/typegen/generateFixtureTypes.ts\"\n  },\n  \"dependencies\": {\n    \"openapi-typescript\": \"7.13.0\",\n    \"picocolors\": \"^1.1.1\",\n    \"yargs\": \"18.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/js-yaml\": \"^4.0.9\",\n    \"@types/node\": \"^26.1.2\",\n    \"@types/yargs\": \"^17.0.35\",\n    \"@typescript/native\": \"npm:typescript@^7.0.2\",\n    \"@vitest/browser\": \"^4.1.10\",\n    \"@vitest/browser-playwright\": \"^4.1.10\",\n    \"@vitest/coverage-istanbul\": \"^4.1.10\",\n    \"@zimic/eslint-config-node\": \"workspace:*\",\n    \"@zimic/interceptor\": \"workspace:*\",\n    \"@zimic/lint-staged-config\": \"workspace:*\",\n    \"@zimic/tsconfig\": \"workspace:*\",\n    \"@zimic/utils\": \"workspace:*\",\n    \"dotenv-cli\": \"^11.0.0\",\n    \"eslint\": \"^9.39.5\",\n    \"js-yaml\": \"^5.2.3\",\n    \"playwright\": \"^1.62.0\",\n    \"prettier\": \"^3.9.6\",\n    \"tsup\": \"^8.5.1\",\n    \"tsx\": \"^4.23.1\",\n    \"typescript\": \"npm:@typescript/typescript6@^6.0.2\",\n    \"vitest\": \"^4.1.10\"\n  },\n  \"peerDependencies\": {\n    \"typescript\": \"^5.0.0 || ^6.0.0 || ^7.0.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"typescript\": {\n      \"optional\": true\n    }\n  }\n}\n","import { PossiblePromise } from '@zimic/utils/types';\n\nexport async function usingElapsedTime<ReturnType>(callback: () => PossiblePromise<ReturnType>) {\n  const startTimeInMilliseconds = performance.now();\n\n  const result = await callback();\n\n  const endTimeInMilliseconds = performance.now();\n  const elapsedTimeInMilliseconds = endTimeInMilliseconds - startTimeInMilliseconds;\n\n  return {\n    startTime: startTimeInMilliseconds,\n    elapsedTime: elapsedTimeInMilliseconds,\n    endTime: endTimeInMilliseconds,\n    result,\n  };\n}\n\nexport function formatElapsedTime(elapsedTimeInMilliseconds: number) {\n  if (elapsedTimeInMilliseconds < 1000) {\n    return `${elapsedTimeInMilliseconds.toFixed(0)}ms`;\n  } else {\n    return `${(elapsedTimeInMilliseconds / 1000).toFixed(2)}s`;\n  }\n}\n","import color from 'picocolors';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport { version } from '@@/package.json';\n\nimport { generateTypesFromOpenAPI } from '@/typegen';\nimport { logger } from '@/utils/logging';\nimport { usingElapsedTime, formatElapsedTime } from '@/utils/time';\n\nasync function runCLI() {\n  await yargs(hideBin(process.argv))\n    .scriptName('zimic-http')\n    .version(version)\n    .showHelpOnFail(false)\n    .strict()\n\n    .command('typegen', 'Generate types from schema sources.', (yargs) =>\n      yargs.demandCommand().command(\n        'openapi <input>',\n        'Generate types from an OpenAPI schema.',\n        (yargs) =>\n          yargs\n            .positional('input', {\n              type: 'string',\n              description:\n                'The path to a local OpenAPI schema file or an URL to fetch it. ' +\n                'Version 3 is supported as YAML or JSON.',\n              demandOption: true,\n            })\n            .option('output', {\n              type: 'string',\n              description:\n                'The path to write the generated types to. If not provided, the types will be written to stdout.',\n              alias: 'o',\n            })\n            .option('service-name', {\n              type: 'string',\n              description: 'The name of the service to use in the generated types.',\n              alias: 's',\n              demandOption: true,\n            })\n            .option('comments', {\n              type: 'boolean',\n              description: 'Whether to include comments in the generated types.',\n              alias: 'c',\n              default: true,\n            })\n            .option('prune', {\n              type: 'boolean',\n              description:\n                'Whether to remove unused operations and components from the generated types. This is useful for ' +\n                'reducing the size of the output file.',\n              alias: 'p',\n              default: true,\n            })\n            .option('filter', {\n              type: 'string',\n              array: true,\n              description: [\n                'One or more expressions filtering which endpoints to include. Filters must follow the format `<method> ' +\n                  '<path>`, where:',\n                '- `<method>`: one HTTP method, a list of HTTP methods separated by commas, or `*` to match any HTTP ' +\n                  'method;',\n                '- `<path>`: a literal path or a glob. `*` matches zero or more characters in a segment (except `/`), ' +\n                  'while `**` matches zero or more characters across segments (may include `/`). For example, ' +\n                  '`GET /users` matches a single method and path, while `* /users` matches any method to the `/users` ' +\n                  'path; `GET /users*` matches any `GET` request whose path starts with `/users`, and `GET /users/**/*` ' +\n                  'matches any `GET` request to any sub-path of `/users`.',\n\n                'Negative filters can be created by prefixing the expression with `!`. For example, `!GET /users` will ' +\n                  'exclude paths matching `GET /users`.',\n              ].join('\\n'),\n              alias: 'f',\n            })\n            .option('filter-file', {\n              type: 'string',\n              description:\n                'A path to a file containing filter expressions. One expression is expected per line and the format ' +\n                'is the same as used in a `--filter` option. Comments are prefixed with `#`. A filter file can be ' +\n                'used alongside additional `--filter` expressions.',\n              alias: 'F',\n            }),\n        async (cliArguments) => {\n          const executionSummary = await usingElapsedTime(async () => {\n            await generateTypesFromOpenAPI({\n              input: cliArguments.input,\n              output: cliArguments.output,\n              serviceName: cliArguments.serviceName,\n              includeComments: cliArguments.comments,\n              prune: cliArguments.prune,\n              filters: cliArguments.filter,\n              filterFile: cliArguments.filterFile,\n            });\n          });\n\n          const outputFilePath = cliArguments.output;\n\n          const successMessage =\n            `${color.green(color.bold('✔'))} Generated ` +\n            `${outputFilePath ? color.green(outputFilePath) : `to ${color.yellow('stdout')}`} ${color.dim(\n              `(${formatElapsedTime(executionSummary.elapsedTime)})`,\n            )}`;\n\n          const hasWrittenToStdout = outputFilePath === undefined;\n          logger[hasWrittenToStdout ? 'warn' : 'info'](successMessage);\n        },\n      ),\n    )\n\n    .parse();\n}\n\nexport default runCLI;\n","#!/usr/bin/env node\nimport runCLI from './cli';\n\nvoid runCLI();\n"]}