@zimic/http 0.5.0-canary.1 → 0.5.1-canary.0
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 +18 -170
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://www.npmjs.com/package/@zimic/http">npm</a>
|
|
15
15
|
<span> • </span>
|
|
16
|
-
<a href="https://
|
|
16
|
+
<a href="https://zimic.dev">Docs</a>
|
|
17
17
|
<span> • </span>
|
|
18
|
-
<a href="
|
|
18
|
+
<a href="https://zimic.dev/docs/examples">Examples</a>
|
|
19
19
|
<span> • </span>
|
|
20
20
|
<a href="https://github.com/zimicjs/zimic/issues">Issues</a>
|
|
21
21
|
<span> • </span>
|
|
@@ -36,184 +36,32 @@
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
- [Features](#features)
|
|
40
|
-
- [Getting started](#getting-started)
|
|
41
|
-
- [Installation](#installation)
|
|
42
|
-
- [Basic usage](#basic-usage)
|
|
43
|
-
- [Documentation](#documentation)
|
|
44
|
-
- [Examples](#examples)
|
|
45
|
-
- [Changelog](#changelog)
|
|
46
|
-
- [Contributing](#contributing)
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
39
|
`@zimic/http` is a collection of type-safe utilities to handle HTTP requests and responses, including headers, search
|
|
51
40
|
params, and form data.
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
>
|
|
55
|
-
> Status: :seedling: **Beta**
|
|
42
|
+
Status: :seedling: **Beta**
|
|
56
43
|
|
|
57
44
|
## Features
|
|
58
45
|
|
|
59
|
-
- :star: **HTTP schemas
|
|
60
|
-
[schema](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas) and use it to type your HTTP requests and
|
|
61
|
-
responses. If you have an [OpenAPI v3](https://swagger.io/specification) declaration,
|
|
62
|
-
[`zimic-http typegen`](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐typegen) can automatically generate the types
|
|
63
|
-
of your schema.
|
|
64
|
-
- :pushpin: **Type-safe native APIs**: Declare type-safe
|
|
65
|
-
[`Headers`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheaders),
|
|
66
|
-
[`URLSearchParams`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparams), and
|
|
67
|
-
[`FormData`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdata) objects, fully compatible with their
|
|
68
|
-
native counterparts.
|
|
69
|
-
|
|
70
|
-
## Getting started
|
|
71
|
-
|
|
72
|
-
Check our [getting started guide](https://github.com/zimicjs/zimic/wiki/getting‐started‐http).
|
|
73
|
-
|
|
74
|
-
### Installation
|
|
75
|
-
|
|
76
|
-
| Manager | Command |
|
|
77
|
-
| :-----: | -------------------------------- |
|
|
78
|
-
| npm | `npm install @zimic/http --save` |
|
|
79
|
-
| yarn | `yarn add @zimic/http` |
|
|
80
|
-
| pnpm | `pnpm add @zimic/http` |
|
|
81
|
-
|
|
82
|
-
## Basic usage
|
|
83
|
-
|
|
84
|
-
1. Declare your [schema](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas):
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
import { type HttpSchema } from '@zimic/http';
|
|
88
|
-
|
|
89
|
-
interface User {
|
|
90
|
-
username: string;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
interface RequestError {
|
|
94
|
-
code: string;
|
|
95
|
-
message: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
type Schema = HttpSchema<{
|
|
99
|
-
'/users': {
|
|
100
|
-
POST: {
|
|
101
|
-
request: { body: User };
|
|
102
|
-
response: {
|
|
103
|
-
201: { body: User };
|
|
104
|
-
400: { body: RequestError };
|
|
105
|
-
409: { body: RequestError };
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
GET: {
|
|
110
|
-
request: {
|
|
111
|
-
headers: { authorization: string };
|
|
112
|
-
searchParams: { query?: string; limit?: `${number}` };
|
|
113
|
-
};
|
|
114
|
-
response: {
|
|
115
|
-
200: { body: User[] };
|
|
116
|
-
400: { body: RequestError };
|
|
117
|
-
401: { body: RequestError };
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
'/users/:userId': {
|
|
123
|
-
PATCH: {
|
|
124
|
-
request: {
|
|
125
|
-
headers: { authorization: string };
|
|
126
|
-
body: Partial<User>;
|
|
127
|
-
};
|
|
128
|
-
response: {
|
|
129
|
-
204: {};
|
|
130
|
-
400: { body: RequestError };
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
}>;
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
2. Use the types in your code!
|
|
138
|
-
|
|
139
|
-
- **Example 1**: Reference the types in your code:
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
import { HttpHeaders, HttpSearchParams, HttpFormData } from '@zimic/http';
|
|
143
|
-
|
|
144
|
-
type UserListHeaders = Schema['/users']['GET']['request']['headers'];
|
|
145
|
-
|
|
146
|
-
const headers = new HttpHeaders<UserListHeaders>({
|
|
147
|
-
authorization: 'Bearer my-token',
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
type UserListSearchParams = Schema['/users']['GET']['request']['searchParams'];
|
|
151
|
-
|
|
152
|
-
const searchParams = new HttpSearchParams<UserListSearchParams>({
|
|
153
|
-
query: 'u',
|
|
154
|
-
limit: '10',
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
type UserCreateBody = Schema['/users']['POST']['request']['body'];
|
|
158
|
-
|
|
159
|
-
const formData = new HttpFormData<UserCreateBody>();
|
|
160
|
-
formData.append('username', 'user');
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
- **Example 2**: Using [`@zimic/fetch`](../zimic-fetch):
|
|
164
|
-
|
|
165
|
-
```ts
|
|
166
|
-
import { createFetch } from '@zimic/fetch';
|
|
167
|
-
|
|
168
|
-
const fetch = createFetch<Schema>({
|
|
169
|
-
baseURL: 'http://localhost:3000',
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const response = await fetch('/users', {
|
|
173
|
-
method: 'POST',
|
|
174
|
-
body: { username: 'user' },
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
if (!response.ok) {
|
|
178
|
-
throw response.error;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
console.log(await response.json()); // { username: 'user' }
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
- **Example 3**: Using [`@zimic/interceptor`](../zimic-interceptor):
|
|
185
|
-
|
|
186
|
-
```ts
|
|
187
|
-
import { createHttpInterceptor } from '@zimic/interceptor/http';
|
|
188
|
-
|
|
189
|
-
const interceptor = createHttpInterceptor<Schema>({
|
|
190
|
-
baseURL: 'http://localhost:3000',
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
await interceptor.start();
|
|
194
|
-
|
|
195
|
-
interceptor.post('/users').respond({
|
|
196
|
-
status: 201,
|
|
197
|
-
body: { username: body.username },
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Documentation
|
|
46
|
+
- :star: **HTTP schemas**
|
|
202
47
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
- CLI reference
|
|
206
|
-
- [`zimic-http typegen`](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐typegen)
|
|
48
|
+
Declare the structure of your endpoints in an [HTTP schema](https://zimic.dev/docs/http/guides/schemas) and use it to
|
|
49
|
+
type your HTTP requests and responses.
|
|
207
50
|
|
|
208
|
-
|
|
51
|
+
- :bulb: **Type generation**
|
|
209
52
|
|
|
210
|
-
|
|
211
|
-
|
|
53
|
+
Infer the types from [OpenAPI](https://www.openapis.org/) documentation and generate ready-to-use HTTP schemas with
|
|
54
|
+
our [typegen CLI](https://zimic.dev/docs/http/guides/typegen).
|
|
212
55
|
|
|
213
|
-
|
|
56
|
+
- :pushpin: **Type-safe APIs**
|
|
214
57
|
|
|
215
|
-
|
|
58
|
+
Declare typed [`Headers`](https://zimic.dev/docs/http/api/http-headers),
|
|
59
|
+
[`URLSearchParams`](https://zimic.dev/docs/http/api/http-search-params), and
|
|
60
|
+
[`FormData`](https://zimic.dev/docs/http/api/http-form-data) objects, fully compatible with their native counterparts.
|
|
216
61
|
|
|
217
|
-
|
|
62
|
+
**Learn more**:
|
|
218
63
|
|
|
219
|
-
|
|
64
|
+
- [`@zimic/http` - Getting started](https://zimic.dev/docs/http/getting-started)
|
|
65
|
+
- [`@zimic/http` - Guides](https://zimic.dev/docs/http/guides)
|
|
66
|
+
- [`@zimic/http` - API](https://zimic.dev/docs/http/api)
|
|
67
|
+
- [`@zimic/http` - CLI](https://zimic.dev/docs/http/cli)
|
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ var color__default = /*#__PURE__*/_interopDefault(color);
|
|
|
12
12
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
|
-
var version = "0.5.
|
|
15
|
+
var version = "0.5.1-canary.0";
|
|
16
16
|
|
|
17
17
|
// src/utils/time.ts
|
|
18
18
|
async function usingElapsedTime(callback) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/utils/time.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["__name","yargs","hideBin","generate_default","color","logger"],"mappings":";;;;;;;;;;;;;;AAcE,IAAW,OAAA,GAAA,gBAAA;;;ACZb,eAAsB,iBAA6B,QAA6C,EAAA;AAC9F,EAAM,MAAA,uBAAA,GAA0B,YAAY,GAAI,EAAA;AAEhD,EAAM,MAAA,MAAA,GAAS,MAAM,QAAS,EAA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A,MAAM,iBAAiB,YAAa,CAAA,MAAA;AAEpC,QAAM,MAAA,cAAA,GACJ,GAAGC,sBAAM,CAAA,KAAA,CAAMA,uBAAM,IAAK,CAAA,QAAG,CAAC,CAAC,CAC5B,WAAA,EAAA,cAAA,GAAiBA,uBAAM,KAAM,CAAA,cAAc,IAAI,CAAM,GAAA,EAAAA,sBAAA,CAAM,OAAO,QAAQ,CAAC,CAAE,CAAA,CAAA,CAAA,EAAIA,sBAAM,CAAA,GAAA;AAAA,UACxF,CAAI,CAAA,EAAA,iBAAA,CAAkB,gBAAiB,CAAA,WAAW,CAAC,CAAA,CAAA;AAAA,SACpD,CAAA,CAAA;AAEH,QAAA,MAAM,qBAAqB,cAAmB,KAAA,MAAA;AAC9C,QAAAC,uBAAA,CAAO,kBAAqB,GAAA,MAAA,GAAS,MAAM,CAAA,CAAE,cAAc,CAAA;AAAA;AAC7D;AACF,IAGD,KAAM,EAAA;AACX;AA/FeL,uBAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAiGf,IAAO,WAAQ,GAAA,MAAA;;;ACxGf,KAAK,WAAO,EAAA","file":"cli.js","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\": \"0.5.0-canary.1\",\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 \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.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 \"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\": \"./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 \"./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 \"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 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"typegen:fixtures\": \"tsx ./scripts/typegen/generateFixtureTypes.ts\",\n \"deps:init\": \"playwright install chromium\"\n },\n \"dependencies\": {\n \"openapi-typescript\": \"7.8.0\",\n \"picocolors\": \"^1.1.1\",\n \"yargs\": \"17.7.2\"\n },\n \"devDependencies\": {\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.15.3\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.1.4\",\n \"@vitest/coverage-istanbul\": \"^3.1.2\",\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\": \"^8.0.0\",\n \"eslint\": \"^9.27.0\",\n \"execa\": \"9.5.3\",\n \"js-yaml\": \"^4.1.0\",\n \"playwright\": \"^1.52.0\",\n \"prettier\": \"^3.5.3\",\n \"tsup\": \"^8.4.0\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.1.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.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 to filter the types to generate. Filters must follow the format ' +\n '`<method> <path>`, where `<method>` is an HTTP method or `*`, and `<path>` is a literal path or a ' +\n 'glob. Filters are case-sensitive regarding paths. For example, `GET /users`, `* /users`, ' +\n '`GET /users/*`, and `GET /users/**/*` are valid filters. Negative filters can be created by ' +\n 'prefixing the expression with `!`. For example, `!GET /users` will exclude paths matching ' +\n '`GET /users`. If more than one positive filter is provided, they will be combined with OR, while ' +\n 'negative filters will be combined with AND.',\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"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/utils/time.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["__name","yargs","hideBin","generate_default","color","logger"],"mappings":";;;;;;;;;;;;;;AAcE,IAAW,OAAA,GAAA,gBAAA;;;ACZb,eAAsB,iBAA6B,QAA6C,EAAA;AAC9F,EAAM,MAAA,uBAAA,GAA0B,YAAY,GAAI,EAAA;AAEhD,EAAM,MAAA,MAAA,GAAS,MAAM,QAAS,EAAA;AAE9B,EAAM,MAAA,qBAAA,GAAwB,YAAY,GAAI,EAAA;AAC9C,EAAA,MAAM,4BAA4B,qBAAwB,GAAA,uBAAA;AAE1D,EAAO,OAAA;AAAA,IACL,SAAW,EAAA,uBAAA;AAAA,IACX,WAAa,EAAA,yBAAA;AAAA,IACb,OAAS,EAAA,qBAAA;AAAA,IACT;AAAA,GACF;AACF;AAdsBA,uBAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;AAgBf,SAAS,kBAAkB,yBAAmC,EAAA;AACnE,EAAA,IAAI,4BAA4B,GAAM,EAAA;AACpC,IAAA,OAAO,CAAG,EAAA,yBAAA,CAA0B,OAAQ,CAAA,CAAC,CAAC,CAAA,EAAA,CAAA;AAAA,GACzC,MAAA;AACL,IAAA,OAAO,CAAI,EAAA,CAAA,yBAAA,GAA4B,GAAM,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAAA;AAE3D;AANgBA,uBAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;;;ACRhB,eAAe,MAAS,GAAA;AACtB,EAAA,MAAMC,uBAAMC,eAAQ,CAAA,OAAA,CAAQ,I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": \"@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\": \"0.5.1-canary.0\",\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 \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.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 \"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\": \"./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 \"./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 \"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 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"typegen:fixtures\": \"tsx ./scripts/typegen/generateFixtureTypes.ts\",\n \"deps:prepare\": \"playwright install chromium\"\n },\n \"dependencies\": {\n \"openapi-typescript\": \"7.8.0\",\n \"picocolors\": \"^1.1.1\",\n \"yargs\": \"17.7.2\"\n },\n \"devDependencies\": {\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.15.3\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.1.4\",\n \"@vitest/coverage-istanbul\": \"^3.1.2\",\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\": \"^8.0.0\",\n \"eslint\": \"^9.27.0\",\n \"execa\": \"9.6.0\",\n \"js-yaml\": \"^4.1.0\",\n \"playwright\": \"^1.52.0\",\n \"prettier\": \"^3.5.3\",\n \"tsup\": \"^8.4.0\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.1.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.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 to filter the types to generate. Filters must follow the format ' +\n '`<method> <path>`, where `<method>` is an HTTP method or `*`, and `<path>` is a literal path or a ' +\n 'glob. Filters are case-sensitive regarding paths. For example, `GET /users`, `* /users`, ' +\n '`GET /users/*`, and `GET /users/**/*` are valid filters. Negative filters can be created by ' +\n 'prefixing the expression with `!`. For example, `!GET /users` will exclude paths matching ' +\n '`GET /users`. If more than one positive filter is provided, they will be combined with OR, while ' +\n 'negative filters will be combined with AND.',\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"]}
|
package/dist/cli.mjs
CHANGED
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/utils/time.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["yargs"],"mappings":";;;;;;;AAcE,IAAW,OAAA,GAAA,gBAAA;;;ACZb,eAAsB,iBAA6B,QAA6C,EAAA;AAC9F,EAAM,MAAA,uBAAA,GAA0B,YAAY,GAAI,EAAA;AAEhD,EAAM,MAAA,MAAA,GAAS,MAAM,QAAS,EAAA;AAE9B,EAAM,MAAA,qBAAA,GAAwB,YAAY,GAAI,EAAA;AAC9C,EAAA,MAAM,4BAA4B,qBAAwB,GAAA,uBAAA;AAE1D,EAAO,OAAA;AAAA,IACL,SAAW,EAAA,uBAAA;AAAA,I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M,KAAM,CAAA,cAAc,IAAI,CAAM,GAAA,EAAA,KAAA,CAAM,OAAO,QAAQ,CAAC,CAAE,CAAA,CAAA,CAAA,EAAI,KAAM,CAAA,GAAA;AAAA,UACxF,CAAI,CAAA,EAAA,iBAAA,CAAkB,gBAAiB,CAAA,WAAW,CAAC,CAAA,CAAA;AAAA,SACpD,CAAA,CAAA;AAEH,QAAA,MAAM,qBAAqB,cAAmB,KAAA,MAAA;AAC9C,QAAA,MAAA,CAAO,kBAAqB,GAAA,MAAA,GAAS,MAAM,CAAA,CAAE,cAAc,CAAA;AAAA;AAC7D;AACF,IAGD,KAAM,EAAA;AACX;AA/Fe,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAiGf,IAAO,WAAQ,GAAA,MAAA;;;ACxGf,KAAK,WAAO,EAAA","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\": \"0.5.0-canary.1\",\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 \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.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 \"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\": \"./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 \"./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 \"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 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"typegen:fixtures\": \"tsx ./scripts/typegen/generateFixtureTypes.ts\",\n \"deps:init\": \"playwright install chromium\"\n },\n \"dependencies\": {\n \"openapi-typescript\": \"7.8.0\",\n \"picocolors\": \"^1.1.1\",\n \"yargs\": \"17.7.2\"\n },\n \"devDependencies\": {\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.15.3\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.1.4\",\n \"@vitest/coverage-istanbul\": \"^3.1.2\",\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\": \"^8.0.0\",\n \"eslint\": \"^9.27.0\",\n \"execa\": \"9.5.3\",\n \"js-yaml\": \"^4.1.0\",\n \"playwright\": \"^1.52.0\",\n \"prettier\": \"^3.5.3\",\n \"tsup\": \"^8.4.0\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.1.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.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 to filter the types to generate. Filters must follow the format ' +\n '`<method> <path>`, where `<method>` is an HTTP method or `*`, and `<path>` is a literal path or a ' +\n 'glob. Filters are case-sensitive regarding paths. For example, `GET /users`, `* /users`, ' +\n '`GET /users/*`, and `GET /users/**/*` are valid filters. Negative filters can be created by ' +\n 'prefixing the expression with `!`. For example, `!GET /users` will exclude paths matching ' +\n '`GET /users`. If more than one positive filter is provided, they will be combined with OR, while ' +\n 'negative filters will be combined with AND.',\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"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/utils/time.ts","../src/cli/cli.ts","../src/cli/index.ts"],"names":["yargs"],"mappings":";;;;;;;AAcE,IAAW,OAAA,GAAA,gBAAA;;;ACZb,eAAsB,iBAA6B,QAA6C,EAAA;AAC9F,EAAM,MAAA,uBAAA,GAA0B,YAAY,GAAI,EAAA;AAEhD,EAAM,MAAA,MAAA,GAAS,MAAM,QAAS,EAAA;AAE9B,EAAM,MAAA,qBAAA,GAAwB,YAAY,GAAI,EAAA;AAC9C,EAAA,MAAM,4BAA4B,qBAAwB,GAAA,uBAAA;AAE1D,EAAO,OAAA;AAAA,IACL,SAAW,EAAA,uBAAA;AAAA,IACX,WAAa,EAAA,yBAAA;AAAA,IACb,OAAS,EAAA,qBAAA;AAAA,IACT;AAAA,GACF;AACF;AAdsB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;AAgBf,SAAS,kBAAkB,yBAAmC,EAAA;AACnE,EAAA,IAAI,4BAA4B,GAAM,EAAA;AACpC,IAAA,OAAO,CAAG,EAAA,yBAAA,CAA0B,OAAQ,CAAA,CAAC,CAAC,CAAA,EAAA,CAAA;AAAA,GACzC,MAAA;AACL,IAAA,OAAO,CAAI,EAAA,CAAA,yBAAA,GAA4B,GAAM,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAAA;AAE3D;AANgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;;;ACRhB,eAAe,MAAS,GAAA;AACtB,EAAA,MAAM,MAAM,OAAQ,CAAA,OAAA,CAAQ,IAAI,CAAC,EAC9B,UAAW,CAAA,YAAY,CACvB,CAAA,OAAA,CAAQ,OAAO,CACf,CAAA,cAAA,CAAe,KAAK,CAAA,CACpB,QAEA,CAAA,OAAA;AAAA,IAAQ,SAAA;AAAA,IAAW,qCAAA;AAAA,IAAuC,CAACA,MAAAA,KAC1DA,MAAM,CAAA,aAAA,EA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AA,YAC7B,OAAO,YAAa,CAAA,KAAA;AAAA,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,SACF,CAAA;AAED,QAAA,MAAM,iBAAiB,YAAa,CAAA,MAAA;AAEpC,QAAM,MAAA,cAAA,GACJ,GAAG,KAAM,CAAA,KAAA,CAAM,MAAM,IAAK,CAAA,QAAG,CAAC,CAAC,CAC5B,WAAA,EAAA,cAAA,GAAiB,MAAM,KAAM,CAAA,cAAc,IAAI,CAAM,GAAA,EAAA,KAAA,CAAM,OAAO,QAAQ,CAAC,CAAE,CAAA,CAAA,CAAA,EAAI,KAAM,CAAA,GAAA;AAAA,UACxF,CAAI,CAAA,EAAA,iBAAA,CAAkB,gBAAiB,CAAA,WAAW,CAAC,CAAA,CAAA;AAAA,SACpD,CAAA,CAAA;AAEH,QAAA,MAAM,qBAAqB,cAAmB,KAAA,MAAA;AAC9C,QAAA,MAAA,CAAO,kBAAqB,GAAA,MAAA,GAAS,MAAM,CAAA,CAAE,cAAc,CAAA;AAAA;AAC7D;AACF,IAGD,KAAM,EAAA;AACX;AA/Fe,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAiGf,IAAO,WAAQ,GAAA,MAAA;;;ACxGf,KAAK,WAAO,EAAA","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\": \"0.5.1-canary.0\",\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 \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"engines\": {\n \"node\": \">=18.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 \"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\": \"./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 \"./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 \"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 -- vitest\",\n \"test:turbo\": \"dotenv -v CI=true -- pnpm run test run --coverage\",\n \"types:check\": \"tsc --noEmit\",\n \"typegen:fixtures\": \"tsx ./scripts/typegen/generateFixtureTypes.ts\",\n \"deps:prepare\": \"playwright install chromium\"\n },\n \"dependencies\": {\n \"openapi-typescript\": \"7.8.0\",\n \"picocolors\": \"^1.1.1\",\n \"yargs\": \"17.7.2\"\n },\n \"devDependencies\": {\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.15.3\",\n \"@types/yargs\": \"^17.0.33\",\n \"@vitest/browser\": \"^3.1.4\",\n \"@vitest/coverage-istanbul\": \"^3.1.2\",\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\": \"^8.0.0\",\n \"eslint\": \"^9.27.0\",\n \"execa\": \"9.6.0\",\n \"js-yaml\": \"^4.1.0\",\n \"playwright\": \"^1.52.0\",\n \"prettier\": \"^3.5.3\",\n \"tsup\": \"^8.4.0\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.1.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.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 to filter the types to generate. Filters must follow the format ' +\n '`<method> <path>`, where `<method>` is an HTTP method or `*`, and `<path>` is a literal path or a ' +\n 'glob. Filters are case-sensitive regarding paths. For example, `GET /users`, `* /users`, ' +\n '`GET /users/*`, and `GET /users/**/*` are valid filters. Negative filters can be created by ' +\n 'prefixing the expression with `!`. For example, `!GET /users` will exclude paths matching ' +\n '`GET /users`. If more than one positive filter is provided, they will be combined with OR, while ' +\n 'negative filters will be combined with AND.',\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"]}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"api",
|
|
13
13
|
"static"
|
|
14
14
|
],
|
|
15
|
-
"version": "0.5.
|
|
15
|
+
"version": "0.5.1-canary.0",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/zimicjs/zimic.git",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@vitest/coverage-istanbul": "^3.1.2",
|
|
79
79
|
"dotenv-cli": "^8.0.0",
|
|
80
80
|
"eslint": "^9.27.0",
|
|
81
|
-
"execa": "9.
|
|
81
|
+
"execa": "9.6.0",
|
|
82
82
|
"js-yaml": "^4.1.0",
|
|
83
83
|
"playwright": "^1.52.0",
|
|
84
84
|
"prettier": "^3.5.3",
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
"tsx": "^4.19.4",
|
|
87
87
|
"typescript": "^5.8.3",
|
|
88
88
|
"vitest": "^3.1.2",
|
|
89
|
-
"@zimic/
|
|
90
|
-
"@zimic/
|
|
89
|
+
"@zimic/eslint-config-node": "0.0.0",
|
|
90
|
+
"@zimic/interceptor": "0.19.1-canary.0",
|
|
91
91
|
"@zimic/tsconfig": "0.0.0",
|
|
92
92
|
"@zimic/utils": "0.0.0",
|
|
93
|
-
"@zimic/
|
|
93
|
+
"@zimic/lint-staged-config": "0.0.0"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"typescript": ">=5.0.0"
|
|
@@ -113,6 +113,6 @@
|
|
|
113
113
|
"test:turbo": "dotenv -v CI=true -- pnpm run test run --coverage",
|
|
114
114
|
"types:check": "tsc --noEmit",
|
|
115
115
|
"typegen:fixtures": "tsx ./scripts/typegen/generateFixtureTypes.ts",
|
|
116
|
-
"deps:
|
|
116
|
+
"deps:prepare": "playwright install chromium"
|
|
117
117
|
}
|
|
118
118
|
}
|