Comparing version 1.0.2 to 1.1.0
@@ -1,3 +0,8 @@ | ||
## v1.0.2 (Feb 13, 2014): | ||
## v1.1.0 (Feb 19, 2014): | ||
* Added Salesforce Canvas environment support (requires canvas-all.js) | ||
## v1.0.2 (Feb 17, 2014): | ||
* Added web browser client utility in `jsforce.browser` object. | ||
@@ -4,0 +9,0 @@ |
@@ -20,2 +20,9 @@ /*global process */ | ||
watch: { | ||
scripts: { | ||
files: ["lib/**/*.js" ], | ||
tasks: ['build'] | ||
} | ||
}, | ||
browserify: { | ||
@@ -22,0 +29,0 @@ options: { |
@@ -0,1 +1,2 @@ | ||
/*global Buffer */ | ||
/** | ||
@@ -46,2 +47,3 @@ * @file Connection class to keep the API session information and manage requests | ||
* @param {String} [options.refreshToken] - Salesforce OAuth2 refresh token | ||
* @param {String|Object} [options.signedRequest] - Salesforce Canvas signed request (Raw Base64 string, JSON string, or deserialized JSON) | ||
* @param {String} [options.proxyUrl] - Cross-domain proxy server URL, used in browser client, non Visualforce app. | ||
@@ -151,2 +153,3 @@ */ | ||
* @param {String} [options.refreshToken] - Salesforce OAuth2 refresh token | ||
* @param {String|Object} [options.signedRequest] - Salesforce Canvas signed request (Raw Base64 string, JSON string, or deserialized JSON) | ||
* @param {UserInfo} [options.userInfo] - Logged in user information | ||
@@ -174,2 +177,8 @@ */ | ||
} | ||
this.signedRequest = options.signedRequest && parseSignedRequest(options.signedRequest); | ||
if (this.signedRequest) { | ||
this.accessToken = this.signedRequest.client.oauthToken; | ||
} | ||
this.userInfo = options.userInfo; | ||
@@ -192,3 +201,18 @@ | ||
/** @private **/ | ||
function parseSignedRequest(sr) { | ||
if (_.isString(sr)) { | ||
if (sr[0] === '{') { // might be JSON | ||
return JSON.parse(sr); | ||
} else { // might be original base64-encoded signed request | ||
var msg = sr.split('.').pop(); // retrieve latter part | ||
var json = new Buffer(msg, 'base64').toString('utf-8'); | ||
return JSON.parse(json); | ||
} | ||
return null; | ||
} | ||
return sr; | ||
} | ||
/** | ||
@@ -246,2 +270,5 @@ * @private | ||
// for connection in canvas with signed request | ||
if (this.signedRequest) { options.signedRequest = this.signedRequest; } | ||
self.emit('request', params.method, params.url, params); | ||
@@ -248,0 +275,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*global process */ | ||
/*global process, Sfdc */ | ||
var util = require('util'), | ||
@@ -11,2 +11,3 @@ stream = require('stream'), | ||
xhrRequest = require('./browser/request'), | ||
canvas = require('./browser/canvas'), | ||
jsonp = require('./browser/jsonp'); | ||
@@ -60,2 +61,4 @@ | ||
httpRequest = jsonp.createRequest(options.jsonp); | ||
} else if (options && options.signedRequest && canvas.supported) { | ||
httpRequest = canvas.createRequest(options.signedRequest); | ||
} | ||
@@ -62,0 +65,0 @@ var createRequest = function() { |
@@ -13,3 +13,3 @@ { | ||
"homepage": "http://github.com/jsforce/jsforce", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -16,0 +16,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2470693
74
31563