@jsforce/jsforce-node 0.0.1 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +54 -0
- package/index.d.ts +4 -0
- package/index.js +1 -0
- package/lib/VERSION.d.ts +2 -0
- package/lib/VERSION.js +3 -0
- package/lib/api/analytics/types.d.ts +509 -0
- package/lib/api/analytics/types.js +2 -0
- package/lib/api/analytics.d.ts +163 -0
- package/lib/api/analytics.js +342 -0
- package/lib/api/apex.d.ts +44 -0
- package/lib/api/apex.js +86 -0
- package/lib/api/bulk.d.ts +253 -0
- package/lib/api/bulk.js +678 -0
- package/lib/api/bulk2.d.ts +324 -0
- package/lib/api/bulk2.js +800 -0
- package/lib/api/chatter.d.ts +133 -0
- package/lib/api/chatter.js +248 -0
- package/lib/api/metadata/schema.d.ts +16117 -0
- package/lib/api/metadata/schema.js +9094 -0
- package/lib/api/metadata.d.ts +189 -0
- package/lib/api/metadata.js +406 -0
- package/lib/api/soap/schema.d.ts +3167 -0
- package/lib/api/soap/schema.js +1787 -0
- package/lib/api/soap.d.ts +76 -0
- package/lib/api/soap.js +155 -0
- package/lib/api/streaming/extension.d.ts +94 -0
- package/lib/api/streaming/extension.js +151 -0
- package/lib/api/streaming.d.ts +160 -0
- package/lib/api/streaming.js +252 -0
- package/lib/api/tooling.d.ts +284 -0
- package/lib/api/tooling.js +202 -0
- package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
- package/lib/api/wsdl/wsdl2schema.js +354 -0
- package/lib/browser/canvas.d.ts +12 -0
- package/lib/browser/canvas.js +77 -0
- package/lib/browser/client.d.ts +82 -0
- package/lib/browser/client.js +244 -0
- package/lib/browser/jsonp.d.ts +12 -0
- package/lib/browser/jsonp.js +69 -0
- package/lib/browser/registry.d.ts +3 -0
- package/lib/browser/registry.js +5 -0
- package/lib/browser/request.d.ts +10 -0
- package/lib/browser/request.js +202 -0
- package/lib/cache.d.ts +74 -0
- package/lib/cache.js +159 -0
- package/lib/connection.d.ts +356 -0
- package/lib/connection.js +1153 -0
- package/lib/core.d.ts +17 -0
- package/lib/core.js +55 -0
- package/lib/csv.d.ts +23 -0
- package/lib/csv.js +35 -0
- package/lib/date.d.ts +82 -0
- package/lib/date.js +201 -0
- package/lib/http-api.d.ts +75 -0
- package/lib/http-api.js +295 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +32 -0
- package/lib/jsforce.d.ts +26 -0
- package/lib/jsforce.js +67 -0
- package/lib/jwtOAuth2.d.ts +8 -0
- package/lib/jwtOAuth2.js +23 -0
- package/lib/oauth2.d.ts +92 -0
- package/lib/oauth2.js +245 -0
- package/lib/process.d.ts +157 -0
- package/lib/process.js +143 -0
- package/lib/query.d.ts +341 -0
- package/lib/query.js +817 -0
- package/lib/quick-action.d.ts +44 -0
- package/lib/quick-action.js +46 -0
- package/lib/record-reference.d.ts +46 -0
- package/lib/record-reference.js +65 -0
- package/lib/record-stream.d.ts +83 -0
- package/lib/record-stream.js +233 -0
- package/lib/registry/base.d.ts +43 -0
- package/lib/registry/base.js +96 -0
- package/lib/registry/empty.d.ts +7 -0
- package/lib/registry/empty.js +13 -0
- package/lib/registry/file.d.ts +11 -0
- package/lib/registry/file.js +51 -0
- package/lib/registry/index.d.ts +8 -0
- package/lib/registry/index.js +21 -0
- package/lib/registry/sfdx.d.ts +56 -0
- package/lib/registry/sfdx.js +133 -0
- package/lib/registry/types.d.ts +47 -0
- package/lib/registry/types.js +2 -0
- package/lib/request-helper.d.ts +23 -0
- package/lib/request-helper.js +102 -0
- package/lib/request.d.ts +11 -0
- package/lib/request.js +75 -0
- package/lib/session-refresh-delegate.d.ts +31 -0
- package/lib/session-refresh-delegate.js +69 -0
- package/lib/soap.d.ts +60 -0
- package/lib/soap.js +257 -0
- package/lib/sobject.d.ts +258 -0
- package/lib/sobject.js +376 -0
- package/lib/soql-builder.d.ts +25 -0
- package/lib/soql-builder.js +226 -0
- package/lib/transport.d.ts +63 -0
- package/lib/transport.js +175 -0
- package/lib/types/common.d.ts +560 -0
- package/lib/types/common.js +2 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.js +23 -0
- package/lib/types/projection.d.ts +26 -0
- package/lib/types/projection.js +2 -0
- package/lib/types/record.d.ts +44 -0
- package/lib/types/record.js +2 -0
- package/lib/types/schema.d.ts +50 -0
- package/lib/types/schema.js +2 -0
- package/lib/types/soap.d.ts +43 -0
- package/lib/types/soap.js +2 -0
- package/lib/types/standard-schema.d.ts +16199 -0
- package/lib/types/standard-schema.js +2 -0
- package/lib/types/util.d.ts +7 -0
- package/lib/types/util.js +2 -0
- package/lib/util/formatter.d.ts +8 -0
- package/lib/util/formatter.js +24 -0
- package/lib/util/function.d.ts +32 -0
- package/lib/util/function.js +52 -0
- package/lib/util/get-body-size.d.ts +4 -0
- package/lib/util/get-body-size.js +39 -0
- package/lib/util/logger.d.ts +29 -0
- package/lib/util/logger.js +102 -0
- package/lib/util/promise.d.ts +19 -0
- package/lib/util/promise.js +25 -0
- package/lib/util/stream.d.ts +12 -0
- package/lib/util/stream.js +88 -0
- package/package.json +262 -6
- package/typings/faye/index.d.ts +16 -0
- package/typings/index.d.ts +1 -0
package/lib/transport.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.HttpProxyTransport = exports.XdProxyTransport = exports.CanvasTransport = exports.JsonpTransport = exports.Transport = void 0;
|
|
30
|
+
const request_1 = __importStar(require("./request"));
|
|
31
|
+
const promise_1 = require("./util/promise");
|
|
32
|
+
const jsonp_1 = __importDefault(require("./browser/jsonp"));
|
|
33
|
+
const canvas_1 = __importDefault(require("./browser/canvas"));
|
|
34
|
+
/**
|
|
35
|
+
* Normarize Salesforce API host name
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
function normalizeApiHost(apiHost) {
|
|
39
|
+
const m = /(\w+)\.(visual\.force|salesforce)\.com$/.exec(apiHost);
|
|
40
|
+
if (m) {
|
|
41
|
+
return `${m[1]}.salesforce.com`;
|
|
42
|
+
}
|
|
43
|
+
return apiHost;
|
|
44
|
+
}
|
|
45
|
+
(0, request_1.setDefaults)({
|
|
46
|
+
httpProxy: process.env.HTTPS_PROXY ?? process.env.HTTP_PROXY ?? undefined,
|
|
47
|
+
timeout: process.env.HTTP_TIMEOUT
|
|
48
|
+
? parseInt(process.env.HTTP_TIMEOUT, 10)
|
|
49
|
+
: undefined,
|
|
50
|
+
followRedirect: true,
|
|
51
|
+
});
|
|
52
|
+
const baseUrl = typeof window !== 'undefined' && window.location && window.location.host
|
|
53
|
+
? `https://${normalizeApiHost(window.location.host)}`
|
|
54
|
+
: process.env.LOCATION_BASE_URL || '';
|
|
55
|
+
/**
|
|
56
|
+
* Class for HTTP request transport
|
|
57
|
+
*
|
|
58
|
+
* @class
|
|
59
|
+
* @protected
|
|
60
|
+
*/
|
|
61
|
+
class Transport {
|
|
62
|
+
/**
|
|
63
|
+
*/
|
|
64
|
+
httpRequest(req, options = {}) {
|
|
65
|
+
return promise_1.StreamPromise.create(() => {
|
|
66
|
+
const createStream = this.getRequestStreamCreator();
|
|
67
|
+
const stream = createStream(req, options);
|
|
68
|
+
const promise = new Promise((resolve, reject) => {
|
|
69
|
+
stream
|
|
70
|
+
.on('complete', (res) => resolve(res))
|
|
71
|
+
.on('error', reject);
|
|
72
|
+
});
|
|
73
|
+
return { stream, promise };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @protected
|
|
78
|
+
*/
|
|
79
|
+
getRequestStreamCreator() {
|
|
80
|
+
return request_1.default;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.Transport = Transport;
|
|
84
|
+
/**
|
|
85
|
+
* Class for JSONP request transport
|
|
86
|
+
*/
|
|
87
|
+
class JsonpTransport extends Transport {
|
|
88
|
+
static supprted = jsonp_1.default.supported;
|
|
89
|
+
_jsonpParam;
|
|
90
|
+
constructor(jsonpParam) {
|
|
91
|
+
super();
|
|
92
|
+
this._jsonpParam = jsonpParam;
|
|
93
|
+
}
|
|
94
|
+
getRequestStreamCreator() {
|
|
95
|
+
const jsonpRequest = jsonp_1.default.createRequest(this._jsonpParam);
|
|
96
|
+
return (params) => jsonpRequest(params);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.JsonpTransport = JsonpTransport;
|
|
100
|
+
/**
|
|
101
|
+
* Class for Sfdc Canvas request transport
|
|
102
|
+
*/
|
|
103
|
+
class CanvasTransport extends Transport {
|
|
104
|
+
static supported = canvas_1.default.supported;
|
|
105
|
+
_signedRequest;
|
|
106
|
+
constructor(signedRequest) {
|
|
107
|
+
super();
|
|
108
|
+
this._signedRequest = signedRequest;
|
|
109
|
+
}
|
|
110
|
+
getRequestStreamCreator() {
|
|
111
|
+
const canvasRequest = canvas_1.default.createRequest(this._signedRequest);
|
|
112
|
+
return (params) => canvasRequest(params);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.CanvasTransport = CanvasTransport;
|
|
116
|
+
/* @private */
|
|
117
|
+
function createXdProxyRequest(req, proxyUrl) {
|
|
118
|
+
const headers = {
|
|
119
|
+
'salesforceproxy-endpoint': req.url,
|
|
120
|
+
};
|
|
121
|
+
if (req.headers) {
|
|
122
|
+
for (const name of Object.keys(req.headers)) {
|
|
123
|
+
headers[name] = req.headers[name];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const nocache = `${Date.now()}.${String(Math.random()).substring(2)}`;
|
|
127
|
+
return {
|
|
128
|
+
method: req.method,
|
|
129
|
+
url: `${proxyUrl}?${nocache}`,
|
|
130
|
+
headers,
|
|
131
|
+
...(req.body != null ? { body: req.body } : {}),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Class for HTTP request transport using cross-domain AJAX proxy service
|
|
136
|
+
*/
|
|
137
|
+
class XdProxyTransport extends Transport {
|
|
138
|
+
_xdProxyUrl;
|
|
139
|
+
constructor(xdProxyUrl) {
|
|
140
|
+
super();
|
|
141
|
+
this._xdProxyUrl = xdProxyUrl;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Make HTTP request via AJAX proxy
|
|
145
|
+
*/
|
|
146
|
+
httpRequest(req, _options = {}) {
|
|
147
|
+
const xdProxyUrl = this._xdProxyUrl;
|
|
148
|
+
const { url, body, ...rreq } = req;
|
|
149
|
+
const canonicalUrl = url.indexOf('/') === 0 ? baseUrl + url : url;
|
|
150
|
+
const xdProxyReq = createXdProxyRequest({ ...rreq, url: canonicalUrl, body }, xdProxyUrl);
|
|
151
|
+
return super.httpRequest(xdProxyReq, {
|
|
152
|
+
followRedirect: (redirectUrl) => createXdProxyRequest({ ...rreq, method: 'GET', url: redirectUrl }, xdProxyUrl),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.XdProxyTransport = XdProxyTransport;
|
|
157
|
+
/**
|
|
158
|
+
* Class for HTTP request transport using a proxy server
|
|
159
|
+
*/
|
|
160
|
+
class HttpProxyTransport extends Transport {
|
|
161
|
+
_httpProxy;
|
|
162
|
+
constructor(httpProxy) {
|
|
163
|
+
super();
|
|
164
|
+
this._httpProxy = httpProxy;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Make HTTP request via proxy server
|
|
168
|
+
*/
|
|
169
|
+
httpRequest(req, options_ = {}) {
|
|
170
|
+
const options = { ...options_, httpProxy: this._httpProxy };
|
|
171
|
+
return super.httpRequest(req, options);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.HttpProxyTransport = HttpProxyTransport;
|
|
175
|
+
exports.default = Transport;
|