File tree Expand file tree Collapse file tree 4 files changed +15
-8
lines changed
Expand file tree Collapse file tree 4 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @linkedapi/node" ,
3- "version" : " 1.2.16 " ,
3+ "version" : " 1.2.17 " ,
44 "description" : " Control your LinkedIn accounts and retrieve real-time data, all through this Node.js SDK." ,
55 "main" : " dist/index.js" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change 66 TLinkedApiErrorType ,
77 TWorkflowCancelResponse ,
88 TWorkflowCompletion ,
9+ TWorkflowInProgressStatus ,
910 TWorkflowResponse ,
10- TWorkflowRunningStatus ,
1111} from '../types' ;
1212
1313import { pollWorkflowResult } from './poll-results' ;
@@ -83,9 +83,12 @@ export abstract class Operation<TParams, TResult> {
8383
8484 public async status (
8585 workflowId : string ,
86- ) : Promise < TWorkflowRunningStatus | TMappedResponse < TResult > > {
86+ ) : Promise < TWorkflowInProgressStatus | TMappedResponse < TResult > > {
8787 const workflowResult = await this . getWorkflowResult ( workflowId ) ;
88- if ( workflowResult . workflowStatus === 'running' ) {
88+ if (
89+ workflowResult . workflowStatus === 'running' ||
90+ workflowResult . workflowStatus === 'pending'
91+ ) {
8992 return workflowResult . workflowStatus ;
9093 }
9194 const result = this . getCompletion ( workflowResult ) ;
Original file line number Diff line number Diff line change 1- import { LinkedApiError , TWorkflowRunningStatus } from '../types' ;
1+ import { LinkedApiError , TWorkflowInProgressStatus } from '../types' ;
22
33import { WaitForCompletionOptions } from './operation' ;
44
55export async function pollWorkflowResult < TResult > (
6- workflowResultFn : ( ) => Promise < TWorkflowRunningStatus | TResult > ,
6+ workflowResultFn : ( ) => Promise < TWorkflowInProgressStatus | TResult > ,
77 options : WaitForCompletionOptions ,
88) : Promise < TResult > {
99 const sleep = ( ms : number ) => new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
@@ -18,7 +18,7 @@ export async function pollWorkflowResult<TResult>(
1818 try {
1919 const result = await workflowResultFn ( ) ;
2020
21- if ( result !== 'running' ) {
21+ if ( result !== 'running' && result !== 'pending' ) {
2222 return result ;
2323 }
2424 invalidAttempts = 0 ;
Original file line number Diff line number Diff line change @@ -9,9 +9,13 @@ export type TWorkflowDefinition =
99 | TSingleActionWorkflowDefinition
1010 | TSingleActionWorkflowDefinition [ ] ;
1111
12+ export type TWorkflowPendingStatus = 'pending' ;
13+
1214export type TWorkflowRunningStatus = 'running' ;
1315
14- export type TWorkflowStatus = TWorkflowRunningStatus | 'completed' | 'failed' ;
16+ export type TWorkflowInProgressStatus = TWorkflowPendingStatus | TWorkflowRunningStatus ;
17+
18+ export type TWorkflowStatus = TWorkflowInProgressStatus | 'completed' | 'failed' ;
1519
1620export type TWorkflowCompletion < TResult extends TWorkflowData = TWorkflowData > =
1721 | TWorkflowCompletionSingleAction < TResult >
You can’t perform that action at this time.
0 commit comments