@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
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
2
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Options for mapping available parameters to expected parameters in a pipeline task.
|
|
5
5
|
*/
|
|
6
6
|
type MakeapAvailableToExpectedParametersOptions = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* The set of expected parameter names (keys) for the task, all values are null.
|
|
9
9
|
*/
|
|
10
10
|
readonly expectedParameters: Readonly<Record<string_parameter_name, null>>;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The set of available parameters (name-value pairs) to map to the expected parameters.
|
|
13
13
|
*/
|
|
14
14
|
readonly availableParameters: Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Maps available parameters to expected parameters
|
|
17
|
+
* Maps available parameters to expected parameters for a pipeline task.
|
|
18
18
|
*
|
|
19
19
|
* The strategy is:
|
|
20
|
-
* 1)
|
|
21
|
-
* 2)
|
|
20
|
+
* 1) First, match parameters by name where both available and expected.
|
|
21
|
+
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
22
22
|
*
|
|
23
|
-
* @throws {PipelineExecutionError}
|
|
23
|
+
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
24
24
|
* @private within the repository used in `createPipelineExecutor`
|
|
25
25
|
*/
|
|
26
26
|
export declare function mapAvailableToExpectedParameters(options: MakeapAvailableToExpectedParametersOptions): Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a deep clone of a PipelineJson object, copying all properties explicitly.
|
|
4
4
|
*
|
|
5
|
-
* Note: It is
|
|
5
|
+
* Note: It is useful for ensuring that modifications to the returned pipeline do not affect the original.
|
|
6
6
|
*
|
|
7
|
-
* @param pipeline
|
|
7
|
+
* @param pipeline The pipeline to clone.
|
|
8
|
+
* @returns A new PipelineJson object with the same properties as the input.
|
|
8
9
|
* @public exported from `@promptbook/utils`
|
|
9
10
|
*/
|
|
10
11
|
export declare function clonePipeline(pipeline: PipelineJson): PipelineJson;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { WritableDeep } from 'type-fest';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a deep clone of the given object
|
|
4
4
|
*
|
|
5
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
6
|
+
*
|
|
7
|
+
* @param objectValue The object to clone.
|
|
8
|
+
* @returns A deep, writable clone of the input object.
|
|
5
9
|
* @public exported from `@promptbook/utils`
|
|
6
10
|
*/
|
|
7
11
|
export declare function deepClone<TObject>(objectValue: TObject): WritableDeep<TObject>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { string_javascript_name } from '../../../types/typeAliases';
|
|
2
2
|
import type { really_unknown } from '../../organization/really_unknown';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
5
5
|
*
|
|
6
|
-
* @param javascriptName
|
|
7
|
-
* @returns
|
|
6
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
7
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
8
8
|
* @public exported from `@promptbook/utils`
|
|
9
9
|
*/
|
|
10
10
|
export declare function isValidJavascriptName(javascriptName: really_unknown): javascriptName is string_javascript_name;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { string_parameter_name } from '../../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
* Function `validateParameterName` will
|
|
3
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
4
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
4
5
|
*
|
|
5
|
-
* @param parameterName
|
|
6
|
-
* @returns
|
|
7
|
-
* @throws {ParseError}
|
|
6
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
7
|
+
* @returns The validated and normalized parameter name.
|
|
8
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
8
9
|
* @private within the repository
|
|
9
10
|
*/
|
|
10
11
|
export declare function validateParameterName(parameterName: string): string_parameter_name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.92.0-
|
|
3
|
+
"version": "0.92.0-24",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0-
|
|
54
|
+
"@promptbook/core": "0.92.0-24"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
const CONNECTION_RETRIES_LIMIT = 5;
|
|
365
365
|
// <- TODO: [🧜♂️]
|
|
366
366
|
/**
|
|
367
|
-
*
|
|
367
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
368
368
|
*
|
|
369
369
|
* @public exported from `@promptbook/core`
|
|
370
370
|
*/
|
|
@@ -1859,7 +1859,7 @@
|
|
|
1859
1859
|
* Function to check if a string is valid CSV
|
|
1860
1860
|
*
|
|
1861
1861
|
* @param value The string to check
|
|
1862
|
-
* @returns
|
|
1862
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
1863
1863
|
*
|
|
1864
1864
|
* @public exported from `@promptbook/utils`
|
|
1865
1865
|
*/
|
|
@@ -1916,18 +1916,28 @@
|
|
|
1916
1916
|
`));
|
|
1917
1917
|
}
|
|
1918
1918
|
const mappedData = [];
|
|
1919
|
-
|
|
1919
|
+
const length = csv.data.length;
|
|
1920
|
+
for (let index = 0; index < length; index++) {
|
|
1920
1921
|
const row = csv.data[index];
|
|
1921
1922
|
if (row[outputParameterName]) {
|
|
1922
1923
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
1923
1924
|
}
|
|
1924
1925
|
const mappedRow = {
|
|
1925
1926
|
...row,
|
|
1926
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
1927
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
1927
1928
|
};
|
|
1928
1929
|
mappedData.push(mappedRow);
|
|
1929
1930
|
if (onProgress) {
|
|
1930
1931
|
// Note: Report the CSV with all rows mapped so far
|
|
1932
|
+
/*
|
|
1933
|
+
!!!!
|
|
1934
|
+
// Report progress with updated value
|
|
1935
|
+
const progressData = mappedData.map((row, i) =>
|
|
1936
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
1937
|
+
);
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
*/
|
|
1931
1941
|
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
1932
1942
|
}
|
|
1933
1943
|
}
|
|
@@ -1954,9 +1964,9 @@
|
|
|
1954
1964
|
`));
|
|
1955
1965
|
}
|
|
1956
1966
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
1957
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
1967
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
1958
1968
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
1959
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
1969
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
1960
1970
|
}));
|
|
1961
1971
|
}));
|
|
1962
1972
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -1976,7 +1986,7 @@
|
|
|
1976
1986
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1977
1987
|
*
|
|
1978
1988
|
* @param value The string to check
|
|
1979
|
-
* @returns
|
|
1989
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1980
1990
|
*
|
|
1981
1991
|
* @public exported from `@promptbook/utils`
|
|
1982
1992
|
*/
|
|
@@ -2049,12 +2059,12 @@
|
|
|
2049
2059
|
async mapValues(options) {
|
|
2050
2060
|
const { value, mapCallback, onProgress } = options;
|
|
2051
2061
|
const lines = value.split('\n');
|
|
2052
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2062
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
2053
2063
|
// TODO: [🧠] Maybe option to skip empty line
|
|
2054
2064
|
/* not await */ mapCallback({
|
|
2055
2065
|
lineContent,
|
|
2056
2066
|
// TODO: [🧠] Maybe also put here `lineNumber`
|
|
2057
|
-
}, lineNumber)));
|
|
2067
|
+
}, lineNumber, array.length)));
|
|
2058
2068
|
return mappedLines.join('\n');
|
|
2059
2069
|
},
|
|
2060
2070
|
},
|
|
@@ -2075,7 +2085,7 @@
|
|
|
2075
2085
|
* Function to check if a string is valid XML
|
|
2076
2086
|
*
|
|
2077
2087
|
* @param value
|
|
2078
|
-
* @returns
|
|
2088
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
2079
2089
|
*
|
|
2080
2090
|
* @public exported from `@promptbook/utils`
|
|
2081
2091
|
*/
|
|
@@ -2372,8 +2382,12 @@
|
|
|
2372
2382
|
*/
|
|
2373
2383
|
|
|
2374
2384
|
/**
|
|
2375
|
-
*
|
|
2385
|
+
* Creates a deep clone of the given object
|
|
2386
|
+
*
|
|
2387
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
2376
2388
|
*
|
|
2389
|
+
* @param objectValue The object to clone.
|
|
2390
|
+
* @returns A deep, writable clone of the input object.
|
|
2377
2391
|
* @public exported from `@promptbook/utils`
|
|
2378
2392
|
*/
|
|
2379
2393
|
function deepClone(objectValue) {
|
|
@@ -2564,11 +2578,12 @@
|
|
|
2564
2578
|
}
|
|
2565
2579
|
|
|
2566
2580
|
/**
|
|
2567
|
-
* Function `validateParameterName` will
|
|
2581
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
2582
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
2568
2583
|
*
|
|
2569
|
-
* @param parameterName
|
|
2570
|
-
* @returns
|
|
2571
|
-
* @throws {ParseError}
|
|
2584
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
2585
|
+
* @returns The validated and normalized parameter name.
|
|
2586
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
2572
2587
|
* @private within the repository
|
|
2573
2588
|
*/
|
|
2574
2589
|
function validateParameterName(parameterName) {
|
|
@@ -3061,14 +3076,15 @@
|
|
|
3061
3076
|
};
|
|
3062
3077
|
|
|
3063
3078
|
/**
|
|
3064
|
-
* Sheets is form of app that
|
|
3079
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
3080
|
+
* and analysis of structured data through AI-powered operations
|
|
3065
3081
|
*
|
|
3066
3082
|
* @public exported from `@promptbook/core`
|
|
3067
3083
|
*/
|
|
3068
3084
|
const SheetsFormfactorDefinition = {
|
|
3069
3085
|
name: 'SHEETS',
|
|
3070
3086
|
aliasNames: ['SHEETS', 'SHEET'],
|
|
3071
|
-
description:
|
|
3087
|
+
description: `A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data`,
|
|
3072
3088
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/176`,
|
|
3073
3089
|
pipelineInterface: {
|
|
3074
3090
|
inputParameters: [
|
|
@@ -3144,7 +3160,7 @@
|
|
|
3144
3160
|
/**
|
|
3145
3161
|
* Parses the formfactor command
|
|
3146
3162
|
*
|
|
3147
|
-
* Note:
|
|
3163
|
+
* 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
|
|
3148
3164
|
*
|
|
3149
3165
|
* @see `documentationUrl` for more details
|
|
3150
3166
|
* @public exported from `@promptbook/editable`
|
|
@@ -3166,7 +3182,7 @@
|
|
|
3166
3182
|
/**
|
|
3167
3183
|
* Description of the FORMFACTOR command
|
|
3168
3184
|
*/
|
|
3169
|
-
description:
|
|
3185
|
+
description: `Specifies the application type and interface requirements that this promptbook should conform to`,
|
|
3170
3186
|
/**
|
|
3171
3187
|
* Link to documentation
|
|
3172
3188
|
*/
|
|
@@ -3742,10 +3758,10 @@
|
|
|
3742
3758
|
}
|
|
3743
3759
|
|
|
3744
3760
|
/**
|
|
3745
|
-
*
|
|
3761
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
3746
3762
|
*
|
|
3747
|
-
* @param javascriptName
|
|
3748
|
-
* @returns
|
|
3763
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
3764
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
3749
3765
|
* @public exported from `@promptbook/utils`
|
|
3750
3766
|
*/
|
|
3751
3767
|
function isValidJavascriptName(javascriptName) {
|