@promptbook/legacy-documents 0.101.0-0 → 0.101.0-2

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.
Files changed (38) hide show
  1. package/esm/index.es.js +24 -5
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +12 -0
  4. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
  5. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +8 -2
  6. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
  7. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  8. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  9. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  10. package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
  11. package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
  12. package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
  13. package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
  14. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  15. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
  16. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
  17. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
  18. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
  19. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
  20. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  21. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
  22. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  23. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  24. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  25. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  26. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  27. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  28. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  29. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  30. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  31. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  32. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  33. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  34. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  35. package/esm/typings/src/version.d.ts +1 -1
  36. package/package.json +2 -2
  37. package/umd/index.umd.js +29 -9
  38. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -6,9 +6,6 @@ import colors from 'colors';
6
6
  import { forTime } from 'waitasecond';
7
7
  import { SHA256 } from 'crypto-js';
8
8
  import hexEncoder from 'crypto-js/enc-hex';
9
- import parserHtml from 'prettier/parser-html';
10
- import parserMarkdown from 'prettier/parser-markdown';
11
- import { format } from 'prettier/standalone';
12
9
  import { randomBytes } from 'crypto';
13
10
  import { Subject } from 'rxjs';
14
11
  import sha256 from 'crypto-js/sha256';
@@ -29,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
29
26
  * @generated
30
27
  * @see https://github.com/webgptorg/promptbook
31
28
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-0';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-2';
33
30
  /**
34
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -832,6 +829,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
832
829
  /**
833
830
  * Removes diacritic marks (accents) from characters in a string.
834
831
  *
832
+ * Note: [🔂] This function is idempotent.
833
+ *
835
834
  * @param input The string containing diacritics to be normalized.
836
835
  * @returns The string with diacritics removed or normalized.
837
836
  * @public exported from `@promptbook/utils`
@@ -900,6 +899,8 @@ function normalizeToKebabCase(text) {
900
899
  /**
901
900
  * Removes emojis from a string and fix whitespaces
902
901
  *
902
+ * Note: [🔂] This function is idempotent.
903
+ *
903
904
  * @param text with emojis
904
905
  * @returns text without emojis
905
906
  * @public exported from `@promptbook/utils`
@@ -972,6 +973,7 @@ function isValidFilePath(filename) {
972
973
  /**
973
974
  * Tests if given string is valid URL.
974
975
  *
976
+ * Note: [🔂] This function is idempotent.
975
977
  * Note: Dataurl are considered perfectly valid.
976
978
  * Note: There are two similar functions:
977
979
  * - `isValidUrl` which tests any URL
@@ -1231,8 +1233,18 @@ function validatePipelineString(pipelineString) {
1231
1233
  * @private withing the package because of HUGE size of prettier dependency
1232
1234
  */
1233
1235
  function prettifyMarkdown(content) {
1236
+ // In browser/Next.js environments, just return the original content
1237
+ // since prettier parsers are not available and would cause bundling issues
1238
+ if (typeof window !== 'undefined') {
1239
+ return content;
1240
+ }
1234
1241
  try {
1235
- return format(content, {
1242
+ // Use dynamic require to avoid static imports that cause bundling issues
1243
+ // This will only work in Node.js environments
1244
+ const prettierStandalone = eval('require')('prettier/standalone');
1245
+ const parserMarkdown = eval('require')('prettier/parser-markdown');
1246
+ const parserHtml = eval('require')('prettier/parser-html');
1247
+ return prettierStandalone.format(content, {
1236
1248
  parser: 'markdown',
1237
1249
  plugins: [parserMarkdown, parserHtml],
1238
1250
  // TODO: DRY - make some import or auto-copy of .prettierrc
@@ -1260,6 +1272,8 @@ function prettifyMarkdown(content) {
1260
1272
  /**
1261
1273
  * Makes first letter of a string uppercase
1262
1274
  *
1275
+ * Note: [🔂] This function is idempotent.
1276
+ *
1263
1277
  * @public exported from `@promptbook/utils`
1264
1278
  */
1265
1279
  function capitalize(word) {
@@ -1589,6 +1603,7 @@ function checkSerializableAsJson(options) {
1589
1603
  /**
1590
1604
  * Creates a deep clone of the given object
1591
1605
  *
1606
+ * Note: [🔂] This function is idempotent.
1592
1607
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
1593
1608
  *
1594
1609
  * @param objectValue The object to clone.
@@ -3480,6 +3495,8 @@ function $getGlobalScope() {
3480
3495
  /**
3481
3496
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
3482
3497
  *
3498
+ * Note: [🔂] This function is idempotent.
3499
+ *
3483
3500
  * @param text The text string to be converted to SCREAMING_CASE format.
3484
3501
  * @returns The normalized text in SCREAMING_CASE format.
3485
3502
  * @example 'HELLO_WORLD'
@@ -3535,6 +3552,8 @@ function normalizeTo_SCREAMING_CASE(text) {
3535
3552
  /**
3536
3553
  * Normalizes a text string to snake_case format.
3537
3554
  *
3555
+ * Note: [🔂] This function is idempotent.
3556
+ *
3538
3557
  * @param text The text string to be converted to snake_case format.
3539
3558
  * @returns The normalized text in snake_case format.
3540
3559
  * @example 'hello_world'