@prismatic-io/spectral
Version:
Utility library for building Prismatic connectors and code-native integrations
34 lines (33 loc) • 3.41 kB
TypeScript
import { type CollectionType, type ComponentRegistry, type ConfigPages, type ConfigVar, type ConfigVarResultCollection, type Flow, type Inputs, type IntegrationDefinition, type QueueConfig, type StandardQueueConfig, type TriggerResult as TriggerPerformResult, type TriggerReference } from "../types";
import type { ActionContext, Component as ServerComponent, TriggerPayload, TriggerResult } from ".";
import { type ComponentReference as ServerComponentReference, type ConfigPage as ServerConfigPage, type RequiredConfigVariable as ServerRequiredConfigVariable } from "./integration";
export declare const CONCURRENCY_LIMIT_MAX = 15;
export declare const CONCURRENCY_LIMIT_MIN = 2;
export declare const convertIntegration: <TInputs extends Inputs, TActionInputs extends Inputs, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerPerformResult<TAllowsBranching, TPayload> = TriggerPerformResult<TAllowsBranching, TPayload>>(definition: IntegrationDefinition<TInputs, TActionInputs, TPayload, TAllowsBranching, TResult>) => ServerComponent<TInputs, TActionInputs, ConfigVarResultCollection, TPayload, TAllowsBranching, TResult>;
export declare const convertConfigPages: (pages: ConfigPages | undefined, userLevelConfigured: boolean) => ServerConfigPage[];
/** Converts typed QueueConfig to legacy format with usesFifoQueue and concurrencyLimit. */
export declare const convertQueueConfig: (queueConfig: QueueConfig) => StandardQueueConfig;
/** Converts a Flow into the structure necessary for YAML generation. */
export declare const convertFlow: <TInputs extends Inputs, TActionInputs extends Inputs, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerPerformResult<TAllowsBranching, TPayload> = TriggerPerformResult<TAllowsBranching, TPayload>>(flow: Flow<TInputs, TActionInputs, TPayload, TAllowsBranching, TResult>, componentRegistry: ComponentRegistry, referenceKey: string) => Record<string, unknown>;
/** Converts an input value to the expected server type by its collection type. */
export declare const convertInputValue: (value: unknown, collectionType: CollectionType | undefined) => unknown;
/** Converts a Config Var into the structure necessary for YAML generation. */
export declare const convertConfigVar: (key: string, configVar: ConfigVar, referenceKey: string, componentRegistry: ComponentRegistry) => ServerRequiredConfigVariable;
export declare const invokeTriggerComponentInput: (componentRef: ServerComponentReference, onTrigger: TriggerReference | undefined, eventName: "perform" | "onInstanceDeploy" | "onInstanceDelete" | "webhookCreate" | "webhookDelete") => {
component: {
key: string;
version: number | "LATEST";
isPublic: boolean;
} | {
key: string;
signature: string;
isPublic: boolean;
};
key: string;
triggerEventFunctionName: "perform" | "onInstanceDeploy" | "onInstanceDelete" | "webhookCreate" | "webhookDelete";
};
export type TriggerActionInvokeFunction = (ref: {
component: ServerComponentReference["component"];
key: string;
triggerEventFunctionName: "perform" | "onInstanceDeploy" | "onInstanceDelete" | "webhookCreate" | "webhookDelete";
}, context: ActionContext, payload: TriggerPayload | null, params: Record<string, unknown>) => Promise<TriggerResult>;