@promptbook/website-crawler 0.89.0-15 โ†’ 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
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-15';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -119,6 +119,7 @@ const ADMIN_EMAIL = 'pavol@ptbk.io';
119
119
  * @public exported from `@promptbook/core`
120
120
  */
121
121
  const ADMIN_GITHUB_NAME = 'hejny';
122
+ // <- TODO: [๐ŸŠ] Pick the best claim
122
123
  /**
123
124
  * When the title is not provided, the default title is used
124
125
  *
@@ -191,7 +192,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
191
192
  */
192
193
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
193
194
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
194
- // TODO: !!!!!! Just .promptbook dir, hardocode others
195
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
195
196
  /**
196
197
  * Where to store the temporary downloads
197
198
  *
@@ -1066,44 +1067,42 @@ class WrappedError extends Error {
1066
1067
  constructor(whatWasThrown) {
1067
1068
  const tag = `[๐Ÿคฎ]`;
1068
1069
  console.error(tag, whatWasThrown);
1069
- super(spaceTrim((block) => `
1070
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
1071
-
1072
- Note: Look for ${tag} in the console for more details
1073
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
1070
+ super(spaceTrim(`
1071
+ Non-Error object was thrown
1074
1072
 
1075
- Please report issue on ${ADMIN_EMAIL}
1076
-
1077
- `));
1073
+ Note: Look for ${tag} in the console for more details
1074
+ Please report issue on ${ADMIN_EMAIL}
1075
+ `));
1078
1076
  this.name = 'WrappedError';
1079
1077
  Object.setPrototypeOf(this, WrappedError.prototype);
1080
1078
  }
1081
1079
  }
1082
1080
 
1083
1081
  /**
1084
- * !!!@@@
1082
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
1085
1083
  *
1086
- * @param whatWasThrown !!!@@@
1087
- * @returns !!!@@@
1084
+ * @param whatWasThrown Any object that was thrown
1085
+ * @returns Nothing if the error is an instance of `Error`
1086
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
1088
1087
  *
1089
1088
  * @private within the repository
1090
1089
  */
1091
1090
  function assertsError(whatWasThrown) {
1092
- // Case 1: !!!@@@
1091
+ // Case 1: Handle error which was rethrown as `WrappedError`
1093
1092
  if (whatWasThrown instanceof WrappedError) {
1094
1093
  const wrappedError = whatWasThrown;
1095
1094
  throw wrappedError;
1096
1095
  }
1097
- // Case 2: !!!@@@
1096
+ // Case 2: Handle unexpected errors
1098
1097
  if (whatWasThrown instanceof UnexpectedError) {
1099
1098
  const unexpectedError = whatWasThrown;
1100
1099
  throw unexpectedError;
1101
1100
  }
1102
- // Case 3: !!!@@@
1101
+ // Case 3: Handle standard errors - keep them up to consumer
1103
1102
  if (whatWasThrown instanceof Error) {
1104
1103
  return;
1105
1104
  }
1106
- // Case 4: !!!@@@
1105
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
1107
1106
  throw new WrappedError(whatWasThrown);
1108
1107
  }
1109
1108
 
@@ -2233,7 +2232,7 @@ class PipelineExecutionError extends Error {
2233
2232
  }
2234
2233
  }
2235
2234
  /**
2236
- * TODO: !!!!!! Add id to all errors
2235
+ * TODO: [๐Ÿง ][๐ŸŒ‚] Add id to all errors
2237
2236
  */
2238
2237
 
2239
2238
  /**
@@ -2563,8 +2562,8 @@ function createTask(options) {
2563
2562
  updatedAt = new Date();
2564
2563
  errors.push(...executionResult.errors);
2565
2564
  warnings.push(...executionResult.warnings);
2566
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
2567
- // TODO: [๐Ÿง ] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2565
+ // <- TODO: [๐ŸŒ‚] Only unique errors and warnings should be added (or filtered)
2566
+ // TODO: [๐Ÿง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2568
2567
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
2569
2568
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2570
2569
  assertsTaskSuccessful(executionResult);