azurajs-scalar 2.1.3-1 → 2.1.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.
- package/dist/index.js +48 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ function proxyMiddleware({
|
|
|
30
30
|
apiSpecUrl,
|
|
31
31
|
proxyUrlPath
|
|
32
32
|
});
|
|
33
|
-
return app.
|
|
33
|
+
return app.all(
|
|
34
34
|
proxyUrlPath,
|
|
35
35
|
async (req, res) => {
|
|
36
36
|
debug("=== PROXY HIT ===");
|
|
@@ -67,12 +67,38 @@ function proxyMiddleware({
|
|
|
67
67
|
}
|
|
68
68
|
headers.host = apiBase.host;
|
|
69
69
|
debug("Forward headers:", headers);
|
|
70
|
-
|
|
70
|
+
let body;
|
|
71
|
+
if (["GET", "HEAD"].includes(req.method)) {
|
|
72
|
+
body = void 0;
|
|
73
|
+
} else {
|
|
74
|
+
if (req.body !== void 0 && req.body !== null) {
|
|
75
|
+
if (typeof req.body === "string") {
|
|
76
|
+
body = req.body;
|
|
77
|
+
} else if (Buffer.isBuffer(req.body)) {
|
|
78
|
+
body = req.body.toString();
|
|
79
|
+
} else {
|
|
80
|
+
try {
|
|
81
|
+
body = JSON.stringify(req.body);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
debug("Error stringifying body:", e);
|
|
84
|
+
body = JSON.stringify(req.body);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
body = void 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
71
91
|
debug("Forward body type:", typeof body);
|
|
72
92
|
debug("Forward body length:", body?.length ?? 0);
|
|
93
|
+
const modifiedHeaders = { ...headers };
|
|
94
|
+
delete modifiedHeaders["content-length"];
|
|
95
|
+
if (body !== void 0 && body !== null) {
|
|
96
|
+
const bodyLength = Buffer.byteLength(body);
|
|
97
|
+
modifiedHeaders["content-length"] = String(bodyLength);
|
|
98
|
+
}
|
|
73
99
|
const proxyRes = await fetch(targetUrl, {
|
|
74
100
|
method: req.method,
|
|
75
|
-
headers,
|
|
101
|
+
headers: modifiedHeaders,
|
|
76
102
|
body
|
|
77
103
|
});
|
|
78
104
|
debug("=== FETCH RESPONSE ===");
|
|
@@ -115,18 +141,25 @@ function proxyMiddleware({
|
|
|
115
141
|
debug("OPTIONS request -> end");
|
|
116
142
|
return res.end();
|
|
117
143
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"First
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
144
|
+
let buffer;
|
|
145
|
+
try {
|
|
146
|
+
const arrayBuf = await proxyRes.arrayBuffer();
|
|
147
|
+
buffer = Buffer.from(arrayBuf);
|
|
148
|
+
debug("=== BODY DEBUG ===");
|
|
149
|
+
debug("ArrayBuffer byteLength:", arrayBuf.byteLength);
|
|
150
|
+
debug("Buffer length:", buffer.length);
|
|
151
|
+
debug("Buffer empty:", buffer.length === 0);
|
|
152
|
+
debug("First 50 bytes (hex):", buffer.subarray(0, 50).toString("hex"));
|
|
153
|
+
debug(
|
|
154
|
+
"First 200 chars (utf8):",
|
|
155
|
+
buffer.subarray(0, 200).toString("utf8")
|
|
156
|
+
);
|
|
157
|
+
debug("=== END BODY DEBUG ===");
|
|
158
|
+
} catch (err) {
|
|
159
|
+
debug("Error reading response body:", err);
|
|
160
|
+
logger("error", `[PROXY] Body read error: ${err}`);
|
|
161
|
+
return res.status(500).json({ error: "Failed to read response from target server" });
|
|
162
|
+
}
|
|
130
163
|
res.status(proxyRes.status).send(buffer);
|
|
131
164
|
} catch (err) {
|
|
132
165
|
debug("=== PROXY ERROR ===");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/types.ts","../src/middleware/proxy.ts","../src/utils/debug.ts","../src/setupDocsRoute.ts","../src/utils/store.ts","../src/client.ts"],"sourcesContent":["import { AzuraClient } from \"azurajs\";\nimport { NextFunction, RequestServer, ResponseServer } from \"azurajs/types\";\n\nexport interface ScalarConfigType {\n baseUrl: string;\n proxyPath?: string;\n docPath?: string;\n apiSpecPath?: string;\n customHtmlPath?: string;\n app: AzuraClient;\n}\n\nexport interface ScalarStoreType {\n proxy_url?: string;\n api_spec_url?: string;\n doc_url?: string;\n custom_html_path?: string;\n}\n\nexport type ProxyMiddlewareType = (\n req: RequestServer,\n res: ResponseServer,\n next?: NextFunction,\n) => Promise<void>;\n\nexport class ScalarError extends Error {\n constructor(\n public readonly message: string,\n public readonly code: string,\n public readonly statusCode: number,\n ) {\n super(message);\n Object.setPrototypeOf(this, ScalarError.prototype);\n }\n}\n\nexport interface ProxyOptions {\n apiSpecUrl: string;\n proxyUrlPath: string;\n app: AzuraClient;\n baseUrl: string;\n}\n\nexport interface SetupDocsRouteOptions extends ScalarConfigType {\n docPath: string;\n proxyUrl: string;\n apiSpecUrl: string;\n}\n","import { ProxyOptions } from \"../config/types\";\nimport { logger } from \"azurajs/logger\";\nimport { debug } from \"../utils/debug\";\nimport { RequestServer, ResponseServer } from \"azurajs/types\";\n\nexport function proxyMiddleware({\n apiSpecUrl,\n app,\n baseUrl,\n proxyUrlPath,\n}: ProxyOptions) {\n debug(\"Setting up proxy middleware:\", {\n apiSpecUrl,\n proxyUrlPath,\n });\n return app.use(\n proxyUrlPath,\n async (req: RequestServer, res: ResponseServer) => {\n debug(\"=== PROXY HIT ===\");\n debug(\"Method:\", req.method);\n debug(\"URL:\", req.url);\n debug(\"Headers:\", req.headers);\n\n try {\n if (!req.url || !req.method) {\n return res.status(400).json({ error: \"Invalid request\" });\n }\n\n logger(\"info\", `[PROXY] ${req.method} ${req.url}`);\n\n /* =========================\n TARGET URL\n ========================= */\n const query = new URLSearchParams(req.url.split(\"?\")[1] || \"\");\n const scalarUrl = query.get(\"scalar_url\");\n const targetUrl = scalarUrl || apiSpecUrl;\n\n debug(\"Target URL:\", targetUrl);\n\n /* =========================\n SAME-ORIGIN\n ========================= */\n const target = new URL(targetUrl);\n const apiBase = new URL(apiSpecUrl);\n const baseOrigin = new URL(baseUrl).origin;\n\n const allowed =\n target.origin === apiBase.origin || target.origin === baseOrigin;\n\n debug(\"Origin check:\", {\n target: target.origin,\n apiSpec: apiBase.origin,\n base: baseOrigin,\n allowed,\n });\n\n if (!allowed) {\n logger(\"warn\", `[PROXY] Blocked cross-origin: ${targetUrl}`);\n return res.status(403).json({ error: \"Cross-origin blocked\" });\n }\n\n /* =========================\n HEADERS\n ========================= */\n const headers: Record<string, string> = {};\n\n for (const [k, v] of Object.entries(req.headers)) {\n if (!v) continue;\n headers[k] = Array.isArray(v) ? v.join(\", \") : v;\n }\n\n headers.host = apiBase.host;\n\n debug(\"Forward headers:\", headers);\n\n /* =========================\n BODY\n ========================= */\n const body = [\"GET\", \"HEAD\"].includes(req.method)\n ? undefined\n : typeof req.body === \"string\"\n ? req.body\n : JSON.stringify(req.body);\n\n debug(\"Forward body type:\", typeof body);\n debug(\"Forward body length:\", body?.length ?? 0);\n\n /* =========================\n FETCH\n ========================= */\n const proxyRes = await fetch(targetUrl, {\n method: req.method,\n headers,\n body,\n });\n\n debug(\"=== FETCH RESPONSE ===\");\n debug(\"Status:\", proxyRes.status);\n debug(\"StatusText:\", proxyRes.statusText);\n debug(\"URL:\", proxyRes.url);\n\n const headersObj: Record<string, string> = {};\n for (const [k, v] of proxyRes.headers.entries()) {\n headersObj[k] = v;\n }\n debug(\"Response headers:\", headersObj);\n\n debug(\"content-type:\", proxyRes.headers.get(\"content-type\"));\n debug(\"content-encoding:\", proxyRes.headers.get(\"content-encoding\"));\n debug(\"transfer-encoding:\", proxyRes.headers.get(\"transfer-encoding\"));\n debug(\"content-length:\", proxyRes.headers.get(\"content-length\"));\n\n /* =========================\n CORS\n ========================= */\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n res.setHeader(\n \"Access-Control-Allow-Methods\",\n \"GET,POST,PUT,PATCH,DELETE,OPTIONS,HEAD\",\n );\n res.setHeader(\"Access-Control-Allow-Headers\", \"*\");\n res.setHeader(\"Access-Control-Expose-Headers\", \"*\");\n\n /* =========================\n SAFE HEADERS PASS\n ========================= */\n for (const [key, value] of proxyRes.headers.entries()) {\n const k = key.toLowerCase();\n\n // quebram proxy quando body já vem decodado\n if (k === \"content-encoding\") continue;\n if (k === \"content-length\") continue;\n\n // headers de conexão\n if (\n [\n \"connection\",\n \"keep-alive\",\n \"transfer-encoding\",\n \"te\",\n \"trailer\",\n \"upgrade\",\n \"host\",\n ].includes(k)\n )\n continue;\n\n res.setHeader(key, value);\n }\n\n if (req.method === \"OPTIONS\") {\n debug(\"OPTIONS request -> end\");\n return res.end();\n }\n\n /* =========================\n DEBUG SEVERO BODY\n ========================= */\n const arrayBuf = await proxyRes.arrayBuffer();\n const buffer = Buffer.from(arrayBuf);\n\n debug(\"=== BODY DEBUG ===\");\n debug(\"ArrayBuffer byteLength:\", arrayBuf.byteLength);\n debug(\"Buffer length:\", buffer.length);\n debug(\"Buffer empty:\", buffer.length === 0);\n debug(\"First 50 bytes (hex):\", buffer.subarray(0, 50).toString(\"hex\"));\n debug(\n \"First 200 chars (utf8):\",\n buffer.subarray(0, 200).toString(\"utf8\"),\n );\n debug(\"=== END BODY DEBUG ===\");\n\n /* =========================\n SEND\n ========================= */\n res.status(proxyRes.status).send(buffer);\n } catch (err) {\n debug(\"=== PROXY ERROR ===\");\n debug(\"Ocorreu um erro no proxy...\", err);\n logger(\"error\", `[PROXY] Error: ${err}`);\n res.status(500).json({ error: \"Proxy error\" });\n }\n },\n );\n}\n","/**\n * Debug utility function that only logs when DEBUG environment variable is set to 'true'\n */\n\nexport function debug(message: string, ...optionalParams: any[]) {\n if (process.env.DEBUG === 'true' || process.env.DEBUG === '1') {\n console.log(`[DEBUG] ${message}`, ...optionalParams);\n }\n}","import { logger } from \"azurajs/logger\";\nimport fs from \"fs\";\nimport path from \"node:path\";\nimport { ScalarError, SetupDocsRouteOptions } from \"./config/types\";\nimport { debug } from \"./utils/debug\";\n\nexport async function setupScalarDocs({\n app,\n docPath,\n customHtmlPath,\n apiSpecUrl,\n proxyUrl,\n}: SetupDocsRouteOptions) {\n debug(\"Setting up docs route with options:\", { docPath, customHtmlPath, apiSpecUrl, proxyUrl });\n\n return app.get(docPath, (req, res) => {\n debug(\"Docs route hit with request:\", req.method, req.url);\n try {\n if (!proxyUrl || !apiSpecUrl) {\n debug(\"Missing required URLs - proxyUrl:\", proxyUrl, \"apiSpecUrl:\", apiSpecUrl);\n throw new ScalarError(\n \"Missing required URLs\",\n \"STORE_VALUES_MISSING\",\n 500,\n );\n }\n\n const htmlPath =\n customHtmlPath || path.join(__dirname, \"../api-docs.html\");\n debug(\"HTML template path:\", htmlPath);\n\n if (!fs.existsSync(htmlPath)) {\n debug(\"HTML template not found at path:\", htmlPath);\n throw new ScalarError(\n \"HTML template not found\",\n \"HTML_TEMPLATE_NOT_FOUND\",\n 404,\n );\n }\n\n const html = fs.readFileSync(htmlPath, \"utf-8\");\n debug(\"HTML template read successfully, length:\", html.length);\n\n const processedHtml = html\n .replace(/&{proxy_url}/g, proxyUrl)\n .replace(/&{api_spec_url}/g, apiSpecUrl);\n debug(\"HTML template processed with proxyUrl and apiSpecUrl\");\n\n return res.send(processedHtml);\n } catch (error) {\n debug(\"Error in docs route:\", error);\n if (error instanceof ScalarError) {\n logger(\"error\", `[ScalarError] ${error.message}`);\n return res.status(error.statusCode).json({ message: error.message });\n } else {\n logger(\"error\", String(error));\n return res.status(500).json({ message: \"Server error\" });\n }\n }\n });\n}\n","/**\n * @fileoverview Store utility for managing application state\n * This module provides a typed store for managing scalar configuration values\n */\n\nimport { ScalarStoreType } from \"../config/types\";\n\n/**\n * Typed store class for managing scalar configuration values\n */\nclass ScalarStore {\n private store: Map<keyof ScalarStoreType, string | undefined> = new Map();\n\n /**\n * Sets a value in the store\n * @param key The key to set\n * @param value The value to set (if undefined, the key will be removed)\n */\n set<K extends keyof ScalarStoreType>(\n key: K,\n value: ScalarStoreType[K],\n ): void {\n this.store.set(key, value as string | undefined);\n }\n\n /**\n * Gets a value from the store\n * @param key The key to get\n * @returns The value associated with the key\n */\n get<K extends keyof ScalarStoreType>(key: K): ScalarStoreType[K] {\n return this.store.get(key) as ScalarStoreType[K];\n }\n\n /**\n * Checks if a key exists in the store\n * @param key The key to check\n * @returns True if the key exists, false otherwise\n */\n has(key: keyof ScalarStoreType): boolean {\n return this.store.has(key);\n }\n\n /**\n * Deletes a key from the store\n * @param key The key to delete\n * @returns True if the key existed and was deleted, false otherwise\n */\n delete(key: keyof ScalarStoreType): boolean {\n return this.store.delete(key);\n }\n\n /**\n * Clears all values from the store\n */\n clear(): void {\n this.store.clear();\n }\n\n /**\n * Gets all values from the store\n * @returns An object containing all key-value pairs in the store\n */\n getAll(): ScalarStoreType {\n const result: Partial<ScalarStoreType> = {};\n for (const [key, value] of this.store.entries()) {\n result[key] = value as ScalarStoreType[keyof ScalarStoreType];\n }\n return result as ScalarStoreType;\n }\n\n // Index signature to allow direct property access\n [key: string]: any;\n}\n\nexport const store = new ScalarStore();\n","/**\n * Scalar client for API documentation\n */\nimport { ScalarConfigType, ScalarError } from \"./config/types\";\nimport { proxyMiddleware } from \"./middleware/proxy\";\nimport { setupScalarDocs } from \"./setupDocsRoute\";\nimport { store } from \"./utils/store\";\nimport { debug } from \"./utils/debug\";\n\nexport class Scalar {\n constructor(config: ScalarConfigType) {\n debug(\"Scalar constructor called with config:\", config);\n\n // Normalize baseUrl to ensure it's a valid absolute URL before validation\n const normalizedConfig = { ...config };\n normalizedConfig.baseUrl = this.normalizeBaseUrl(config.baseUrl);\n debug(\"Normalized config:\", normalizedConfig);\n\n // Validate the configuration\n this.validateConfig(normalizedConfig);\n\n // Set default paths if not provided\n const proxyPath = normalizedConfig.proxyPath || \"/scalar/proxy\";\n const docPath = normalizedConfig.docPath || \"/docs\";\n const apiSpecPath = normalizedConfig.apiSpecPath || \"\";\n debug(\n \"Using paths - proxyPath:\",\n proxyPath,\n \"docPath:\",\n docPath,\n \"apiSpecPath:\",\n apiSpecPath,\n );\n\n // Calculate full URLs from baseUrl and paths\n // Use default proxy if proxyPath is not provided\n const proxyUrl = normalizedConfig.proxyPath\n ? this.joinUrl(normalizedConfig.baseUrl, normalizedConfig.proxyPath)\n : \"https://proxy.scalar.com\";\n const docUrl = this.joinUrl(normalizedConfig.baseUrl, docPath);\n const apiSpecUrl = this.joinUrl(normalizedConfig.baseUrl, apiSpecPath);\n debug(\n \"Calculated URLs - proxyUrl:\",\n proxyUrl,\n \"docUrl:\",\n docUrl,\n \"apiSpecUrl:\",\n apiSpecUrl,\n );\n\n // Store the calculated URLs\n store.set(\"proxy_url\", proxyUrl);\n store.set(\"api_spec_url\", apiSpecUrl);\n store.set(\"doc_url\", docUrl);\n debug(\"Stored URLs in store\");\n\n // Call setup with the calculated URLs\n setupScalarDocs({\n ...normalizedConfig,\n proxyUrl,\n docPath,\n apiSpecUrl,\n });\n debug(\"setupScalarDocs called\");\n\n // Setup proxy middleware if proxyPath is provided (for custom proxy)\n if (normalizedConfig.proxyPath) {\n // Setup proxy middleware\n proxyMiddleware({\n apiSpecUrl,\n proxyUrlPath: normalizedConfig.proxyPath,\n app: normalizedConfig.app,\n baseUrl: normalizedConfig.baseUrl,\n });\n debug(\"proxyMiddleware called\");\n }\n }\n\n private joinUrl(baseUrl: string, path: string): string {\n // Normalize the baseUrl to ensure it ends with a slash\n const normalizedBaseUrl = baseUrl.endsWith(\"/\") ? baseUrl : baseUrl + \"/\";\n\n // Normalize the path to ensure it starts with a slash\n const normalizedPath = path.startsWith(\"/\") ? path : \"/\" + path;\n\n // Join the baseUrl and path, removing any double slashes\n return normalizedBaseUrl.replace(/\\/$/, \"\") + normalizedPath;\n }\n\n private normalizeBaseUrl(baseUrl: string): string {\n if (!baseUrl) {\n throw new ScalarError(\n \"baseUrl is required\",\n \"MISSING_REQUIRED_CONFIG\",\n 400,\n );\n }\n\n // If baseUrl doesn't start with a protocol, prepend http://\n if (!/^https?:\\/\\//i.test(baseUrl)) {\n return \"http://\" + baseUrl;\n }\n\n return baseUrl;\n }\n\n private validateConfig(config: ScalarConfigType): void {\n if (!config.baseUrl) {\n throw new ScalarError(\n \"baseUrl is required\",\n \"MISSING_REQUIRED_CONFIG\",\n 400,\n );\n }\n\n try {\n // Validate baseUrl\n debug(\"Validating baseUrl:\", config.baseUrl);\n new URL(config.baseUrl);\n\n // Validate paths if provided\n if (config.proxyPath) {\n debug(\"Validating proxyPath:\", config.proxyPath);\n if (!this.isValidPath(config.proxyPath)) {\n debug(\"proxyPath validation FAILED\");\n throw new Error(\"Invalid proxyPath\");\n }\n }\n\n if (config.docPath) {\n debug(\"Validating docPath:\", config.docPath);\n if (!this.isValidPath(config.docPath)) {\n debug(\"docPath validation FAILED\");\n throw new Error(\"Invalid docPath\");\n }\n }\n\n if (config.apiSpecPath) {\n debug(\"Validating apiSpecPath:\", config.apiSpecPath);\n if (!this.isValidPath(config.apiSpecPath)) {\n debug(\"apiSpecPath validation FAILED\");\n throw new Error(\"Invalid apiSpecPath\");\n }\n }\n } catch (error) {\n debug(\"Validation error:\", error);\n throw new ScalarError(\"Invalid URL provided\", \"INVALID_URL\", 400);\n }\n }\n\n private isValidPath(path: string): boolean {\n // Aceita paths relativos com barras no meio e no final\n return (\n typeof path === \"string\" &&\n /^\\/[a-zA-Z0-9\\-._~:\\/@!$&'()*+,;=]*\\/?$/.test(path)\n );\n }\n}\n"],"mappings":";AAyBO,IAAM,cAAN,MAAM,qBAAoB,MAAM;AAAA,EACrC,YACkB,SACA,MACA,YAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAGhB,WAAO,eAAe,MAAM,aAAY,SAAS;AAAA,EACnD;AACF;;;ACjCA,SAAS,cAAc;;;ACGhB,SAAS,MAAM,YAAoB,gBAAuB;AAC/D,MAAI,QAAQ,IAAI,UAAU,UAAU,QAAQ,IAAI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,IAAI,MAAM,mBAAmB;AAAA,QACrC;AAAA,MACF;AAEA,UAAI,OAAO,SAAS;AAClB,cAAM,uBAAuB,OAAO,OAAO;AAC3C,YAAI,CAAC,KAAK,YAAY,OAAO,OAAO,GAAG;AACrC,gBAAM,2BAA2B;AACjC,gBAAM,IAAI,MAAM,iBAAiB;AAAA,QACnC;AAAA,MACF;AAEA,UAAI,OAAO,aAAa;AACtB,cAAM,2BAA2B,OAAO,WAAW;AACnD,YAAI,CAAC,KAAK,YAAY,OAAO,WAAW,GAAG;AACzC,gBAAM,+BAA+B;AACrC,gBAAM,IAAI,MAAM,qBAAqB;AAAA,QACvC;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,qBAAqB,KAAK;AAChC,YAAM,IAAI,YAAY,wBAAwB,eAAe,GAAG;AAAA,IAClE;AAAA,EACF;AAAA,EAEQ,YAAYA,OAAuB;AAEzC,WACE,OAAOA,UAAS,YAChB,0CAA0C,KAAKA,KAAI;AAAA,EAEvD;AACF;","names":["logger","logger","path"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/types.ts","../src/middleware/proxy.ts","../src/utils/debug.ts","../src/setupDocsRoute.ts","../src/utils/store.ts","../src/client.ts"],"sourcesContent":["import { AzuraClient } from \"azurajs\";\nimport { NextFunction, RequestServer, ResponseServer } from \"azurajs/types\";\n\nexport interface ScalarConfigType {\n baseUrl: string;\n proxyPath?: string;\n docPath?: string;\n apiSpecPath?: string;\n customHtmlPath?: string;\n app: AzuraClient;\n}\n\nexport interface ScalarStoreType {\n proxy_url?: string;\n api_spec_url?: string;\n doc_url?: string;\n custom_html_path?: string;\n}\n\nexport type ProxyMiddlewareType = (\n req: RequestServer,\n res: ResponseServer,\n next?: NextFunction,\n) => Promise<void>;\n\nexport class ScalarError extends Error {\n constructor(\n public readonly message: string,\n public readonly code: string,\n public readonly statusCode: number,\n ) {\n super(message);\n Object.setPrototypeOf(this, ScalarError.prototype);\n }\n}\n\nexport interface ProxyOptions {\n apiSpecUrl: string;\n proxyUrlPath: string;\n app: AzuraClient;\n baseUrl: string;\n}\n\nexport interface SetupDocsRouteOptions extends ScalarConfigType {\n docPath: string;\n proxyUrl: string;\n apiSpecUrl: string;\n}\n","import { ProxyOptions } from \"../config/types\";\nimport { logger } from \"azurajs/logger\";\nimport { debug } from \"../utils/debug\";\nimport { RequestServer, ResponseServer } from \"azurajs/types\";\n\nexport function proxyMiddleware({\n apiSpecUrl,\n app,\n baseUrl,\n proxyUrlPath,\n}: ProxyOptions) {\n debug(\"Setting up proxy middleware:\", {\n apiSpecUrl,\n proxyUrlPath,\n });\n return app.all(\n proxyUrlPath,\n async (req: RequestServer, res: ResponseServer) => {\n debug(\"=== PROXY HIT ===\");\n debug(\"Method:\", req.method);\n debug(\"URL:\", req.url);\n debug(\"Headers:\", req.headers);\n\n try {\n if (!req.url || !req.method) {\n return res.status(400).json({ error: \"Invalid request\" });\n }\n\n logger(\"info\", `[PROXY] ${req.method} ${req.url}`);\n\n /* =========================\n TARGET URL\n ========================= */\n const query = new URLSearchParams(req.url.split(\"?\")[1] || \"\");\n const scalarUrl = query.get(\"scalar_url\");\n const targetUrl = scalarUrl || apiSpecUrl;\n\n debug(\"Target URL:\", targetUrl);\n\n /* =========================\n SAME-ORIGIN\n ========================= */\n const target = new URL(targetUrl);\n const apiBase = new URL(apiSpecUrl);\n const baseOrigin = new URL(baseUrl).origin;\n\n const allowed =\n target.origin === apiBase.origin || target.origin === baseOrigin;\n\n debug(\"Origin check:\", {\n target: target.origin,\n apiSpec: apiBase.origin,\n base: baseOrigin,\n allowed,\n });\n\n if (!allowed) {\n logger(\"warn\", `[PROXY] Blocked cross-origin: ${targetUrl}`);\n return res.status(403).json({ error: \"Cross-origin blocked\" });\n }\n\n /* =========================\n HEADERS\n ========================= */\n const headers: Record<string, string> = {};\n\n for (const [k, v] of Object.entries(req.headers)) {\n if (!v) continue;\n headers[k] = Array.isArray(v) ? v.join(\", \") : v;\n }\n\n headers.host = apiBase.host;\n\n debug(\"Forward headers:\", headers);\n\n /* =========================\n BODY\n ========================= */\n let body: string | undefined;\n if ([\"GET\", \"HEAD\"].includes(req.method)) {\n body = undefined;\n } else {\n // Verifica se req.body existe e tem conteúdo antes de processar\n if (req.body !== undefined && req.body !== null) {\n if (typeof req.body === \"string\") {\n body = req.body;\n } else if (Buffer.isBuffer(req.body)) {\n body = req.body.toString();\n } else {\n try {\n body = JSON.stringify(req.body);\n } catch (e) {\n debug(\"Error stringifying body:\", e);\n body = JSON.stringify(req.body);\n }\n }\n } else {\n body = undefined;\n }\n }\n\n debug(\"Forward body type:\", typeof body);\n debug(\"Forward body length:\", body?.length ?? 0);\n\n /* =========================\n FETCH\n ========================= */\n // Remover o cabeçalho content-length para evitar conflitos\n const modifiedHeaders = { ...headers };\n delete modifiedHeaders['content-length'];\n\n // Adicionar o cabeçalho content-length com base no corpo real\n if (body !== undefined && body !== null) {\n const bodyLength = Buffer.byteLength(body);\n modifiedHeaders['content-length'] = String(bodyLength);\n }\n\n const proxyRes = await fetch(targetUrl, {\n method: req.method,\n headers: modifiedHeaders,\n body,\n });\n\n debug(\"=== FETCH RESPONSE ===\");\n debug(\"Status:\", proxyRes.status);\n debug(\"StatusText:\", proxyRes.statusText);\n debug(\"URL:\", proxyRes.url);\n\n const headersObj: Record<string, string> = {};\n for (const [k, v] of proxyRes.headers.entries()) {\n headersObj[k] = v;\n }\n debug(\"Response headers:\", headersObj);\n\n debug(\"content-type:\", proxyRes.headers.get(\"content-type\"));\n debug(\"content-encoding:\", proxyRes.headers.get(\"content-encoding\"));\n debug(\"transfer-encoding:\", proxyRes.headers.get(\"transfer-encoding\"));\n debug(\"content-length:\", proxyRes.headers.get(\"content-length\"));\n\n /* =========================\n CORS\n ========================= */\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n res.setHeader(\n \"Access-Control-Allow-Methods\",\n \"GET,POST,PUT,PATCH,DELETE,OPTIONS,HEAD\",\n );\n res.setHeader(\"Access-Control-Allow-Headers\", \"*\");\n res.setHeader(\"Access-Control-Expose-Headers\", \"*\");\n\n /* =========================\n SAFE HEADERS PASS\n ========================= */\n for (const [key, value] of proxyRes.headers.entries()) {\n const k = key.toLowerCase();\n\n // quebram proxy quando body já vem decodado\n if (k === \"content-encoding\") continue;\n if (k === \"content-length\") continue;\n\n // headers de conexão\n if (\n [\n \"connection\",\n \"keep-alive\",\n \"transfer-encoding\",\n \"te\",\n \"trailer\",\n \"upgrade\",\n \"host\",\n ].includes(k)\n )\n continue;\n\n res.setHeader(key, value);\n }\n\n if (req.method === \"OPTIONS\") {\n debug(\"OPTIONS request -> end\");\n return res.end();\n }\n\n /* =========================\n DEBUG SEVERO BODY\n ========================= */\n let buffer;\n try {\n const arrayBuf = await proxyRes.arrayBuffer();\n buffer = Buffer.from(arrayBuf);\n\n debug(\"=== BODY DEBUG ===\");\n debug(\"ArrayBuffer byteLength:\", arrayBuf.byteLength);\n debug(\"Buffer length:\", buffer.length);\n debug(\"Buffer empty:\", buffer.length === 0);\n debug(\"First 50 bytes (hex):\", buffer.subarray(0, 50).toString(\"hex\"));\n debug(\n \"First 200 chars (utf8):\",\n buffer.subarray(0, 200).toString(\"utf8\"),\n );\n debug(\"=== END BODY DEBUG ===\");\n } catch (err) {\n debug(\"Error reading response body:\", err);\n logger(\"error\", `[PROXY] Body read error: ${err}`);\n\n // Se houver erro ao ler o body, envia uma resposta vazia ou uma mensagem de erro\n return res.status(500).json({ error: \"Failed to read response from target server\" });\n }\n\n /* =========================\n SEND\n ========================= */\n res.status(proxyRes.status).send(buffer);\n } catch (err) {\n debug(\"=== PROXY ERROR ===\");\n debug(\"Ocorreu um erro no proxy...\", err);\n logger(\"error\", `[PROXY] Error: ${err}`);\n res.status(500).json({ error: \"Proxy error\" });\n }\n },\n );\n}\n","/**\n * Debug utility function that only logs when DEBUG environment variable is set to 'true'\n */\n\nexport function debug(message: string, ...optionalParams: any[]) {\n if (process.env.DEBUG === 'true' || process.env.DEBUG === '1') {\n console.log(`[DEBUG] ${message}`, ...optionalParams);\n }\n}","import { logger } from \"azurajs/logger\";\nimport fs from \"fs\";\nimport path from \"node:path\";\nimport { ScalarError, SetupDocsRouteOptions } from \"./config/types\";\nimport { debug } from \"./utils/debug\";\n\nexport async function setupScalarDocs({\n app,\n docPath,\n customHtmlPath,\n apiSpecUrl,\n proxyUrl,\n}: SetupDocsRouteOptions) {\n debug(\"Setting up docs route with options:\", { docPath, customHtmlPath, apiSpecUrl, proxyUrl });\n\n return app.get(docPath, (req, res) => {\n debug(\"Docs route hit with request:\", req.method, req.url);\n try {\n if (!proxyUrl || !apiSpecUrl) {\n debug(\"Missing required URLs - proxyUrl:\", proxyUrl, \"apiSpecUrl:\", apiSpecUrl);\n throw new ScalarError(\n \"Missing required URLs\",\n \"STORE_VALUES_MISSING\",\n 500,\n );\n }\n\n const htmlPath =\n customHtmlPath || path.join(__dirname, \"../api-docs.html\");\n debug(\"HTML template path:\", htmlPath);\n\n if (!fs.existsSync(htmlPath)) {\n debug(\"HTML template not found at path:\", htmlPath);\n throw new ScalarError(\n \"HTML template not found\",\n \"HTML_TEMPLATE_NOT_FOUND\",\n 404,\n );\n }\n\n const html = fs.readFileSync(htmlPath, \"utf-8\");\n debug(\"HTML template read successfully, length:\", html.length);\n\n const processedHtml = html\n .replace(/&{proxy_url}/g, proxyUrl)\n .replace(/&{api_spec_url}/g, apiSpecUrl);\n debug(\"HTML template processed with proxyUrl and apiSpecUrl\");\n\n return res.send(processedHtml);\n } catch (error) {\n debug(\"Error in docs route:\", error);\n if (error instanceof ScalarError) {\n logger(\"error\", `[ScalarError] ${error.message}`);\n return res.status(error.statusCode).json({ message: error.message });\n } else {\n logger(\"error\", String(error));\n return res.status(500).json({ message: \"Server error\" });\n }\n }\n });\n}\n","/**\n * @fileoverview Store utility for managing application state\n * This module provides a typed store for managing scalar configuration values\n */\n\nimport { ScalarStoreType } from \"../config/types\";\n\n/**\n * Typed store class for managing scalar configuration values\n */\nclass ScalarStore {\n private store: Map<keyof ScalarStoreType, string | undefined> = new Map();\n\n /**\n * Sets a value in the store\n * @param key The key to set\n * @param value The value to set (if undefined, the key will be removed)\n */\n set<K extends keyof ScalarStoreType>(\n key: K,\n value: ScalarStoreType[K],\n ): void {\n this.store.set(key, value as string | undefined);\n }\n\n /**\n * Gets a value from the store\n * @param key The key to get\n * @returns The value associated with the key\n */\n get<K extends keyof ScalarStoreType>(key: K): ScalarStoreType[K] {\n return this.store.get(key) as ScalarStoreType[K];\n }\n\n /**\n * Checks if a key exists in the store\n * @param key The key to check\n * @returns True if the key exists, false otherwise\n */\n has(key: keyof ScalarStoreType): boolean {\n return this.store.has(key);\n }\n\n /**\n * Deletes a key from the store\n * @param key The key to delete\n * @returns True if the key existed and was deleted, false otherwise\n */\n delete(key: keyof ScalarStoreType): boolean {\n return this.store.delete(key);\n }\n\n /**\n * Clears all values from the store\n */\n clear(): void {\n this.store.clear();\n }\n\n /**\n * Gets all values from the store\n * @returns An object containing all key-value pairs in the store\n */\n getAll(): ScalarStoreType {\n const result: Partial<ScalarStoreType> = {};\n for (const [key, value] of this.store.entries()) {\n result[key] = value as ScalarStoreType[keyof ScalarStoreType];\n }\n return result as ScalarStoreType;\n }\n\n // Index signature to allow direct property access\n [key: string]: any;\n}\n\nexport const store = new ScalarStore();\n","/**\n * Scalar client for API documentation\n */\nimport { ScalarConfigType, ScalarError } from \"./config/types\";\nimport { proxyMiddleware } from \"./middleware/proxy\";\nimport { setupScalarDocs } from \"./setupDocsRoute\";\nimport { store } from \"./utils/store\";\nimport { debug } from \"./utils/debug\";\n\nexport class Scalar {\n constructor(config: ScalarConfigType) {\n debug(\"Scalar constructor called with config:\", config);\n\n // Normalize baseUrl to ensure it's a valid absolute URL before validation\n const normalizedConfig = { ...config };\n normalizedConfig.baseUrl = this.normalizeBaseUrl(config.baseUrl);\n debug(\"Normalized config:\", normalizedConfig);\n\n // Validate the configuration\n this.validateConfig(normalizedConfig);\n\n // Set default paths if not provided\n const proxyPath = normalizedConfig.proxyPath || \"/scalar/proxy\";\n const docPath = normalizedConfig.docPath || \"/docs\";\n const apiSpecPath = normalizedConfig.apiSpecPath || \"\";\n debug(\n \"Using paths - proxyPath:\",\n proxyPath,\n \"docPath:\",\n docPath,\n \"apiSpecPath:\",\n apiSpecPath,\n );\n\n // Calculate full URLs from baseUrl and paths\n // Use default proxy if proxyPath is not provided\n const proxyUrl = normalizedConfig.proxyPath\n ? this.joinUrl(normalizedConfig.baseUrl, normalizedConfig.proxyPath)\n : \"https://proxy.scalar.com\";\n const docUrl = this.joinUrl(normalizedConfig.baseUrl, docPath);\n const apiSpecUrl = this.joinUrl(normalizedConfig.baseUrl, apiSpecPath);\n debug(\n \"Calculated URLs - proxyUrl:\",\n proxyUrl,\n \"docUrl:\",\n docUrl,\n \"apiSpecUrl:\",\n apiSpecUrl,\n );\n\n // Store the calculated URLs\n store.set(\"proxy_url\", proxyUrl);\n store.set(\"api_spec_url\", apiSpecUrl);\n store.set(\"doc_url\", docUrl);\n debug(\"Stored URLs in store\");\n\n // Call setup with the calculated URLs\n setupScalarDocs({\n ...normalizedConfig,\n proxyUrl,\n docPath,\n apiSpecUrl,\n });\n debug(\"setupScalarDocs called\");\n\n // Setup proxy middleware if proxyPath is provided (for custom proxy)\n if (normalizedConfig.proxyPath) {\n // Setup proxy middleware\n proxyMiddleware({\n apiSpecUrl,\n proxyUrlPath: normalizedConfig.proxyPath,\n app: normalizedConfig.app,\n baseUrl: normalizedConfig.baseUrl,\n });\n debug(\"proxyMiddleware called\");\n }\n }\n\n private joinUrl(baseUrl: string, path: string): string {\n // Normalize the baseUrl to ensure it ends with a slash\n const normalizedBaseUrl = baseUrl.endsWith(\"/\") ? baseUrl : baseUrl + \"/\";\n\n // Normalize the path to ensure it starts with a slash\n const normalizedPath = path.startsWith(\"/\") ? path : \"/\" + path;\n\n // Join the baseUrl and path, removing any double slashes\n return normalizedBaseUrl.replace(/\\/$/, \"\") + normalizedPath;\n }\n\n private normalizeBaseUrl(baseUrl: string): string {\n if (!baseUrl) {\n throw new ScalarError(\n \"baseUrl is required\",\n \"MISSING_REQUIRED_CONFIG\",\n 400,\n );\n }\n\n // If baseUrl doesn't start with a protocol, prepend http://\n if (!/^https?:\\/\\//i.test(baseUrl)) {\n return \"http://\" + baseUrl;\n }\n\n return baseUrl;\n }\n\n private validateConfig(config: ScalarConfigType): void {\n if (!config.baseUrl) {\n throw new ScalarError(\n \"baseUrl is required\",\n \"MISSING_REQUIRED_CONFIG\",\n 400,\n );\n }\n\n try {\n // Validate baseUrl\n debug(\"Validating baseUrl:\", config.baseUrl);\n new URL(config.baseUrl);\n\n // Validate paths if provided\n if (config.proxyPath) {\n debug(\"Validating proxyPath:\", config.proxyPath);\n if (!this.isValidPath(config.proxyPath)) {\n debug(\"proxyPath validation FAILED\");\n throw new Error(\"Invalid proxyPath\");\n }\n }\n\n if (config.docPath) {\n debug(\"Validating docPath:\", config.docPath);\n if (!this.isValidPath(config.docPath)) {\n debug(\"docPath validation FAILED\");\n throw new Error(\"Invalid docPath\");\n }\n }\n\n if (config.apiSpecPath) {\n debug(\"Validating apiSpecPath:\", config.apiSpecPath);\n if (!this.isValidPath(config.apiSpecPath)) {\n debug(\"apiSpecPath validation FAILED\");\n throw new Error(\"Invalid apiSpecPath\");\n }\n }\n } catch (error) {\n debug(\"Validation error:\", error);\n throw new ScalarError(\"Invalid URL provided\", \"INVALID_URL\", 400);\n }\n }\n\n private isValidPath(path: string): boolean {\n // Aceita paths relativos com barras no meio e no final\n return (\n typeof path === \"string\" &&\n /^\\/[a-zA-Z0-9\\-._~:\\/@!$&'()*+,;=]*\\/?$/.test(path)\n );\n }\n}\n"],"mappings":";AAyBO,IAAM,cAAN,MAAM,qBAAoB,MAAM;AAAA,EACrC,YACkB,SACA,MACA,YAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAGhB,WAAO,eAAe,MAAM,aAAY,SAAS;AAAA,EACnD;AACF;;;ACjCA,SAAS,cAAc;;;ACGhB,SAAS,MAAM,YAAoB,gBAAuB;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vC;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,qBAAqB,KAAK;AAChC,YAAM,IAAI,YAAY,wBAAwB,eAAe,GAAG;AAAA,IAClE;AAAA,EACF;AAAA,EAEQ,YAAYA,OAAuB;AAEzC,WACE,OAAOA,UAAS,YAChB,0CAA0C,KAAKA,KAAI;AAAA,EAEvD;AACF;","names":["logger","logger","path"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azurajs-scalar",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Proxy middleware and controller to scalar documentation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"packageManager": "pnpm@10.25.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"azurajs": "2.
|
|
19
|
+
"azurajs": "2.7.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^25.0.10",
|