-
Notifications
You must be signed in to change notification settings - Fork 139
[STRATCONN-588] Generate bundledConfigIds #555
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
Changes from all commits
3334c3a
9e6652b
9d2e22a
7bbbcb4
f9960cc
7d544aa
8569f31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ var utm = require('@segment/utm-params'); | |
| var uuid = require('@lukeed/uuid').v4; | ||
| var Queue = require('@segment/localstorage-retry'); | ||
|
|
||
| const json = JSON; | ||
| var json = JSON; | ||
|
|
||
| /** | ||
| * Cookie options | ||
|
|
@@ -64,7 +64,9 @@ var Segment = (exports = module.exports = integration('Segment.io') | |
| .option('saveCrossDomainIdInLocalStorage', true) | ||
| .option('retryQueue', true) | ||
| .option('addBundledMetadata', false) | ||
| .option('unbundledIntegrations', [])); | ||
| .option('unbundledIntegrations', [])) | ||
| .option('unbundledConfigIds', []) | ||
| .option('maybeBundledConfigIds', {}); | ||
|
Comment on lines
+68
to
+69
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we were to conditionally add these arrays in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. I agree. |
||
|
|
||
| /** | ||
| * Get the store. | ||
|
|
@@ -315,11 +317,31 @@ Segment.prototype.normalize = function(message) { | |
| } | ||
| if (this.options.addBundledMetadata) { | ||
| var bundled = keys(this.analytics.Integrations); | ||
| var maybeBundledConfigIds = this.options.maybeBundledConfigIds | ||
|
|
||
| // Generate a list of bundled config IDs using the intersection of | ||
| // bundled destination names and maybe bundled config IDs. | ||
| var bundledConfigIds = [] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so -- |
||
| for (var i = 0; i < bundled.length; i++) { | ||
| var name = bundled[i] | ||
| if (!maybeBundledConfigIds) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be clearer if this conditional was outside of the loop since it does not depend on anything in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd have to refactor and wrap the for-loop in a conditional. I can go either way but was trying to avoid nested conditionals. |
||
| break | ||
| } | ||
| if (!maybeBundledConfigIds[name]) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the casing is the same of destination names in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, the casing here is the same but they depend on two different sources. The chance of these being different is unlikely but possible. Fwiw, the integration wouldn't receive the proper settings if the name within the integration code doesn't match the destination creation name because settings are keyed by the definition creation name.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to Gabe's comment, I spot checked a few destinations which I know have undergone name changes and the name defined in integration code marched the definition creation name. |
||
| continue | ||
| } | ||
|
|
||
| for (var j = 0; j < maybeBundledConfigIds[name].length; j++) { | ||
| var id = maybeBundledConfigIds[name][j] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we maybe want to see if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comment here regarding this https://github.com/segmentio/ajs-renderer/pull/256/files#r577105220 |
||
| bundledConfigIds.push(id) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| msg._metadata = msg._metadata || {}; | ||
| msg._metadata.bundled = bundled; | ||
| msg._metadata.unbundled = this.options.unbundledIntegrations; | ||
| msg._metadata.bundledConfigIds = this.options.bundledConfigIds; | ||
| msg._metadata.unbundledConfigIds = this.options.unbundledConfigIds; | ||
| msg._metadata.bundledIds = bundledConfigIds; | ||
| } | ||
| this.debug('normalized %o', msg); | ||
| this.ampId(ctx); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 was unintentionally switched to
constin #553.