@jsforce/jsforce-node 0.0.1 → 3.0.0-next.1

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.
Files changed (127) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +54 -0
  3. package/index.d.ts +4 -0
  4. package/index.js +1 -0
  5. package/lib/VERSION.d.ts +2 -0
  6. package/lib/VERSION.js +3 -0
  7. package/lib/api/analytics/types.d.ts +509 -0
  8. package/lib/api/analytics/types.js +2 -0
  9. package/lib/api/analytics.d.ts +163 -0
  10. package/lib/api/analytics.js +342 -0
  11. package/lib/api/apex.d.ts +44 -0
  12. package/lib/api/apex.js +86 -0
  13. package/lib/api/bulk.d.ts +444 -0
  14. package/lib/api/bulk.js +1372 -0
  15. package/lib/api/chatter.d.ts +133 -0
  16. package/lib/api/chatter.js +248 -0
  17. package/lib/api/metadata/schema.d.ts +16117 -0
  18. package/lib/api/metadata/schema.js +9094 -0
  19. package/lib/api/metadata.d.ts +189 -0
  20. package/lib/api/metadata.js +406 -0
  21. package/lib/api/soap/schema.d.ts +3167 -0
  22. package/lib/api/soap/schema.js +1787 -0
  23. package/lib/api/soap.d.ts +76 -0
  24. package/lib/api/soap.js +155 -0
  25. package/lib/api/streaming/extension.d.ts +94 -0
  26. package/lib/api/streaming/extension.js +151 -0
  27. package/lib/api/streaming.d.ts +160 -0
  28. package/lib/api/streaming.js +252 -0
  29. package/lib/api/tooling.d.ts +284 -0
  30. package/lib/api/tooling.js +202 -0
  31. package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
  32. package/lib/api/wsdl/wsdl2schema.js +354 -0
  33. package/lib/browser/canvas.d.ts +12 -0
  34. package/lib/browser/canvas.js +77 -0
  35. package/lib/browser/client.d.ts +82 -0
  36. package/lib/browser/client.js +244 -0
  37. package/lib/browser/jsonp.d.ts +12 -0
  38. package/lib/browser/jsonp.js +69 -0
  39. package/lib/browser/registry.d.ts +3 -0
  40. package/lib/browser/registry.js +5 -0
  41. package/lib/browser/request.d.ts +10 -0
  42. package/lib/browser/request.js +202 -0
  43. package/lib/cache.d.ts +74 -0
  44. package/lib/cache.js +159 -0
  45. package/lib/connection.d.ts +355 -0
  46. package/lib/connection.js +1153 -0
  47. package/lib/core.d.ts +17 -0
  48. package/lib/core.js +55 -0
  49. package/lib/csv.d.ts +23 -0
  50. package/lib/csv.js +35 -0
  51. package/lib/date.d.ts +82 -0
  52. package/lib/date.js +201 -0
  53. package/lib/http-api.d.ts +75 -0
  54. package/lib/http-api.js +257 -0
  55. package/lib/index.d.ts +12 -0
  56. package/lib/index.js +31 -0
  57. package/lib/jsforce.d.ts +26 -0
  58. package/lib/jsforce.js +67 -0
  59. package/lib/jwtOAuth2.d.ts +8 -0
  60. package/lib/jwtOAuth2.js +23 -0
  61. package/lib/oauth2.d.ts +92 -0
  62. package/lib/oauth2.js +245 -0
  63. package/lib/process.d.ts +157 -0
  64. package/lib/process.js +143 -0
  65. package/lib/query.d.ts +341 -0
  66. package/lib/query.js +817 -0
  67. package/lib/quick-action.d.ts +44 -0
  68. package/lib/quick-action.js +46 -0
  69. package/lib/record-reference.d.ts +46 -0
  70. package/lib/record-reference.js +65 -0
  71. package/lib/record-stream.d.ts +83 -0
  72. package/lib/record-stream.js +233 -0
  73. package/lib/registry/base.d.ts +43 -0
  74. package/lib/registry/base.js +96 -0
  75. package/lib/registry/empty.d.ts +7 -0
  76. package/lib/registry/empty.js +13 -0
  77. package/lib/registry/file.d.ts +11 -0
  78. package/lib/registry/file.js +51 -0
  79. package/lib/registry/index.d.ts +8 -0
  80. package/lib/registry/index.js +21 -0
  81. package/lib/registry/sfdx.d.ts +56 -0
  82. package/lib/registry/sfdx.js +133 -0
  83. package/lib/registry/types.d.ts +47 -0
  84. package/lib/registry/types.js +2 -0
  85. package/lib/request-helper.d.ts +23 -0
  86. package/lib/request-helper.js +102 -0
  87. package/lib/request.d.ts +11 -0
  88. package/lib/request.js +75 -0
  89. package/lib/session-refresh-delegate.d.ts +31 -0
  90. package/lib/session-refresh-delegate.js +69 -0
  91. package/lib/soap.d.ts +60 -0
  92. package/lib/soap.js +246 -0
  93. package/lib/sobject.d.ts +258 -0
  94. package/lib/sobject.js +376 -0
  95. package/lib/soql-builder.d.ts +25 -0
  96. package/lib/soql-builder.js +226 -0
  97. package/lib/transport.d.ts +63 -0
  98. package/lib/transport.js +175 -0
  99. package/lib/types/common.d.ts +560 -0
  100. package/lib/types/common.js +2 -0
  101. package/lib/types/index.d.ts +7 -0
  102. package/lib/types/index.js +23 -0
  103. package/lib/types/projection.d.ts +26 -0
  104. package/lib/types/projection.js +2 -0
  105. package/lib/types/record.d.ts +44 -0
  106. package/lib/types/record.js +2 -0
  107. package/lib/types/schema.d.ts +50 -0
  108. package/lib/types/schema.js +2 -0
  109. package/lib/types/soap.d.ts +43 -0
  110. package/lib/types/soap.js +2 -0
  111. package/lib/types/standard-schema.d.ts +16199 -0
  112. package/lib/types/standard-schema.js +2 -0
  113. package/lib/types/util.d.ts +7 -0
  114. package/lib/types/util.js +2 -0
  115. package/lib/util/formatter.d.ts +8 -0
  116. package/lib/util/formatter.js +24 -0
  117. package/lib/util/function.d.ts +32 -0
  118. package/lib/util/function.js +52 -0
  119. package/lib/util/logger.d.ts +29 -0
  120. package/lib/util/logger.js +102 -0
  121. package/lib/util/promise.d.ts +19 -0
  122. package/lib/util/promise.js +25 -0
  123. package/lib/util/stream.d.ts +12 -0
  124. package/lib/util/stream.js +88 -0
  125. package/package.json +260 -6
  126. package/typings/faye/index.d.ts +16 -0
  127. package/typings/index.d.ts +1 -0
@@ -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;