function createReadiness() {
let ready = true;
function markUnready() {
ready = false;
}
export type ErrorCode =
| 'VALIDATION'
| 'UNAUTHENTICATED'
| 'FORBIDDEN'
| 'NOT_FOUND'
| 'CONFLICT'
const jwt = require('jsonwebtoken');
const SECRET = process.env.JWT_SECRET;
const ALGORITHM = 'HS256';
const ACCESS_TTL = '15m';
const jwt = require('jsonwebtoken');
function authenticate(req, res, next) {
const header = req.headers.authorization || '';
const [scheme, token] = header.split(' ');
function parseRange(header, size) {
if (!header || !header.startsWith('bytes=')) return null;
const [rawStart, rawEnd] = header.replace('bytes=', '').split('-');
let start;
let end;
const express = require('express');
const controller = require('../controllers/userController');
const router = express.Router();
router.use((req, res, next) => {
const { z } = require('zod');
const signupSchema = z
.object({
email: z
.string()
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 type { Redis } from "ioredis";
export interface StoredResponse {
status: "pending" | "completed";
fingerprint: string;
httpStatus?: number;
export interface Cursor {
createdAt: string;
id: string;
}
export function encodeCursor(c: Cursor): string {
import { RequestHandler } from 'express';
import { ZodTypeAny, ZodError } from 'zod';
export class ValidationError extends Error {
status = 422;
constructor(public issues: unknown) {
import { createHash } from "crypto";
import { Request, Response } from "express";
export function computeEtag(body: string): string {
const digest = createHash("sha1").update(body).digest("base64");
return `"${digest}"`;