@salesforce/core 3.30.14 → 3.31.7

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 (153) hide show
  1. package/LICENSE.txt +11 -11
  2. package/README.md +222 -227
  3. package/lib/config/aliasesConfig.d.ts +12 -12
  4. package/lib/config/aliasesConfig.js +27 -27
  5. package/lib/config/authInfoConfig.d.ts +19 -19
  6. package/lib/config/authInfoConfig.js +34 -34
  7. package/lib/config/config.d.ts +311 -311
  8. package/lib/config/config.js +574 -574
  9. package/lib/config/configAggregator.d.ts +232 -232
  10. package/lib/config/configAggregator.js +379 -379
  11. package/lib/config/configFile.d.ts +199 -199
  12. package/lib/config/configFile.js +340 -340
  13. package/lib/config/configGroup.d.ts +141 -141
  14. package/lib/config/configGroup.js +224 -224
  15. package/lib/config/configStore.d.ts +241 -241
  16. package/lib/config/configStore.js +352 -352
  17. package/lib/config/envVars.d.ts +101 -101
  18. package/lib/config/envVars.js +456 -456
  19. package/lib/config/orgUsersConfig.d.ts +31 -31
  20. package/lib/config/orgUsersConfig.js +41 -41
  21. package/lib/config/sandboxOrgConfig.d.ts +37 -37
  22. package/lib/config/sandboxOrgConfig.js +50 -50
  23. package/lib/config/sandboxProcessCache.d.ts +16 -16
  24. package/lib/config/sandboxProcessCache.js +37 -37
  25. package/lib/config/tokensConfig.d.ts +10 -10
  26. package/lib/config/tokensConfig.js +28 -28
  27. package/lib/config/ttlConfig.d.ts +34 -34
  28. package/lib/config/ttlConfig.js +54 -54
  29. package/lib/crypto/crypto.d.ts +54 -54
  30. package/lib/crypto/crypto.js +220 -220
  31. package/lib/crypto/keyChain.d.ts +8 -8
  32. package/lib/crypto/keyChain.js +61 -61
  33. package/lib/crypto/keyChainImpl.d.ts +116 -116
  34. package/lib/crypto/keyChainImpl.js +486 -486
  35. package/lib/crypto/secureBuffer.d.ts +46 -46
  36. package/lib/crypto/secureBuffer.js +82 -82
  37. package/lib/deviceOauthService.d.ts +71 -71
  38. package/lib/deviceOauthService.js +191 -191
  39. package/lib/exported.d.ts +38 -38
  40. package/lib/exported.js +118 -118
  41. package/lib/global.d.ts +70 -70
  42. package/lib/global.js +109 -109
  43. package/lib/lifecycleEvents.d.ts +93 -93
  44. package/lib/lifecycleEvents.js +188 -188
  45. package/lib/logger.d.ts +381 -381
  46. package/lib/logger.js +734 -734
  47. package/lib/messages.d.ts +291 -291
  48. package/lib/messages.js +543 -543
  49. package/lib/org/authInfo.d.ts +344 -344
  50. package/lib/org/authInfo.js +892 -892
  51. package/lib/org/authRemover.d.ts +88 -88
  52. package/lib/org/authRemover.js +182 -182
  53. package/lib/org/connection.d.ts +197 -197
  54. package/lib/org/connection.js +395 -395
  55. package/lib/org/index.d.ts +6 -6
  56. package/lib/org/index.js +28 -28
  57. package/lib/org/org.d.ts +558 -558
  58. package/lib/org/org.js +1267 -1267
  59. package/lib/org/orgConfigProperties.d.ts +69 -69
  60. package/lib/org/orgConfigProperties.js +136 -136
  61. package/lib/org/permissionSetAssignment.d.ts +35 -35
  62. package/lib/org/permissionSetAssignment.js +125 -125
  63. package/lib/org/scratchOrgCache.d.ts +20 -20
  64. package/lib/org/scratchOrgCache.js +32 -32
  65. package/lib/org/scratchOrgCreate.d.ts +54 -54
  66. package/lib/org/scratchOrgCreate.js +216 -216
  67. package/lib/org/scratchOrgErrorCodes.d.ts +10 -10
  68. package/lib/org/scratchOrgErrorCodes.js +88 -88
  69. package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -26
  70. package/lib/org/scratchOrgFeatureDeprecation.js +109 -109
  71. package/lib/org/scratchOrgInfoApi.d.ts +68 -68
  72. package/lib/org/scratchOrgInfoApi.js +413 -413
  73. package/lib/org/scratchOrgInfoGenerator.d.ts +64 -64
  74. package/lib/org/scratchOrgInfoGenerator.js +241 -241
  75. package/lib/org/scratchOrgLifecycleEvents.d.ts +10 -10
  76. package/lib/org/scratchOrgLifecycleEvents.js +40 -40
  77. package/lib/org/scratchOrgSettingsGenerator.d.ts +78 -78
  78. package/lib/org/scratchOrgSettingsGenerator.js +276 -276
  79. package/lib/org/scratchOrgTypes.d.ts +43 -43
  80. package/lib/org/scratchOrgTypes.js +8 -8
  81. package/lib/org/user.d.ts +187 -187
  82. package/lib/org/user.js +448 -448
  83. package/lib/schema/printer.d.ts +79 -79
  84. package/lib/schema/printer.js +260 -260
  85. package/lib/schema/validator.d.ts +70 -70
  86. package/lib/schema/validator.js +169 -169
  87. package/lib/sfError.d.ts +73 -73
  88. package/lib/sfError.js +136 -136
  89. package/lib/sfProject.d.ts +357 -357
  90. package/lib/sfProject.js +671 -671
  91. package/lib/stateAggregator/accessors/aliasAccessor.d.ts +98 -98
  92. package/lib/stateAggregator/accessors/aliasAccessor.js +145 -145
  93. package/lib/stateAggregator/accessors/orgAccessor.d.ts +101 -101
  94. package/lib/stateAggregator/accessors/orgAccessor.js +240 -240
  95. package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +8 -8
  96. package/lib/stateAggregator/accessors/sandboxAccessor.js +27 -27
  97. package/lib/stateAggregator/accessors/tokenAccessor.d.ts +63 -63
  98. package/lib/stateAggregator/accessors/tokenAccessor.js +79 -79
  99. package/lib/stateAggregator/index.d.ts +4 -4
  100. package/lib/stateAggregator/index.js +26 -26
  101. package/lib/stateAggregator/stateAggregator.d.ts +25 -25
  102. package/lib/stateAggregator/stateAggregator.js +45 -45
  103. package/lib/status/myDomainResolver.d.ts +66 -66
  104. package/lib/status/myDomainResolver.js +124 -124
  105. package/lib/status/pollingClient.d.ts +85 -85
  106. package/lib/status/pollingClient.js +115 -115
  107. package/lib/status/streamingClient.d.ts +244 -244
  108. package/lib/status/streamingClient.js +436 -436
  109. package/lib/status/types.d.ts +89 -89
  110. package/lib/status/types.js +17 -17
  111. package/lib/testSetup.d.ts +553 -530
  112. package/lib/testSetup.js +871 -727
  113. package/lib/util/cache.d.ts +11 -11
  114. package/lib/util/cache.js +69 -69
  115. package/lib/util/checkLightningDomain.d.ts +1 -1
  116. package/lib/util/checkLightningDomain.js +28 -28
  117. package/lib/util/directoryWriter.d.ts +12 -12
  118. package/lib/util/directoryWriter.js +53 -53
  119. package/lib/util/getJwtAudienceUrl.d.ts +4 -4
  120. package/lib/util/getJwtAudienceUrl.js +18 -18
  121. package/lib/util/internal.d.ts +58 -58
  122. package/lib/util/internal.js +118 -118
  123. package/lib/util/jsonXmlTools.d.ts +14 -14
  124. package/lib/util/jsonXmlTools.js +38 -38
  125. package/lib/util/mapKeys.d.ts +14 -14
  126. package/lib/util/mapKeys.js +51 -51
  127. package/lib/util/sfdc.d.ts +52 -52
  128. package/lib/util/sfdc.js +85 -85
  129. package/lib/util/sfdcUrl.d.ts +72 -72
  130. package/lib/util/sfdcUrl.js +215 -215
  131. package/lib/util/structuredWriter.d.ts +9 -9
  132. package/lib/util/structuredWriter.js +2 -2
  133. package/lib/util/zipWriter.d.ts +16 -16
  134. package/lib/util/zipWriter.js +67 -67
  135. package/lib/webOAuthServer.d.ts +156 -156
  136. package/lib/webOAuthServer.js +388 -388
  137. package/messages/auth.md +37 -37
  138. package/messages/config.md +156 -156
  139. package/messages/connection.md +30 -30
  140. package/messages/core.json +20 -20
  141. package/messages/core.md +67 -67
  142. package/messages/encryption.md +85 -85
  143. package/messages/envVars.md +303 -303
  144. package/messages/org.md +63 -63
  145. package/messages/permissionSetAssignment.md +31 -31
  146. package/messages/scratchOrgCreate.md +23 -23
  147. package/messages/scratchOrgErrorCodes.md +115 -115
  148. package/messages/scratchOrgFeatureDeprecation.md +11 -11
  149. package/messages/scratchOrgInfoApi.md +15 -15
  150. package/messages/scratchOrgInfoGenerator.md +23 -23
  151. package/messages/streaming.md +23 -23
  152. package/messages/user.md +35 -35
  153. package/package.json +97 -97
