export type Settled<R> =
| { status: 'fulfilled'; value: R }
| { status: 'rejected'; reason: unknown };
export interface ConcurrencyOptions {
limit: number;
import { randomBytes, createHash } from "crypto";
import jwt from "jsonwebtoken";
import { RefreshTokenStore } from "./store";
const ACCESS_SECRET = process.env.ACCESS_SECRET!;
const ACCESS_TTL = "15m";
CREATE TABLE outbox (
id BIGSERIAL PRIMARY KEY,
aggregate_type TEXT NOT NULL,
aggregate_id TEXT NOT NULL,
event_type TEXT NOT NULL,
payload JSONB NOT NULL,
import { Pool, PoolClient, Client, QueryResult, QueryResultRow } from 'pg';
const MAX_LIFETIME_MS = 30 * 60 * 1000;
export const pool = new Pool({
connectionString: process.env.DATABASE_URL,
import { createHash } from "crypto";
import { readFileSync } from "fs";
export function sha256(query: string): string {
return createHash("sha256").update(query, "utf8").digest("hex");
}
import { Registry, Histogram, Counter, collectDefaultMetrics } from 'prom-client';
export const register = new Registry();
collectDefaultMetrics({ register });
#!/usr/bin/env bash
set -euo pipefail
bundle exec bundler-audit check --update
npm audit --audit-level=high
pip-audit --strict
import { Queue } from "bullmq";
import IORedis from "ioredis";
export const connection = new IORedis(process.env.REDIS_URL ?? "redis://localhost:6379", {
maxRetriesPerRequest: null,
});
import { readFileSync } from 'fs';
import { join } from 'path';
import Handlebars from 'handlebars';
import mjml2html from 'mjml';
import { htmlToText } from 'html-to-text';
FROM node:20-alpine AS base
WORKDIR /app
RUN apk add --no-cache libc6-compat
FROM base AS deps
COPY package.json package-lock.json ./
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: