@promptbook/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,7 +1,6 @@
1
1
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { basename } from 'path';
3
- import { randomBytes } from 'crypto';
4
- import { SHA256 } from 'crypto-js';
3
+ import CryptoJS from 'crypto-js';
5
4
  import hexEncoder from 'crypto-js/enc-hex';
6
5
 
7
6
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
@@ -18,7 +17,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
17
  * @generated
19
18
  * @see https://github.com/webgptorg/promptbook
20
19
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
20
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
22
21
  /**
23
22
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
23
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2449,7 +2448,7 @@ class ParseError extends Error {
2449
2448
  * @private internal helper function
2450
2449
  */
2451
2450
  function $randomToken(randomness) {
2452
- return randomBytes(randomness).toString('hex');
2451
+ return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
2453
2452
  }
2454
2453
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
2455
2454
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -3674,7 +3673,7 @@ const CountUtils = {
3674
3673
  * @public exported from `@promptbook/utils`
3675
3674
  */
3676
3675
  function computeHash(value) {
3677
- return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
3676
+ return CryptoJS.SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
3678
3677
  }
3679
3678
  // TODO: [🥬][🥬] Use this ACRY
3680
3679