@promptbook/markdown-utils 0.75.2 → 0.75.3

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
@@ -20,7 +20,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
20
20
  *
21
21
  * @see https://github.com/webgptorg/promptbook
22
22
  */
23
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
23
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
26
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3048,16 +3048,16 @@ function $registeredScrapersMessage() {
3048
3048
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
3049
3049
  */
3050
3050
  var all = [];
3051
- var _loop_1 = function (packageName, className) {
3051
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3052
3052
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3053
3053
  return "continue";
3054
3054
  }
3055
- all.push({ packageName: packageName, className: className });
3055
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3056
3056
  };
3057
3057
  try {
3058
3058
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
3059
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
3060
- _loop_1(packageName, className);
3059
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
3060
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
3061
3061
  }
3062
3062
  }
3063
3063
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -3067,16 +3067,16 @@ function $registeredScrapersMessage() {
3067
3067
  }
3068
3068
  finally { if (e_1) throw e_1.error; }
3069
3069
  }
3070
- var _loop_2 = function (packageName, className) {
3070
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3071
3071
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3072
3072
  return "continue";
3073
3073
  }
3074
- all.push({ packageName: packageName, className: className });
3074
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3075
3075
  };
3076
3076
  try {
3077
3077
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
3078
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
3079
- _loop_2(packageName, className);
3078
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
3079
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
3080
3080
  }
3081
3081
  }
3082
3082
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -3106,29 +3106,33 @@ function $registeredScrapersMessage() {
3106
3106
  }
3107
3107
  return spaceTrim(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
3108
3108
  .map(function (_a, i) {
3109
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
3109
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
3110
3110
  var more;
3111
+ // TODO: Use documentationUrl
3111
3112
  if (just(false)) {
3112
3113
  more = '';
3113
3114
  }
3114
3115
  else if (!isMetadataAviailable && !isInstalled) {
3115
3116
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
3116
- more = "(not installed and no metadata, looks like a unexpected behavior)";
3117
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
3117
3118
  }
3118
3119
  else if (isMetadataAviailable && !isInstalled) {
3119
3120
  // TODO: [�][�]
3120
- more = "(not installed)";
3121
+ more = "*(not installed)*";
3121
3122
  }
3122
3123
  else if (!isMetadataAviailable && isInstalled) {
3123
- more = "(no metadata, looks like a unexpected behavior)";
3124
+ more = "*(no metadata, looks like a unexpected behavior)*";
3124
3125
  }
3125
3126
  else if (isMetadataAviailable && isInstalled) {
3126
3127
  more = "(installed)";
3127
3128
  }
3128
3129
  else {
3129
- more = "(unknown state, looks like a unexpected behavior)";
3130
+ more = "*(unknown state, looks like a unexpected behavior)*";
3130
3131
  }
3131
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
3132
+ if (!isAvilableInBrowser) {
3133
+ more += " *(not available in browser)*";
3134
+ }
3135
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
3132
3136
  })
3133
3137
  .join('\n')), "\n "); });
3134
3138
  }
@@ -3425,7 +3429,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3425
3429
  return [7 /*endfinally*/];
3426
3430
  case 9:
3427
3431
  if (partialPieces === null) {
3428
- throw new KnowledgeScrapeError(spaceTrim(function (block) { return "\n Cannot scrape knowledge from source: ".concat(knowledgeSource.sourceContent, "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
3432
+ throw new KnowledgeScrapeError(spaceTrim(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
3433
+ .split('\n')
3434
+ .map(function (line) { return "> ".concat(line); })
3435
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
3429
3436
  }
3430
3437
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
3431
3438
  {