@easydocs/cli 0.5.0 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 EasyDocs
3
+ Copyright (c) 2025 Ruben González Alonso
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { createDB, getAllEndpoints, getEndpointsByProject, findOrCreateProject, buildFullSpec } from "@easydocs/core";
5
- import { capture } from "@easydocs/core";
5
+ import { createCapturer, parseConfig } from "@easydocs/core";
6
6
  import { createServer } from "http";
7
7
  import { createRequire } from "module";
8
8
  import { existsSync } from "fs";
@@ -107,6 +107,7 @@ async function runExport(args2) {
107
107
  async function runProxy(args2) {
108
108
  const port = parseInt(getFlag(args2, "port") ?? "3999", 10);
109
109
  const projectSlug = getFlag(args2, "project") ?? "default";
110
+ const capturer = createCapturer(parseConfig({ project: projectSlug }));
110
111
  const server = createServer(async (req, res) => {
111
112
  const reqUrl = new URL(req.url ?? "/", `http://localhost:${port}`);
112
113
  const targetParam = reqUrl.searchParams.get("target");
@@ -156,21 +157,18 @@ async function runProxy(args2) {
156
157
  parsedRequestBody = requestBody.toString();
157
158
  }
158
159
  }
159
- capture(
160
- {
161
- method,
162
- path: targetUrl.pathname,
163
- query: Object.fromEntries(targetUrl.searchParams.entries()),
164
- params: {},
165
- body: parsedRequestBody,
166
- response: responseBody,
167
- status: upstream.status,
168
- requestHeaders: req.headers,
169
- responseHeaders: Object.fromEntries(upstream.headers.entries()),
170
- durationMs: Date.now() - startedAt
171
- },
172
- { project: projectSlug }
173
- );
160
+ capturer.capture({
161
+ method,
162
+ path: targetUrl.pathname,
163
+ query: Object.fromEntries(targetUrl.searchParams.entries()),
164
+ params: {},
165
+ body: parsedRequestBody,
166
+ response: responseBody,
167
+ status: upstream.status,
168
+ requestHeaders: req.headers,
169
+ responseHeaders: Object.fromEntries(upstream.headers.entries()),
170
+ durationMs: Date.now() - startedAt
171
+ });
174
172
  res.writeHead(upstream.status, Object.fromEntries(upstream.headers.entries()));
175
173
  res.end(responseText);
176
174
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easydocs/cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.4",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "js-yaml": "^4.1.0",
15
- "@easydocs/core": "0.5.0"
15
+ "@easydocs/core": "0.5.4"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/js-yaml": "^4.0.9",
@@ -20,6 +20,11 @@
20
20
  "tsup": "^8.3.0",
21
21
  "typescript": "^5"
22
22
  },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/RubenGlez/easydocs",
26
+ "directory": ""
27
+ },
23
28
  "scripts": {
24
29
  "build": "tsup",
25
30
  "dev": "tsup --watch",