Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cm360 batching support #2651
feat: cm360 batching support #2651
Changes from all commits
f44a105
3771b3d
3e589e7
44f1048
0cf895e
d7ca5c7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 12 in src/v0/destinations/campaign_manager/networkHandler.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/networkHandler.js#L12
Check warning on line 28 in src/v0/destinations/campaign_manager/networkHandler.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/networkHandler.js#L27-L28
Check warning on line 33 in src/v0/destinations/campaign_manager/networkHandler.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/networkHandler.js#L31-L33
Check warning on line 35 in src/v0/destinations/campaign_manager/networkHandler.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/networkHandler.js#L35
Check warning on line 42 in src/v0/destinations/campaign_manager/networkHandler.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/networkHandler.js#L42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this always return in milliseconds only irrespective of input passed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If input is
1668624722555000
(this is in microseconds, year 2022) , the date utility still considers it is in milliseconds and convert this to 054846-08-12T03:22:35.000Z (year 5000) , when we call getTime it return 1668624722555000, so doing no of digits check here.Same case with
1668624722
it considers it in ms, and getTime return it in1668624722
, so need to multiply by 6There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think one alternative thing we can do if they pass
timestamp in properties
, we can make it mandatory to pass it in microSeconds and get rid of this conversion at our endThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Example usage:
const input1 = "2023-10-11T12:34:56.789Z"; // ISO 8601 date string with milliseconds
const input2 = "1633956896789"; // Milliseconds
const input3 = "1633956896789000"; // Microseconds
console.log(convertToMicroseconds(input1)); // Output: 1633956896789000
console.log(convertToMicroseconds(input2)); // Output: 1633956896789000
console.log(convertToMicroseconds(input3)); // Output: 1633956896789000
This code defines the convertToMicroseconds function, which first checks if the input is a valid date string (ISO 8601 format). If it is, it checks whether the input has milliseconds or not and converts it accordingly. If the input is a numeric string, it checks its length to determine whether it's in milliseconds or microseconds. If the input doesn't match any of these formats, it throws an error for an invalid input format.
Source: chatgpt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(convertToMicroseconds("2022-11-17T00:22:02.903+05:30"));
o/p -->>1668624722903000000 (in nanosweconds)
will modify this a bit
Check warning on line 98 in src/v0/destinations/campaign_manager/transform.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/transform.js#L98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could keep this ev.message.body.JSON in a variable and reuse it instead of typing long strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will override the encryptionInfo, is this expected?
Check warning on line 269 in src/v0/destinations/campaign_manager/transform.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/transform.js#L269
Check warning on line 280 in src/v0/destinations/campaign_manager/transform.js
Codecov / codecov/patch
src/v0/destinations/campaign_manager/transform.js#L280