-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): pull main into develop post release v1.90.2 (#4065)
- Loading branch information
Showing
16 changed files
with
91 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
# Only allow these users to create new hotfix branch from 'main' | ||
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc') | ||
if: github.ref == 'refs/heads/main' && (github.actor == 'vinayteki95' || github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc' || github.triggering_actor == 'vinayteki95') | ||
steps: | ||
- name: Create Branch | ||
uses: peterjgrainger/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 25 additions & 10 deletions
35
src/controllers/util/conversionStrategies/strategyV2ToV0.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
import { TransformationError } from '@rudderstack/integrations-lib'; | ||
import { SourceInputConversionResult, SourceInputV2 } from '../../../types'; | ||
import { VersionConversionStrategy } from './abstractions'; | ||
import { ErrorMessages } from '../../../constants'; | ||
|
||
export class StrategyV2ToV0 extends VersionConversionStrategy<SourceInputV2, NonNullable<unknown>> { | ||
convert(sourceEvents: SourceInputV2[]): SourceInputConversionResult<NonNullable<unknown>>[] { | ||
return sourceEvents.map((sourceEvent) => { | ||
try { | ||
const v0Event = JSON.parse(sourceEvent.request.body); | ||
return { output: v0Event }; | ||
} catch (err) { | ||
const conversionError = | ||
err instanceof Error ? err : new Error('error converting v2 to v0 spec'); | ||
return { conversionError }; | ||
} | ||
}); | ||
return sourceEvents.map((sourceEvent) => this.convertSingleEvent(sourceEvent)); | ||
} | ||
|
||
private convertSingleEvent( | ||
sourceEvent: SourceInputV2, | ||
): SourceInputConversionResult<NonNullable<unknown>> { | ||
try { | ||
const v0Event = this.parseRequestBody(sourceEvent.request.body); | ||
return { output: v0Event }; | ||
} catch (err) { | ||
const conversionError = | ||
err instanceof TransformationError ? err : new Error('error converting v2 to v0 spec'); | ||
|
||
return { conversionError }; | ||
} | ||
} | ||
|
||
private parseRequestBody(body: string): NonNullable<unknown> { | ||
try { | ||
return JSON.parse(body); | ||
} catch (err) { | ||
throw new TransformationError(ErrorMessages.JSONParseError); | ||
} | ||
} | ||
} |
34 changes: 24 additions & 10 deletions
34
src/controllers/util/conversionStrategies/strategyV2ToV1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import { TransformationError } from '@rudderstack/integrations-lib'; | ||
import { SourceInput, SourceInputConversionResult, SourceInputV2 } from '../../../types'; | ||
import { VersionConversionStrategy } from './abstractions'; | ||
|
||
export class StrategyV2ToV1 extends VersionConversionStrategy<SourceInputV2, SourceInput> { | ||
convert(sourceEvents: SourceInputV2[]): SourceInputConversionResult<SourceInput>[] { | ||
return sourceEvents.map((sourceEvent) => { | ||
try { | ||
const v1Event = { event: JSON.parse(sourceEvent.request.body), source: sourceEvent.source }; | ||
return { output: v1Event }; | ||
} catch (err) { | ||
const conversionError = | ||
err instanceof Error ? err : new Error('error converting v2 to v1 spec'); | ||
return { conversionError }; | ||
} | ||
}); | ||
return sourceEvents.map((sourceEvent) => this.convertSingleEvent(sourceEvent)); | ||
} | ||
|
||
private convertSingleEvent(sourceEvent: SourceInputV2): SourceInputConversionResult<SourceInput> { | ||
try { | ||
const v1Event = { | ||
event: this.parseRequestBody(sourceEvent.request.body), | ||
source: sourceEvent.source, | ||
}; | ||
return { output: v1Event }; | ||
} catch (err) { | ||
const conversionError = | ||
err instanceof TransformationError ? err : new Error('error converting v2 to v1 spec'); | ||
return { conversionError }; | ||
} | ||
} | ||
|
||
private parseRequestBody(body: string): NonNullable<unknown> { | ||
try { | ||
return JSON.parse(body); | ||
} catch (err) { | ||
throw new TransformationError('Malformed JSON in request body'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters