/** * Import-cheap authoring contracts for package-owned deployment manifests. * Executable route, schema, UI, subscriber, job, and provider code is referenced by * package export, never imported from this module. */ import type { VoyantGraphAccessDeclaration, VoyantGraphActionDeclaration, VoyantGraphAdminDeclaration, VoyantGraphConfigDeclaration, VoyantGraphLifecycleDeclaration, VoyantGraphPresentationDeclaration, VoyantGraphProjectAccessDeclaration, VoyantGraphProviderDeclaration, VoyantGraphReportingCatalog, VoyantGraphReportingDeclaration, VoyantGraphResourceDeclaration, VoyantGraphSecretDeclaration, VoyantGraphSetupMigration, VoyantGraphToolDeclaration, VoyantGraphWebhookDeclaration } from "./project-facets.js"; export type * from "./project-facets.js"; export declare const VOYANT_GRAPH_PROJECT_SCHEMA_VERSION: "voyant.project.v1"; export declare const VOYANT_GRAPH_MODULE_SCHEMA_VERSION: "voyant.module.v1"; export declare const VOYANT_GRAPH_EXTENSION_SCHEMA_VERSION: "voyant.extension.v1"; export declare const VOYANT_GRAPH_PLUGIN_SCHEMA_VERSION: "voyant.plugin.v1"; export declare const VOYANT_GRAPH_ADAPTER_SCHEMA_VERSION: "voyant.adapter.v1"; export declare const VOYANT_GRAPH_PROVIDER_SCHEMA_VERSION: "voyant.provider.v1"; export type VoyantGraphUnitKind = "module" | "extension" | "plugin" | "adapter" | "provider"; export type VoyantGraphRouteSurface = "admin" | "public" | "webhook" | "internal"; export type VoyantGraphRouteMethod = "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT"; export type VoyantGraphJsonValue = null | boolean | number | string | readonly VoyantGraphJsonValue[] | { readonly [key: string]: VoyantGraphJsonValue; }; export type VoyantGraphJsonObject = { readonly [key: string]: VoyantGraphJsonValue; }; export interface VoyantGraphCapabilityDeclaration { capabilities?: readonly string[]; ports?: readonly VoyantGraphPortDeclaration[]; } export type VoyantGraphCustomFieldCapability = "read" | "write" | "search" | "export" | "invoice" | "presentation"; /** An entity-owner declaration that Settings may expose as a custom-field target. */ export interface VoyantGraphCustomFieldTargetDeclaration { id: string; /** Immutable namespace used by the target's owning deployment unit. */ namespace: string; label: string; fieldTypes: readonly string[]; capabilities: readonly VoyantGraphCustomFieldCapability[]; } /** A selected target declaration lowered with its owning graph unit. */ export interface VoyantGraphCustomFieldTarget extends VoyantGraphCustomFieldTargetDeclaration { ownerUnitId: string; } export interface VoyantGraphPortDeclaration { id: string; optional?: boolean; /** Additive static contributor aggregation. Valid only in a unit's runtimePorts. */ cardinality?: "many"; /** Lazy export of the owning typed VoyantPort used for startup conformance. */ conformance?: VoyantGraphRuntimeReference; } export interface VoyantPort { readonly id: string; readonly test: (provider: TProvider) => void | Promise; /** Import-cheap reference back to this typed port for generic startup preflight. */ readonly conformance?: VoyantGraphRuntimeReference; } export declare function definePort(input: VoyantPort): VoyantPort; export declare function providePort(port: VoyantPort): VoyantGraphPortDeclaration; export declare function requirePort(port: VoyantPort, options?: { optional?: boolean; cardinality?: "many"; }): VoyantGraphPortDeclaration; export declare function assertPortConforms(port: VoyantPort, provider: TProvider): Promise; export interface VoyantGraphRuntimeFactoryGraph { /** Explicit deployment provider selections keyed by provider role. */ readonly providerSelections: Readonly>; /** Read-only custom-field targets lowered from the selected entity manifests. */ readonly customFieldTargets?: readonly VoyantGraphCustomFieldTarget[]; readonly accessCatalog: { readonly resources: readonly { readonly id: string; readonly unitId: string; readonly resource: string; readonly label: string; readonly description: string; readonly wildcard: "allow" | "explicit-resource"; readonly remoteSafe?: boolean; readonly actions: readonly { readonly action: string; readonly label: string; readonly description: string; readonly sensitive?: boolean; readonly remoteSafe?: boolean; readonly wildcard?: "allow" | "explicit"; }[]; readonly legacyActions?: readonly string[]; }[]; readonly presets: readonly { readonly id: string; readonly kind: "api-token" | "api-token-grant" | "staff"; readonly label: string; readonly description: string; readonly grants: readonly string[]; readonly audience?: "staff" | "customer" | "partner" | "supplier"; }[]; }; /** Present on generated v1 runtimes; optional for direct factory test harnesses. */ readonly eventCatalog?: VoyantGraphEventCatalog; /** Source-free report datasets, presets, and page templates selected by the graph. */ readonly reportingCatalog?: VoyantGraphReportingCatalog; readonly tools: readonly { readonly referenceId: string; readonly context?: readonly string[]; load(): Promise; }[]; /** Action/approval policies admitted by the selected graph. */ readonly actions?: readonly VoyantGraphActionDeclaration[]; readonly references: readonly { readonly id: string; readonly unitId: string; readonly facet: string; readonly entityId: string; readonly importEntry: string; load(): Promise; loadModule = Record>(): Promise; }[]; readonly setupSteps: readonly { readonly id: string; readonly skippable: boolean; }[]; } export interface VoyantGraphRuntimeFactoryContext { readonly unitId: string; /** Deployment bindings for fixed job invocations; absent on non-job facets. */ readonly bindings?: unknown; /** Validated JSON config authored on this package-scoped project selection. */ readonly projectConfig: Readonly; /** Read validated config for another explicitly selected unit by exact graph id. */ getUnitProjectConfig(unitId: string): Readonly | undefined; /** API facets selected for this runtime unit in the resolved graph. */ readonly api: readonly Readonly>[]; /** Import-capable selected graph view for generic graph consumers such as MCP. */ readonly graph: VoyantGraphRuntimeFactoryGraph; /** Selected deployment providers keyed by their declared runtime-port id. */ readonly runtimePorts: Readonly>; hasPort(port: VoyantPort): boolean; getPort(port: VoyantPort): Promise; getPorts(port: VoyantPort): Promise; } export type VoyantGraphRuntimeFactory = (context: VoyantGraphRuntimeFactoryContext) => TResult | Promise; /** Mark an executable package export that consumes its manifest-declared ports. */ export declare function defineGraphRuntimeFactory(factory: VoyantGraphRuntimeFactory): VoyantGraphRuntimeFactory; export declare function isGraphRuntimeFactory(value: unknown): value is VoyantGraphRuntimeFactory; /** A symbolic package export resolved only after package admission. */ export interface VoyantGraphRuntimeReference { entry: string; export?: string; } export interface VoyantGraphRouteBundle { id: string; surface: VoyantGraphRouteSurface; methods?: readonly VoyantGraphRouteMethod[]; mount?: string; openapi?: VoyantGraphRouteOpenApi; resource?: string; /** Delegate capability checks to handlers while retaining surface authentication. */ authorization?: "coarse" | "route"; requiredScopes?: readonly string[]; /** Anonymous public access for the whole public mount or route-relative path subsets. */ anonymous?: boolean | readonly string[]; /** Transactional DB routing for the whole mount or route-relative path subsets. */ transactional?: boolean | readonly string[]; runtime?: VoyantGraphRuntimeReference; } /** Build-time API document ownership declared by the route bundle. */ export interface VoyantGraphRouteOpenApi { document: string; } export interface VoyantGraphFacetEntity { id: string; source?: string; /** Named executable export when a facet source contains multiple declarations. */ export?: string; } /** Distinguishes entity metadata from executable cross-module link definitions. */ export interface VoyantGraphLinkDeclaration extends VoyantGraphFacetEntity { kind: "linkable" | "definition"; } export interface VoyantGraphEvent extends VoyantGraphFacetEntity { eventType?: string; /** Semantic version of the emitted payload contract. Required with payloadSchema. */ version?: string; /** * JSON Schema used for upgrade compatibility and external delivery projection. * Object properties are allowlisted; `writeOnly` or `x-voyant-redact` fields are redacted. */ payloadSchema?: VoyantGraphJsonObject; /** External events may be selected by deployment-owned outbound webhook subscriptions. */ visibility?: "internal" | "external"; /** Stable provenance copied into outbound delivery audit records. */ audit?: { sourceModule: string; category: "domain" | "internal"; }; } export declare const VOYANT_EVENT_CATALOG_SCHEMA_VERSION: "voyant.event-catalog.v1"; /** One versioned event contract compiled from a selected package manifest. */ export interface VoyantGraphEventCatalogEntry { /** Stable lookup identity for one event contract version. */ key: string; id: string; unitId: string; packageName: string; eventType: string; version: string; payloadSchema: VoyantGraphJsonObject; visibility: "internal" | "external"; audit: { sourceModule: string; category: "domain" | "internal"; }; /** JSON paths whose schema marks them write-only or explicitly redacted. */ redactedFields: readonly string[]; } /** Canonical event contracts derived exclusively from the selected graph. */ export interface VoyantGraphEventCatalog { schemaVersion: typeof VOYANT_EVENT_CATALOG_SCHEMA_VERSION; events: readonly VoyantGraphEventCatalogEntry[]; } /** External delivery is deny-by-default and requires an explicit object property allowlist. */ export declare function isExternalWebhookPayloadSchema(value: unknown): value is VoyantGraphJsonObject & { type: "object"; properties: VoyantGraphJsonObject; }; export interface VoyantGraphSubscriber extends VoyantGraphFacetEntity { eventType?: string; filter?: VoyantGraphJsonObject; runtime?: VoyantGraphRuntimeReference; } /** Package-owned cadence for a built-in product job. */ export type VoyantGraphJobSchedule = ({ cron: string; every?: never; } | { every: string | number; cron?: never; }) & { timezone?: string; overlap?: "skip" | "queue"; }; /** * Package-declared scheduling bounds for a product job. Hosts may select only * one of these named profiles; they never receive an arbitrary cron expression * or a different runtime handler. */ export interface VoyantGraphJobSchedulingPolicy { /** Named, package-owned alternatives to the job's default schedule. */ profiles?: Readonly>; /** Required jobs cannot be disabled by deployment configuration. */ required?: boolean; } /** * A package-owned background operation selected with its owning graph unit. * * Jobs deliberately have no input or payload declaration. Durable work remains * in the owning domain, while a host only schedules or wakes the fixed runtime * export selected by this declaration. */ export interface VoyantGraphJob extends VoyantGraphFacetEntity { runtime: VoyantGraphRuntimeReference; /** The safe package default retained for existing job declarations. */ schedule?: VoyantGraphJobSchedule; /** Bounded host-resolved cadence choices; handlers and identities remain fixed. */ scheduling?: VoyantGraphJobSchedulingPolicy; /** Marks a job that may be prompted after its domain records durable work. */ wakeup?: boolean; } export interface VoyantGraphUnitManifest { schemaVersion: typeof VOYANT_GRAPH_MODULE_SCHEMA_VERSION | typeof VOYANT_GRAPH_EXTENSION_SCHEMA_VERSION | typeof VOYANT_GRAPH_PLUGIN_SCHEMA_VERSION | typeof VOYANT_GRAPH_ADAPTER_SCHEMA_VERSION | typeof VOYANT_GRAPH_PROVIDER_SCHEMA_VERSION; id: string; localId?: string; packageName?: string; /** The package export that creates this unit's runtime module or extension. */ runtime?: VoyantGraphRuntimeReference; /** Deployment-supplied ports available only to this unit's runtime factories. */ runtimePorts?: readonly VoyantGraphPortDeclaration[]; customFieldTargets?: readonly VoyantGraphCustomFieldTargetDeclaration[]; provides?: VoyantGraphCapabilityDeclaration; requires?: VoyantGraphCapabilityDeclaration; api?: readonly VoyantGraphRouteBundle[]; schema?: readonly VoyantGraphFacetEntity[]; migrations?: readonly VoyantGraphFacetEntity[]; links?: readonly VoyantGraphLinkDeclaration[]; subscribers?: readonly VoyantGraphSubscriber[]; events?: readonly VoyantGraphEvent[]; jobs?: readonly VoyantGraphJob[]; setupMigrations?: readonly VoyantGraphSetupMigration[]; config?: readonly VoyantGraphConfigDeclaration[]; secrets?: readonly VoyantGraphSecretDeclaration[]; resources?: readonly VoyantGraphResourceDeclaration[]; providers?: readonly VoyantGraphProviderDeclaration[]; access?: VoyantGraphAccessDeclaration; admin?: VoyantGraphAdminDeclaration; presentations?: readonly VoyantGraphPresentationDeclaration[]; reporting?: VoyantGraphReportingDeclaration; tools?: readonly VoyantGraphToolDeclaration[]; webhooks?: readonly VoyantGraphWebhookDeclaration[]; actions?: readonly VoyantGraphActionDeclaration[]; lifecycle?: VoyantGraphLifecycleDeclaration; meta?: VoyantGraphJsonObject; } export interface DefineVoyantGraphUnitInput extends Omit { schemaVersion?: VoyantGraphUnitManifest["schemaVersion"]; } export interface DefineVoyantGraphProjectSelection { resolve: string; config?: VoyantGraphJsonObject; } export type DefineVoyantGraphProjectUnitInput = string | DefineVoyantGraphProjectSelection | VoyantGraphUnitManifest; export type VoyantGraphProjectSelectionProvenance = { kind: "package"; packageName: string; unitPath?: string; } | { kind: "path"; path: string; }; /** Serializable author intent retained separately from package-owned facets. */ export interface VoyantGraphProjectSelection { id: string; resolve: string; packageName: string; provenance: VoyantGraphProjectSelectionProvenance; config?: VoyantGraphJsonObject; } export interface VoyantGraphProjectSelections { modules: readonly VoyantGraphProjectSelection[]; extensions: readonly VoyantGraphProjectSelection[]; plugins: readonly VoyantGraphProjectSelection[]; adapters: readonly VoyantGraphProjectSelection[]; providers: readonly VoyantGraphProjectSelection[]; } export declare const VOYANT_PRODUCT_BOM_REFERENCE_SCHEMA_VERSION: "voyant.product-bom-reference.v1"; /** Identifies the versioned product declaration expanded into an explicit project graph. */ export interface VoyantProductBomReference { schemaVersion: typeof VOYANT_PRODUCT_BOM_REFERENCE_SCHEMA_VERSION; id: string; version: string; } export type VoyantGraphProjectDeploymentMode = "local" | "managed-cloud" | "self-hosted"; /** A migration folder owned by the deployment rather than an installed package. */ export interface VoyantGraphProjectDeploymentMigration { id: string; /** Project-relative path to a committed Drizzle migration folder. */ source: string; } /** * Unified application graphs always compile to the Node runtime. Hosting * choices such as Voyant Cloud, Docker, Fly, or Railway are CLI target adapters * for that Node artifact, not alternate application runtimes. */ export interface VoyantGraphProjectDeployment { target?: "node"; mode?: VoyantGraphProjectDeploymentMode; providers?: Readonly>; migrations?: readonly VoyantGraphProjectDeploymentMigration[]; } /** A host preference may select only package-declared profile names. */ export interface VoyantGraphProjectJobScheduling { /** Applies to jobs that publish this profile, unless a job preference overrides it. */ profile?: string; /** Per-job profile selection, or false to disable an optional job. */ jobs?: Readonly>; } export interface DefineVoyantGraphProjectInput { schemaVersion?: typeof VOYANT_GRAPH_PROJECT_SCHEMA_VERSION; productBom?: VoyantProductBomReference; modules: readonly DefineVoyantGraphProjectUnitInput[]; extensions?: readonly DefineVoyantGraphProjectUnitInput[]; plugins?: readonly DefineVoyantGraphProjectUnitInput[]; adapters?: readonly DefineVoyantGraphProjectUnitInput[]; providers?: readonly DefineVoyantGraphProjectUnitInput[]; access?: VoyantGraphProjectAccessDeclaration; jobScheduling?: VoyantGraphProjectJobScheduling; deployment?: VoyantGraphProjectDeployment; meta?: VoyantGraphJsonObject; } export interface VoyantGraphProject { schemaVersion: typeof VOYANT_GRAPH_PROJECT_SCHEMA_VERSION; productBom?: VoyantProductBomReference; modules: readonly VoyantGraphUnitManifest[]; extensions: readonly VoyantGraphUnitManifest[]; plugins: readonly VoyantGraphUnitManifest[]; adapters: readonly VoyantGraphUnitManifest[]; providers: readonly VoyantGraphUnitManifest[]; selections?: VoyantGraphProjectSelections; access?: VoyantGraphProjectAccessDeclaration; jobScheduling?: VoyantGraphProjectJobScheduling; deployment?: VoyantGraphProjectDeployment; meta?: VoyantGraphJsonObject; } export declare function defineModule(input: DefineVoyantGraphUnitInput): VoyantGraphUnitManifest; export declare function defineExtension(input: DefineVoyantGraphUnitInput): VoyantGraphUnitManifest; export declare function definePlugin(input: DefineVoyantGraphUnitInput): VoyantGraphUnitManifest; export declare function defineAdapter(input: DefineVoyantGraphUnitInput): VoyantGraphUnitManifest; export declare function defineProvider(input: DefineVoyantGraphUnitInput): VoyantGraphUnitManifest; export declare function defineProject(input: DefineVoyantGraphProjectInput): VoyantGraphProject;