@promptbook/wizard 0.101.0-0 → 0.101.0-1
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 +32 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
- package/esm/typings/src/utils/parseNumber.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +37 -10
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
@@ -12,9 +12,6 @@ import { forTime } from 'waitasecond';
|
|
12
12
|
import { SHA256 } from 'crypto-js';
|
13
13
|
import hexEncoder from 'crypto-js/enc-hex';
|
14
14
|
import { basename, join, dirname, isAbsolute, relative } from 'path';
|
15
|
-
import parserHtml from 'prettier/parser-html';
|
16
|
-
import parserMarkdown from 'prettier/parser-markdown';
|
17
|
-
import { format } from 'prettier/standalone';
|
18
15
|
import { Subject } from 'rxjs';
|
19
16
|
import sha256 from 'crypto-js/sha256';
|
20
17
|
import { lookup, extension } from 'mime-types';
|
@@ -39,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
39
36
|
* @generated
|
40
37
|
* @see https://github.com/webgptorg/promptbook
|
41
38
|
*/
|
42
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
39
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
|
43
40
|
/**
|
44
41
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
45
42
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -647,6 +644,7 @@ function checkSerializableAsJson(options) {
|
|
647
644
|
/**
|
648
645
|
* Creates a deep clone of the given object
|
649
646
|
*
|
647
|
+
* Note: [🔂] This function is idempotent.
|
650
648
|
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
651
649
|
*
|
652
650
|
* @param objectValue The object to clone.
|
@@ -831,6 +829,8 @@ function $getGlobalScope() {
|
|
831
829
|
/**
|
832
830
|
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
833
831
|
*
|
832
|
+
* Note: [🔂] This function is idempotent.
|
833
|
+
*
|
834
834
|
* @param text The text string to be converted to SCREAMING_CASE format.
|
835
835
|
* @returns The normalized text in SCREAMING_CASE format.
|
836
836
|
* @example 'HELLO_WORLD'
|
@@ -886,6 +886,8 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
886
886
|
/**
|
887
887
|
* Normalizes a text string to snake_case format.
|
888
888
|
*
|
889
|
+
* Note: [🔂] This function is idempotent.
|
890
|
+
*
|
889
891
|
* @param text The text string to be converted to snake_case format.
|
890
892
|
* @returns The normalized text in snake_case format.
|
891
893
|
* @example 'hello_world'
|
@@ -1408,6 +1410,7 @@ const LLM_PROVIDER_PROFILES = {
|
|
1408
1410
|
/**
|
1409
1411
|
* Tests if given string is valid URL.
|
1410
1412
|
*
|
1413
|
+
* Note: [🔂] This function is idempotent.
|
1411
1414
|
* Note: Dataurl are considered perfectly valid.
|
1412
1415
|
* Note: There are two similar functions:
|
1413
1416
|
* - `isValidUrl` which tests any URL
|
@@ -2309,6 +2312,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
2309
2312
|
/**
|
2310
2313
|
* Removes diacritic marks (accents) from characters in a string.
|
2311
2314
|
*
|
2315
|
+
* Note: [🔂] This function is idempotent.
|
2316
|
+
*
|
2312
2317
|
* @param input The string containing diacritics to be normalized.
|
2313
2318
|
* @returns The string with diacritics removed or normalized.
|
2314
2319
|
* @public exported from `@promptbook/utils`
|
@@ -6210,6 +6215,8 @@ function normalizeToKebabCase(text) {
|
|
6210
6215
|
/**
|
6211
6216
|
* Removes emojis from a string and fix whitespaces
|
6212
6217
|
*
|
6218
|
+
* Note: [🔂] This function is idempotent.
|
6219
|
+
*
|
6213
6220
|
* @param text with emojis
|
6214
6221
|
* @returns text without emojis
|
6215
6222
|
* @public exported from `@promptbook/utils`
|
@@ -6461,8 +6468,18 @@ function validatePipelineString(pipelineString) {
|
|
6461
6468
|
* @private withing the package because of HUGE size of prettier dependency
|
6462
6469
|
*/
|
6463
6470
|
function prettifyMarkdown(content) {
|
6471
|
+
// In browser/Next.js environments, just return the original content
|
6472
|
+
// since prettier parsers are not available and would cause bundling issues
|
6473
|
+
if (typeof window !== 'undefined') {
|
6474
|
+
return content;
|
6475
|
+
}
|
6464
6476
|
try {
|
6465
|
-
|
6477
|
+
// Use dynamic require to avoid static imports that cause bundling issues
|
6478
|
+
// This will only work in Node.js environments
|
6479
|
+
const prettierStandalone = eval('require')('prettier/standalone');
|
6480
|
+
const parserMarkdown = eval('require')('prettier/parser-markdown');
|
6481
|
+
const parserHtml = eval('require')('prettier/parser-html');
|
6482
|
+
return prettierStandalone.format(content, {
|
6466
6483
|
parser: 'markdown',
|
6467
6484
|
plugins: [parserMarkdown, parserHtml],
|
6468
6485
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
@@ -6490,6 +6507,8 @@ function prettifyMarkdown(content) {
|
|
6490
6507
|
/**
|
6491
6508
|
* Makes first letter of a string uppercase
|
6492
6509
|
*
|
6510
|
+
* Note: [🔂] This function is idempotent.
|
6511
|
+
*
|
6493
6512
|
* @public exported from `@promptbook/utils`
|
6494
6513
|
*/
|
6495
6514
|
function capitalize(word) {
|
@@ -13041,7 +13060,9 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
13041
13060
|
*/
|
13042
13061
|
|
13043
13062
|
/**
|
13044
|
-
* Makes first letter of a string
|
13063
|
+
* Makes first letter of a string lowercase
|
13064
|
+
*
|
13065
|
+
* Note: [🔂] This function is idempotent.
|
13045
13066
|
*
|
13046
13067
|
* @public exported from `@promptbook/utils`
|
13047
13068
|
*/
|
@@ -13111,6 +13132,8 @@ function normalizeTo_PascalCase(text) {
|
|
13111
13132
|
/**
|
13112
13133
|
* Take every whitespace (space, new line, tab) and replace it with a single space
|
13113
13134
|
*
|
13135
|
+
* Note: [🔂] This function is idempotent.
|
13136
|
+
*
|
13114
13137
|
* @public exported from `@promptbook/utils`
|
13115
13138
|
*/
|
13116
13139
|
function normalizeWhitespaces(sentence) {
|
@@ -13120,6 +13143,7 @@ function normalizeWhitespaces(sentence) {
|
|
13120
13143
|
/**
|
13121
13144
|
* Function parseNumber will parse number from string
|
13122
13145
|
*
|
13146
|
+
* Note: [🔂] This function is idempotent.
|
13123
13147
|
* Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
|
13124
13148
|
* Note: it also works only with decimal numbers
|
13125
13149
|
*
|
@@ -13188,6 +13212,7 @@ function parseNumber(value) {
|
|
13188
13212
|
/**
|
13189
13213
|
* Removes quotes from a string
|
13190
13214
|
*
|
13215
|
+
* Note: [🔂] This function is idempotent.
|
13191
13216
|
* Tip: This is very useful for post-processing of the result of the LLM model
|
13192
13217
|
* Note: This function removes only the same quotes from the beginning and the end of the string
|
13193
13218
|
* Note: There are two similar functions:
|
@@ -13211,6 +13236,7 @@ function removeQuotes(text) {
|
|
13211
13236
|
/**
|
13212
13237
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
13213
13238
|
*
|
13239
|
+
* Note: [🔂] This function is idempotent.
|
13214
13240
|
* Note: This is useful for post-processing of the result of the chat LLM model
|
13215
13241
|
* when the model wraps the result in the (markdown) code block.
|
13216
13242
|
*
|