@promptbook/markdown-utils 0.89.0-14 โ†’ 0.89.0-16

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/esm/index.es.js CHANGED
@@ -25,7 +25,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-14';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -218,6 +218,7 @@ const ADMIN_EMAIL = 'pavol@ptbk.io';
218
218
  * @public exported from `@promptbook/core`
219
219
  */
220
220
  const ADMIN_GITHUB_NAME = 'hejny';
221
+ // <- TODO: [๐ŸŠ] Pick the best claim
221
222
  /**
222
223
  * When the title is not provided, the default title is used
223
224
  *
@@ -290,7 +291,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
290
291
  */
291
292
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
292
293
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
293
- // TODO: !!!!!! Just .promptbook dir, hardocode others
294
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
294
295
  /**
295
296
  * Where to store the temporary downloads
296
297
  *
@@ -422,44 +423,42 @@ class WrappedError extends Error {
422
423
  constructor(whatWasThrown) {
423
424
  const tag = `[๐Ÿคฎ]`;
424
425
  console.error(tag, whatWasThrown);
425
- super(spaceTrim$1((block) => `
426
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
427
-
428
- Note: Look for ${tag} in the console for more details
429
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
426
+ super(spaceTrim$1(`
427
+ Non-Error object was thrown
430
428
 
431
- Please report issue on ${ADMIN_EMAIL}
432
-
433
- `));
429
+ Note: Look for ${tag} in the console for more details
430
+ Please report issue on ${ADMIN_EMAIL}
431
+ `));
434
432
  this.name = 'WrappedError';
435
433
  Object.setPrototypeOf(this, WrappedError.prototype);
436
434
  }
437
435
  }
438
436
 
439
437
  /**
440
- * !!!@@@
438
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
441
439
  *
442
- * @param whatWasThrown !!!@@@
443
- * @returns !!!@@@
440
+ * @param whatWasThrown Any object that was thrown
441
+ * @returns Nothing if the error is an instance of `Error`
442
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
444
443
  *
445
444
  * @private within the repository
446
445
  */
447
446
  function assertsError(whatWasThrown) {
448
- // Case 1: !!!@@@
447
+ // Case 1: Handle error which was rethrown as `WrappedError`
449
448
  if (whatWasThrown instanceof WrappedError) {
450
449
  const wrappedError = whatWasThrown;
451
450
  throw wrappedError;
452
451
  }
453
- // Case 2: !!!@@@
452
+ // Case 2: Handle unexpected errors
454
453
  if (whatWasThrown instanceof UnexpectedError) {
455
454
  const unexpectedError = whatWasThrown;
456
455
  throw unexpectedError;
457
456
  }
458
- // Case 3: !!!@@@
457
+ // Case 3: Handle standard errors - keep them up to consumer
459
458
  if (whatWasThrown instanceof Error) {
460
459
  return;
461
460
  }
462
- // Case 4: !!!@@@
461
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
463
462
  throw new WrappedError(whatWasThrown);
464
463
  }
465
464
 
@@ -1755,7 +1754,7 @@ class PipelineExecutionError extends Error {
1755
1754
  }
1756
1755
  }
1757
1756
  /**
1758
- * TODO: !!!!!! Add id to all errors
1757
+ * TODO: [๐Ÿง ][๐ŸŒ‚] Add id to all errors
1759
1758
  */
1760
1759
 
1761
1760
  /**
@@ -2134,8 +2133,8 @@ function createTask(options) {
2134
2133
  updatedAt = new Date();
2135
2134
  errors.push(...executionResult.errors);
2136
2135
  warnings.push(...executionResult.warnings);
2137
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
2138
- // TODO: [๐Ÿง ] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2136
+ // <- TODO: [๐ŸŒ‚] Only unique errors and warnings should be added (or filtered)
2137
+ // TODO: [๐Ÿง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2139
2138
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
2140
2139
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2141
2140
  assertsTaskSuccessful(executionResult);