@promptbook/editable 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,6 +1,7 @@
|
|
|
1
1
|
import type { really_any } from '../organization/really_any';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
4
|
+
* regardless of the JavaScript environment in which the code is running
|
|
4
5
|
*
|
|
5
6
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
6
7
|
*
|
|
@@ -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/editable",
|
|
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/editable.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-js": "4.2.0",
|
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
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
const LOOP_LIMIT = 1000;
|
|
92
92
|
// <- TODO: [🧜♂️]
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
95
95
|
*
|
|
96
96
|
* @public exported from `@promptbook/core`
|
|
97
97
|
*/
|
|
@@ -755,7 +755,7 @@
|
|
|
755
755
|
* Function to check if a string is valid CSV
|
|
756
756
|
*
|
|
757
757
|
* @param value The string to check
|
|
758
|
-
* @returns
|
|
758
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
759
759
|
*
|
|
760
760
|
* @public exported from `@promptbook/utils`
|
|
761
761
|
*/
|
|
@@ -812,18 +812,28 @@
|
|
|
812
812
|
`));
|
|
813
813
|
}
|
|
814
814
|
const mappedData = [];
|
|
815
|
-
|
|
815
|
+
const length = csv.data.length;
|
|
816
|
+
for (let index = 0; index < length; index++) {
|
|
816
817
|
const row = csv.data[index];
|
|
817
818
|
if (row[outputParameterName]) {
|
|
818
819
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
819
820
|
}
|
|
820
821
|
const mappedRow = {
|
|
821
822
|
...row,
|
|
822
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
823
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
823
824
|
};
|
|
824
825
|
mappedData.push(mappedRow);
|
|
825
826
|
if (onProgress) {
|
|
826
827
|
// Note: Report the CSV with all rows mapped so far
|
|
828
|
+
/*
|
|
829
|
+
!!!!
|
|
830
|
+
// Report progress with updated value
|
|
831
|
+
const progressData = mappedData.map((row, i) =>
|
|
832
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
833
|
+
);
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
*/
|
|
827
837
|
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
828
838
|
}
|
|
829
839
|
}
|
|
@@ -850,9 +860,9 @@
|
|
|
850
860
|
`));
|
|
851
861
|
}
|
|
852
862
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
853
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
863
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
854
864
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
855
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
865
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
856
866
|
}));
|
|
857
867
|
}));
|
|
858
868
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -872,7 +882,7 @@
|
|
|
872
882
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
873
883
|
*
|
|
874
884
|
* @param value The string to check
|
|
875
|
-
* @returns
|
|
885
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
876
886
|
*
|
|
877
887
|
* @public exported from `@promptbook/utils`
|
|
878
888
|
*/
|
|
@@ -945,12 +955,12 @@
|
|
|
945
955
|
async mapValues(options) {
|
|
946
956
|
const { value, mapCallback, onProgress } = options;
|
|
947
957
|
const lines = value.split('\n');
|
|
948
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
958
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
949
959
|
// TODO: [🧠] Maybe option to skip empty line
|
|
950
960
|
/* not await */ mapCallback({
|
|
951
961
|
lineContent,
|
|
952
962
|
// TODO: [🧠] Maybe also put here `lineNumber`
|
|
953
|
-
}, lineNumber)));
|
|
963
|
+
}, lineNumber, array.length)));
|
|
954
964
|
return mappedLines.join('\n');
|
|
955
965
|
},
|
|
956
966
|
},
|
|
@@ -971,7 +981,7 @@
|
|
|
971
981
|
* Function to check if a string is valid XML
|
|
972
982
|
*
|
|
973
983
|
* @param value
|
|
974
|
-
* @returns
|
|
984
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
975
985
|
*
|
|
976
986
|
* @public exported from `@promptbook/utils`
|
|
977
987
|
*/
|
|
@@ -1268,8 +1278,12 @@
|
|
|
1268
1278
|
*/
|
|
1269
1279
|
|
|
1270
1280
|
/**
|
|
1271
|
-
*
|
|
1281
|
+
* Creates a deep clone of the given object
|
|
1282
|
+
*
|
|
1283
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
1272
1284
|
*
|
|
1285
|
+
* @param objectValue The object to clone.
|
|
1286
|
+
* @returns A deep, writable clone of the input object.
|
|
1273
1287
|
* @public exported from `@promptbook/utils`
|
|
1274
1288
|
*/
|
|
1275
1289
|
function deepClone(objectValue) {
|
|
@@ -1707,11 +1721,12 @@
|
|
|
1707
1721
|
}
|
|
1708
1722
|
|
|
1709
1723
|
/**
|
|
1710
|
-
* Function `validateParameterName` will
|
|
1724
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
1725
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
1711
1726
|
*
|
|
1712
|
-
* @param parameterName
|
|
1713
|
-
* @returns
|
|
1714
|
-
* @throws {ParseError}
|
|
1727
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
1728
|
+
* @returns The validated and normalized parameter name.
|
|
1729
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
1715
1730
|
* @private within the repository
|
|
1716
1731
|
*/
|
|
1717
1732
|
function validateParameterName(parameterName) {
|
|
@@ -2204,14 +2219,15 @@
|
|
|
2204
2219
|
};
|
|
2205
2220
|
|
|
2206
2221
|
/**
|
|
2207
|
-
* Sheets is form of app that
|
|
2222
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
2223
|
+
* and analysis of structured data through AI-powered operations
|
|
2208
2224
|
*
|
|
2209
2225
|
* @public exported from `@promptbook/core`
|
|
2210
2226
|
*/
|
|
2211
2227
|
const SheetsFormfactorDefinition = {
|
|
2212
2228
|
name: 'SHEETS',
|
|
2213
2229
|
aliasNames: ['SHEETS', 'SHEET'],
|
|
2214
|
-
description:
|
|
2230
|
+
description: `A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data`,
|
|
2215
2231
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/176`,
|
|
2216
2232
|
pipelineInterface: {
|
|
2217
2233
|
inputParameters: [
|
|
@@ -2287,7 +2303,7 @@
|
|
|
2287
2303
|
/**
|
|
2288
2304
|
* Parses the formfactor command
|
|
2289
2305
|
*
|
|
2290
|
-
* Note:
|
|
2306
|
+
* 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
|
|
2291
2307
|
*
|
|
2292
2308
|
* @see `documentationUrl` for more details
|
|
2293
2309
|
* @public exported from `@promptbook/editable`
|
|
@@ -2309,7 +2325,7 @@
|
|
|
2309
2325
|
/**
|
|
2310
2326
|
* Description of the FORMFACTOR command
|
|
2311
2327
|
*/
|
|
2312
|
-
description:
|
|
2328
|
+
description: `Specifies the application type and interface requirements that this promptbook should conform to`,
|
|
2313
2329
|
/**
|
|
2314
2330
|
* Link to documentation
|
|
2315
2331
|
*/
|
|
@@ -3129,10 +3145,10 @@
|
|
|
3129
3145
|
}
|
|
3130
3146
|
|
|
3131
3147
|
/**
|
|
3132
|
-
*
|
|
3148
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
3133
3149
|
*
|
|
3134
|
-
* @param javascriptName
|
|
3135
|
-
* @returns
|
|
3150
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
3151
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
3136
3152
|
* @public exported from `@promptbook/utils`
|
|
3137
3153
|
*/
|
|
3138
3154
|
function isValidJavascriptName(javascriptName) {
|