const jwt = require('jsonwebtoken');
const ACCESS_SECRET = process.env.JWT_ACCESS_SECRET;
const REFRESH_SECRET = process.env.JWT_REFRESH_SECRET;
const ISSUER = 'api.example.com';
const AUDIENCE = 'example-web';
import { Queue } from "bullmq";
import { createHash } from "crypto";
export const connection = { host: "127.0.0.1", port: 6379 };
export interface ChargePayload {
name: CI
on:
push:
branches: [main]
pull_request:
import { S3Client } from "@aws-sdk/client-s3";
import { createPresignedPost, PresignedPost } from "@aws-sdk/s3-presigned-post";
import { randomUUID } from "crypto";
const s3 = new S3Client({ region: process.env.AWS_REGION });
const BUCKET = process.env.UPLOAD_BUCKET!;
import { WebSocketServer } from 'ws';
import type WebSocket from 'ws';
type ClientState = { topics: Set<string> };
const state = new WeakMap<WebSocket, ClientState>();
const SHUTDOWN_TIMEOUT_MS = 10_000;
function registerFatalHandlers({ logger, onFatal, exitCode = 1 }) {
let shuttingDown = false;
async function handleFatal(kind, error) {
import { Knex } from 'knex';
export interface RawDailyRow {
day: string;
order_count: string;
gross_cents: string;
import { Request, Response } from 'express';
import { authenticate } from './auth.service';
export async function login(req: Request, res: Response): Promise<void> {
const { email, password } = req.body ?? {};
import { Pool } from "pg";
async function keyFor(pool: Pool, name: string): Promise<string> {
const { rows } = await pool.query<{ key: string }>(
"SELECT hashtextextended($1, 0) AS key",
[name]
import { z } from "zod";
export const rowSchema = z.object({
email: z.string().email(),
name: z.string().min(1, "name is required"),
age: z.coerce.number().int().min(0, "age must be >= 0"),
import { Prisma, PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
type TxClient = Prisma.TransactionClient;
import jwt, { JwtPayload, SignOptions } from 'jsonwebtoken';
const SECRET = process.env.JWT_SECRET as string;
const ISSUER = 'auth.example.com';
const AUDIENCE = 'api.example.com';