@promptbook/remote-client 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,8 +1,7 @@
1
1
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
- import { randomBytes } from 'crypto';
2
+ import CryptoJS from 'crypto-js';
3
3
  import { io } from 'socket.io-client';
4
- import { parse, unparse } from 'papaparse';
5
- import { SHA256 } from 'crypto-js';
4
+ import papaparse from 'papaparse';
6
5
  import hexEncoder from 'crypto-js/enc-hex';
7
6
  import { basename } from 'path';
8
7
 
@@ -20,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
20
19
  * @generated
21
20
  * @see https://github.com/webgptorg/promptbook
22
21
  */
23
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
22
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
24
23
  /**
25
24
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
25
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -257,7 +256,7 @@ class ParseError extends Error {
257
256
  * @private internal helper function
258
257
  */
259
258
  function $randomToken(randomness) {
260
- return randomBytes(randomness).toString('hex');
259
+ return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
261
260
  }
262
261
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
263
262
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -2254,7 +2253,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
2254
2253
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
2255
2254
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2256
2255
  }
2257
- const csv = parse(value, settings);
2256
+ const csv = papaparse.parse(value, settings);
2258
2257
  return csv;
2259
2258
  }
2260
2259
 
@@ -2339,10 +2338,10 @@ const CsvFormatParser = {
2339
2338
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
2340
2339
  );
2341
2340
  */
2342
- await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
2341
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
2343
2342
  }
2344
2343
  }
2345
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
2344
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
2346
2345
  },
2347
2346
  },
2348
2347
  {
@@ -2370,7 +2369,7 @@ const CsvFormatParser = {
2370
2369
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
2371
2370
  }));
2372
2371
  }));
2373
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
2372
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
2374
2373
  },
2375
2374
  },
2376
2375
  ],
@@ -4171,7 +4170,7 @@ function normalizeToKebabCase(text) {
4171
4170
  * @public exported from `@promptbook/editable`
4172
4171
  */
4173
4172
  function knowledgeSourceContentToName(knowledgeSourceContent) {
4174
- const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
4173
+ const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
4175
4174
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
4176
4175
  .toString( /* hex */)
4177
4176
  .substring(0, 20);