Infrastructure build to support third-party app integrations
This commit is contained in:
43
backend/types/integration.ts
Normal file
43
backend/types/integration.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user