@salesforce/core 8.9.0 → 8.10.0

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.
@@ -29,7 +29,7 @@ function default_1() {
29
29
  cb();
30
30
  },
31
31
  });
32
- // eslint-disable-next-line @typescript-eslint/no-empty-function
32
+ // Set up pipeline with proper error handling
33
33
  (0, node_stream_1.pipeline)(source, myTransportStream, () => { });
34
34
  return myTransportStream;
35
35
  }, {
@@ -37,21 +37,20 @@ function default_1() {
37
37
  enablePipelining: true,
38
38
  });
39
39
  }
40
- /** if the DEBUG= is set, see if that matches the logger name. If not, we don't want to keep going */
40
+ // Cache for debug regex to avoid recreating it on every message
41
+ let cachedDebugRegex = null;
42
+ let lastDebugPattern = null;
41
43
  const debugAllows = (chunk) => {
42
44
  if (!process.env.DEBUG || process.env.DEBUG === '*')
43
45
  return true;
44
46
  if (typeof chunk.name !== 'string')
45
47
  return true;
46
- // turn wildcard patterns into regexes
47
- const regexFromDebug = new RegExp(process.env.DEBUG.replace(/\*/g, '.*'));
48
- if (!regexFromDebug.test(chunk.name)) {
49
- // console.log(`no match : ${chunk.name} for ${process.env.DEBUG}`);
50
- return false;
51
- }
52
- else {
53
- // console.log(`match : ${chunk.name} for ${process.env.DEBUG}`);
54
- return true;
48
+ // Only create a new regex if the DEBUG pattern has changed
49
+ if (process.env.DEBUG !== lastDebugPattern) {
50
+ lastDebugPattern = process.env.DEBUG;
51
+ cachedDebugRegex = new RegExp(process.env.DEBUG.replace(/\*/g, '.*'));
55
52
  }
53
+ // Use the cached regex for pattern matching
54
+ return cachedDebugRegex.test(chunk.name);
56
55
  };
57
56
  //# sourceMappingURL=transformStream.js.map
@@ -65,6 +65,11 @@ export declare namespace PollingClient {
65
65
  * ```
66
66
  */
67
67
  timeoutErrorName?: string;
68
+ /**
69
+ * Maximum number of retries. Use 'INFINITELY' for unlimited retries until timeout is reached.
70
+ * If not specified, defaults to 'INFINITELY'.
71
+ */
72
+ retryLimit?: number | 'INFINITELY';
68
73
  };
69
74
  /**
70
75
  * Default options set for polling. The default options specify a timeout of 3 minutes and polling frequency of 15
@@ -76,13 +76,12 @@ class PollingClient extends kit_1.AsyncOptionalCreatable {
76
76
  }
77
77
  throw new Error('Operation did not complete. Retrying...'); // triggers a retry
78
78
  };
79
- const finalResult = (0, ts_retry_promise_1.retryDecorator)(doPoll, {
80
- timeout: this.options.timeout.milliseconds,
81
- delay: this.options.frequency.milliseconds,
82
- retries: 'INFINITELY',
83
- });
84
79
  try {
85
- return await finalResult();
80
+ return await (0, ts_retry_promise_1.retryDecorator)(doPoll, {
81
+ timeout: this.options.timeout.milliseconds,
82
+ delay: this.options.frequency.milliseconds,
83
+ retries: this.options.retryLimit ?? 'INFINITELY',
84
+ })();
86
85
  }
87
86
  catch (error) {
88
87
  if (errorInPollingFunction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",