44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { NoteInput } from './domain.js';
|
|
|
|
export type ProviderSlug = 'slack' | 'jira' | 'linear' | 'github' | 'rest';
|
|
|
|
export type SignatureScheme = 'slack-v0' | 'github-sha256' | 'linear-sha256' | 'none';
|
|
|
|
export type DeliveryStatus = 'pending' | 'processing' | 'done' | 'failed';
|
|
|
|
/**
|
|
* Integration as exposed to application code. Ciphertext columns are
|
|
* deliberately absent so a value of this type can never leak a secret.
|
|
*/
|
|
export type IntegrationRow = {
|
|
id: number;
|
|
provider: ProviderSlug;
|
|
externalWorkspaceId: string | null;
|
|
displayName: string | null;
|
|
scopes: string[];
|
|
tokenExpiresAt: Date | null;
|
|
};
|
|
|
|
export type SignatureResult =
|
|
| { ok: true }
|
|
| { ok: false; reason: 'missing' | 'malformed' | 'mismatch' | 'stale' };
|
|
|
|
export type NormalizedDelivery = {
|
|
externalId: string;
|
|
notes: NoteInput[];
|
|
};
|
|
|
|
/** Provenance recorded on each ingested note's source_meta column. */
|
|
export type NoteProvenance = {
|
|
provider: ProviderSlug;
|
|
externalId: string;
|
|
permalink?: string;
|
|
authorHandle?: string;
|
|
receivedAt: string;
|
|
};
|
|
|
|
const SLUGS: readonly string[] = ['slack', 'jira', 'linear', 'github', 'rest'];
|
|
|
|
export const isProviderSlug = (value: string): value is ProviderSlug =>
|
|
SLUGS.includes(value);
|