UNPKG

@grouparoo/core

Version:
94 lines (93 loc) 4.34 kB
import { Destination, SimpleDestinationOptions } from "../../models/Destination"; import { GrouparooRecord } from "../../models/GrouparooRecord"; import { Export } from "../../models/Export"; import { Group } from "../../models/Group"; import { Property } from "../../models/Property"; import { ErrorWithRecordId, DestinationMappingOptionsResponseType, DestinationMappingOptionsMethodResponse } from "../../classes/plugin"; import { ExportProcessor } from "../../models/ExportProcessor"; import { Run } from "../../models/Run"; import { MappingHelper } from "../mappingHelper"; export declare namespace DestinationOps { /** * Export all the Group Members of the Groups that this Destination is Tracking */ function exportMembers(destination: Destination): Promise<Run>; function updateTracking(destination: Destination, collection: Destination["collection"], collectionId?: string): Promise<{ oldRun: Run; newRun: Run; }>; /** * Get a preview of a GrouparooRecord for this Destination * It is assumed that the record provided is already in a Group tracked by this Destination */ function recordPreview(destination: Destination, record: GrouparooRecord, mapping: MappingHelper.Mappings, destinationGroupMemberships: { [groupId: string]: string; }): Promise<{ id: string; state: "pending" | "ready" | "draft" | "deleted"; modelId: string; modelName: string; groupIds: string[]; invalid: boolean; properties: import("./record").RecordPropertyType; createdAt: number; updatedAt: number; } & { properties: Record<string, any>; groupNames: string[]; }>; /** * Get the Destination Connection's supported Sync Modes */ function getSupportedSyncModes(destination: Destination): Promise<{ supportedModes: ("sync" | "additive" | "enrich")[]; defaultMode: "sync" | "additive" | "enrich"; }>; /** * Get the Destination Connection Options from the plugin */ function destinationConnectionOptions(destination: Destination, destinationOptions?: SimpleDestinationOptions): Promise<import("../../classes/plugin").DestinationOptionsMethodResponse>; /** * Get the Destination Mapping Options from the Plugin */ function destinationMappingOptions(destination: Destination, cached?: boolean, saveCache?: boolean): Promise<DestinationMappingOptionsMethodResponse>; function getExportArrayProperties(destination: Destination): Promise<import("../../classes/plugin").ExportArrayPropertiesMethodResponse>; /** * Given a Destination and GrouparooRecords (and lots of related data), create all the exports that should be sent */ function exportRecords(destination: Destination, records: GrouparooRecord[], synchronous?: boolean, force?: boolean, saveExports?: boolean, toDelete?: boolean): Promise<Export[]>; interface CombinedError extends Error { errors?: ErrorWithRecordId[]; } function runExportProcessor(destination: Destination, exportProcessor: ExportProcessor): Promise<{ success: boolean; error: Error; retryDelay: number; retryexportIds: string[]; } | { success: boolean; error: CombinedError; retryDelay?: undefined; retryexportIds?: undefined; }>; function sendExports(destination: Destination, givenExports: Export[], synchronous?: boolean): Promise<{ retryDelay: number; retryexportIds: string[]; success: boolean; error: Error; }>; function sendExport(destination: Destination, _export: Export, synchronous?: boolean): Promise<{ retryDelay: number; retryexportIds: string[]; success: boolean; error: Error; }>; /** * Format Grouparoo's record properties to the type the destination wants. */ function formatOutgoingRecordProperties(value: unknown, grouparooType: Property["type"], destinationType: DestinationMappingOptionsResponseType): DestinationMappingOptionsResponseType; /** * Determine which destinations are interested in this record due to the groups they are tracking */ function relevantFor(record: GrouparooRecord, groups?: Group[]): Promise<Destination[]>; }