-
Notifications
You must be signed in to change notification settings - Fork 83
feat: datafile accessor #535
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
674c9bd
refactor: modify datafile-manager to require, use, and return datafil…
pthompson127 09bf4bc
docs: modify params of createInstance methods (in browser, Node, and …
pthompson127 27ceed7
refactor: modify datafile setter to handle case for datafile object/i…
pthompson127 434ab3e
refactor: add helper function to take care of setting datafile and cr…
pthompson127 9a136d0
feat: add toDatafile() method in OptimizelyConfig
pthompson127 38d7b92
refactor: remove accidental formatting changes
pthompson127 c2ff808
Merge branch 'master' of https://github.com/optimizely/javascript-sdk…
pthompson127 6762ff5
getDatafile tweaks
48b2d44
Don't set null
5e3bea5
refactor: address PR requested changes
pthompson127 68b532c
docs: fix datafile accessor methods descriptions
pthompson127 f8120f4
style: fix styling and typos
pthompson127 229a971
test: update httpPollingDatafileManager test to account for datafile …
pthompson127 f7dec26
test: update tests to comply with change in datafile format
pthompson127 8fc3baf
merge: pull from master after datafile-manager updates and resolve me…
pthompson127 1e7f54e
test: modify existing tests to account for datafile accessor changes
pthompson127 5957dce
test: re-adding logs to comply with browser tests
pthompson127 efe28e8
fix: add import statement for log messages
pthompson127 244f8ff
updated dfm package
msohailhussain e9535f8
stringified datafile
msohailhussain 6f85f62
Merge branch 'master' into peter/getDatafile
msohailhussain 8e7688d
conflicts resolved.
msohailhussain b7278bc
lint fix
msohailhussain efbebb2
comments resolved
mnoman09 e87d8a1
reverting these changes as its causing error
mnoman09 1abe037
returning optimizelyConfig as default
mnoman09 1623409
resolved fixes
msohailhussain 87a1746
remove this.createProjectConfig stubbing
msohailhussain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -110,12 +110,26 @@ function getFeaturesMap(configObj, allExperiments) { | |
}, {}); | ||
} | ||
|
||
export var getOptimizelyConfig = function(configObj) { | ||
// Fetch all feature variables from feature flags to merge them with variation variables | ||
var experimentsMap = getExperimentsMap(configObj); | ||
return { | ||
experimentsMap: experimentsMap, | ||
featuresMap: getFeaturesMap(configObj, experimentsMap), | ||
revision: configObj.revision, | ||
}; | ||
}; | ||
/** | ||
* The OptimizelyConfig class | ||
* @param {Object} configObj | ||
* @param {string} datafile | ||
*/ | ||
export function OptimizelyConfig(configObj, datafile) { | ||
this.experimentsMap = getExperimentsMap(configObj); | ||
this.featuresMap = getFeaturesMap(configObj, this.experimentsMap); | ||
this.revision = configObj.revision; | ||
this.__datafile = datafile; | ||
} | ||
|
||
/** | ||
* Get the datafile | ||
* @returns {string} JSON string representation of the datafile that was used to create the current config object | ||
*/ | ||
OptimizelyConfig.prototype.getDatafile = function() { | ||
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. Please add a JSDoc comment with the return type. |
||
return this.__datafile; | ||
} | ||
|
||
export default { | ||
OptimizelyConfig: OptimizelyConfig | ||
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. unable to stub, that's why passing object. |
||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
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.
Oops...I thought your branch was based on https://github.com/optimizely/javascript-sdk/tree/mcarroll/optimizely-sdk-typescript, so I suggested adding some newer syntax. But I see now this PR is against master. I suppose the easiest thing now is to wait until we can merge https://github.com/optimizely/javascript-sdk/tree/mcarroll/optimizely-sdk-typescript into master before merging these changes.
We can address this later, as the first step for this PR should be separating out and pushing through the datafile manager changes.