@grouparoo/core
Version:
The Grouparoo Core
168 lines (167 loc) • 6.89 kB
TypeScript
import { ScheduleConfigurationObject, SourceConfigurationObject } from "../classes/codeConfig";
import { MappingHelper } from "./../modules/mappingHelper";
import { OptionHelper } from "./../modules/optionHelper";
import { App } from "./App";
import { Mapping } from "./Mapping";
import { Option } from "./Option";
import { Schedule } from "./Schedule";
import { GrouparooRecord } from "./GrouparooRecord";
import { Property, PropertyFiltersWithKey, SimplePropertyOptions, PropertyTypes } from "./Property";
import { Run } from "./Run";
import { GrouparooModel } from "./GrouparooModel";
import { CommonModel } from "../classes/commonModel";
export interface BootstrapUniquePropertyParams {
mappedColumn: string;
key?: string;
type?: typeof PropertyTypes[number];
id?: string;
local?: boolean;
propertyOptions?: Record<string, any>;
sourceOptions?: Record<string, any>;
}
export interface SimpleSourceOptions extends OptionHelper.SimpleOptions {
}
export interface SourceMapping extends MappingHelper.Mappings {
}
declare const STATES: readonly ["draft", "ready", "deleted"];
export declare class Source extends CommonModel<Source> {
idPrefix(): string;
appId: string;
name: string;
type: string;
state: typeof STATES[number];
locked: string;
modelId: string;
app: App;
schedule: Schedule;
mappings: Mapping[];
properties: Property[];
__options: Option[];
model: GrouparooModel;
getOptions(sourceFromEnvironment?: boolean): Promise<OptionHelper.SimpleOptions>;
setOptions(options: SimpleSourceOptions, externallyValidate?: boolean): Promise<void>;
afterSetOptions(hasChanges: boolean): Promise<void>;
validateOptions(options?: SimpleSourceOptions, externallyValidate?: boolean): Promise<void>;
getPlugin(): Promise<{
plugin: import("..").GrouparooPlugin;
pluginConnection: import("..").PluginConnection;
pluginApp: import("..").PluginApp;
}>;
parameterizedOptions(run?: Run): Promise<SimpleSourceOptions>;
getMapping(): Promise<MappingHelper.Mappings>;
setMapping(mappings: SourceMapping, externallyValidate?: boolean): Promise<void>;
afterSetMapping(): Promise<void>;
validateMapping(): Promise<boolean>;
sourceConnectionOptions(sourceOptions?: SimpleSourceOptions): Promise<import("..").SourceOptionsMethodResponse>;
sourcePreview(sourceOptions?: SimpleSourceOptions): Promise<import("..").SourcePreviewMethodResponseRow[]>;
defaultPropertyOptions(): Promise<{
key: string;
displayName?: string;
default?: boolean;
description: string;
required: boolean;
type: string;
primary?: boolean;
options: {
key: string;
description?: string;
default?: boolean;
examples?: any[];
}[];
}[]>;
apiData(): Promise<{
id: string;
name: string;
type: string;
state: "ready" | "draft" | "deleted";
mapping: MappingHelper.Mappings;
app: {
id: string;
name: string;
icon: string;
type: string;
state: "ready" | "draft" | "deleted";
locked: string;
options: OptionHelper.SimpleOptions;
provides: {
source: boolean;
destination: boolean;
};
pluginName: string;
pluginApp: import("..").PluginApp;
refreshQueryAvailable: boolean;
createdAt: number;
updatedAt: number;
appRefreshQuery: {
id: string;
appId: string;
refreshQuery: string;
value: string;
locked: string;
state: "ready" | "draft";
lastChangedAt: number;
lastConfirmedAt: number;
recurringFrequency: number;
createdAt: number;
updatedAt: number;
};
};
appId: string;
modelName: string;
modelId: string;
scheduleAvailable: boolean;
schedule: {
id: string;
name: string;
state: "ready" | "draft";
sourceId: string;
incremental: boolean;
recurring: boolean;
refreshEnabled: boolean;
locked: string;
confirmRecords: boolean;
supportIncrementalSchedule: boolean;
options: OptionHelper.SimpleOptions;
filters: import("../modules/filterHelper").FilterHelper.FiltersWithKey[];
recurringFrequency: number;
createdAt: number;
updatedAt: number;
};
previewAvailable: boolean;
locked: string;
options: OptionHelper.SimpleOptions;
connection: import("..").PluginConnection;
createdAt: number;
updatedAt: number;
}>;
scheduleAvailable(): Promise<boolean>;
previewAvailable(): Promise<boolean>;
importRecordProperty(record: GrouparooRecord, property: Property, propertyOptionsOverride?: OptionHelper.SimpleOptions, propertyFiltersOverride?: PropertyFiltersWithKey[]): Promise<import("..").RecordPropertyPluginMethodResponse>;
importRecordProperties(records: GrouparooRecord[], properties: Property[], propertyOptionsOverride?: {
[key: string]: SimplePropertyOptions;
}, propertyFiltersOverride?: {
[key: string]: PropertyFiltersWithKey[];
}): Promise<import("..").RecordPropertiesPluginMethodResponse>;
import(record: GrouparooRecord): Promise<{
canImport: boolean;
properties: Record<string, import("..").RecordPropertyPluginMethodResponse>;
}>;
bootstrapUniqueProperty(params: BootstrapUniquePropertyParams): Promise<Property>;
getConfigId(): string;
getConfigObject(): Promise<SourceConfigurationObject | [SourceConfigurationObject, ScheduleConfigurationObject]>;
static ensureModel(instance: Source): Promise<void>;
static ensurePluginConnection(instance: Source): Promise<void>;
static ensureAppReady(instance: Source): Promise<void>;
static ensureSupportedAppType(instance: Source): Promise<void>;
static updateState(instance: Source): Promise<void>;
static noUpdateIfLocked(instance: Source): Promise<void>;
static determinePrimaryKeyProperty(instance: Source): Promise<void>;
static ensureNotInUse(instance: Source): Promise<void>;
static ensurePrimaryKeyPropertyNotInUse(instance: Source): Promise<void>;
static noDestroyIfLocked(instance: Source): Promise<void>;
static destroyOptions(instance: Source): Promise<number>;
static destroyMappings(instance: Source): Promise<number>;
static destroyPrimaryKeyProperty(instance: Source): Promise<void>;
static invalidateCache(): Promise<void>;
}
export {};