import { IntegrationDefinition, IntegrationInstance } from './../../jupiter-types'; import { GraphClient } from '../../graph'; import { PersisterClient } from '../../persister'; import { RawDataUploader } from '../../persister/types'; import { IntegrationCache } from '../cache/types'; import { IntegrationLogger } from '../types'; import { IntegrationJobKey } from './execution'; export declare type IntegrationServiceClientConfig = { integrationDefinitionId: string; integrationInstanceId: string; accountId: string; }; /** * Maintains references to API clients providing an interface to J1 services * within a managed integration execution environment. */ export interface J1ServiceClients { /** * Provides an API to read the J1 graph database. */ graph: GraphClient; /** * Provides an API to deliver operations to the J1 persister. */ persister: PersisterClient; integrationService: IntegrationServiceClient; /** * Provides an API to deliver raw data uploads to J1. */ rawDataUploader: RawDataUploader; } /** * A client providing access to integration meta data. */ export interface IntegrationServiceClient { /** * Provides the the start time of the last successfully completed * synchronization. This is useful for fetching provider data that has changed * since the last synchronization. */ lastSuccessfulSynchronizationTime: () => Promise; /** * Provides the complete set of `IntegrationInstance`s for this integration * within the J1 account. */ integrationInstances: () => Promise; /** * Create an `IntegrationInstance` for this integration within the J1 account. * This is useful in cases where an integration is capable of provisioning * additional instances automatically. * * The `accountId` and `integrationDefinitionId` will be overridden to prevent * integrations from creating instances outside their purview. */ createIntegrationInstance: (instance: Omit) => Promise; } export declare type IntegrationClientProviderConfig = { logger: IntegrationLogger; definition: IntegrationDefinition; instance: IntegrationInstance; accountId: string; timestamp: number; }; /** * Maintains external service clients within the lifecycle of an integration * execution process. */ export interface IntegrationClientProvider { /** * Provides initialized clients for the current invocation of the integration. * You may also get specific clients. * * @see getGraph * @see getPersister * @see getIntegrationService * @see getRawDataUploader */ getClients: () => J1ServiceClients; getGraph: () => GraphClient; /** * Provides an API to deliver operations to the J1 persister. */ getPersister: () => PersisterClient; getIntegrationService: () => IntegrationServiceClient; getRawDataUploader: () => RawDataUploader; /** * Provides an API to cache data between the steps of an integration. This * will throw an error when called outside a step execution handler. */ getCache: () => IntegrationCache; /** * Informs the provider of the start of executing integration processing. */ executionStarted: (jobKey: IntegrationJobKey | undefined) => Promise; /** * Informs the provider of the completion of executing integration processing. */ executionCompleted: () => Promise; }