@promptbook/markdown-utils 0.112.0-114 → 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
@@ -1,13 +1,12 @@
1
1
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
- import { randomBytes } from 'crypto';
2
+ import CryptoJS from 'crypto-js';
3
3
  import { Subject } from 'rxjs';
4
4
  import { forTime } from 'waitasecond';
5
5
  import hexEncoder from 'crypto-js/enc-hex';
6
6
  import sha256 from 'crypto-js/sha256';
7
7
  import { basename, join, dirname, isAbsolute } from 'path';
8
- import { SHA256 } from 'crypto-js';
9
8
  import { lookup, extension } from 'mime-types';
10
- import { parse, unparse } from 'papaparse';
9
+ import papaparse from 'papaparse';
11
10
 
12
11
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
13
12
  /**
@@ -23,7 +22,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
23
22
  * @generated
24
23
  * @see https://github.com/webgptorg/promptbook
25
24
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
27
26
  /**
28
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3269,7 +3268,7 @@ class MissingToolsError extends Error {
3269
3268
  * @private internal helper function
3270
3269
  */
3271
3270
  function $randomToken(randomness) {
3272
- return randomBytes(randomness).toString('hex');
3271
+ return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
3273
3272
  }
3274
3273
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3275
3274
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -5229,7 +5228,7 @@ function normalizeToKebabCase(text) {
5229
5228
  * @public exported from `@promptbook/editable`
5230
5229
  */
5231
5230
  function knowledgeSourceContentToName(knowledgeSourceContent) {
5232
- const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
5231
+ const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
5233
5232
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
5234
5233
  .toString( /* hex */)
5235
5234
  .substring(0, 20);
@@ -6223,7 +6222,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
6223
6222
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
6224
6223
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
6225
6224
  }
6226
- const csv = parse(value, settings);
6225
+ const csv = papaparse.parse(value, settings);
6227
6226
  return csv;
6228
6227
  }
6229
6228
 
@@ -6308,10 +6307,10 @@ const CsvFormatParser = {
6308
6307
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
6309
6308
  );
6310
6309
  */
6311
- await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6310
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6312
6311
  }
6313
6312
  }
6314
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6313
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6315
6314
  },
6316
6315
  },
6317
6316
  {
@@ -6339,7 +6338,7 @@ const CsvFormatParser = {
6339
6338
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
6340
6339
  }));
6341
6340
  }));
6342
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6341
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6343
6342
  },
6344
6343
  },
6345
6344
  ],