mentie 0.1.11 → 0.1.13

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.
@@ -80,7 +80,9 @@ export const log_environment = logger => {
80
80
  },
81
81
  environment: {
82
82
  dev,
83
- is_emulator
83
+ is_emulator,
84
+ is_cypress,
85
+ loglevel
84
86
  }
85
87
  }
86
88
 
@@ -63,7 +63,14 @@ const annotate_messages = messages => {
63
63
 
64
64
 
65
65
  // If we are running in cypress, stringify the messages because they become unavailable in the console
66
- if( is_cypress ) messages = messages.map( message => JSON.stringify( message, null, 2 ) )
66
+ if( is_cypress ) {
67
+
68
+ try {
69
+ messages = messages.map( message => JSON.stringify( message, null, 2 ) )
70
+ } catch {
71
+ // This fails if the JSON was something curcular, se we'll leave things as they are
72
+ }
73
+ }
67
74
 
68
75
  // Annotate the provided messages
69
76
  messages = add_trace( messages )
@@ -10,12 +10,12 @@
10
10
  * @example
11
11
  * make_retryable( do_thing )
12
12
  * make_retryable( () => fetch( 'https://api.com/data' ) )
13
- * @see {@link https://www.npmjs.com/package/promise-retry|promise-retry}
13
+ * @see {@link https://www.npmjs.com/package/promise-retry}
14
14
  */
15
15
  export async function make_retryable( async_function, { retry_times=5, cooldown_in_s=10, cooldown_entropy=true, logger=null } ) {
16
16
 
17
17
  // Function dependencies
18
- const Retrier = await import( 'promise-retry' )
18
+ const { default: Retrier } = await import( 'promise-retry' )
19
19
  const { wait } = await import( './time.js' )
20
20
 
21
21
  // Set a default logger that does nothing if none was provided
@@ -67,12 +67,12 @@ export async function make_retryable( async_function, { retry_times=5, cooldown_
67
67
  * @param {Function} [options.logger] - Progress callback function.
68
68
  * @param {boolean} [options.fail_fast=true] - Whether to fail fast or continue with other functions when an error occurs.
69
69
  * @returns {Promise<Array>} - A promise that resolves to an array of results from the async functions.
70
- * @see {@link https://www.npmjs.com/package/promise-parallel-throttle|promise-parallel-throttle}
70
+ * @see {@link https://www.npmjs.com/package/promise-parallel-throttle}
71
71
  */
72
72
  export async function throttle_and_retry( async_function_array=[], { max_parallel=2, retry_times, cooldown_in_s, cooldown_entropy, logger, fail_fast=true } ) {
73
73
 
74
74
  // Function dependencies
75
- const Throttle = await import( 'promise-parallel-throttle' )
75
+ const { default: Throttle } = await import( 'promise-parallel-throttle' )
76
76
 
77
77
  // Create array of retryable functions
78
78
  const retryable_async_functions = async_function_array.map( async_function => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mentie",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Mentor's toolbelt",
5
5
  "type": "module",
6
6
  "main": "index.js",