@promptbook/markdown-utils 0.75.1 → 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.0';
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
@@ -1329,7 +1329,6 @@ function validatePipelineCore(pipeline) {
1329
1329
  while (unresovedTasks.length > 0) {
1330
1330
  _loop_3();
1331
1331
  }
1332
- // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1333
1332
  }
1334
1333
  /**
1335
1334
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -3049,16 +3048,16 @@ function $registeredScrapersMessage() {
3049
3048
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
3050
3049
  */
3051
3050
  var all = [];
3052
- var _loop_1 = function (packageName, className) {
3051
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3053
3052
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3054
3053
  return "continue";
3055
3054
  }
3056
- all.push({ packageName: packageName, className: className });
3055
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3057
3056
  };
3058
3057
  try {
3059
3058
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
3060
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
3061
- _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);
3062
3061
  }
3063
3062
  }
3064
3063
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -3068,16 +3067,16 @@ function $registeredScrapersMessage() {
3068
3067
  }
3069
3068
  finally { if (e_1) throw e_1.error; }
3070
3069
  }
3071
- var _loop_2 = function (packageName, className) {
3070
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3072
3071
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3073
3072
  return "continue";
3074
3073
  }
3075
- all.push({ packageName: packageName, className: className });
3074
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3076
3075
  };
3077
3076
  try {
3078
3077
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
3079
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
3080
- _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);
3081
3080
  }
3082
3081
  }
3083
3082
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -3107,29 +3106,33 @@ function $registeredScrapersMessage() {
3107
3106
  }
3108
3107
  return spaceTrim(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
3109
3108
  .map(function (_a, i) {
3110
- 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;
3111
3110
  var more;
3111
+ // TODO: Use documentationUrl
3112
3112
  if (just(false)) {
3113
3113
  more = '';
3114
3114
  }
3115
3115
  else if (!isMetadataAviailable && !isInstalled) {
3116
3116
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
3117
- more = "(not installed and no metadata, looks like a unexpected behavior)";
3117
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
3118
3118
  }
3119
3119
  else if (isMetadataAviailable && !isInstalled) {
3120
3120
  // TODO: [�][�]
3121
- more = "(not installed)";
3121
+ more = "*(not installed)*";
3122
3122
  }
3123
3123
  else if (!isMetadataAviailable && isInstalled) {
3124
- more = "(no metadata, looks like a unexpected behavior)";
3124
+ more = "*(no metadata, looks like a unexpected behavior)*";
3125
3125
  }
3126
3126
  else if (isMetadataAviailable && isInstalled) {
3127
3127
  more = "(installed)";
3128
3128
  }
3129
3129
  else {
3130
- more = "(unknown state, looks like a unexpected behavior)";
3130
+ more = "*(unknown state, looks like a unexpected behavior)*";
3131
3131
  }
3132
- 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);
3133
3136
  })
3134
3137
  .join('\n')), "\n "); });
3135
3138
  }
@@ -3426,7 +3429,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3426
3429
  return [7 /*endfinally*/];
3427
3430
  case 9:
3428
3431
  if (partialPieces === null) {
3429
- 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 "); }));
3430
3436
  }
3431
3437
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
3432
3438
  {