📚 Documentação inicial do ALETHEIA
- MANUAL-PRODUTO.md: Manual do usuário final - MANUAL-VENDAS.md: Estratégia comercial e vendas - MANUAL-TECNICO.md: Infraestrutura e deploy - README.md: Visão geral do projeto
This commit is contained in:
57
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/context.js
generated
vendored
Normal file
57
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/context.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getTestReqInfo: null,
|
||||
withRequest: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getTestReqInfo: function() {
|
||||
return getTestReqInfo;
|
||||
},
|
||||
withRequest: function() {
|
||||
return withRequest;
|
||||
}
|
||||
});
|
||||
const _nodeasync_hooks = require("node:async_hooks");
|
||||
const testStorage = new _nodeasync_hooks.AsyncLocalStorage();
|
||||
function extractTestInfoFromRequest(req, reader) {
|
||||
const proxyPortHeader = reader.header(req, "next-test-proxy-port");
|
||||
if (!proxyPortHeader) {
|
||||
return undefined;
|
||||
}
|
||||
const url = reader.url(req);
|
||||
const proxyPort = Number(proxyPortHeader);
|
||||
const testData = reader.header(req, "next-test-data") || "";
|
||||
return {
|
||||
url,
|
||||
proxyPort,
|
||||
testData
|
||||
};
|
||||
}
|
||||
function withRequest(req, reader, fn) {
|
||||
const testReqInfo = extractTestInfoFromRequest(req, reader);
|
||||
if (!testReqInfo) {
|
||||
return fn();
|
||||
}
|
||||
return testStorage.run(testReqInfo, fn);
|
||||
}
|
||||
function getTestReqInfo(req, reader) {
|
||||
const testReqInfo = testStorage.getStore();
|
||||
if (testReqInfo) {
|
||||
return testReqInfo;
|
||||
}
|
||||
if (req && reader) {
|
||||
return extractTestInfoFromRequest(req, reader);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=context.js.map
|
||||
133
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js
generated
vendored
Normal file
133
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
handleFetch: null,
|
||||
interceptFetch: null,
|
||||
reader: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
handleFetch: function() {
|
||||
return handleFetch;
|
||||
},
|
||||
interceptFetch: function() {
|
||||
return interceptFetch;
|
||||
},
|
||||
reader: function() {
|
||||
return reader;
|
||||
}
|
||||
});
|
||||
const _context = require("./context");
|
||||
const reader = {
|
||||
url (req) {
|
||||
return req.url;
|
||||
},
|
||||
header (req, name) {
|
||||
return req.headers.get(name);
|
||||
}
|
||||
};
|
||||
function getTestStack() {
|
||||
let stack = (new Error().stack ?? "").split("\n");
|
||||
// Skip the first line and find first non-empty line.
|
||||
for(let i = 1; i < stack.length; i++){
|
||||
if (stack[i].length > 0) {
|
||||
stack = stack.slice(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Filter out franmework lines.
|
||||
stack = stack.filter((f)=>!f.includes("/next/dist/"));
|
||||
// At most 5 lines.
|
||||
stack = stack.slice(0, 5);
|
||||
// Cleanup some internal info and trim.
|
||||
stack = stack.map((s)=>s.replace("webpack-internal:///(rsc)/", "").trim());
|
||||
return stack.join(" ");
|
||||
}
|
||||
async function buildProxyRequest(testData, request) {
|
||||
const { url, method, headers, body, cache, credentials, integrity, mode, redirect, referrer, referrerPolicy } = request;
|
||||
return {
|
||||
testData,
|
||||
api: "fetch",
|
||||
request: {
|
||||
url,
|
||||
method,
|
||||
headers: [
|
||||
...Array.from(headers),
|
||||
[
|
||||
"next-test-stack",
|
||||
getTestStack()
|
||||
]
|
||||
],
|
||||
body: body ? Buffer.from(await request.arrayBuffer()).toString("base64") : null,
|
||||
cache,
|
||||
credentials,
|
||||
integrity,
|
||||
mode,
|
||||
redirect,
|
||||
referrer,
|
||||
referrerPolicy
|
||||
}
|
||||
};
|
||||
}
|
||||
function buildResponse(proxyResponse) {
|
||||
const { status, headers, body } = proxyResponse.response;
|
||||
return new Response(body ? Buffer.from(body, "base64") : null, {
|
||||
status,
|
||||
headers: new Headers(headers)
|
||||
});
|
||||
}
|
||||
async function handleFetch(originalFetch, request) {
|
||||
const testInfo = (0, _context.getTestReqInfo)(request, reader);
|
||||
if (!testInfo) {
|
||||
// Passthrough non-test requests.
|
||||
return originalFetch(request);
|
||||
}
|
||||
const { testData, proxyPort } = testInfo;
|
||||
const proxyRequest = await buildProxyRequest(testData, request);
|
||||
const resp = await originalFetch(`http://localhost:${proxyPort}`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(proxyRequest),
|
||||
next: {
|
||||
// @ts-ignore
|
||||
internal: true
|
||||
}
|
||||
});
|
||||
if (!resp.ok) {
|
||||
throw new Error(`Proxy request failed: ${resp.status}`);
|
||||
}
|
||||
const proxyResponse = await resp.json();
|
||||
const { api } = proxyResponse;
|
||||
switch(api){
|
||||
case "continue":
|
||||
return originalFetch(request);
|
||||
case "abort":
|
||||
case "unhandled":
|
||||
throw new Error(`Proxy request aborted [${request.method} ${request.url}]`);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return buildResponse(proxyResponse);
|
||||
}
|
||||
function interceptFetch(originalFetch) {
|
||||
global.fetch = function testFetch(input, init) {
|
||||
var _init_next;
|
||||
// Passthrough internal requests.
|
||||
// @ts-ignore
|
||||
if (init == null ? void 0 : (_init_next = init.next) == null ? void 0 : _init_next.internal) {
|
||||
return originalFetch(input, init);
|
||||
}
|
||||
return handleFetch(originalFetch, new Request(input, init));
|
||||
};
|
||||
return ()=>{
|
||||
global.fetch = originalFetch;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch.js.map
|
||||
26
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/httpget.js
generated
vendored
Normal file
26
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/httpget.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "interceptHttpGet", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return interceptHttpGet;
|
||||
}
|
||||
});
|
||||
const _ClientRequest = require("next/dist/compiled/@mswjs/interceptors/ClientRequest");
|
||||
const _fetch = require("./fetch");
|
||||
function interceptHttpGet(originalFetch) {
|
||||
const clientRequestInterceptor = new _ClientRequest.ClientRequestInterceptor();
|
||||
clientRequestInterceptor.on("request", async ({ request })=>{
|
||||
const response = await (0, _fetch.handleFetch)(originalFetch, request);
|
||||
request.respondWith(response);
|
||||
});
|
||||
clientRequestInterceptor.apply();
|
||||
// Cleanup.
|
||||
return ()=>{
|
||||
clientRequestInterceptor.dispose();
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=httpget.js.map
|
||||
62
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/server.js
generated
vendored
Normal file
62
frontend/.next/standalone/node_modules/next/dist/experimental/testmode/server.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
interceptTestApis: null,
|
||||
wrapRequestHandlerNode: null,
|
||||
wrapRequestHandlerWorker: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
interceptTestApis: function() {
|
||||
return interceptTestApis;
|
||||
},
|
||||
wrapRequestHandlerNode: function() {
|
||||
return wrapRequestHandlerNode;
|
||||
},
|
||||
wrapRequestHandlerWorker: function() {
|
||||
return wrapRequestHandlerWorker;
|
||||
}
|
||||
});
|
||||
const _context = require("./context");
|
||||
const _fetch = require("./fetch");
|
||||
const _httpget = require("./httpget");
|
||||
const reader = {
|
||||
url (req) {
|
||||
return req.url ?? "";
|
||||
},
|
||||
header (req, name) {
|
||||
const h = req.headers[name];
|
||||
if (h === undefined || h === null) {
|
||||
return null;
|
||||
}
|
||||
if (typeof h === "string") {
|
||||
return h;
|
||||
}
|
||||
return h[0] ?? null;
|
||||
}
|
||||
};
|
||||
function interceptTestApis() {
|
||||
const originalFetch = global.fetch;
|
||||
const restoreFetch = (0, _fetch.interceptFetch)(originalFetch);
|
||||
const restoreHttpGet = (0, _httpget.interceptHttpGet)(originalFetch);
|
||||
// Cleanup.
|
||||
return ()=>{
|
||||
restoreFetch();
|
||||
restoreHttpGet();
|
||||
};
|
||||
}
|
||||
function wrapRequestHandlerWorker(handler) {
|
||||
return (req, res)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res));
|
||||
}
|
||||
function wrapRequestHandlerNode(handler) {
|
||||
return (req, res, parsedUrl)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res, parsedUrl));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server.js.map
|
||||
Reference in New Issue
Block a user