@promptbook/legacy-documents 0.77.0 → 0.77.1

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
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2228,7 +2228,7 @@ var NotYetImplementedError = /** @class */ (function (_super) {
2228
2228
  *
2229
2229
  * @public exported from `@promptbook/core`
2230
2230
  */
2231
- var ERRORS = {
2231
+ var PROMPTBOOK_ERRORS = {
2232
2232
  AbstractFormatError: AbstractFormatError,
2233
2233
  CsvFormatError: CsvFormatError,
2234
2234
  CollectionError: CollectionError,
@@ -2246,6 +2246,35 @@ var ERRORS = {
2246
2246
  UnexpectedError: UnexpectedError,
2247
2247
  // TODO: [🪑]> VersionMismatchError,
2248
2248
  };
2249
+ /**
2250
+ * Index of all javascript errors
2251
+ *
2252
+ * @private for internal usage
2253
+ */
2254
+ var COMMON_JAVASCRIPT_ERRORS = {
2255
+ Error: Error,
2256
+ EvalError: EvalError,
2257
+ RangeError: RangeError,
2258
+ ReferenceError: ReferenceError,
2259
+ SyntaxError: SyntaxError,
2260
+ TypeError: TypeError,
2261
+ URIError: URIError,
2262
+ AggregateError: AggregateError,
2263
+ /*
2264
+ Note: Not widely supported
2265
+ > InternalError,
2266
+ > ModuleError,
2267
+ > HeapError,
2268
+ > WebAssemblyCompileError,
2269
+ > WebAssemblyRuntimeError,
2270
+ */
2271
+ };
2272
+ /**
2273
+ * Index of all errors
2274
+ *
2275
+ * @private for internal usage
2276
+ */
2277
+ var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
2249
2278
  /**
2250
2279
  * Note: [💞] Ignore a discrepancy between file name and entity name
2251
2280
  */
@@ -2256,11 +2285,11 @@ var ERRORS = {
2256
2285
  * @public exported from `@promptbook/utils`
2257
2286
  */
2258
2287
  function deserializeError(error) {
2259
- if (error.name === 'Error') {
2260
- return new Error(error.message);
2288
+ var ErrorClass = ALL_ERRORS[error.name];
2289
+ if (ErrorClass === undefined) {
2290
+ return new Error("".concat(error.name, ": ").concat(error.message));
2261
2291
  }
2262
- var CustomError = ERRORS[error.name];
2263
- return new CustomError(error.message);
2292
+ return new ErrorClass(error.message);
2264
2293
  }
2265
2294
 
2266
2295
  /**
@@ -2334,8 +2363,8 @@ function isPipelinePrepared(pipeline) {
2334
2363
  */
2335
2364
  function serializeError(error) {
2336
2365
  var name = error.name, message = error.message, stack = error.stack;
2337
- if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
2338
- throw new UnexpectedError(spaceTrim$1(function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
2366
+ if (!Object.keys(ALL_ERRORS).includes(name)) {
2367
+ console.error(spaceTrim$1(function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
2339
2368
  }
2340
2369
  return {
2341
2370
  name: name,