UNPKG

@veltdev/types

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

227 lines (226 loc) 10.3 kB
import { FirebaseOptions } from "@angular/fire/app"; import { FeatureType } from "../../utils/enums"; export declare class Config { /** * Restrict Snippyly features to specific pages. You can specify partial URL strings. * * Default: All pages where snippyly script or snippyly web components are added. */ urlAllowList?: string[]; /** * Only allow the provided Snippyly features to run. * * Default: All features are enabled. */ featureAllowList?: Array<FeatureType>; /** * Restrict Snippyly features to specific user plans. * * Default: All users. */ userPlanAllowList?: string[]; /** * Restrict Snippyly features to specific users. * * Default: All users. */ userIdAllowList?: string[]; /** * Restrict Snippyly features to specific groups/teams of users. * * Default: All groups/teams. */ userGroupIdAllowList?: string[]; /** * To enable/disable debug mode * * This change will be reflected after a page refresh */ debugMode?: boolean; /** * To enable/disable prefers color scheme. * If this is set to true, then we will listen to changes on the * prefers-color-scheme media query to set the global theme of our components. */ usePrefersColorScheme?: boolean; /** * To enable/disable advanced queries. * * Default: false */ advancedQueriesDisabled?: boolean; /** * The domain of the API proxy. * @deprecated Use `proxyConfig.apiHost` instead. */ apiProxyDomain?: string; /** * Controls whether global Velt styles are loaded. * When true (default), global styles are applied. * When false, global styles are not loaded - useful for custom styling. * * Default: true */ globalStyles?: boolean; /** * Configuration for routing all traffic through reverse proxies. */ proxyConfig?: ProxyConfig; /** * Self-hosting / on-prem backend configuration. When set, a deployment can point * Velt-infra endpoints (Firebase config, cloud-function URLs, the notifications-hub * RTDB URL, the regional setEncryptedData endpoints) at the customer's own infra. * * Every field is OPTIONAL and every unspecified value falls back to the per-build * default in `src/environments/*` — so an existing SaaS build with no `selfHosted` * config behaves exactly as before (behavior-preserving). */ selfHosted?: SelfHostedConfig; } /** * VENDORED from the backend deployment-profile manifest — source of truth: * `shared-firebase-function` repo, `functions/src/deployment-profiles/modules.manifest.ts` * (`DeploymentModuleId`, 13 modules; backend plan §8.3, ratified 2026-07-03; `console` * split added in backend iteration-4). Do NOT add, remove, or rename ids here without a * matching manifest change — the endpoint→module map in `endpoints.service.ts` and its * cross-repo drift-fence test key off this list. */ export declare const DEPLOYMENT_MODULE_IDS: readonly ["core", "notifications", "recorder-media", "ai", "agents", "huddle-webrtc", "integrations-workflow", "superflow", "billing-stripe", "analytics-telemetry", "migrations", "velt-internal", "console"]; /** A backend feature-module id (see {@link DEPLOYMENT_MODULE_IDS} for provenance). */ export type DeploymentModuleId = typeof DEPLOYMENT_MODULE_IDS[number]; /** * Per-endpoint overrides for the cloud-function fleet. Each value is a fully-configurable * ABSOLUTE base URL — do NOT assume the `*.cloudfunctions.net` shape (Tier A now serves the * fleet from Cloud Run with arbitrary hostnames). Keys mirror `environment.cloudFunction.*`. * Unspecified keys fall back to the `environment` default. */ export interface SelfHostedCloudFunctionConfig { validateClient?: string; getPlanDetails?: string; sa?: string; getIceServers?: string; chatgptCompletion?: string; rewriterAskAi?: string; whisperTranscription?: string; getAllowedDocuments?: string; getNotificationsForDocuments?: string; videoBackend?: string; convertRecording?: string; processRecording?: string; sdkProxy?: string; screenshot?: string; /** * Single override for the write endpoint that collapses the ×5 regional * `setEncryptedData` split — when set, it is used for ALL regions. Self-hosted * deployments typically run a single region. */ setEncryptedData?: string; /** * Optional per-region overrides (used only if the single `setEncryptedData` above is * unset). Keys are the `FirebaseRegion` values (`usCentral1`, `asiaSouthEast1`, ...). */ regions?: { [region: string]: { setEncryptedData?: string; }; }; } export interface SelfHostedConfig { /** * Strict (full self-hosted) mode. Default `false`. * * - `false` (hybrid / staged rollout): any endpoint WITHOUT an injected override falls * back to the Velt default in `src/environments/*` — useful for testing one * self-hosted endpoint at a time while the rest stay on Velt SaaS. * - `true` (full self-hosting / data sovereignty): there is NO fallback to Velt. An * endpoint without an injected override resolves to an inert * `velt://self-hosted-disabled/<endpoint>` sentinel that can never produce network * egress — the feature behind it is effectively disabled. Missing CORE endpoints * (`validateClient`, `sdkProxy`, `setEncryptedData`, `getNotificationsForDocuments`, * the notifications DB URL, `firebaseConfig`) are additionally * reported once as a loud misconfiguration error, since the SDK cannot function * without them (plan §4.3: every endpoint runs in the customer cloud or is disabled). */ strict?: boolean; /** * Firebase config override (deep-merged over `environment.firebaseConfig`). Injected * keys win; unspecified keys keep the `environment` default. Per-tenant auth-token * claims still override this at runtime (within-project tenant routing is preserved). * * NOTE (strict mode): this is the ONE value that still falls back to the `environment` * default when unset, because an undefined base config would break the Firebase * bootstrap chain outright. The miss is still reported as a core misconfiguration, and * the `identify()` response config overrides this base at runtime anyway. Making the * bootstrap itself injectable is the tracked Phase A gap (`app.module.ts` static * `initializeApp`). */ firebaseConfig?: Partial<FirebaseOptions>; /** Override for the notifications-hub RTDB URL (`firebaseNotificationsDatabaseURL`). */ firebaseNotificationsDatabaseURL?: string; /** Per-endpoint cloud-function URL overrides. */ cloudFunction?: SelfHostedCloudFunctionConfig; /** * Enables defensive consumption of the portable-backend `identify()` response * (`{ token, backend, wsEndpoint, apiEndpoint }`, backend §6.1). Default `false`: * when false, a portable response is ignored and the existing Firebase path runs * unchanged — no behavior change when the backend does not send it. */ enablePortableBackend?: boolean; /** * The RESOLVED module closure of the deployment profile (backend plan §8.3) — the * enabled-module-id list the backend deploy tooling emits in * `velt-deployment-profile.json`. The customer's tooling inlines it at init; the SDK * does NOT fetch it at runtime and does NOT re-resolve module dependencies (the * backend's `profile-resolver.ts` already computed the fail-closed closure). * * Semantics (ratified — SDK-side synthesis, no Tier A server router): * - Absent, not an array, or an EMPTY array (a valid resolved closure is never empty): * ALL modules enabled — byte-identical to today for SaaS and existing selfHosted * configs. * - Non-empty: LITERAL membership — any endpoint whose module is NOT in the list * resolves to the inert `velt://self-hosted-disabled/*` sentinel, so the denial * normalizer synthesizes `'unimplemented'` locally with zero egress. Works with or * without `strict`. Unknown/typo'd ids enable nothing (fail-closed, mirroring the * backend resolver — a malformed profile must not silently re-open Velt egress). * - A profile opt-out is authoritative: it wins over an injected endpoint URL, and its * endpoints degrade silently even when classified `core` (opt-out ≠ misconfiguration * — they are excluded from the strict-mode core-misconfiguration report). */ deploymentProfile?: DeploymentModuleId[]; } export interface ProxyConfig { /** Custom host for the Velt CDN (e.g., 'cdn-proxy.customer.com') */ cdnHost?: string; /** Custom host for the Velt API (e.g., 'api-proxy.customer.com') */ apiHost?: string; /** Custom host for Firestore (e.g., 'firestore-proxy.customer.com') */ v2DbHost?: string; /** Custom host for Firebase RTDB (e.g., 'rtdb-proxy.customer.com'). Replaces the firebaseio.com domain in all RTDB URLs. */ v1DbHost?: string; /** Custom host for Firebase Storage (e.g., 'storage-proxy.customer.com'). Replaces firebasestorage.googleapis.com. */ storageHost?: string; /** Custom host for Firebase Auth (e.g., 'auth-proxy.customer.com'). Replaces identitytoolkit.googleapis.com and securetoken.googleapis.com. */ authHost?: string; /** Force long-polling for Firestore and RTDB instead of WebSocket. Default: false (WebSocket). */ forceLongPolling?: boolean; } export interface ExtendedFirebaseOptions extends FirebaseOptions { storeDbId: string; region?: string; } export interface AdvancedQueries { advancedQueriesEnabled: boolean; advancedQueriesEnabledTime: number; } export interface DisableLogsConfig { warnings?: boolean; suppressAll?: boolean; } export interface GetProjectConfigResponse { isPrivateCommentsEnabled: boolean; activityConfig?: ActivityConfig; } export interface ActivityConfig { immutable: boolean; isEnabled: boolean; }