FastAPI backend (Python 3.11, MSSQL ODBC for SambaPOS, Azure DI OCR),
kitchen_db on central PG. React/TS/Vite frontend with navy sidebar layout.
Backend: auth.py (APP_SLUG=kitchen, SimpleNamespace — archive routes use
.kitchen_id/.is_admin without modification), main.py (51 migrations, scheduler,
internal router for KDS bookings feed), api/internal.py, full archive API
(31 routers: invoices, recipes, menus, sambapos, resos, newbook, disputes,
purchase_orders, etc.), models, migrations, OCR pipeline.
kitchen_id pinned to 1 (B1 — single hotel).
Frontend: AuthGate (app=kitchen, token shim for archive compat — B5b pending),
Layout (navy sidebar, 6 sections, Lucide icons, teal --app-primary),
App.tsx (Outlet pattern, UploadApp outside Layout), index.css (full :root block).
strict: false — archive components have type issues; build clean.
Note: 45 archive components call fetch('/api/...') without /kitchen/ prefix
(B5b). Runtime 404s; deferred until after initial testing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
No EOL
2.4 KiB
JavaScript
66 lines
No EOL
2.4 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const debug_1 = __importDefault(require("debug"));
|
|
const debug = debug_1.default('https-proxy-agent:parse-proxy-response');
|
|
function parseProxyResponse(socket) {
|
|
return new Promise((resolve, reject) => {
|
|
// we need to buffer any HTTP traffic that happens with the proxy before we get
|
|
// the CONNECT response, so that if the response is anything other than an "200"
|
|
// response code, then we can re-play the "data" events on the socket once the
|
|
// HTTP parser is hooked up...
|
|
let buffersLength = 0;
|
|
const buffers = [];
|
|
function read() {
|
|
const b = socket.read();
|
|
if (b)
|
|
ondata(b);
|
|
else
|
|
socket.once('readable', read);
|
|
}
|
|
function cleanup() {
|
|
socket.removeListener('end', onend);
|
|
socket.removeListener('error', onerror);
|
|
socket.removeListener('close', onclose);
|
|
socket.removeListener('readable', read);
|
|
}
|
|
function onclose(err) {
|
|
debug('onclose had error %o', err);
|
|
}
|
|
function onend() {
|
|
debug('onend');
|
|
}
|
|
function onerror(err) {
|
|
cleanup();
|
|
debug('onerror %o', err);
|
|
reject(err);
|
|
}
|
|
function ondata(b) {
|
|
buffers.push(b);
|
|
buffersLength += b.length;
|
|
const buffered = Buffer.concat(buffers, buffersLength);
|
|
const endOfHeaders = buffered.indexOf('\r\n\r\n');
|
|
if (endOfHeaders === -1) {
|
|
// keep buffering
|
|
debug('have not received end of HTTP headers yet...');
|
|
read();
|
|
return;
|
|
}
|
|
const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n'));
|
|
const statusCode = +firstLine.split(' ')[1];
|
|
debug('got proxy server response: %o', firstLine);
|
|
resolve({
|
|
statusCode,
|
|
buffered
|
|
});
|
|
}
|
|
socket.on('error', onerror);
|
|
socket.on('close', onclose);
|
|
socket.on('end', onend);
|
|
read();
|
|
});
|
|
}
|
|
exports.default = parseProxyResponse;
|
|
//# sourceMappingURL=parse-proxy-response.js.map
|