Skip to content

Commit

Permalink
Merge pull request #786 from zapier/PDE-4991
Browse files Browse the repository at this point in the history
feat(core): Define types for performBulk
  • Loading branch information
kola-er committed May 15, 2024
2 parents b02b238 + 5b7ac13 commit e88b4e5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,38 @@ export interface ZObject {
delete: (key: string) => Promise<boolean>;
};
}

interface PerformBulkSuccessItem {
outputData: { [x: string]: any };
error?: string;
}

interface PerformBulkErrorItem {
outputData?: { [x: string]: any };
error: string;
}

export type PerformBulkItem = PerformBulkSuccessItem | PerformBulkErrorItem;

export interface BufferedBundle<InputData = { [x: string]: any }> {
inputData: InputData;
meta: {
id: string;
[x: string]: any;
};
}

export interface BulkBundle<InputData = { [x: string]: any }> {
authData: { [x: string]: string };
bulk: BufferedBundle<InputData>[];
groupedBy: { [x: string]: string };
}

export interface PerformBulkResult {
[id: string]: PerformBulkItem;
}

export const performBulk: (
z: ZObject,
bundle: BulkBundle
) => Promise<PerformBulkResult>;

0 comments on commit e88b4e5

Please sign in to comment.