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>
68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
/**
|
|
* Binary search
|
|
* @param table - the table search. must be sorted!
|
|
* @param value - value to find
|
|
* @param cmp
|
|
* @private
|
|
*/
|
|
export declare function _lookup(table: number[], value: number, cmp?: (value: number) => boolean): {
|
|
lo: number;
|
|
hi: number;
|
|
};
|
|
export declare function _lookup<T>(table: T[], value: number, cmp: (value: number) => boolean): {
|
|
lo: number;
|
|
hi: number;
|
|
};
|
|
/**
|
|
* Binary search
|
|
* @param table - the table search. must be sorted!
|
|
* @param key - property name for the value in each entry
|
|
* @param value - value to find
|
|
* @param last - lookup last index
|
|
* @private
|
|
*/
|
|
export declare const _lookupByKey: (table: Record<string, number>[], key: string, value: number, last?: boolean) => {
|
|
lo: number;
|
|
hi: number;
|
|
};
|
|
/**
|
|
* Reverse binary search
|
|
* @param table - the table search. must be sorted!
|
|
* @param key - property name for the value in each entry
|
|
* @param value - value to find
|
|
* @private
|
|
*/
|
|
export declare const _rlookupByKey: (table: Record<string, number>[], key: string, value: number) => {
|
|
lo: number;
|
|
hi: number;
|
|
};
|
|
/**
|
|
* Return subset of `values` between `min` and `max` inclusive.
|
|
* Values are assumed to be in sorted order.
|
|
* @param values - sorted array of values
|
|
* @param min - min value
|
|
* @param max - max value
|
|
*/
|
|
export declare function _filterBetween(values: number[], min: number, max: number): number[];
|
|
export interface ArrayListener<T> {
|
|
_onDataPush?(...item: T[]): void;
|
|
_onDataPop?(): void;
|
|
_onDataShift?(): void;
|
|
_onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
|
|
_onDataUnshift?(...item: T[]): void;
|
|
}
|
|
/**
|
|
* Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
|
|
* 'unshift') and notify the listener AFTER the array has been altered. Listeners are
|
|
* called on the '_onData*' callbacks (e.g. _onDataPush, etc.) with same arguments.
|
|
*/
|
|
export declare function listenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void;
|
|
/**
|
|
* Removes the given array event listener and cleanup extra attached properties (such as
|
|
* the _chartjs stub and overridden methods) if array doesn't have any more listeners.
|
|
*/
|
|
export declare function unlistenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void;
|
|
/**
|
|
* @param items
|
|
*/
|
|
export declare function _arrayUnique<T>(items: T[]): T[];
|