@promptbook/remote-server 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 +115 -55
- 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 +115 -55
- 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/remote-server",
|
|
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-server.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
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @generated
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -115,6 +115,21 @@
|
|
|
115
115
|
* @public exported from `@promptbook/core`
|
|
116
116
|
*/
|
|
117
117
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
118
|
+
/**
|
|
119
|
+
* Threshold value that determines when a dataset is considered "big"
|
|
120
|
+
* and may require special handling or optimizations
|
|
121
|
+
*
|
|
122
|
+
* For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
|
|
123
|
+
*
|
|
124
|
+
* @public exported from `@promptbook/core`
|
|
125
|
+
*/
|
|
126
|
+
const BIG_DATASET_TRESHOLD = 50;
|
|
127
|
+
/**
|
|
128
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
129
|
+
*
|
|
130
|
+
* @public exported from `@promptbook/core`
|
|
131
|
+
*/
|
|
132
|
+
const FAILED_VALUE_PLACEHOLDER = '!?';
|
|
118
133
|
// <- TODO: [๐ง ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
119
134
|
/**
|
|
120
135
|
* The maximum number of iterations for a loops
|
|
@@ -194,7 +209,7 @@
|
|
|
194
209
|
const DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
|
|
195
210
|
// <- TODO: [๐งโโ๏ธ]
|
|
196
211
|
/**
|
|
197
|
-
*
|
|
212
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
198
213
|
*
|
|
199
214
|
* @public exported from `@promptbook/core`
|
|
200
215
|
*/
|
|
@@ -205,19 +220,19 @@
|
|
|
205
220
|
skipEmptyLines: true,
|
|
206
221
|
});
|
|
207
222
|
/**
|
|
208
|
-
*
|
|
223
|
+
* Controls whether verbose logging is enabled by default throughout the application.
|
|
209
224
|
*
|
|
210
225
|
* @public exported from `@promptbook/core`
|
|
211
226
|
*/
|
|
212
227
|
let DEFAULT_IS_VERBOSE = false;
|
|
213
228
|
/**
|
|
214
|
-
*
|
|
229
|
+
* Controls whether auto-installation of dependencies is enabled by default.
|
|
215
230
|
*
|
|
216
231
|
* @public exported from `@promptbook/core`
|
|
217
232
|
*/
|
|
218
233
|
const DEFAULT_IS_AUTO_INSTALLED = false;
|
|
219
234
|
/**
|
|
220
|
-
*
|
|
235
|
+
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
221
236
|
*
|
|
222
237
|
* @private within the repository
|
|
223
238
|
*/
|
|
@@ -1277,8 +1292,12 @@
|
|
|
1277
1292
|
*/
|
|
1278
1293
|
|
|
1279
1294
|
/**
|
|
1280
|
-
*
|
|
1295
|
+
* Creates a deep clone of the given object
|
|
1296
|
+
*
|
|
1297
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
1281
1298
|
*
|
|
1299
|
+
* @param objectValue The object to clone.
|
|
1300
|
+
* @returns A deep, writable clone of the input object.
|
|
1282
1301
|
* @public exported from `@promptbook/utils`
|
|
1283
1302
|
*/
|
|
1284
1303
|
function deepClone(objectValue) {
|
|
@@ -1836,7 +1855,7 @@
|
|
|
1836
1855
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1837
1856
|
*
|
|
1838
1857
|
* @param value The string to check
|
|
1839
|
-
* @returns
|
|
1858
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1840
1859
|
*
|
|
1841
1860
|
* @public exported from `@promptbook/utils`
|
|
1842
1861
|
*/
|
|
@@ -2497,7 +2516,7 @@
|
|
|
2497
2516
|
/**
|
|
2498
2517
|
* Constructs a pipeline collection from pipelines
|
|
2499
2518
|
*
|
|
2500
|
-
* @param pipelines
|
|
2519
|
+
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
2501
2520
|
*
|
|
2502
2521
|
* Note: During the construction logic of all pipelines are validated
|
|
2503
2522
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
@@ -3028,7 +3047,8 @@
|
|
|
3028
3047
|
*/
|
|
3029
3048
|
|
|
3030
3049
|
/**
|
|
3031
|
-
*
|
|
3050
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
3051
|
+
* regardless of the JavaScript environment in which the code is running
|
|
3032
3052
|
*
|
|
3033
3053
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
3034
3054
|
*
|
|
@@ -3107,11 +3127,11 @@
|
|
|
3107
3127
|
}
|
|
3108
3128
|
|
|
3109
3129
|
/**
|
|
3110
|
-
*
|
|
3130
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
3111
3131
|
*
|
|
3112
3132
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
3113
3133
|
*
|
|
3114
|
-
* @private internal utility, exported are only
|
|
3134
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
3115
3135
|
*/
|
|
3116
3136
|
class $Register {
|
|
3117
3137
|
constructor(registerName) {
|
|
@@ -3155,10 +3175,10 @@
|
|
|
3155
3175
|
}
|
|
3156
3176
|
|
|
3157
3177
|
/**
|
|
3158
|
-
*
|
|
3178
|
+
* Global registry for storing metadata about all available scrapers and converters.
|
|
3159
3179
|
*
|
|
3160
|
-
* Note: `$` is used to indicate that this interacts with the global scope
|
|
3161
|
-
* @singleton Only one instance of each register is created per build, but
|
|
3180
|
+
* Note: `$` is used to indicate that this interacts with the global scope.
|
|
3181
|
+
* @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
|
|
3162
3182
|
* @public exported from `@promptbook/core`
|
|
3163
3183
|
*/
|
|
3164
3184
|
const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
@@ -4445,7 +4465,7 @@
|
|
|
4445
4465
|
* Function to check if a string is valid CSV
|
|
4446
4466
|
*
|
|
4447
4467
|
* @param value The string to check
|
|
4448
|
-
* @returns
|
|
4468
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
4449
4469
|
*
|
|
4450
4470
|
* @public exported from `@promptbook/utils`
|
|
4451
4471
|
*/
|
|
@@ -4502,18 +4522,28 @@
|
|
|
4502
4522
|
`));
|
|
4503
4523
|
}
|
|
4504
4524
|
const mappedData = [];
|
|
4505
|
-
|
|
4525
|
+
const length = csv.data.length;
|
|
4526
|
+
for (let index = 0; index < length; index++) {
|
|
4506
4527
|
const row = csv.data[index];
|
|
4507
4528
|
if (row[outputParameterName]) {
|
|
4508
4529
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
4509
4530
|
}
|
|
4510
4531
|
const mappedRow = {
|
|
4511
4532
|
...row,
|
|
4512
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
4533
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
4513
4534
|
};
|
|
4514
4535
|
mappedData.push(mappedRow);
|
|
4515
4536
|
if (onProgress) {
|
|
4516
4537
|
// Note: Report the CSV with all rows mapped so far
|
|
4538
|
+
/*
|
|
4539
|
+
!!!!
|
|
4540
|
+
// Report progress with updated value
|
|
4541
|
+
const progressData = mappedData.map((row, i) =>
|
|
4542
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
4543
|
+
);
|
|
4544
|
+
|
|
4545
|
+
|
|
4546
|
+
*/
|
|
4517
4547
|
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
4518
4548
|
}
|
|
4519
4549
|
}
|
|
@@ -4540,9 +4570,9 @@
|
|
|
4540
4570
|
`));
|
|
4541
4571
|
}
|
|
4542
4572
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
4543
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
4573
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
4544
4574
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
4545
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
4575
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
4546
4576
|
}));
|
|
4547
4577
|
}));
|
|
4548
4578
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -4613,12 +4643,12 @@
|
|
|
4613
4643
|
async mapValues(options) {
|
|
4614
4644
|
const { value, mapCallback, onProgress } = options;
|
|
4615
4645
|
const lines = value.split('\n');
|
|
4616
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
4646
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
4617
4647
|
// TODO: [๐ง ] Maybe option to skip empty line
|
|
4618
4648
|
/* not await */ mapCallback({
|
|
4619
4649
|
lineContent,
|
|
4620
4650
|
// TODO: [๐ง ] Maybe also put here `lineNumber`
|
|
4621
|
-
}, lineNumber)));
|
|
4651
|
+
}, lineNumber, array.length)));
|
|
4622
4652
|
return mappedLines.join('\n');
|
|
4623
4653
|
},
|
|
4624
4654
|
},
|
|
@@ -4639,7 +4669,7 @@
|
|
|
4639
4669
|
* Function to check if a string is valid XML
|
|
4640
4670
|
*
|
|
4641
4671
|
* @param value
|
|
4642
|
-
* @returns
|
|
4672
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
4643
4673
|
*
|
|
4644
4674
|
* @public exported from `@promptbook/utils`
|
|
4645
4675
|
*/
|
|
@@ -4701,13 +4731,13 @@
|
|
|
4701
4731
|
*/
|
|
4702
4732
|
|
|
4703
4733
|
/**
|
|
4704
|
-
* Maps available parameters to expected parameters
|
|
4734
|
+
* Maps available parameters to expected parameters for a pipeline task.
|
|
4705
4735
|
*
|
|
4706
4736
|
* The strategy is:
|
|
4707
|
-
* 1)
|
|
4708
|
-
* 2)
|
|
4737
|
+
* 1) First, match parameters by name where both available and expected.
|
|
4738
|
+
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
4709
4739
|
*
|
|
4710
|
-
* @throws {PipelineExecutionError}
|
|
4740
|
+
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
4711
4741
|
* @private within the repository used in `createPipelineExecutor`
|
|
4712
4742
|
*/
|
|
4713
4743
|
function mapAvailableToExpectedParameters(options) {
|
|
@@ -5444,7 +5474,11 @@
|
|
|
5444
5474
|
*/
|
|
5445
5475
|
|
|
5446
5476
|
/**
|
|
5447
|
-
*
|
|
5477
|
+
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
5478
|
+
* Handles format and subformat resolution, error handling, and progress reporting.
|
|
5479
|
+
*
|
|
5480
|
+
* @param options - Options for execution, including task details and progress callback.
|
|
5481
|
+
* @returns The result of the subvalue mapping or execution attempts.
|
|
5448
5482
|
*
|
|
5449
5483
|
* @private internal utility of `createPipelineExecutor`
|
|
5450
5484
|
*/
|
|
@@ -5509,15 +5543,11 @@
|
|
|
5509
5543
|
settings: formatSettings,
|
|
5510
5544
|
onProgress(partialResultString) {
|
|
5511
5545
|
return onProgress(Object.freeze({
|
|
5512
|
-
[task.resultingParameterName]:
|
|
5513
|
-
// <- Note: [๐ฉโ๐ฉโ๐ง] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
5514
|
-
partialResultString,
|
|
5546
|
+
[task.resultingParameterName]: partialResultString,
|
|
5515
5547
|
}));
|
|
5516
5548
|
},
|
|
5517
|
-
async mapCallback(subparameters, index) {
|
|
5549
|
+
async mapCallback(subparameters, index, length) {
|
|
5518
5550
|
let mappedParameters;
|
|
5519
|
-
// TODO: [๐คนโโ๏ธ][๐ช] Limit to N concurrent executions
|
|
5520
|
-
// TODO: When done [๐] Report progress also for each subvalue here
|
|
5521
5551
|
try {
|
|
5522
5552
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
5523
5553
|
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
|
|
@@ -5528,32 +5558,52 @@
|
|
|
5528
5558
|
if (!(error instanceof PipelineExecutionError)) {
|
|
5529
5559
|
throw error;
|
|
5530
5560
|
}
|
|
5531
|
-
|
|
5532
|
-
|
|
5561
|
+
const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
|
|
5562
|
+
${error.message}
|
|
5533
5563
|
|
|
5534
|
-
|
|
5535
|
-
|
|
5564
|
+
This is error in FOREACH command when mapping data
|
|
5565
|
+
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
5536
5566
|
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5567
|
+
${block(pipelineIdentification)}
|
|
5568
|
+
Subparameter index: ${index}
|
|
5569
|
+
`));
|
|
5570
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
5571
|
+
console.error(highLevelError);
|
|
5572
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
5573
|
+
}
|
|
5574
|
+
throw highLevelError;
|
|
5540
5575
|
}
|
|
5541
5576
|
const allSubparameters = {
|
|
5542
5577
|
...parameters,
|
|
5543
5578
|
...mappedParameters,
|
|
5544
5579
|
};
|
|
5545
|
-
// Note: [๐จโ๐จโ๐ง] Now we can freeze `subparameters` because we are sure that all and only used parameters are defined and are not going to be changed
|
|
5546
5580
|
Object.freeze(allSubparameters);
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5581
|
+
try {
|
|
5582
|
+
const subresultString = await executeAttempts({
|
|
5583
|
+
...options,
|
|
5584
|
+
priority: priority + index,
|
|
5585
|
+
parameters: allSubparameters,
|
|
5586
|
+
pipelineIdentification: spaceTrim__default["default"]((block) => `
|
|
5587
|
+
${block(pipelineIdentification)}
|
|
5588
|
+
Subparameter index: ${index}
|
|
5589
|
+
`),
|
|
5590
|
+
});
|
|
5591
|
+
return subresultString;
|
|
5592
|
+
}
|
|
5593
|
+
catch (error) {
|
|
5594
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
5595
|
+
console.error(spaceTrim__default["default"]((block) => `
|
|
5596
|
+
Error in FOREACH command:
|
|
5597
|
+
|
|
5598
|
+
${block(pipelineIdentification)}
|
|
5599
|
+
|
|
5600
|
+
${block(pipelineIdentification)}
|
|
5601
|
+
Subparameter index: ${index}
|
|
5602
|
+
`));
|
|
5603
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
5604
|
+
}
|
|
5605
|
+
throw error;
|
|
5606
|
+
}
|
|
5557
5607
|
},
|
|
5558
5608
|
});
|
|
5559
5609
|
return resultString;
|
|
@@ -5688,7 +5738,11 @@
|
|
|
5688
5738
|
*/
|
|
5689
5739
|
|
|
5690
5740
|
/**
|
|
5691
|
-
*
|
|
5741
|
+
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
5742
|
+
* Ensures all reserved parameters are defined and throws if any are missing.
|
|
5743
|
+
*
|
|
5744
|
+
* @param options - Options including tools, pipeline, task, and context.
|
|
5745
|
+
* @returns An object containing all reserved parameters for the task.
|
|
5692
5746
|
*
|
|
5693
5747
|
* @private internal utility of `createPipelineExecutor`
|
|
5694
5748
|
*/
|
|
@@ -5721,7 +5775,10 @@
|
|
|
5721
5775
|
}
|
|
5722
5776
|
|
|
5723
5777
|
/**
|
|
5724
|
-
*
|
|
5778
|
+
* Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
|
|
5779
|
+
*
|
|
5780
|
+
* @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
|
|
5781
|
+
* @returns The output parameters produced by the task.
|
|
5725
5782
|
*
|
|
5726
5783
|
* @private internal utility of `createPipelineExecutor`
|
|
5727
5784
|
*/
|
|
@@ -5855,9 +5912,12 @@
|
|
|
5855
5912
|
}
|
|
5856
5913
|
|
|
5857
5914
|
/**
|
|
5858
|
-
*
|
|
5915
|
+
* Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress.
|
|
5916
|
+
*
|
|
5917
|
+
* Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`.
|
|
5859
5918
|
*
|
|
5860
|
-
*
|
|
5919
|
+
* @param options - Options for execution, including input parameters, pipeline, and callbacks.
|
|
5920
|
+
* @returns The result of the pipeline execution, including output parameters, errors, and usage statistics.
|
|
5861
5921
|
*
|
|
5862
5922
|
* @private internal utility of `createPipelineExecutor`
|
|
5863
5923
|
*/
|