@promptbook/documents 0.112.0-115 → 0.112.0-117

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
@@ -3,14 +3,13 @@ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { spawn } from 'child_process';
4
4
  import colors from 'colors';
5
5
  import { forTime } from 'waitasecond';
6
- import { randomBytes } from 'crypto';
6
+ import CryptoJS from 'crypto-js';
7
7
  import { Subject } from 'rxjs';
8
8
  import hexEncoder from 'crypto-js/enc-hex';
9
9
  import sha256 from 'crypto-js/sha256';
10
10
  import { basename, join, dirname, isAbsolute } from 'path';
11
- import { SHA256 } from 'crypto-js';
12
11
  import { lookup, extension } from 'mime-types';
13
- import { parse, unparse } from 'papaparse';
12
+ import papaparse from 'papaparse';
14
13
 
15
14
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
16
15
  /**
@@ -26,7 +25,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
25
  * @generated
27
26
  * @see https://github.com/webgptorg/promptbook
28
27
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-115';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
30
29
  /**
31
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3358,7 +3357,7 @@ function createPipelineCollectionFromJson(...promptbooks) {
3358
3357
  * @private internal helper function
3359
3358
  */
3360
3359
  function $randomToken(randomness) {
3361
- return randomBytes(randomness).toString('hex');
3360
+ return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
3362
3361
  }
3363
3362
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3364
3363
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -5292,7 +5291,7 @@ function normalizeToKebabCase(text) {
5292
5291
  * @public exported from `@promptbook/editable`
5293
5292
  */
5294
5293
  function knowledgeSourceContentToName(knowledgeSourceContent) {
5295
- const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
5294
+ const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
5296
5295
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
5297
5296
  .toString( /* hex */)
5298
5297
  .substring(0, 20);
@@ -6253,7 +6252,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
6253
6252
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
6254
6253
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
6255
6254
  }
6256
- const csv = parse(value, settings);
6255
+ const csv = papaparse.parse(value, settings);
6257
6256
  return csv;
6258
6257
  }
6259
6258
 
@@ -6338,10 +6337,10 @@ const CsvFormatParser = {
6338
6337
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
6339
6338
  );
6340
6339
  */
6341
- await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6340
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6342
6341
  }
6343
6342
  }
6344
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6343
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6345
6344
  },
6346
6345
  },
6347
6346
  {
@@ -6369,7 +6368,7 @@ const CsvFormatParser = {
6369
6368
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
6370
6369
  }));
6371
6370
  }));
6372
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6371
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6373
6372
  },
6374
6373
  },
6375
6374
  ],
@@ -8567,7 +8566,7 @@ async function getScraperIntermediateSource(source, options) {
8567
8566
  const { filename: sourceFilename, url } = source;
8568
8567
  const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
8569
8568
  // TODO: [👬] DRY
8570
- const hash = SHA256(
8569
+ const hash = CryptoJS.SHA256(
8571
8570
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
8572
8571
  hexEncoder.parse(sourceFilename || url || 'untitled'))
8573
8572
  .toString( /* hex */)