Skip to content

Commit cc2f3bf

Browse files
arnav777devsayan-das-in
authored andcommitted
refactor: remove unused AsyncActionResponseType and clean up polling logic
1 parent 4e0a4fd commit cc2f3bf

4 files changed

Lines changed: 8 additions & 21 deletions

File tree

packages/core/src/destination-kit/action.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,6 @@ export class Action<
675675

676676
// Construct the request client and perform the poll operation
677677
const requestClient = this.createRequestClient(dataBundle)
678-
if (!this.definition.pollStatus) {
679-
throw new IntegrationError('Poll method is not defined.', 'NotImplemented', 501)
680-
}
681678
const pollResponse = await this.definition.pollStatus(requestClient, dataBundle)
682679

683680
return pollResponse
@@ -817,17 +814,19 @@ export class Action<
817814
* Try to use the parsed response `.data` or `.content` string
818815
* @see {@link ../middleware/after-response/prepare-response.ts}
819816
*/
820-
821-
// Handle async action responses by returning them as it is
822-
if (response && typeof response === 'object' && (response as any).isAsync === true) {
823-
return response
824-
}
817+
console.log('[parseResponse] response type:', typeof response)
818+
console.log('[parseResponse] response instanceof Response:', response instanceof Response)
819+
console.log('[parseResponse] response value:', JSON.stringify(response))
820+
console.log('[parseResponse] response.data:', (response as ModifiedResponse).data)
825821

826822
if (response instanceof Response) {
827-
return (response as ModifiedResponse).data ?? (response as ModifiedResponse).content
823+
const result = (response as ModifiedResponse).data ?? (response as ModifiedResponse).content
824+
console.log('[parseResponse] extracted from Response — .data/.content:', JSON.stringify(result))
825+
return result
828826
}
829827

830828
// otherwise, we don't really know what this is, so return as-is
829+
console.log('[parseResponse] returning as-is (not a Response instance)')
831830
return response
832831
}
833832

packages/core/src/destination-kit/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import type {
2828
DeletionPayload,
2929
DynamicFieldResponse,
3030
ResultMultiStatusNode,
31-
AsyncActionResponseType,
3231
AsyncPollResponseType
3332
} from './types'
3433
import type { AllRequestOptions } from '../request-client'
@@ -47,7 +46,6 @@ export type {
4746
ExecuteInput,
4847
RequestFn,
4948
Result,
50-
AsyncActionResponseType,
5149
AsyncPollResponseType
5250
}
5351
export { hookTypeStrings }

packages/core/src/destination-kit/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,6 @@ export type ActionDestinationErrorResponseType = {
405405
body?: JSONLikeObject | string
406406
}
407407

408-
export type AsyncActionResponseType = {
409-
/** Indicates this is an async operation */
410-
isAsync: true
411-
/** Optional message about the async operation(s) */
412-
message?: string
413-
/** Initial status code */
414-
status?: number
415-
}
416-
417408
export type AsyncOperationResult = {
418409
/** The current status of this operation */
419410
status: 'pending' | 'completed' | 'failed'

packages/core/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export type {
8383
Logger,
8484
Preset,
8585
Result,
86-
AsyncActionResponseType,
8786
AsyncPollResponseType
8887
} from './destination-kit'
8988

0 commit comments

Comments
 (0)