- Node/Express/TypeScript API under /api/v1 with JWT auth (login, refresh, logout, /me) - Prisma schema: vendors, users, roles, products, categories, taxes, transactions - SQLite for local dev; Postgres via docker-compose for production - Full CRUD routes for vendors, users, categories, taxes, products with Zod validation and RBAC - Paginated list endpoints scoped per vendor; refresh token rotation - React/TypeScript admin SPA (Vite): login, protected routing, sidebar layout - Pages: Dashboard, Catalog (tabbed Products/Categories/Taxes), Users, Vendor Settings - Shared UI: Table, Modal, FormField, Btn, PageHeader components - Multi-stage Dockerfile; docker-compose with Postgres healthcheck - Seed script with demo vendor and owner account - INSTRUCTIONS.md, ROADMAP.md, .claude/launch.json for dev server config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
var $TypeError = require('es-errors/type');
|
|
var inspect = require('object-inspect');
|
|
var getSideChannelList = require('side-channel-list');
|
|
var getSideChannelMap = require('side-channel-map');
|
|
var getSideChannelWeakMap = require('side-channel-weakmap');
|
|
|
|
var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
|
|
|
|
/** @type {import('.')} */
|
|
module.exports = function getSideChannel() {
|
|
/** @typedef {ReturnType<typeof getSideChannel>} Channel */
|
|
|
|
/** @type {Channel | undefined} */ var $channelData;
|
|
|
|
/** @type {Channel} */
|
|
var channel = {
|
|
assert: function (key) {
|
|
if (!channel.has(key)) {
|
|
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
}
|
|
},
|
|
'delete': function (key) {
|
|
return !!$channelData && $channelData['delete'](key);
|
|
},
|
|
get: function (key) {
|
|
return $channelData && $channelData.get(key);
|
|
},
|
|
has: function (key) {
|
|
return !!$channelData && $channelData.has(key);
|
|
},
|
|
set: function (key, value) {
|
|
if (!$channelData) {
|
|
$channelData = makeChannel();
|
|
}
|
|
|
|
$channelData.set(key, value);
|
|
}
|
|
};
|
|
// @ts-expect-error TODO: figure out why this is erroring
|
|
return channel;
|
|
};
|