@promptbook/remote-client 0.92.0-22 → 0.92.0-24
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 +39 -23
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +33 -11
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +11 -8
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +8 -3
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +10 -8
- package/esm/typings/src/formats/_common/FormatParser.d.ts +5 -3
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +31 -6
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/index.d.ts +1 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +4 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
- package/esm/typings/src/types/typeAliases.d.ts +9 -7
- package/esm/typings/src/utils/$Register.d.ts +8 -7
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
- package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
- package/package.json +2 -2
- package/umd/index.umd.js +39 -23
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
* @generated
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
23
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -361,7 +361,7 @@ const CONNECTION_TIMEOUT_MS = 7 * 1000;
|
|
|
361
361
|
const CONNECTION_RETRIES_LIMIT = 5;
|
|
362
362
|
// <- TODO: [🧜♂️]
|
|
363
363
|
/**
|
|
364
|
-
*
|
|
364
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
365
365
|
*
|
|
366
366
|
* @public exported from `@promptbook/core`
|
|
367
367
|
*/
|
|
@@ -1856,7 +1856,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
|
|
|
1856
1856
|
* Function to check if a string is valid CSV
|
|
1857
1857
|
*
|
|
1858
1858
|
* @param value The string to check
|
|
1859
|
-
* @returns
|
|
1859
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
1860
1860
|
*
|
|
1861
1861
|
* @public exported from `@promptbook/utils`
|
|
1862
1862
|
*/
|
|
@@ -1913,18 +1913,28 @@ const CsvFormatParser = {
|
|
|
1913
1913
|
`));
|
|
1914
1914
|
}
|
|
1915
1915
|
const mappedData = [];
|
|
1916
|
-
|
|
1916
|
+
const length = csv.data.length;
|
|
1917
|
+
for (let index = 0; index < length; index++) {
|
|
1917
1918
|
const row = csv.data[index];
|
|
1918
1919
|
if (row[outputParameterName]) {
|
|
1919
1920
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
1920
1921
|
}
|
|
1921
1922
|
const mappedRow = {
|
|
1922
1923
|
...row,
|
|
1923
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
1924
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
1924
1925
|
};
|
|
1925
1926
|
mappedData.push(mappedRow);
|
|
1926
1927
|
if (onProgress) {
|
|
1927
1928
|
// Note: Report the CSV with all rows mapped so far
|
|
1929
|
+
/*
|
|
1930
|
+
!!!!
|
|
1931
|
+
// Report progress with updated value
|
|
1932
|
+
const progressData = mappedData.map((row, i) =>
|
|
1933
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
1934
|
+
);
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
*/
|
|
1928
1938
|
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
1929
1939
|
}
|
|
1930
1940
|
}
|
|
@@ -1951,9 +1961,9 @@ const CsvFormatParser = {
|
|
|
1951
1961
|
`));
|
|
1952
1962
|
}
|
|
1953
1963
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
1954
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
1964
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
1955
1965
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
1956
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
1966
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
1957
1967
|
}));
|
|
1958
1968
|
}));
|
|
1959
1969
|
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -1973,7 +1983,7 @@ const CsvFormatParser = {
|
|
|
1973
1983
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1974
1984
|
*
|
|
1975
1985
|
* @param value The string to check
|
|
1976
|
-
* @returns
|
|
1986
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1977
1987
|
*
|
|
1978
1988
|
* @public exported from `@promptbook/utils`
|
|
1979
1989
|
*/
|
|
@@ -2046,12 +2056,12 @@ const TextFormatParser = {
|
|
|
2046
2056
|
async mapValues(options) {
|
|
2047
2057
|
const { value, mapCallback, onProgress } = options;
|
|
2048
2058
|
const lines = value.split('\n');
|
|
2049
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2059
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
2050
2060
|
// TODO: [🧠] Maybe option to skip empty line
|
|
2051
2061
|
/* not await */ mapCallback({
|
|
2052
2062
|
lineContent,
|
|
2053
2063
|
// TODO: [🧠] Maybe also put here `lineNumber`
|
|
2054
|
-
}, lineNumber)));
|
|
2064
|
+
}, lineNumber, array.length)));
|
|
2055
2065
|
return mappedLines.join('\n');
|
|
2056
2066
|
},
|
|
2057
2067
|
},
|
|
@@ -2072,7 +2082,7 @@ const TextFormatParser = {
|
|
|
2072
2082
|
* Function to check if a string is valid XML
|
|
2073
2083
|
*
|
|
2074
2084
|
* @param value
|
|
2075
|
-
* @returns
|
|
2085
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
2076
2086
|
*
|
|
2077
2087
|
* @public exported from `@promptbook/utils`
|
|
2078
2088
|
*/
|
|
@@ -2369,8 +2379,12 @@ function checkSerializableAsJson(options) {
|
|
|
2369
2379
|
*/
|
|
2370
2380
|
|
|
2371
2381
|
/**
|
|
2372
|
-
*
|
|
2382
|
+
* Creates a deep clone of the given object
|
|
2383
|
+
*
|
|
2384
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
2373
2385
|
*
|
|
2386
|
+
* @param objectValue The object to clone.
|
|
2387
|
+
* @returns A deep, writable clone of the input object.
|
|
2374
2388
|
* @public exported from `@promptbook/utils`
|
|
2375
2389
|
*/
|
|
2376
2390
|
function deepClone(objectValue) {
|
|
@@ -2561,11 +2575,12 @@ function removeQuotes(text) {
|
|
|
2561
2575
|
}
|
|
2562
2576
|
|
|
2563
2577
|
/**
|
|
2564
|
-
* Function `validateParameterName` will
|
|
2578
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
2579
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
2565
2580
|
*
|
|
2566
|
-
* @param parameterName
|
|
2567
|
-
* @returns
|
|
2568
|
-
* @throws {ParseError}
|
|
2581
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
2582
|
+
* @returns The validated and normalized parameter name.
|
|
2583
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
2569
2584
|
* @private within the repository
|
|
2570
2585
|
*/
|
|
2571
2586
|
function validateParameterName(parameterName) {
|
|
@@ -3058,14 +3073,15 @@ const MatcherFormfactorDefinition = {
|
|
|
3058
3073
|
};
|
|
3059
3074
|
|
|
3060
3075
|
/**
|
|
3061
|
-
* Sheets is form of app that
|
|
3076
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
3077
|
+
* and analysis of structured data through AI-powered operations
|
|
3062
3078
|
*
|
|
3063
3079
|
* @public exported from `@promptbook/core`
|
|
3064
3080
|
*/
|
|
3065
3081
|
const SheetsFormfactorDefinition = {
|
|
3066
3082
|
name: 'SHEETS',
|
|
3067
3083
|
aliasNames: ['SHEETS', 'SHEET'],
|
|
3068
|
-
description:
|
|
3084
|
+
description: `A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data`,
|
|
3069
3085
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/176`,
|
|
3070
3086
|
pipelineInterface: {
|
|
3071
3087
|
inputParameters: [
|
|
@@ -3141,7 +3157,7 @@ const FORMFACTOR_DEFINITIONS = [
|
|
|
3141
3157
|
/**
|
|
3142
3158
|
* Parses the formfactor command
|
|
3143
3159
|
*
|
|
3144
|
-
* Note:
|
|
3160
|
+
* Note: This command is used as a formfactor for new commands and defines the app type format - it should NOT be used in any `.book` file
|
|
3145
3161
|
*
|
|
3146
3162
|
* @see `documentationUrl` for more details
|
|
3147
3163
|
* @public exported from `@promptbook/editable`
|
|
@@ -3163,7 +3179,7 @@ const formfactorCommandParser = {
|
|
|
3163
3179
|
/**
|
|
3164
3180
|
* Description of the FORMFACTOR command
|
|
3165
3181
|
*/
|
|
3166
|
-
description:
|
|
3182
|
+
description: `Specifies the application type and interface requirements that this promptbook should conform to`,
|
|
3167
3183
|
/**
|
|
3168
3184
|
* Link to documentation
|
|
3169
3185
|
*/
|
|
@@ -3739,10 +3755,10 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
3739
3755
|
}
|
|
3740
3756
|
|
|
3741
3757
|
/**
|
|
3742
|
-
*
|
|
3758
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
3743
3759
|
*
|
|
3744
|
-
* @param javascriptName
|
|
3745
|
-
* @returns
|
|
3760
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
3761
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
3746
3762
|
* @public exported from `@promptbook/utils`
|
|
3747
3763
|
*/
|
|
3748
3764
|
function isValidJavascriptName(javascriptName) {
|