@promptbook/website-crawler 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
@@ -24,7 +24,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
24
24
  *
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2978,16 +2978,16 @@ function $registeredScrapersMessage() {
2978
2978
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
2979
2979
  */
2980
2980
  var all = [];
2981
- var _loop_1 = function (packageName, className) {
2981
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
2982
2982
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
2983
2983
  return "continue";
2984
2984
  }
2985
- all.push({ packageName: packageName, className: className });
2985
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
2986
2986
  };
2987
2987
  try {
2988
2988
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
2989
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
2990
- _loop_1(packageName, className);
2989
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
2990
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
2991
2991
  }
2992
2992
  }
2993
2993
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -2997,16 +2997,16 @@ function $registeredScrapersMessage() {
2997
2997
  }
2998
2998
  finally { if (e_1) throw e_1.error; }
2999
2999
  }
3000
- var _loop_2 = function (packageName, className) {
3000
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3001
3001
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3002
3002
  return "continue";
3003
3003
  }
3004
- all.push({ packageName: packageName, className: className });
3004
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3005
3005
  };
3006
3006
  try {
3007
3007
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
3008
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
3009
- _loop_2(packageName, className);
3008
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
3009
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
3010
3010
  }
3011
3011
  }
3012
3012
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -3036,29 +3036,33 @@ function $registeredScrapersMessage() {
3036
3036
  }
3037
3037
  return spaceTrim$1(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
3038
3038
  .map(function (_a, i) {
3039
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
3039
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
3040
3040
  var more;
3041
+ // TODO: Use documentationUrl
3041
3042
  if (just(false)) {
3042
3043
  more = '';
3043
3044
  }
3044
3045
  else if (!isMetadataAviailable && !isInstalled) {
3045
3046
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
3046
- more = "(not installed and no metadata, looks like a unexpected behavior)";
3047
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
3047
3048
  }
3048
3049
  else if (isMetadataAviailable && !isInstalled) {
3049
3050
  // TODO: [�][�]
3050
- more = "(not installed)";
3051
+ more = "*(not installed)*";
3051
3052
  }
3052
3053
  else if (!isMetadataAviailable && isInstalled) {
3053
- more = "(no metadata, looks like a unexpected behavior)";
3054
+ more = "*(no metadata, looks like a unexpected behavior)*";
3054
3055
  }
3055
3056
  else if (isMetadataAviailable && isInstalled) {
3056
3057
  more = "(installed)";
3057
3058
  }
3058
3059
  else {
3059
- more = "(unknown state, looks like a unexpected behavior)";
3060
+ more = "*(unknown state, looks like a unexpected behavior)*";
3060
3061
  }
3061
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
3062
+ if (!isAvilableInBrowser) {
3063
+ more += " *(not available in browser)*";
3064
+ }
3065
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
3062
3066
  })
3063
3067
  .join('\n')), "\n "); });
3064
3068
  }
@@ -3355,7 +3359,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3355
3359
  return [7 /*endfinally*/];
3356
3360
  case 9:
3357
3361
  if (partialPieces === null) {
3358
- throw new KnowledgeScrapeError(spaceTrim$1(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 "); }));
3362
+ throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
3363
+ .split('\n')
3364
+ .map(function (line) { return "> ".concat(line); })
3365
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
3359
3366
  }
3360
3367
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
3361
3368
  {