-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjsforce@1.11.0.patch
96 lines (91 loc) · 3.47 KB
/
jsforce@1.11.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
diff --git a/lib/api/metadata.js b/lib/api/metadata.js
index ccf3c79ee557030b38e66aa64882129ce4c92b72..6ee61b4232b56e2200d385d02ca5a2a8580e3e69 100644
--- a/lib/api/metadata.js
+++ b/lib/api/metadata.js
@@ -561,6 +561,17 @@ Metadata.prototype.checkDeployStatus = function(id, includeDetails, callback) {
}).thenCall(callback);
};
+/**
+ * Cancel a deployment previously started by a call to deploy()
+ *
+ * @param {String} id - Async process id returned from deploy request
+ * @param {Callback.<Metadata~AsyncResult>} [callback] - Callback function
+ * @returns {Promise.<Metadata~AsyncResult>}
+ */
+Metadata.prototype.cancelDeploy = function(id, callback) {
+ var res = this._invoke("cancelDeploy", { asyncProcessId: id });
+ return new AsyncResultLocator(this, res).thenCall(callback);
+};
/*--------------------------------------------*/
diff --git a/lib/connection.js b/lib/connection.js
index e833b5a7c3ae7a534000141e3b986e40426dd4c5..84a2ef1f04da296b80dc17abe2a67233812f4382 100644
--- a/lib/connection.js
+++ b/lib/connection.js
@@ -797,7 +797,7 @@ Connection.prototype._createParallel = function(type, records, options) {
if (options.allOrNone || !err.errorCode) {
throw err;
}
- return this._toRecordResult(null, err);
+ return self._toRecordResult(null, err);
});
})
);
@@ -916,7 +916,7 @@ Connection.prototype._updateParallel = function(type, records, options) {
if (options.allOrNone || !err.errorCode) {
throw err;
}
- return this._toRecordResult(record.Id, err);
+ return self._toRecordResult(record.Id, err);
});
})
);
@@ -1112,7 +1112,7 @@ Connection.prototype._destroyParallel = function(type, ids, options) {
if (options.allOrNone || !err.errorCode) {
throw err;
}
- return this._toRecordResult(id, err);
+ return self._toRecordResult(id, err);
});
})
);
@@ -1313,6 +1313,7 @@ Connection.prototype.doBatchDescribeRequest = function(types) {
var url = [self._baseUrl(), "composite/batch"].join("/");
var version = "v" + self.version;
var batchRequests = [];
+ var logger = this._logger;
types.forEach(function (type) {
batchRequests.push({
method: "GET",
@@ -1333,9 +1334,9 @@ Connection.prototype.doBatchDescribeRequest = function(types) {
var subResp = response.results[i];
if (Array.isArray(subResp.result)) {
if (subResp.result[0].errorCode && subResp.result[0].message) {
- this._logger.error(
+ logger.error(
'Error: ' + subResp.result[0].errorCode + ' ' +
- subResp.result[0].message + ' - ' + typesToFetch[i]
+ subResp.result[0].message + ' - ' + types[i]
);
}
} else {
diff --git a/lib/http-api.js b/lib/http-api.js
index 607923b4fb1769fdee58207a4509d65f3692a4f6..df44faf09e807562c984d086dc8b67e88505828d 100644
--- a/lib/http-api.js
+++ b/lib/http-api.js
@@ -128,6 +128,7 @@ HttpApi.prototype.beforeSend = function(request) {
}
request.headers["Sforce-Call-Options"] = callOptions.join(', ');
}
+ this._conn.emit('request', request);
};
/**
@@ -206,7 +207,10 @@ function parseText(str) { return str; }
* @protected
*/
HttpApi.prototype.isSessionExpired = function(response) {
+ if (response.statusCode === 403) {
+ return response.body == 'Bad_OAuth_Token' || response.body == 'Missing_OAuth_Token';
+ }
return response.statusCode === 401;
};
/**