167 lines
6.3 KiB
TypeScript
167 lines
6.3 KiB
TypeScript
// R-P5 (P5) — the Apps-Engine App catalog (global definition table seed).
|
|
//
|
|
// One entry per integratable app. The `connectionSchema` drives the
|
|
// auto-generated credential form in the connect wizard. v1 ships ONLY the
|
|
// reference `sample-data-sync` adapter; concrete apps (Gmail/Outlook/AirCall/
|
|
// Mollie/KWP) add their catalog entry + adapter together in P14/P15/P16/P20, so
|
|
// the catalog and the adapter registry stay drift-free.
|
|
//
|
|
// Pure data (no node/Prisma) — importable by web, worker, the catalog upsert, and
|
|
// the drift check.
|
|
|
|
import type { AdapterConnectionType } from "@hivegrid/foundation";
|
|
|
|
/** A credential field rendered by the connect wizard (from connectionSchema). */
|
|
export interface AppCredentialField {
|
|
readonly name: string;
|
|
/** i18n label key (M003). */
|
|
readonly labelKey: string;
|
|
readonly type: "text" | "secret" | "url";
|
|
readonly required: boolean;
|
|
}
|
|
|
|
export interface AppConnectionSchema {
|
|
readonly fields: readonly AppCredentialField[];
|
|
}
|
|
|
|
export type AppCatalogCategory = "erp" | "communication" | "calendar" | "signature" | "payment" | "ki";
|
|
|
|
export interface AppCatalogEntry {
|
|
readonly key: string;
|
|
/** i18n key for the app's display name (M003). Brand names route through i18n
|
|
* too, staying identical across locales. */
|
|
readonly titleKey: string;
|
|
readonly category: AppCatalogCategory;
|
|
readonly connectionType: AdapterConnectionType;
|
|
readonly connectionSchema: AppConnectionSchema;
|
|
readonly phase: string;
|
|
readonly icon?: string;
|
|
/** Reference/demo adapters stay registered (drift check, tests) but are hidden
|
|
* from the tenant-facing catalog — customers must not see our fixtures. */
|
|
readonly internal?: boolean;
|
|
}
|
|
|
|
export const INTEGRATION_CATALOG: readonly AppCatalogEntry[] = [
|
|
{
|
|
key: "sample-data-sync",
|
|
titleKey: "integrations.app.sampleDataSync.title",
|
|
category: "erp",
|
|
connectionType: "rest_api",
|
|
phase: "P5",
|
|
internal: true,
|
|
connectionSchema: {
|
|
fields: [
|
|
{ name: "baseUrl", labelKey: "integrations.field.baseUrl", type: "url", required: true },
|
|
{ name: "apiKey", labelKey: "integrations.field.apiKey", type: "secret", required: true },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
// AK-P16a · Google Calendar. connectionType oauth2 → the connect flow is the
|
|
// OAuth redirect (no manual credential form), so `fields` is empty. The
|
|
// per-USER connection + bidirectional sync lives in the calendar module
|
|
// (CalendarConnection); this catalog entry keeps the app reachable in the
|
|
// integrations surface and drift-free with its registered adapter.
|
|
key: "google-calendar",
|
|
titleKey: "integrations.app.googleCalendar.title",
|
|
category: "calendar",
|
|
connectionType: "oauth2",
|
|
phase: "P16",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// VR-P33 · Inbound-first HalloPetra assistant. The tenant supplies the
|
|
// API key manually; post-call delivery is configured in HalloPetra's
|
|
// webhook dashboard and processed by the telephony event engine.
|
|
key: "hallopetra",
|
|
titleKey: "integrations.app.hallopetra.title",
|
|
category: "communication",
|
|
connectionType: "api_key",
|
|
phase: "P33",
|
|
connectionSchema: {
|
|
fields: [{ name: "apiKey", labelKey: "integrations.field.apiKey", type: "secret", required: true }],
|
|
},
|
|
},
|
|
{
|
|
// VA-P23 · Gmail mailbox sync. connectionType oauth2 → the connect flow is
|
|
// the OAuth redirect (no manual credential form). The per-USER mailbox +
|
|
// push sync lives in the email-inbox module (EmailIntegrationMailbox); this
|
|
// catalog entry keeps the app reachable in the integrations surface and
|
|
// drift-free with its registered adapter.
|
|
key: "gmail",
|
|
titleKey: "integrations.app.gmail.title",
|
|
category: "communication",
|
|
connectionType: "oauth2",
|
|
phase: "P23",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// VA-P23 · Microsoft (Outlook/Graph) mailbox sync — same pattern as gmail.
|
|
key: "microsoft-mail",
|
|
titleKey: "integrations.app.microsoftMail.title",
|
|
category: "communication",
|
|
connectionType: "oauth2",
|
|
phase: "P23",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// AK-P15a · Aircall telephony. OAuth yields one permanent bearer token per
|
|
// connected Aircall company; the dedicated telephony surface owns user
|
|
// bindings, calls and webhook processing.
|
|
key: "aircall",
|
|
titleKey: "integrations.app.aircall.title",
|
|
category: "communication",
|
|
connectionType: "oauth2",
|
|
phase: "P15",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// VR-P32a · Geerkens pilot for the KWP OAuth2/PKCE connector. The dedicated
|
|
// setup flow uses the environment-bound pilot client; no manual secret form
|
|
// is rendered by the generic Apps Engine wizard.
|
|
key: "kwp",
|
|
titleKey: "integrations.app.kwp.title",
|
|
category: "erp",
|
|
connectionType: "oauth2",
|
|
phase: "P32",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// AK-P16d · AD-25 default: hardened self-hosted SES. No external provider
|
|
// credentials are required; the app entry keeps the module visible in the
|
|
// integration surface and drift-free with the registered adapter.
|
|
key: "ses-selfhosted",
|
|
titleKey: "integrations.app.sesSelfhosted.title",
|
|
category: "signature",
|
|
connectionType: "rest_api",
|
|
phase: "P16",
|
|
connectionSchema: { fields: [] },
|
|
},
|
|
{
|
|
// AK-P16d · Optional PandaDoc BYOK bridge. AD-25 keeps PandaDoc out of the
|
|
// default flow; tenants can connect their own key/template when needed.
|
|
key: "pandadoc-byok",
|
|
titleKey: "integrations.app.pandadocByok.title",
|
|
category: "signature",
|
|
connectionType: "api_key",
|
|
phase: "P16",
|
|
connectionSchema: {
|
|
fields: [
|
|
{ name: "apiKey", labelKey: "integrations.field.apiKey", type: "secret", required: true },
|
|
{ name: "templateUuid", labelKey: "integrations.field.templateUuid", type: "text", required: true },
|
|
{ name: "webhookSharedKey", labelKey: "integrations.field.webhookSharedKey", type: "secret", required: false },
|
|
],
|
|
},
|
|
},
|
|
];
|
|
|
|
/** All catalog keys (for drift comparison). */
|
|
export function catalogKeys(): string[] {
|
|
return INTEGRATION_CATALOG.map((entry) => entry.key);
|
|
}
|
|
|
|
/** Look up a catalog entry by key. */
|
|
export function getCatalogEntry(key: string): AppCatalogEntry | undefined {
|
|
return INTEGRATION_CATALOG.find((entry) => entry.key === key);
|
|
}
|