@promptbook/node 0.86.0-13 → 0.86.0-14

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 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- var PROMPTBOOK_ENGINE_VERSION = '0.86.0-13';
32
+ var PROMPTBOOK_ENGINE_VERSION = '0.86.0-14';
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
@@ -548,7 +548,7 @@ function capitalize(word) {
548
548
  * Converts promptbook in JSON format to string format
549
549
  *
550
550
  * @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
551
- * @param pipelineJson Promptbook in JSON format (.book.json)
551
+ * @param pipelineJson Promptbook in JSON format (.bookc)
552
552
  * @returns Promptbook in string format (.book.md)
553
553
  * @public exported from `@promptbook/core`
554
554
  */
@@ -9070,7 +9070,7 @@ function flattenMarkdown(markdown) {
9070
9070
  * Note: This function acts as compilation process
9071
9071
  *
9072
9072
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9073
- * @returns {Promptbook} compiled in JSON format (.book.json)
9073
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9074
9074
  * @throws {ParseError} if the promptbook string is not valid
9075
9075
  * @public exported from `@promptbook/core`
9076
9076
  */
@@ -9538,7 +9538,7 @@ function parsePipeline(pipelineString) {
9538
9538
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9539
9539
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
9540
9540
  * @param options - Options and tools for the compilation
9541
- * @returns {Promptbook} compiled in JSON format (.book.json)
9541
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9542
9542
  * @throws {ParseError} if the promptbook string is not valid
9543
9543
  * @public exported from `@promptbook/core`
9544
9544
  */
@@ -11266,7 +11266,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11266
11266
  }
11267
11267
  madeLibraryFilePath = join(rootPath, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
11268
11268
  // <- TODO: [🦒] Allow to override (pass different value into the function)
11269
- , ".json"));
11269
+ , ".bookc"));
11270
11270
  return [4 /*yield*/, isFileExisting(madeLibraryFilePath, tools.fs)];
11271
11271
  case 3:
11272
11272
  if (!(_f.sent())) ;
@@ -11288,13 +11288,13 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11288
11288
  return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
11289
11289
  case 1:
11290
11290
  fileNames = _b.sent();
11291
- // Note: First load all `.book.json` and then `.book` / `.book` files
11292
- // `.book.json` can be prepared so it is faster to load
11291
+ // Note: First load compiled `.bookc` files and then source `.book` files
11292
+ // `.bookc` are already compiled and can be used faster
11293
11293
  fileNames.sort(function (a, b) {
11294
- if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
11294
+ if ((a.endsWith('.bookc') || a.endsWith('.book.json')) && (b.endsWith('.book') || b.endsWith('.book.md'))) {
11295
11295
  return -1;
11296
11296
  }
11297
- if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
11297
+ if ((a.endsWith('.book') || a.endsWith('.book.md')) && (b.endsWith('.bookc') || b.endsWith('.book.json'))) {
11298
11298
  return 1;
11299
11299
  }
11300
11300
  return 0;
@@ -11311,7 +11311,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11311
11311
  case 1:
11312
11312
  _f.trys.push([1, 8, , 9]);
11313
11313
  pipeline = null;
11314
- if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
11314
+ if (!(fileName.endsWith('.book') || fileName.endsWith('.book.md'))) return [3 /*break*/, 4];
11315
11315
  _c = validatePipelineString;
11316
11316
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11317
11317
  case 2:
@@ -11324,7 +11324,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11324
11324
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
11325
11325
  return [3 /*break*/, 7];
11326
11326
  case 4:
11327
- if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
11327
+ if (!(fileName.endsWith('.bookc') || fileName.endsWith('.book.json'))) return [3 /*break*/, 6];
11328
11328
  _e = (_d = JSON).parse;
11329
11329
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11330
11330
  case 5: