diff --git a/.changeset/small-moles-judge.md b/.changeset/small-moles-judge.md new file mode 100644 index 000000000..c21347d3c --- /dev/null +++ b/.changeset/small-moles-judge.md @@ -0,0 +1,8 @@ +--- +'@flatfile/plugin-connect-via-merge': patch +'@flatfile/plugin-space-configure': patch +'@flatfile/plugin-job-handler': patch +'@flatfile/util-extractor': patch +--- + +Fix tick params diff --git a/plugins/job-handler/src/job.handler.ts b/plugins/job-handler/src/job.handler.ts index ec6a00233..c3387a2b4 100644 --- a/plugins/job-handler/src/job.handler.ts +++ b/plugins/job-handler/src/job.handler.ts @@ -29,7 +29,7 @@ export function jobHandler( job: string, handler: ( event: FlatfileEvent, - tick: (progress?: number, message?: string) => Promise + tick: (progress: number, message?: string) => Promise ) => Promise, opts: PluginOptions = {} ) { @@ -42,10 +42,10 @@ export function jobHandler( progress: 10, }) - const tick = async (progress: number, info: string) => { + const tick = async (progress: number, info?: string) => { return await api.jobs.ack(jobId, { - info, progress, + ...(info !== undefined && { info }), }) } diff --git a/plugins/merge-connection/src/index.ts b/plugins/merge-connection/src/index.ts index 885900753..a9eafd8b7 100644 --- a/plugins/merge-connection/src/index.ts +++ b/plugins/merge-connection/src/index.ts @@ -79,7 +79,7 @@ export default function mergePlugin() { function handleCreateConnectedWorkbooks() { return async ( event: FlatfileEvent, - tick: (progress?: number, message?: string) => Promise + tick: (progress: number, message?: string) => Promise ) => { try { const { spaceId, environmentId, jobId } = event.context @@ -191,7 +191,7 @@ function handleCreateConnectedWorkbooks() { function handleConnectedWorkbookSync() { return async ( event: FlatfileEvent, - tick: (progress?: number, message?: string) => Promise + tick: (progress: number, message?: string) => Promise ) => { try { const { spaceId, workbookId, environmentId } = event.context @@ -296,7 +296,7 @@ async function checkAllSyncsComplete( async function waitForMergeSync( mergeClient: MergeClient, category: string, - tick: (progress?: number, message?: string) => Promise + tick: (progress: number, message?: string) => Promise ): Promise { try { let attempts = 0 diff --git a/plugins/space-configure/src/space.configure.ts b/plugins/space-configure/src/space.configure.ts index 6ddd14a10..520b0d419 100644 --- a/plugins/space-configure/src/space.configure.ts +++ b/plugins/space-configure/src/space.configure.ts @@ -25,7 +25,7 @@ export function configureSpace( callback?: ( event: FlatfileEvent, workbookIds: string[], - tick: (progress?: number, message?: string) => Promise + tick: (progress: number, message?: string) => Promise ) => any | Promise ) { return function (listener: FlatfileListener) { diff --git a/utils/extractor/src/index.ts b/utils/extractor/src/index.ts index de6067aa9..9e681b5e2 100644 --- a/utils/extractor/src/index.ts +++ b/utils/extractor/src/index.ts @@ -48,7 +48,7 @@ export const Extractor = ( const buffer = await getFileBuffer(event) const { jobId } = event.context try { - const tick = async (progress: number, info: string) => { + const tick = async (progress: number, info?: string) => { await api.jobs.ack(jobId, { progress, info }) if (debug) { console.log(`Job progress: ${progress}, Info: ${info}`)