Skip to content

Commit

Permalink
Merge branch 'develop' into refactor.sources-to-v2-batch2
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayteki95 authored Feb 18, 2025
2 parents f136015 + c272267 commit bc7b3d9
Show file tree
Hide file tree
Showing 20 changed files with 1,043 additions and 335 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-user-transformer-image:
name: Build User Transformer Docker Image - PR
Expand All @@ -69,4 +69,4 @@ jobs:
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
workflow_url:
type: string
secrets:
DOCKERHUB_PROD_TOKEN:
DOCKERHUB_TOKEN:
required: true

env:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
push_target: production
use_merge_sha: true
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-user-transformer-image:
name: Build User Transformer Docker Image - Dev
Expand All @@ -78,4 +78,4 @@ jobs:
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
use_merge_sha: true
skip_tests: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}}
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

create-pull-request:
name: Update Helm Charts For Production and Create Pull Request
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
use_merge_sha: true
skip_tests: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}}
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

create-pull-request:
name: Update Helm Charts For Production and Create Pull Request
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-for-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
push_target: production
use_merge_sha: true
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-user-transformer-image:
name: Build User Transformer Docker Image - Staging
Expand All @@ -71,7 +71,7 @@ jobs:
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

create-pull-request:
name: Update Helm Charts For Staging and Create Pull Request
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"json-diff": "^1.0.3",
"json-size": "^1.0.0",
"jsontoxml": "^1.0.1",
"koa": "^2.15.3",
"koa": "^2.15.4",
"koa-bodyparser": "^4.4.0",
"koa2-swagger-ui": "^5.7.0",
"libphonenumber-js": "^1.11.18",
Expand Down
3 changes: 2 additions & 1 deletion src/cdk/v2/destinations/http/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ steps:
- name: prepareBody
template: |
const payload = $.getCustomMappings(.message, .destination.Config.propertiesMapping);
const propertiesMapping = .destination.Config.isDefaultMapping ? [{"to": "$", "from": "$"}] : .destination.Config.propertiesMapping;
const payload = $.getCustomMappings(.message, propertiesMapping);
$.context.payload = $.prepareBody(payload, $.context.format, .destination.Config.xmlRootKey);
- name: buildResponseForProcessTransformation
Expand Down
4 changes: 2 additions & 2 deletions src/cdk/v2/destinations/zoho/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const DATA_CENTRE_BASE_ENDPOINTS_MAP = {
};

const getBaseEndpoint = (dataServer) => DATA_CENTRE_BASE_ENDPOINTS_MAP[dataServer];
const COMMON_RECORD_ENDPOINT = (dataCenter = 'US') =>
`${getBaseEndpoint(dataCenter)}/crm/v6/moduleType`;
const COMMON_RECORD_ENDPOINT = (dataCenter) =>
`${getBaseEndpoint(dataCenter || 'US')}/crm/v6/moduleType`;

// ref: https://www.zoho.com/crm/developer/docs/api/v6/insert-records.html#:~:text=%2DX%20POST-,System%2Ddefined%20mandatory%20fields%20for%20each%20module,-While%20inserting%20records
const MODULE_MANDATORY_FIELD_CONFIG = {
Expand Down
17 changes: 6 additions & 11 deletions src/cdk/v2/destinations/zoho/transformRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const responseBuilder = (
identifierType,
operationModuleType,
commonEndPoint,
action,
isUpsert,
metadata,
) => {
const { trigger, addDefaultDuplicateCheck, multiSelectFieldLevelDecision } = config;
Expand All @@ -43,7 +43,7 @@ const responseBuilder = (
Authorization: `Zoho-oauthtoken ${metadata[0].secret.accessToken}`,
};

if (action === 'insert' || action === 'update') {
if (isUpsert) {
const payload = {
duplicate_check_fields: handleDuplicateCheck(
addDefaultDuplicateCheck,
Expand All @@ -70,7 +70,6 @@ const batchResponseBuilder = (
identifierType,
operationModuleType,
upsertEndPoint,
action,
) => {
const upsertResponseArray = [];
const deletionResponseArray = [];
Expand Down Expand Up @@ -101,7 +100,7 @@ const batchResponseBuilder = (
identifierType,
operationModuleType,
upsertEndPoint,
action,
true,
upsertmetadataChunks.items[0],
),
);
Expand All @@ -115,7 +114,7 @@ const batchResponseBuilder = (
identifierType,
operationModuleType,
upsertEndPoint,
action,
false,
deletionmetadataChunks.items[0],
),
);
Expand Down Expand Up @@ -226,13 +225,12 @@ const handleDeletion = async (
*/
const processInput = async (
input,
action,
operationModuleType,
Config,
transformedResponseToBeBatched,
errorResponseList,
) => {
const { fields } = input.message;
const { fields, action } = input.message;

if (isEmptyObject(fields)) {
const emptyFieldsError = new InstrumentationError('`fields` cannot be empty');
Expand Down Expand Up @@ -285,7 +283,6 @@ const processRecordInputs = async (inputs, destination) => {
const response = [];
const errorResponseList = [];
const { Config } = destination;
const { action } = inputs[0].message;

const transformedResponseToBeBatched = {
upsertData: [],
Expand All @@ -296,13 +293,12 @@ const processRecordInputs = async (inputs, destination) => {

const { operationModuleType, identifierType, upsertEndPoint } = deduceModuleInfo(inputs, Config);

validateConfigurationIssue(Config, operationModuleType, action);
validateConfigurationIssue(Config, operationModuleType);

await Promise.all(
inputs.map((input) =>
processInput(
input,
action,
operationModuleType,
Config,
transformedResponseToBeBatched,
Expand All @@ -322,7 +318,6 @@ const processRecordInputs = async (inputs, destination) => {
identifierType,
operationModuleType,
upsertEndPoint,
action,
);

if (upsertResponseArray.length === 0 && deletionResponseArray.length === 0) {
Expand Down
Loading

0 comments on commit bc7b3d9

Please sign in to comment.