@promptbook/node 0.92.0-21 β 0.92.0-23
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 +144 -84
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/config.d.ts +29 -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 +15 -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 +40 -5
- 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/llm-providers/_common/register/LlmToolsOptions.d.ts +4 -1
- 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/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 +144 -84
- package/umd/index.umd.js.map +1 -1
|
@@ -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/node",
|
|
3
|
-
"version": "0.92.0-
|
|
3
|
+
"version": "0.92.0-23",
|
|
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/node.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0-
|
|
54
|
+
"@promptbook/core": "0.92.0-23"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* @generated
|
|
47
47
|
* @see https://github.com/webgptorg/promptbook
|
|
48
48
|
*/
|
|
49
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
49
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
|
|
50
50
|
/**
|
|
51
51
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
52
52
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -117,6 +117,12 @@
|
|
|
117
117
|
* @public exported from `@promptbook/core`
|
|
118
118
|
*/
|
|
119
119
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
120
|
+
/**
|
|
121
|
+
* @@@
|
|
122
|
+
*
|
|
123
|
+
* @public exported from `@promptbook/core`
|
|
124
|
+
*/
|
|
125
|
+
const BIG_DATASET_TRESHOLD = 50;
|
|
120
126
|
// <- TODO: [π§ ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
121
127
|
/**
|
|
122
128
|
* The maximum number of iterations for a loops
|
|
@@ -211,7 +217,7 @@
|
|
|
211
217
|
const DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = `index`;
|
|
212
218
|
// <- TODO: [π§ββοΈ]
|
|
213
219
|
/**
|
|
214
|
-
*
|
|
220
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
215
221
|
*
|
|
216
222
|
* @public exported from `@promptbook/core`
|
|
217
223
|
*/
|
|
@@ -222,19 +228,19 @@
|
|
|
222
228
|
skipEmptyLines: true,
|
|
223
229
|
});
|
|
224
230
|
/**
|
|
225
|
-
*
|
|
231
|
+
* Controls whether verbose logging is enabled by default throughout the application.
|
|
226
232
|
*
|
|
227
233
|
* @public exported from `@promptbook/core`
|
|
228
234
|
*/
|
|
229
235
|
let DEFAULT_IS_VERBOSE = false;
|
|
230
236
|
/**
|
|
231
|
-
*
|
|
237
|
+
* Controls whether auto-installation of dependencies is enabled by default.
|
|
232
238
|
*
|
|
233
239
|
* @public exported from `@promptbook/core`
|
|
234
240
|
*/
|
|
235
241
|
const DEFAULT_IS_AUTO_INSTALLED = false;
|
|
236
242
|
/**
|
|
237
|
-
*
|
|
243
|
+
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
238
244
|
*
|
|
239
245
|
* @private within the repository
|
|
240
246
|
*/
|
|
@@ -580,8 +586,12 @@
|
|
|
580
586
|
*/
|
|
581
587
|
|
|
582
588
|
/**
|
|
583
|
-
*
|
|
589
|
+
* Creates a deep clone of the given object
|
|
584
590
|
*
|
|
591
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
592
|
+
*
|
|
593
|
+
* @param objectValue The object to clone.
|
|
594
|
+
* @returns A deep, writable clone of the input object.
|
|
585
595
|
* @public exported from `@promptbook/utils`
|
|
586
596
|
*/
|
|
587
597
|
function deepClone(objectValue) {
|
|
@@ -1220,7 +1230,7 @@
|
|
|
1220
1230
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1221
1231
|
*
|
|
1222
1232
|
* @param value The string to check
|
|
1223
|
-
* @returns
|
|
1233
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1224
1234
|
*
|
|
1225
1235
|
* @public exported from `@promptbook/utils`
|
|
1226
1236
|
*/
|
|
@@ -2562,7 +2572,7 @@
|
|
|
2562
2572
|
* Function to check if a string is valid CSV
|
|
2563
2573
|
*
|
|
2564
2574
|
* @param value The string to check
|
|
2565
|
-
* @returns
|
|
2575
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
2566
2576
|
*
|
|
2567
2577
|
* @public exported from `@promptbook/utils`
|
|
2568
2578
|
*/
|
|
@@ -2601,7 +2611,8 @@
|
|
|
2601
2611
|
subvalueParsers: [
|
|
2602
2612
|
{
|
|
2603
2613
|
subvalueName: 'ROW',
|
|
2604
|
-
async mapValues(
|
|
2614
|
+
async mapValues(options) {
|
|
2615
|
+
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
2605
2616
|
const csv = csvParse(value, settings);
|
|
2606
2617
|
if (csv.errors.length !== 0) {
|
|
2607
2618
|
throw new CsvFormatError(spaceTrim__default["default"]((block) => `
|
|
@@ -2617,21 +2628,30 @@
|
|
|
2617
2628
|
${block(value)}
|
|
2618
2629
|
`));
|
|
2619
2630
|
}
|
|
2620
|
-
const mappedData =
|
|
2631
|
+
const mappedData = [];
|
|
2632
|
+
const length = csv.data.length;
|
|
2633
|
+
for (let index = 0; index < length; index++) {
|
|
2634
|
+
const row = csv.data[index];
|
|
2621
2635
|
if (row[outputParameterName]) {
|
|
2622
2636
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
2623
2637
|
}
|
|
2624
|
-
|
|
2638
|
+
const mappedRow = {
|
|
2625
2639
|
...row,
|
|
2626
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
2640
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
2627
2641
|
};
|
|
2628
|
-
|
|
2642
|
+
mappedData.push(mappedRow);
|
|
2643
|
+
if (onProgress) {
|
|
2644
|
+
// Note: Report the CSV with all rows mapped so far
|
|
2645
|
+
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2629
2648
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
2630
2649
|
},
|
|
2631
2650
|
},
|
|
2632
2651
|
{
|
|
2633
2652
|
subvalueName: 'CELL',
|
|
2634
|
-
async mapValues(
|
|
2653
|
+
async mapValues(options) {
|
|
2654
|
+
const { value, settings, mapCallback, onProgress } = options;
|
|
2635
2655
|
const csv = csvParse(value, settings);
|
|
2636
2656
|
if (csv.errors.length !== 0) {
|
|
2637
2657
|
throw new CsvFormatError(spaceTrim__default["default"]((block) => `
|
|
@@ -2648,9 +2668,9 @@
|
|
|
2648
2668
|
`));
|
|
2649
2669
|
}
|
|
2650
2670
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
2651
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
2671
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
2652
2672
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
2653
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
2673
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
2654
2674
|
}));
|
|
2655
2675
|
}));
|
|
2656
2676
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -2718,14 +2738,15 @@
|
|
|
2718
2738
|
subvalueParsers: [
|
|
2719
2739
|
{
|
|
2720
2740
|
subvalueName: 'LINE',
|
|
2721
|
-
async mapValues(
|
|
2741
|
+
async mapValues(options) {
|
|
2742
|
+
const { value, mapCallback, onProgress } = options;
|
|
2722
2743
|
const lines = value.split('\n');
|
|
2723
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2744
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
2724
2745
|
// TODO: [π§ ] Maybe option to skip empty line
|
|
2725
2746
|
/* not await */ mapCallback({
|
|
2726
2747
|
lineContent,
|
|
2727
2748
|
// TODO: [π§ ] Maybe also put here `lineNumber`
|
|
2728
|
-
}, lineNumber)));
|
|
2749
|
+
}, lineNumber, array.length)));
|
|
2729
2750
|
return mappedLines.join('\n');
|
|
2730
2751
|
},
|
|
2731
2752
|
},
|
|
@@ -2746,7 +2767,7 @@
|
|
|
2746
2767
|
* Function to check if a string is valid XML
|
|
2747
2768
|
*
|
|
2748
2769
|
* @param value
|
|
2749
|
-
* @returns
|
|
2770
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
2750
2771
|
*
|
|
2751
2772
|
* @public exported from `@promptbook/utils`
|
|
2752
2773
|
*/
|
|
@@ -2808,13 +2829,13 @@
|
|
|
2808
2829
|
*/
|
|
2809
2830
|
|
|
2810
2831
|
/**
|
|
2811
|
-
* Maps available parameters to expected parameters
|
|
2832
|
+
* Maps available parameters to expected parameters for a pipeline task.
|
|
2812
2833
|
*
|
|
2813
2834
|
* The strategy is:
|
|
2814
|
-
* 1)
|
|
2815
|
-
* 2)
|
|
2835
|
+
* 1) First, match parameters by name where both available and expected.
|
|
2836
|
+
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
2816
2837
|
*
|
|
2817
|
-
* @throws {PipelineExecutionError}
|
|
2838
|
+
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
2818
2839
|
* @private within the repository used in `createPipelineExecutor`
|
|
2819
2840
|
*/
|
|
2820
2841
|
function mapAvailableToExpectedParameters(options) {
|
|
@@ -4023,12 +4044,16 @@
|
|
|
4023
4044
|
*/
|
|
4024
4045
|
|
|
4025
4046
|
/**
|
|
4026
|
-
*
|
|
4047
|
+
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
4048
|
+
* Handles format and subformat resolution, error handling, and progress reporting.
|
|
4049
|
+
*
|
|
4050
|
+
* @param options - Options for execution, including task details and progress callback.
|
|
4051
|
+
* @returns The result of the subvalue mapping or execution attempts.
|
|
4027
4052
|
*
|
|
4028
4053
|
* @private internal utility of `createPipelineExecutor`
|
|
4029
4054
|
*/
|
|
4030
4055
|
async function executeFormatSubvalues(options) {
|
|
4031
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification } = options;
|
|
4056
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
4032
4057
|
if (task.foreach === undefined) {
|
|
4033
4058
|
return /* not await */ executeAttempts(options);
|
|
4034
4059
|
}
|
|
@@ -4082,46 +4107,74 @@
|
|
|
4082
4107
|
formatSettings = csvSettings;
|
|
4083
4108
|
// <- TODO: [π€ΉββοΈ] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4084
4109
|
}
|
|
4085
|
-
const resultString = await subvalueParser.mapValues(
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4110
|
+
const resultString = await subvalueParser.mapValues({
|
|
4111
|
+
value: parameterValue,
|
|
4112
|
+
outputParameterName: task.foreach.outputSubparameterName,
|
|
4113
|
+
settings: formatSettings,
|
|
4114
|
+
onProgress(partialResultString) {
|
|
4115
|
+
return onProgress(Object.freeze({
|
|
4116
|
+
[task.resultingParameterName]: partialResultString,
|
|
4117
|
+
}));
|
|
4118
|
+
},
|
|
4119
|
+
async mapCallback(subparameters, index, length) {
|
|
4120
|
+
let mappedParameters;
|
|
4121
|
+
try {
|
|
4122
|
+
mappedParameters = mapAvailableToExpectedParameters({
|
|
4123
|
+
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
|
|
4124
|
+
availableParameters: subparameters,
|
|
4125
|
+
});
|
|
4098
4126
|
}
|
|
4099
|
-
|
|
4100
|
-
|
|
4127
|
+
catch (error) {
|
|
4128
|
+
if (!(error instanceof PipelineExecutionError)) {
|
|
4129
|
+
throw error;
|
|
4130
|
+
}
|
|
4131
|
+
const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
|
|
4132
|
+
${error.message}
|
|
4101
4133
|
|
|
4102
|
-
|
|
4103
|
-
|
|
4134
|
+
This is error in FOREACH command when mapping data
|
|
4135
|
+
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
4104
4136
|
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4137
|
+
${block(pipelineIdentification)}
|
|
4138
|
+
Subparameter index: ${index}
|
|
4139
|
+
`));
|
|
4140
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
4141
|
+
console.error(highLevelError);
|
|
4142
|
+
return '~';
|
|
4143
|
+
}
|
|
4144
|
+
throw highLevelError;
|
|
4145
|
+
}
|
|
4146
|
+
const allSubparameters = {
|
|
4147
|
+
...parameters,
|
|
4148
|
+
...mappedParameters,
|
|
4149
|
+
};
|
|
4150
|
+
Object.freeze(allSubparameters);
|
|
4151
|
+
try {
|
|
4152
|
+
const subresultString = await executeAttempts({
|
|
4153
|
+
...options,
|
|
4154
|
+
priority: priority + index,
|
|
4155
|
+
parameters: allSubparameters,
|
|
4156
|
+
pipelineIdentification: spaceTrim__default["default"]((block) => `
|
|
4157
|
+
${block(pipelineIdentification)}
|
|
4158
|
+
Subparameter index: ${index}
|
|
4159
|
+
`),
|
|
4160
|
+
});
|
|
4161
|
+
return subresultString;
|
|
4162
|
+
}
|
|
4163
|
+
catch (error) {
|
|
4164
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
4165
|
+
console.error(spaceTrim__default["default"]((block) => `
|
|
4166
|
+
Error in FOREACH command:
|
|
4167
|
+
|
|
4168
|
+
${block(pipelineIdentification)}
|
|
4169
|
+
|
|
4170
|
+
${block(pipelineIdentification)}
|
|
4171
|
+
Subparameter index: ${index}
|
|
4172
|
+
`));
|
|
4173
|
+
return '~';
|
|
4174
|
+
}
|
|
4175
|
+
throw error;
|
|
4176
|
+
}
|
|
4177
|
+
},
|
|
4125
4178
|
});
|
|
4126
4179
|
return resultString;
|
|
4127
4180
|
}
|
|
@@ -4255,7 +4308,11 @@
|
|
|
4255
4308
|
*/
|
|
4256
4309
|
|
|
4257
4310
|
/**
|
|
4258
|
-
*
|
|
4311
|
+
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
4312
|
+
* Ensures all reserved parameters are defined and throws if any are missing.
|
|
4313
|
+
*
|
|
4314
|
+
* @param options - Options including tools, pipeline, task, and context.
|
|
4315
|
+
* @returns An object containing all reserved parameters for the task.
|
|
4259
4316
|
*
|
|
4260
4317
|
* @private internal utility of `createPipelineExecutor`
|
|
4261
4318
|
*/
|
|
@@ -4288,18 +4345,16 @@
|
|
|
4288
4345
|
}
|
|
4289
4346
|
|
|
4290
4347
|
/**
|
|
4291
|
-
*
|
|
4348
|
+
* Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
|
|
4349
|
+
*
|
|
4350
|
+
* @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
|
|
4351
|
+
* @returns The output parameters produced by the task.
|
|
4292
4352
|
*
|
|
4293
4353
|
* @private internal utility of `createPipelineExecutor`
|
|
4294
4354
|
*/
|
|
4295
4355
|
async function executeTask(options) {
|
|
4296
4356
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
4297
4357
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
4298
|
-
await onProgress({
|
|
4299
|
-
outputParameters: {
|
|
4300
|
-
[currentTask.resultingParameterName]: '', // <- TODO: [π§ ] What is the best value here?
|
|
4301
|
-
},
|
|
4302
|
-
});
|
|
4303
4358
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
4304
4359
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
4305
4360
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
@@ -4374,6 +4429,7 @@
|
|
|
4374
4429
|
preparedPipeline,
|
|
4375
4430
|
tools,
|
|
4376
4431
|
$executionReport,
|
|
4432
|
+
onProgress,
|
|
4377
4433
|
pipelineIdentification,
|
|
4378
4434
|
maxExecutionAttempts,
|
|
4379
4435
|
maxParallelCount,
|
|
@@ -4426,9 +4482,12 @@
|
|
|
4426
4482
|
}
|
|
4427
4483
|
|
|
4428
4484
|
/**
|
|
4429
|
-
*
|
|
4485
|
+
* Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress.
|
|
4486
|
+
*
|
|
4487
|
+
* Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`.
|
|
4430
4488
|
*
|
|
4431
|
-
*
|
|
4489
|
+
* @param options - Options for execution, including input parameters, pipeline, and callbacks.
|
|
4490
|
+
* @returns The result of the pipeline execution, including output parameters, errors, and usage statistics.
|
|
4432
4491
|
*
|
|
4433
4492
|
* @private internal utility of `createPipelineExecutor`
|
|
4434
4493
|
*/
|
|
@@ -5029,11 +5088,11 @@
|
|
|
5029
5088
|
}
|
|
5030
5089
|
|
|
5031
5090
|
/**
|
|
5032
|
-
*
|
|
5091
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
5033
5092
|
*
|
|
5034
5093
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
5035
5094
|
*
|
|
5036
|
-
* @private internal utility, exported are only
|
|
5095
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
5037
5096
|
*/
|
|
5038
5097
|
class $Register {
|
|
5039
5098
|
constructor(registerName) {
|
|
@@ -5077,10 +5136,10 @@
|
|
|
5077
5136
|
}
|
|
5078
5137
|
|
|
5079
5138
|
/**
|
|
5080
|
-
*
|
|
5139
|
+
* Global registry for storing metadata about all available scrapers and converters.
|
|
5081
5140
|
*
|
|
5082
|
-
* Note: `$` is used to indicate that this interacts with the global scope
|
|
5083
|
-
* @singleton Only one instance of each register is created per build, but
|
|
5141
|
+
* Note: `$` is used to indicate that this interacts with the global scope.
|
|
5142
|
+
* @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
|
|
5084
5143
|
* @public exported from `@promptbook/core`
|
|
5085
5144
|
*/
|
|
5086
5145
|
const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
@@ -6619,11 +6678,12 @@
|
|
|
6619
6678
|
}
|
|
6620
6679
|
|
|
6621
6680
|
/**
|
|
6622
|
-
* Function `validateParameterName` will
|
|
6681
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
6682
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
6623
6683
|
*
|
|
6624
|
-
* @param parameterName
|
|
6625
|
-
* @returns
|
|
6626
|
-
* @throws {ParseError}
|
|
6684
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
6685
|
+
* @returns The validated and normalized parameter name.
|
|
6686
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
6627
6687
|
* @private within the repository
|
|
6628
6688
|
*/
|
|
6629
6689
|
function validateParameterName(parameterName) {
|
|
@@ -7797,10 +7857,10 @@
|
|
|
7797
7857
|
}
|
|
7798
7858
|
|
|
7799
7859
|
/**
|
|
7800
|
-
*
|
|
7860
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
7801
7861
|
*
|
|
7802
|
-
* @param javascriptName
|
|
7803
|
-
* @returns
|
|
7862
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
7863
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
7804
7864
|
* @public exported from `@promptbook/utils`
|
|
7805
7865
|
*/
|
|
7806
7866
|
function isValidJavascriptName(javascriptName) {
|