@grouparoo/core
Version:
The Grouparoo Core
91 lines (90 loc) • 3.19 kB
TypeScript
import { Destination } from "./Destination";
import { GrouparooRecord } from "./GrouparooRecord";
import { Errors } from "../modules/errors";
import { PropertyTypes } from "./Property";
import { CommonModel } from "../classes/commonModel";
/**
* The GrouparooRecord Properties in their normal data types (string, boolean, date, etc)
*/
export interface ExportRecordProperties {
[key: string]: any | any[];
}
/**
* The GrouparooRecord Properties as stringified rawValues + types
*/
export interface ExportRecordPropertiesWithType {
[key: string]: {
type: typeof PropertyTypes[number];
rawValue: string | string[];
};
}
export declare const ExportStates: readonly ["draft", "pending", "processing", "canceled", "failed", "complete"];
export declare class Export extends CommonModel<Export> {
idPrefix(): string;
destinationId: string;
recordId: string;
exportProcessorId: string;
state: typeof ExportStates[number];
force: boolean;
startedAt: Date;
sendAt: Date;
retryCount: number;
completedAt: Date;
errorMessage: string;
errorLevel: Errors.ErrorLevel;
get oldRecordProperties(): ExportRecordProperties;
set oldRecordProperties(value: ExportRecordProperties);
get newRecordProperties(): ExportRecordProperties;
set newRecordProperties(value: ExportRecordProperties);
get oldGroups(): string[];
set oldGroups(value: string[]);
get newGroups(): string[];
set newGroups(value: string[]);
toDelete: boolean;
hasChanges: boolean;
destination: Destination;
record: GrouparooRecord;
setError(error: Error & {
errorLevel?: Export["errorLevel"];
}, retryDelay?: number): Promise<this>;
retry(retryDelay?: number, skipCount?: boolean): Promise<this>;
apiData(includeDestination?: boolean): Promise<{
id: string;
destination: {
id: string;
state: "ready" | "draft" | "deleted";
name: string;
groupId: string;
modelId: string;
};
destinationName: string;
recordId: string;
modelId: string;
exportProcessorId: string;
state: "failed" | "canceled" | "complete" | "pending" | "draft" | "processing";
force: boolean;
createdAt: number;
sendAt: number;
startedAt: number;
completedAt: number;
retryCount: number;
oldRecordProperties: ExportRecordProperties;
newRecordProperties: ExportRecordProperties;
oldGroups: string[];
newGroups: string[];
toDelete: boolean;
hasChanges: boolean;
errorMessage: string;
errorLevel: "error" | "info";
}>;
static defaultState: string;
static updateState(instance: Export): Promise<void>;
static ensureErrorLevel(instance: Export): void;
static logExport(instance: Export): Promise<void>;
static retryFailed(startDate: Date, endDate: Date, destination?: Destination, saveExports?: boolean): Promise<number>;
static retryById(exportId: string): Promise<number>;
static sweep(limit: number): Promise<{
count: number;
days: number;
}>;
}