@@ -1,437 +1,437 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2020, salesforce.com, inc.
4
- * All rights reserved.
5
- * Licensed under the BSD 3-Clause license.
6
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.StreamingClient = exports.CometClient = void 0;
10
- /* eslint-disable @typescript-eslint/ban-ts-comment */
11
- const url_1 = require("url");
12
- const lib_1 = require("@salesforce/kit/lib");
13
- const lib_2 = require("@salesforce/ts-types/lib");
14
- const Faye = require("faye");
15
- const logger_1 = require("../logger");
16
- const sfError_1 = require("../sfError");
17
- const messages_1 = require("../messages");
18
- const types_1 = require("./types");
19
- Object.defineProperty(exports, "CometClient", { enumerable: true, get: function () { return types_1.CometClient; } });
20
- messages_1.Messages.importMessagesDirectory(__dirname);
21
- const messages = messages_1.Messages.load('@salesforce/core', 'streaming', [
22
- 'waitParamValidValueError',
23
- 'genericHandshakeTimeout',
24
- 'invalidApiVersion',
25
- 'genericTimeout',
26
- 'handshakeApiVersionError',
27
- ]);
28
- /**
29
- * Validation helper
30
- *
31
- * @param newTime New Duration to validate.
32
- * @param existingTime Existing time to validate.
33
- */
34
- function validateTimeout(newTime, existingTime) {
35
- if (newTime.milliseconds >= existingTime.milliseconds) {
36
- return newTime;
37
- }
38
- throw messages.createError('waitParamValidValueError', [existingTime.minutes]);
39
- }
40
- /**
41
- * Api wrapper to support Salesforce streaming. The client contains an internal implementation of a cometd specification.
42
- *
43
- * Salesforce client and timeout information
44
- *
45
- * Streaming API imposes two timeouts, as supported in the Bayeux protocol.
46
- *
47
- * Socket timeout: 110 seconds
48
- * A client receives events (JSON-formatted HTTP responses) while it waits on a connection. If no events are generated
49
- * and the client is still waiting, the connection times out after 110 seconds and the server closes the connection.
50
- * Clients should reconnect before two minutes to avoid the connection timeout.
51
- *
52
- * Reconnect timeout: 40 seconds
53
- * After receiving the events, a client needs to reconnect to receive the next set of events. If the reconnection
54
- * doesn't happen within 40 seconds, the server expires the subscription and the connection is closed. If this happens,
55
- * the client must start again and handshake, subscribe, and connect. Each Streaming API client logs into an instance
56
- * and maintains a session. When the client handshakes, connects, or subscribes, the session timeout is restarted. A
57
- * client session times out if the client doesn’t reconnect to the server within 40 seconds after receiving a response
58
- * (an event, subscribe result, and so on).
59
- *
60
- * Note that these timeouts apply to the Streaming API client session and not the Salesforce authentication session. If
61
- * the client session times out, the authentication session remains active until the organization-specific timeout
62
- * policy goes into effect.
63
- *
64
- * ```
65
- * const streamProcessor = (message: JsonMap): StatusResult => {
66
- * const payload = ensureJsonMap(message.payload);
67
- * const id = ensureString(payload.id);
68
- *
69
- * if (payload.status !== 'Active') {
70
- * return { completed: false };
71
- * }
72
- *
73
- * return {
74
- * completed: true,
75
- * payload: id
76
- * };
77
- * };
78
- *
79
- * const org = await Org.create();
80
- * const options = new StreamingClient.DefaultOptions(org, 'MyPushTopics', streamProcessor);
81
- *
82
- * const asyncStatusClient = await StreamingClient.create(options);
83
- *
84
- * await asyncStatusClient.handshake();
85
- *
86
- * const info: RequestInfo = {
87
- * method: 'POST',
88
- * url: `${org.getField(OrgFields.INSTANCE_URL)}/SomeService`,
89
- * headers: { HEADER: 'HEADER_VALUE'},
90
- * body: 'My content'
91
- * };
92
- *
93
- * await asyncStatusClient.subscribe(async () => {
94
- * const connection = await org.getConnection();
95
- * // Now that we are subscribed, we can initiate the request that will cause the events to start streaming.
96
- * const requestResponse: JsonCollection = await connection.request(info);
97
- * const id = ensureJsonMap(requestResponse).id;
98
- * console.log(`this.id: ${JSON.stringify(ensureString(id), null, 4)}`);
99
- * });
100
- * ```
101
- */
102
- class StreamingClient extends lib_1.AsyncOptionalCreatable {
103
- /**
104
- * Constructor
105
- *
106
- * @param options Streaming client options
107
- * {@link AsyncCreatable.create}
108
- */
109
- constructor(options) {
110
- super(options);
111
- this.options = (0, lib_2.ensure)(options);
112
- const instanceUrl = (0, lib_2.ensure)(this.options.org.getConnection().getAuthInfoFields().instanceUrl);
113
- /**
114
- * The salesforce network infrastructure issues a cookie called sfdx-stream if it sees /cometd in the url.
115
- * Without this cookie request response streams will experience intermittent client session failures.
116
- *
117
- * The following cookies should be sent on a /meta/handshake
118
- *
119
- * "set-cookie": [
120
- * "BrowserId=<ID>;Path=/;Domain=.salesforce.com;Expires=Sun, 13-Jan-2019 20:16:19 GMT;Max-Age=5184000",
121
- * "t=<ID>;Path=/cometd/;HttpOnly",
122
- * "BAYEUX_BROWSER=<ID>;Path=/cometd/;Secure",
123
- * "sfdc-stream=<ID>; expires=Wed, 14-Nov-2018 23:16:19 GMT; path=/"
124
- * ],
125
- *
126
- * Enable SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING to debug potential session problems and to verify cookie
127
- * exchanges.
128
- */
129
- this.targetUrl = (0, url_1.resolve)(instanceUrl, `cometd/${this.options.apiVersion}`);
130
- this.cometClient = this.options.streamingImpl.getCometClient(this.targetUrl);
131
- this.options.streamingImpl.setLogger(this.log.bind(this));
132
- this.cometClient.on('transport:up', () => this.log('Transport up event received'));
133
- this.cometClient.on('transport:down', () => this.log('Transport down event received'));
134
- this.cometClient.addExtension({
135
- incoming: this.incoming.bind(this),
136
- });
137
- this.cometClient.disable('websocket');
138
- }
139
- /**
140
- * Asynchronous initializer.
141
- */
142
- async init() {
143
- // get the apiVersion from the connection if not already an option
144
- const conn = this.options.org.getConnection();
145
- this.options.apiVersion = this.options.apiVersion || conn.getApiVersion();
146
- this.logger = await logger_1.Logger.child(this.constructor.name);
147
- await this.options.org.refreshAuth();
148
- const accessToken = conn.getConnectionOptions().accessToken;
149
- if (accessToken && accessToken.length > 5) {
150
- this.logger.debug(`accessToken: XXXXXX${accessToken.substring(accessToken.length - 5, accessToken.length - 1)}`);
151
- this.cometClient.setHeader('Authorization', `OAuth ${accessToken}`);
152
- }
153
- else {
154
- throw new sfError_1.SfError('Missing or invalid access token', 'MissingOrInvalidAccessToken');
155
- }
156
- this.log(`Streaming client target url: ${this.targetUrl}`);
157
- this.log(`options.subscribeTimeout (ms): ${this.options.subscribeTimeout.milliseconds}`);
158
- this.log(`options.handshakeTimeout (ms): ${this.options.handshakeTimeout.milliseconds}`);
159
- }
160
- /**
161
- * Allows replaying of of Streaming events starting with replayId.
162
- *
163
- * @param replayId The starting message id to replay from.
164
- */
165
- replay(replayId) {
166
- this.cometClient.addExtension({
167
- outgoing: (message, callback) => {
168
- if (message.channel === '/meta/subscribe') {
169
- if (!message.ext) {
170
- message.ext = {};
171
- }
172
- const replayFromMap = {};
173
- replayFromMap[this.options.channel] = replayId;
174
- // add "ext : { "replay" : { CHANNEL : REPLAY_VALUE }}" to subscribe message
175
- (0, lib_1.set)(message, 'ext.replay', replayFromMap);
176
- }
177
- callback(message);
178
- },
179
- });
180
- }
181
- /**
182
- * Provides a convenient way to handshake with the server endpoint before trying to subscribe.
183
- */
184
- handshake() {
185
- let timeout;
186
- return new Promise((resolve, reject) => {
187
- timeout = setTimeout(() => {
188
- const timeoutError = messages.createError('genericHandshakeTimeout', [this.targetUrl]);
189
- this.doTimeout(timeout, timeoutError);
190
- reject(timeoutError);
191
- }, this.options.handshakeTimeout.milliseconds);
192
- this.cometClient.handshake(() => {
193
- this.log('handshake completed');
194
- clearTimeout(timeout);
195
- this.log('cleared handshake timeout');
196
- resolve(StreamingClient.ConnectionState.CONNECTED);
197
- });
198
- });
199
- }
200
- /**
201
- * Subscribe to streaming events. When the streaming processor that's set in the options completes execution it
202
- * returns a payload in the StatusResult object. The payload is just echoed here for convenience.
203
- *
204
- * **Throws** *{@link SfError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
205
- *
206
- * @param streamInit This function should call the platform apis that result in streaming updates on push topics.
207
- * {@link StatusResult}
208
- */
209
- subscribe(streamInit) {
210
- let timeout;
211
- // This outer promise is to hold the streaming promise chain open until the streaming processor
212
- // says it's complete.
213
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
214
- return new Promise((subscribeResolve, subscribeReject) =>
215
- // This is the inner promise chain that's satisfied when the client impl (Faye/Mock) says it's subscribed.
216
- new Promise((subscriptionResolve, subscriptionReject) => {
217
- timeout = setTimeout(() => {
218
- const timeoutError = messages.createError('genericTimeout');
219
- this.doTimeout(timeout, timeoutError);
220
- subscribeReject(timeoutError);
221
- }, this.options.subscribeTimeout.milliseconds);
222
- // Initialize the subscription.
223
- const subscription = this.cometClient.subscribe(this.options.channel, (message) => {
224
- try {
225
- // The result of the stream processor determines the state of the outer promise.
226
- const result = this.options.streamProcessor(message);
227
- // The stream processor says it's complete. Clean up and resolve the outer promise.
228
- if (result?.completed) {
229
- clearTimeout(timeout);
230
- this.disconnectClient();
231
- subscribeResolve(result.payload);
232
- } // This 'if' is intended to be evaluated until it's completed or until the timeout fires.
233
- }
234
- catch (e) {
235
- // it's completely valid for the stream processor to throw an error. If it does we will
236
- // reject the outer promise. Keep in mind if we are here the subscription was resolved.
237
- clearTimeout(timeout);
238
- this.disconnectClient();
239
- subscribeReject(e);
240
- }
241
- });
242
- subscription.callback(() => {
243
- subscriptionResolve();
244
- });
245
- subscription.errback((error) => {
246
- subscriptionReject(error);
247
- });
248
- })
249
- .then(() =>
250
- // Now that we successfully have a subscription started up we are safe to initialize the function that
251
- // will affect the streaming events. I.E. create an org or run apex tests.
252
- streamInit?.())
253
- .catch((error) => {
254
- this.disconnect();
255
- // Need to catch the subscription rejection or it will result in an unhandled rejection error.
256
- clearTimeout(timeout);
257
- // No subscription so we can reject the out promise as well.
258
- subscribeReject(error);
259
- }));
260
- }
261
- /**
262
- * Handler for incoming streaming messages.
263
- *
264
- * @param message The message to process.
265
- * @param cb The callback. Failure to call this can cause the internal comet client to hang.
266
- */
267
- incoming(message, cb) {
268
- this.log(message);
269
- // Look for a specific error message during the handshake. If found, throw an error
270
- // with actions for the user.
271
- if (message &&
272
- message.channel === '/meta/handshake' &&
273
- message.error &&
274
- (0, lib_2.ensureString)(message.error).includes('400::API version in the URI is mandatory')) {
275
- throw messages.createError('handshakeApiVersionError', [this.options.apiVersion]);
276
- }
277
- cb(message);
278
- }
279
- doTimeout(timeout, error) {
280
- this.disconnect();
281
- clearTimeout(timeout);
282
- this.log(JSON.stringify(error));
283
- return error;
284
- }
285
- disconnectClient() {
286
- if (this.cometClient) {
287
- this.cometClient.disconnect();
288
- }
289
- }
290
- disconnect() {
291
- this.log('Disconnecting the comet client');
292
- // This is a patch for faye. If Faye encounters errors while attempting to handshake it will keep trying
293
- // and will prevent the timeout from disconnecting. Here for example we will detect there is no client id but
294
- // unauthenticated connections are being made to salesforce. Let's close the dispatcher if it exists and
295
- // has no clientId.
296
- // @ts-ignore
297
- // eslint-disable-next-line no-underscore-dangle
298
- if (this.cometClient._dispatcher) {
299
- this.log('Closing the faye dispatcher');
300
- // @ts-ignore
301
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, no-underscore-dangle
302
- const dispatcher = this.cometClient._dispatcher;
303
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access
304
- this.log(`dispatcher.clientId: ${dispatcher.clientId}`);
305
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
306
- if (!dispatcher.clientId) {
307
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
308
- dispatcher.close();
309
- }
310
- else {
311
- this.disconnectClient();
312
- }
313
- }
314
- }
315
- /**
316
- * Simple inner log wrapper
317
- *
318
- * @param message The message to log
319
- */
320
- log(message) {
321
- if (this.logger) {
322
- this.logger.debug(message);
323
- }
324
- }
325
- }
326
- exports.StreamingClient = StreamingClient;
327
- (function (StreamingClient) {
328
- /**
329
- * Default Streaming Options. Uses Faye as the cometd impl.
330
- */
331
- class DefaultOptions {
332
- /**
333
- * Constructor for DefaultStreamingOptions
334
- *
335
- * @param org The streaming target org
336
- * @param channel The streaming channel or topic. If the topic is a system topic then api 36.0 is used.
337
- * System topics are deprecated.
338
- * @param streamProcessor The function called that can process streaming messages.
339
- * @param envDep
340
- * @see {@link StatusResult}
341
- */
342
- constructor(org, channel, streamProcessor, envDep = lib_1.env) {
343
- if (envDep) {
344
- const logger = logger_1.Logger.childFromRoot('StreamingClient');
345
- logger.warn('envDep is deprecated');
346
- }
347
- if (!streamProcessor) {
348
- throw new sfError_1.SfError('Missing stream processor', 'MissingArg');
349
- }
350
- if (!org) {
351
- throw new sfError_1.SfError('Missing org', 'MissingArg');
352
- }
353
- if (!channel) {
354
- throw new sfError_1.SfError('Missing streaming channel', 'MissingArg');
355
- }
356
- this.org = org;
357
- this.apiVersion = org.getConnection().getApiVersion();
358
- if (channel.startsWith('/system')) {
359
- this.apiVersion = '36.0';
360
- }
361
- if (!(parseFloat(this.apiVersion) > 0)) {
362
- throw messages.createError('invalidApiVersion', [this.apiVersion]);
363
- }
364
- this.streamProcessor = streamProcessor;
365
- this.channel = channel;
366
- this.subscribeTimeout = StreamingClient.DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT;
367
- this.handshakeTimeout = StreamingClient.DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT;
368
- this.streamingImpl = {
369
- getCometClient: (url) =>
370
- // @ts-ignore
371
- new Faye.Client(url),
372
- setLogger: (logLine) => {
373
- // @ts-ignore
374
- Faye.logger = {};
375
- ['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
376
- // @ts-ignore
377
- (0, lib_1.set)(Faye.logger, element, logLine);
378
- });
379
- },
380
- };
381
- }
382
- /**
383
- * Setter for the subscribe timeout.
384
- *
385
- * **Throws** An error if the newTime is less than the default time.
386
- *
387
- * @param newTime The new subscribe timeout.
388
- * {@link DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT}
389
- */
390
- setSubscribeTimeout(newTime) {
391
- this.subscribeTimeout = validateTimeout(newTime, DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT);
392
- }
393
- /**
394
- * Setter for the handshake timeout.
395
- *
396
- * **Throws** An error if the newTime is less than the default time.
397
- *
398
- * @param newTime The new handshake timeout
399
- * {@link DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT}
400
- */
401
- setHandshakeTimeout(newTime) {
402
- this.handshakeTimeout = validateTimeout(newTime, DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT);
403
- }
404
- }
405
- DefaultOptions.SFDX_ENABLE_FAYE_COOKIES_ALLOW_ALL_PATHS = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
406
- DefaultOptions.SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
407
- DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT = lib_1.Duration.minutes(3);
408
- DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT = lib_1.Duration.seconds(30);
409
- StreamingClient.DefaultOptions = DefaultOptions;
410
- /**
411
- * Connection state
412
- *
413
- * @see {@link StreamingClient.handshake}
414
- */
415
- let ConnectionState;
416
- (function (ConnectionState) {
417
- /**
418
- * Used to indicated that the streaming client is connected.
419
- */
420
- ConnectionState[ConnectionState["CONNECTED"] = 0] = "CONNECTED";
421
- })(ConnectionState = StreamingClient.ConnectionState || (StreamingClient.ConnectionState = {}));
422
- /**
423
- * Indicators to test error names for StreamingTimeouts
424
- */
425
- let TimeoutErrorType;
426
- (function (TimeoutErrorType) {
427
- /**
428
- * To indicate the error occurred on handshake
429
- */
430
- TimeoutErrorType["HANDSHAKE"] = "GenericHandshakeTimeoutError";
431
- /**
432
- * To indicate the error occurred on subscribe
433
- */
434
- TimeoutErrorType["SUBSCRIBE"] = "GenericTimeoutError";
435
- })(TimeoutErrorType = StreamingClient.TimeoutErrorType || (StreamingClient.TimeoutErrorType = {}));
436
- })(StreamingClient = exports.StreamingClient || (exports.StreamingClient = {}));
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2020, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.StreamingClient = exports.CometClient = void 0;
10
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
11
+ const url_1 = require("url");
12
+ const lib_1 = require("@salesforce/kit/lib");
13
+ const lib_2 = require("@salesforce/ts-types/lib");
14
+ const Faye = require("faye");
15
+ const logger_1 = require("../logger");
16
+ const sfError_1 = require("../sfError");
17
+ const messages_1 = require("../messages");
18
+ const types_1 = require("./types");
19
+ Object.defineProperty(exports, "CometClient", { enumerable: true, get: function () { return types_1.CometClient; } });
20
+ messages_1.Messages.importMessagesDirectory(__dirname);
21
+ const messages = messages_1.Messages.load('@salesforce/core', 'streaming', [
22
+ 'waitParamValidValueError',
23
+ 'genericHandshakeTimeout',
24
+ 'invalidApiVersion',
25
+ 'genericTimeout',
26
+ 'handshakeApiVersionError',
27
+ ]);
28
+ /**
29
+ * Validation helper
30
+ *
31
+ * @param newTime New Duration to validate.
32
+ * @param existingTime Existing time to validate.
33
+ */
34
+ function validateTimeout(newTime, existingTime) {
35
+ if (newTime.milliseconds >= existingTime.milliseconds) {
36
+ return newTime;
37
+ }
38
+ throw messages.createError('waitParamValidValueError', [existingTime.minutes]);
39
+ }
40
+ /**
41
+ * Api wrapper to support Salesforce streaming. The client contains an internal implementation of a cometd specification.
42
+ *
43
+ * Salesforce client and timeout information
44
+ *
45
+ * Streaming API imposes two timeouts, as supported in the Bayeux protocol.
46
+ *
47
+ * Socket timeout: 110 seconds
48
+ * A client receives events (JSON-formatted HTTP responses) while it waits on a connection. If no events are generated
49
+ * and the client is still waiting, the connection times out after 110 seconds and the server closes the connection.
50
+ * Clients should reconnect before two minutes to avoid the connection timeout.
51
+ *
52
+ * Reconnect timeout: 40 seconds
53
+ * After receiving the events, a client needs to reconnect to receive the next set of events. If the reconnection
54
+ * doesn't happen within 40 seconds, the server expires the subscription and the connection is closed. If this happens,
55
+ * the client must start again and handshake, subscribe, and connect. Each Streaming API client logs into an instance
56
+ * and maintains a session. When the client handshakes, connects, or subscribes, the session timeout is restarted. A
57
+ * client session times out if the client doesn’t reconnect to the server within 40 seconds after receiving a response
58
+ * (an event, subscribe result, and so on).
59
+ *
60
+ * Note that these timeouts apply to the Streaming API client session and not the Salesforce authentication session. If
61
+ * the client session times out, the authentication session remains active until the organization-specific timeout
62
+ * policy goes into effect.
63
+ *
64
+ * ```
65
+ * const streamProcessor = (message: JsonMap): StatusResult => {
66
+ * const payload = ensureJsonMap(message.payload);
67
+ * const id = ensureString(payload.id);
68
+ *
69
+ * if (payload.status !== 'Active') {
70
+ * return { completed: false };
71
+ * }
72
+ *
73
+ * return {
74
+ * completed: true,
75
+ * payload: id
76
+ * };
77
+ * };
78
+ *
79
+ * const org = await Org.create();
80
+ * const options = new StreamingClient.DefaultOptions(org, 'MyPushTopics', streamProcessor);
81
+ *
82
+ * const asyncStatusClient = await StreamingClient.create(options);
83
+ *
84
+ * await asyncStatusClient.handshake();
85
+ *
86
+ * const info: RequestInfo = {
87
+ * method: 'POST',
88
+ * url: `${org.getField(OrgFields.INSTANCE_URL)}/SomeService`,
89
+ * headers: { HEADER: 'HEADER_VALUE'},
90
+ * body: 'My content'
91
+ * };
92
+ *
93
+ * await asyncStatusClient.subscribe(async () => {
94
+ * const connection = await org.getConnection();
95
+ * // Now that we are subscribed, we can initiate the request that will cause the events to start streaming.
96
+ * const requestResponse: JsonCollection = await connection.request(info);
97
+ * const id = ensureJsonMap(requestResponse).id;
98
+ * console.log(`this.id: ${JSON.stringify(ensureString(id), null, 4)}`);
99
+ * });
100
+ * ```
101
+ */
102
+ class StreamingClient extends lib_1.AsyncOptionalCreatable {
103
+ /**
104
+ * Constructor
105
+ *
106
+ * @param options Streaming client options
107
+ * {@link AsyncCreatable.create}
108
+ */
109
+ constructor(options) {
110
+ super(options);
111
+ this.options = (0, lib_2.ensure)(options);
112
+ const instanceUrl = (0, lib_2.ensure)(this.options.org.getConnection().getAuthInfoFields().instanceUrl);
113
+ /**
114
+ * The salesforce network infrastructure issues a cookie called sfdx-stream if it sees /cometd in the url.
115
+ * Without this cookie request response streams will experience intermittent client session failures.
116
+ *
117
+ * The following cookies should be sent on a /meta/handshake
118
+ *
119
+ * "set-cookie": [
120
+ * "BrowserId=<ID>;Path=/;Domain=.salesforce.com;Expires=Sun, 13-Jan-2019 20:16:19 GMT;Max-Age=5184000",
121
+ * "t=<ID>;Path=/cometd/;HttpOnly",
122
+ * "BAYEUX_BROWSER=<ID>;Path=/cometd/;Secure",
123
+ * "sfdc-stream=<ID>; expires=Wed, 14-Nov-2018 23:16:19 GMT; path=/"
124
+ * ],
125
+ *
126
+ * Enable SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING to debug potential session problems and to verify cookie
127
+ * exchanges.
128
+ */
129
+ this.targetUrl = (0, url_1.resolve)(instanceUrl, `cometd/${this.options.apiVersion}`);
130
+ this.cometClient = this.options.streamingImpl.getCometClient(this.targetUrl);
131
+ this.options.streamingImpl.setLogger(this.log.bind(this));
132
+ this.cometClient.on('transport:up', () => this.log('Transport up event received'));
133
+ this.cometClient.on('transport:down', () => this.log('Transport down event received'));
134
+ this.cometClient.addExtension({
135
+ incoming: this.incoming.bind(this),
136
+ });
137
+ this.cometClient.disable('websocket');
138
+ }
139
+ /**
140
+ * Asynchronous initializer.
141
+ */
142
+ async init() {
143
+ // get the apiVersion from the connection if not already an option
144
+ const conn = this.options.org.getConnection();
145
+ this.options.apiVersion = this.options.apiVersion || conn.getApiVersion();
146
+ this.logger = await logger_1.Logger.child(this.constructor.name);
147
+ await this.options.org.refreshAuth();
148
+ const accessToken = conn.getConnectionOptions().accessToken;
149
+ if (accessToken && accessToken.length > 5) {
150
+ this.logger.debug(`accessToken: XXXXXX${accessToken.substring(accessToken.length - 5, accessToken.length - 1)}`);
151
+ this.cometClient.setHeader('Authorization', `OAuth ${accessToken}`);
152
+ }
153
+ else {
154
+ throw new sfError_1.SfError('Missing or invalid access token', 'MissingOrInvalidAccessToken');
155
+ }
156
+ this.log(`Streaming client target url: ${this.targetUrl}`);
157
+ this.log(`options.subscribeTimeout (ms): ${this.options.subscribeTimeout.milliseconds}`);
158
+ this.log(`options.handshakeTimeout (ms): ${this.options.handshakeTimeout.milliseconds}`);
159
+ }
160
+ /**
161
+ * Allows replaying of of Streaming events starting with replayId.
162
+ *
163
+ * @param replayId The starting message id to replay from.
164
+ */
165
+ replay(replayId) {
166
+ this.cometClient.addExtension({
167
+ outgoing: (message, callback) => {
168
+ if (message.channel === '/meta/subscribe') {
169
+ if (!message.ext) {
170
+ message.ext = {};
171
+ }
172
+ const replayFromMap = {};
173
+ replayFromMap[this.options.channel] = replayId;
174
+ // add "ext : { "replay" : { CHANNEL : REPLAY_VALUE }}" to subscribe message
175
+ (0, lib_1.set)(message, 'ext.replay', replayFromMap);
176
+ }
177
+ callback(message);
178
+ },
179
+ });
180
+ }
181
+ /**
182
+ * Provides a convenient way to handshake with the server endpoint before trying to subscribe.
183
+ */
184
+ handshake() {
185
+ let timeout;
186
+ return new Promise((resolve, reject) => {
187
+ timeout = setTimeout(() => {
188
+ const timeoutError = messages.createError('genericHandshakeTimeout', [this.targetUrl]);
189
+ this.doTimeout(timeout, timeoutError);
190
+ reject(timeoutError);
191
+ }, this.options.handshakeTimeout.milliseconds);
192
+ this.cometClient.handshake(() => {
193
+ this.log('handshake completed');
194
+ clearTimeout(timeout);
195
+ this.log('cleared handshake timeout');
196
+ resolve(StreamingClient.ConnectionState.CONNECTED);
197
+ });
198
+ });
199
+ }
200
+ /**
201
+ * Subscribe to streaming events. When the streaming processor that's set in the options completes execution it
202
+ * returns a payload in the StatusResult object. The payload is just echoed here for convenience.
203
+ *
204
+ * **Throws** *{@link SfError}{ name: '{@link StreamingClient.TimeoutErrorType.SUBSCRIBE}'}* When the subscribe timeout occurs.
205
+ *
206
+ * @param streamInit This function should call the platform apis that result in streaming updates on push topics.
207
+ * {@link StatusResult}
208
+ */
209
+ subscribe(streamInit) {
210
+ let timeout;
211
+ // This outer promise is to hold the streaming promise chain open until the streaming processor
212
+ // says it's complete.
213
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
214
+ return new Promise((subscribeResolve, subscribeReject) =>
215
+ // This is the inner promise chain that's satisfied when the client impl (Faye/Mock) says it's subscribed.
216
+ new Promise((subscriptionResolve, subscriptionReject) => {
217
+ timeout = setTimeout(() => {
218
+ const timeoutError = messages.createError('genericTimeout');
219
+ this.doTimeout(timeout, timeoutError);
220
+ subscribeReject(timeoutError);
221
+ }, this.options.subscribeTimeout.milliseconds);
222
+ // Initialize the subscription.
223
+ const subscription = this.cometClient.subscribe(this.options.channel, (message) => {
224
+ try {
225
+ // The result of the stream processor determines the state of the outer promise.
226
+ const result = this.options.streamProcessor(message);
227
+ // The stream processor says it's complete. Clean up and resolve the outer promise.
228
+ if (result?.completed) {
229
+ clearTimeout(timeout);
230
+ this.disconnectClient();
231
+ subscribeResolve(result.payload);
232
+ } // This 'if' is intended to be evaluated until it's completed or until the timeout fires.
233
+ }
234
+ catch (e) {
235
+ // it's completely valid for the stream processor to throw an error. If it does we will
236
+ // reject the outer promise. Keep in mind if we are here the subscription was resolved.
237
+ clearTimeout(timeout);
238
+ this.disconnectClient();
239
+ subscribeReject(e);
240
+ }
241
+ });
242
+ subscription.callback(() => {
243
+ subscriptionResolve();
244
+ });
245
+ subscription.errback((error) => {
246
+ subscriptionReject(error);
247
+ });
248
+ })
249
+ .then(() =>
250
+ // Now that we successfully have a subscription started up we are safe to initialize the function that
251
+ // will affect the streaming events. I.E. create an org or run apex tests.
252
+ streamInit?.())
253
+ .catch((error) => {
254
+ this.disconnect();
255
+ // Need to catch the subscription rejection or it will result in an unhandled rejection error.
256
+ clearTimeout(timeout);
257
+ // No subscription so we can reject the out promise as well.
258
+ subscribeReject(error);
259
+ }));
260
+ }
261
+ /**
262
+ * Handler for incoming streaming messages.
263
+ *
264
+ * @param message The message to process.
265
+ * @param cb The callback. Failure to call this can cause the internal comet client to hang.
266
+ */
267
+ incoming(message, cb) {
268
+ this.log(message);
269
+ // Look for a specific error message during the handshake. If found, throw an error
270
+ // with actions for the user.
271
+ if (message &&
272
+ message.channel === '/meta/handshake' &&
273
+ message.error &&
274
+ (0, lib_2.ensureString)(message.error).includes('400::API version in the URI is mandatory')) {
275
+ throw messages.createError('handshakeApiVersionError', [this.options.apiVersion]);
276
+ }
277
+ cb(message);
278
+ }
279
+ doTimeout(timeout, error) {
280
+ this.disconnect();
281
+ clearTimeout(timeout);
282
+ this.log(JSON.stringify(error));
283
+ return error;
284
+ }
285
+ disconnectClient() {
286
+ if (this.cometClient) {
287
+ this.cometClient.disconnect();
288
+ }
289
+ }
290
+ disconnect() {
291
+ this.log('Disconnecting the comet client');
292
+ // This is a patch for faye. If Faye encounters errors while attempting to handshake it will keep trying
293
+ // and will prevent the timeout from disconnecting. Here for example we will detect there is no client id but
294
+ // unauthenticated connections are being made to salesforce. Let's close the dispatcher if it exists and
295
+ // has no clientId.
296
+ // @ts-ignore
297
+ // eslint-disable-next-line no-underscore-dangle
298
+ if (this.cometClient._dispatcher) {
299
+ this.log('Closing the faye dispatcher');
300
+ // @ts-ignore
301
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, no-underscore-dangle
302
+ const dispatcher = this.cometClient._dispatcher;
303
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access
304
+ this.log(`dispatcher.clientId: ${dispatcher.clientId}`);
305
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
306
+ if (!dispatcher.clientId) {
307
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
308
+ dispatcher.close();
309
+ }
310
+ else {
311
+ this.disconnectClient();
312
+ }
313
+ }
314
+ }
315
+ /**
316
+ * Simple inner log wrapper
317
+ *
318
+ * @param message The message to log
319
+ */
320
+ log(message) {
321
+ if (this.logger) {
322
+ this.logger.debug(message);
323
+ }
324
+ }
325
+ }
326
+ exports.StreamingClient = StreamingClient;
327
+ (function (StreamingClient) {
328
+ /**
329
+ * Default Streaming Options. Uses Faye as the cometd impl.
330
+ */
331
+ class DefaultOptions {
332
+ /**
333
+ * Constructor for DefaultStreamingOptions
334
+ *
335
+ * @param org The streaming target org
336
+ * @param channel The streaming channel or topic. If the topic is a system topic then api 36.0 is used.
337
+ * System topics are deprecated.
338
+ * @param streamProcessor The function called that can process streaming messages.
339
+ * @param envDep
340
+ * @see {@link StatusResult}
341
+ */
342
+ constructor(org, channel, streamProcessor, envDep = lib_1.env) {
343
+ if (envDep) {
344
+ const logger = logger_1.Logger.childFromRoot('StreamingClient');
345
+ logger.warn('envDep is deprecated');
346
+ }
347
+ if (!streamProcessor) {
348
+ throw new sfError_1.SfError('Missing stream processor', 'MissingArg');
349
+ }
350
+ if (!org) {
351
+ throw new sfError_1.SfError('Missing org', 'MissingArg');
352
+ }
353
+ if (!channel) {
354
+ throw new sfError_1.SfError('Missing streaming channel', 'MissingArg');
355
+ }
356
+ this.org = org;
357
+ this.apiVersion = org.getConnection().getApiVersion();
358
+ if (channel.startsWith('/system')) {
359
+ this.apiVersion = '36.0';
360
+ }
361
+ if (!(parseFloat(this.apiVersion) > 0)) {
362
+ throw messages.createError('invalidApiVersion', [this.apiVersion]);
363
+ }
364
+ this.streamProcessor = streamProcessor;
365
+ this.channel = channel;
366
+ this.subscribeTimeout = StreamingClient.DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT;
367
+ this.handshakeTimeout = StreamingClient.DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT;
368
+ this.streamingImpl = {
369
+ getCometClient: (url) =>
370
+ // @ts-ignore
371
+ new Faye.Client(url),
372
+ setLogger: (logLine) => {
373
+ // @ts-ignore
374
+ Faye.logger = {};
375
+ ['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
376
+ // @ts-ignore
377
+ (0, lib_1.set)(Faye.logger, element, logLine);
378
+ });
379
+ },
380
+ };
381
+ }
382
+ /**
383
+ * Setter for the subscribe timeout.
384
+ *
385
+ * **Throws** An error if the newTime is less than the default time.
386
+ *
387
+ * @param newTime The new subscribe timeout.
388
+ * {@link DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT}
389
+ */
390
+ setSubscribeTimeout(newTime) {
391
+ this.subscribeTimeout = validateTimeout(newTime, DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT);
392
+ }
393
+ /**
394
+ * Setter for the handshake timeout.
395
+ *
396
+ * **Throws** An error if the newTime is less than the default time.
397
+ *
398
+ * @param newTime The new handshake timeout
399
+ * {@link DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT}
400
+ */
401
+ setHandshakeTimeout(newTime) {
402
+ this.handshakeTimeout = validateTimeout(newTime, DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT);
403
+ }
404
+ }
405
+ DefaultOptions.SFDX_ENABLE_FAYE_COOKIES_ALLOW_ALL_PATHS = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
406
+ DefaultOptions.SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
407
+ DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT = lib_1.Duration.minutes(3);
408
+ DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT = lib_1.Duration.seconds(30);
409
+ StreamingClient.DefaultOptions = DefaultOptions;
410
+ /**
411
+ * Connection state
412
+ *
413
+ * @see {@link StreamingClient.handshake}
414
+ */
415
+ let ConnectionState;
416
+ (function (ConnectionState) {
417
+ /**
418
+ * Used to indicated that the streaming client is connected.
419
+ */
420
+ ConnectionState[ConnectionState["CONNECTED"] = 0] = "CONNECTED";
421
+ })(ConnectionState = StreamingClient.ConnectionState || (StreamingClient.ConnectionState = {}));
422
+ /**
423
+ * Indicators to test error names for StreamingTimeouts
424
+ */
425
+ let TimeoutErrorType;
426
+ (function (TimeoutErrorType) {
427
+ /**
428
+ * To indicate the error occurred on handshake
429
+ */
430
+ TimeoutErrorType["HANDSHAKE"] = "GenericHandshakeTimeoutError";
431
+ /**
432
+ * To indicate the error occurred on subscribe
433
+ */
434
+ TimeoutErrorType["SUBSCRIBE"] = "GenericTimeoutError";
435
+ })(TimeoutErrorType = StreamingClient.TimeoutErrorType || (StreamingClient.TimeoutErrorType = {}));
436
+ })(StreamingClient = exports.StreamingClient || (exports.StreamingClient = {}));
437
437
  //# sourceMappingURL=streamingClient.js.map