@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
package/esm/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -101,6 +101,12 @@ const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
|
101
101
|
* @public exported from `@promptbook/core`
|
|
102
102
|
*/
|
|
103
103
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
104
|
+
/**
|
|
105
|
+
* @@@
|
|
106
|
+
*
|
|
107
|
+
* @public exported from `@promptbook/core`
|
|
108
|
+
*/
|
|
109
|
+
const BIG_DATASET_TRESHOLD = 50;
|
|
104
110
|
// <- TODO: [π§ ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
105
111
|
/**
|
|
106
112
|
* The maximum number of iterations for a loops
|
|
@@ -195,7 +201,7 @@ ex-port const WIZZARD_APP_ID: string_app_id = 'wizzard';
|
|
|
195
201
|
const DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = `index`;
|
|
196
202
|
// <- TODO: [π§ββοΈ]
|
|
197
203
|
/**
|
|
198
|
-
*
|
|
204
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
199
205
|
*
|
|
200
206
|
* @public exported from `@promptbook/core`
|
|
201
207
|
*/
|
|
@@ -206,19 +212,19 @@ const DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
206
212
|
skipEmptyLines: true,
|
|
207
213
|
});
|
|
208
214
|
/**
|
|
209
|
-
*
|
|
215
|
+
* Controls whether verbose logging is enabled by default throughout the application.
|
|
210
216
|
*
|
|
211
217
|
* @public exported from `@promptbook/core`
|
|
212
218
|
*/
|
|
213
219
|
let DEFAULT_IS_VERBOSE = false;
|
|
214
220
|
/**
|
|
215
|
-
*
|
|
221
|
+
* Controls whether auto-installation of dependencies is enabled by default.
|
|
216
222
|
*
|
|
217
223
|
* @public exported from `@promptbook/core`
|
|
218
224
|
*/
|
|
219
225
|
const DEFAULT_IS_AUTO_INSTALLED = false;
|
|
220
226
|
/**
|
|
221
|
-
*
|
|
227
|
+
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
222
228
|
*
|
|
223
229
|
* @private within the repository
|
|
224
230
|
*/
|
|
@@ -564,8 +570,12 @@ function checkSerializableAsJson(options) {
|
|
|
564
570
|
*/
|
|
565
571
|
|
|
566
572
|
/**
|
|
567
|
-
*
|
|
573
|
+
* Creates a deep clone of the given object
|
|
568
574
|
*
|
|
575
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
576
|
+
*
|
|
577
|
+
* @param objectValue The object to clone.
|
|
578
|
+
* @returns A deep, writable clone of the input object.
|
|
569
579
|
* @public exported from `@promptbook/utils`
|
|
570
580
|
*/
|
|
571
581
|
function deepClone(objectValue) {
|
|
@@ -1204,7 +1214,7 @@ function isValidFilePath(filename) {
|
|
|
1204
1214
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1205
1215
|
*
|
|
1206
1216
|
* @param value The string to check
|
|
1207
|
-
* @returns
|
|
1217
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1208
1218
|
*
|
|
1209
1219
|
* @public exported from `@promptbook/utils`
|
|
1210
1220
|
*/
|
|
@@ -2546,7 +2556,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
|
|
|
2546
2556
|
* Function to check if a string is valid CSV
|
|
2547
2557
|
*
|
|
2548
2558
|
* @param value The string to check
|
|
2549
|
-
* @returns
|
|
2559
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
2550
2560
|
*
|
|
2551
2561
|
* @public exported from `@promptbook/utils`
|
|
2552
2562
|
*/
|
|
@@ -2585,7 +2595,8 @@ const CsvFormatParser = {
|
|
|
2585
2595
|
subvalueParsers: [
|
|
2586
2596
|
{
|
|
2587
2597
|
subvalueName: 'ROW',
|
|
2588
|
-
async mapValues(
|
|
2598
|
+
async mapValues(options) {
|
|
2599
|
+
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
2589
2600
|
const csv = csvParse(value, settings);
|
|
2590
2601
|
if (csv.errors.length !== 0) {
|
|
2591
2602
|
throw new CsvFormatError(spaceTrim((block) => `
|
|
@@ -2601,21 +2612,30 @@ const CsvFormatParser = {
|
|
|
2601
2612
|
${block(value)}
|
|
2602
2613
|
`));
|
|
2603
2614
|
}
|
|
2604
|
-
const mappedData =
|
|
2615
|
+
const mappedData = [];
|
|
2616
|
+
const length = csv.data.length;
|
|
2617
|
+
for (let index = 0; index < length; index++) {
|
|
2618
|
+
const row = csv.data[index];
|
|
2605
2619
|
if (row[outputParameterName]) {
|
|
2606
2620
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
2607
2621
|
}
|
|
2608
|
-
|
|
2622
|
+
const mappedRow = {
|
|
2609
2623
|
...row,
|
|
2610
|
-
[outputParameterName]: await mapCallback(row, index),
|
|
2624
|
+
[outputParameterName]: await mapCallback(row, index, length),
|
|
2611
2625
|
};
|
|
2612
|
-
|
|
2626
|
+
mappedData.push(mappedRow);
|
|
2627
|
+
if (onProgress) {
|
|
2628
|
+
// Note: Report the CSV with all rows mapped so far
|
|
2629
|
+
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2613
2632
|
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
2614
2633
|
},
|
|
2615
2634
|
},
|
|
2616
2635
|
{
|
|
2617
2636
|
subvalueName: 'CELL',
|
|
2618
|
-
async mapValues(
|
|
2637
|
+
async mapValues(options) {
|
|
2638
|
+
const { value, settings, mapCallback, onProgress } = options;
|
|
2619
2639
|
const csv = csvParse(value, settings);
|
|
2620
2640
|
if (csv.errors.length !== 0) {
|
|
2621
2641
|
throw new CsvFormatError(spaceTrim((block) => `
|
|
@@ -2632,9 +2652,9 @@ const CsvFormatParser = {
|
|
|
2632
2652
|
`));
|
|
2633
2653
|
}
|
|
2634
2654
|
const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
|
|
2635
|
-
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
|
|
2655
|
+
return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
|
|
2636
2656
|
const index = rowIndex * Object.keys(row).length + columnIndex;
|
|
2637
|
-
return /* not await */ mapCallback({ [key]: value }, index);
|
|
2657
|
+
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
2638
2658
|
}));
|
|
2639
2659
|
}));
|
|
2640
2660
|
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
@@ -2702,14 +2722,15 @@ const TextFormatParser = {
|
|
|
2702
2722
|
subvalueParsers: [
|
|
2703
2723
|
{
|
|
2704
2724
|
subvalueName: 'LINE',
|
|
2705
|
-
async mapValues(
|
|
2725
|
+
async mapValues(options) {
|
|
2726
|
+
const { value, mapCallback, onProgress } = options;
|
|
2706
2727
|
const lines = value.split('\n');
|
|
2707
|
-
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2728
|
+
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
|
|
2708
2729
|
// TODO: [π§ ] Maybe option to skip empty line
|
|
2709
2730
|
/* not await */ mapCallback({
|
|
2710
2731
|
lineContent,
|
|
2711
2732
|
// TODO: [π§ ] Maybe also put here `lineNumber`
|
|
2712
|
-
}, lineNumber)));
|
|
2733
|
+
}, lineNumber, array.length)));
|
|
2713
2734
|
return mappedLines.join('\n');
|
|
2714
2735
|
},
|
|
2715
2736
|
},
|
|
@@ -2730,7 +2751,7 @@ const TextFormatParser = {
|
|
|
2730
2751
|
* Function to check if a string is valid XML
|
|
2731
2752
|
*
|
|
2732
2753
|
* @param value
|
|
2733
|
-
* @returns
|
|
2754
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
2734
2755
|
*
|
|
2735
2756
|
* @public exported from `@promptbook/utils`
|
|
2736
2757
|
*/
|
|
@@ -2792,13 +2813,13 @@ const FORMAT_DEFINITIONS = [JsonFormatParser, XmlFormatParser, TextFormatParser,
|
|
|
2792
2813
|
*/
|
|
2793
2814
|
|
|
2794
2815
|
/**
|
|
2795
|
-
* Maps available parameters to expected parameters
|
|
2816
|
+
* Maps available parameters to expected parameters for a pipeline task.
|
|
2796
2817
|
*
|
|
2797
2818
|
* The strategy is:
|
|
2798
|
-
* 1)
|
|
2799
|
-
* 2)
|
|
2819
|
+
* 1) First, match parameters by name where both available and expected.
|
|
2820
|
+
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
2800
2821
|
*
|
|
2801
|
-
* @throws {PipelineExecutionError}
|
|
2822
|
+
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
2802
2823
|
* @private within the repository used in `createPipelineExecutor`
|
|
2803
2824
|
*/
|
|
2804
2825
|
function mapAvailableToExpectedParameters(options) {
|
|
@@ -4007,12 +4028,16 @@ async function executeAttempts(options) {
|
|
|
4007
4028
|
*/
|
|
4008
4029
|
|
|
4009
4030
|
/**
|
|
4010
|
-
*
|
|
4031
|
+
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
4032
|
+
* Handles format and subformat resolution, error handling, and progress reporting.
|
|
4033
|
+
*
|
|
4034
|
+
* @param options - Options for execution, including task details and progress callback.
|
|
4035
|
+
* @returns The result of the subvalue mapping or execution attempts.
|
|
4011
4036
|
*
|
|
4012
4037
|
* @private internal utility of `createPipelineExecutor`
|
|
4013
4038
|
*/
|
|
4014
4039
|
async function executeFormatSubvalues(options) {
|
|
4015
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification } = options;
|
|
4040
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
4016
4041
|
if (task.foreach === undefined) {
|
|
4017
4042
|
return /* not await */ executeAttempts(options);
|
|
4018
4043
|
}
|
|
@@ -4066,46 +4091,74 @@ async function executeFormatSubvalues(options) {
|
|
|
4066
4091
|
formatSettings = csvSettings;
|
|
4067
4092
|
// <- TODO: [π€ΉββοΈ] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4068
4093
|
}
|
|
4069
|
-
const resultString = await subvalueParser.mapValues(
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4094
|
+
const resultString = await subvalueParser.mapValues({
|
|
4095
|
+
value: parameterValue,
|
|
4096
|
+
outputParameterName: task.foreach.outputSubparameterName,
|
|
4097
|
+
settings: formatSettings,
|
|
4098
|
+
onProgress(partialResultString) {
|
|
4099
|
+
return onProgress(Object.freeze({
|
|
4100
|
+
[task.resultingParameterName]: partialResultString,
|
|
4101
|
+
}));
|
|
4102
|
+
},
|
|
4103
|
+
async mapCallback(subparameters, index, length) {
|
|
4104
|
+
let mappedParameters;
|
|
4105
|
+
try {
|
|
4106
|
+
mappedParameters = mapAvailableToExpectedParameters({
|
|
4107
|
+
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
|
|
4108
|
+
availableParameters: subparameters,
|
|
4109
|
+
});
|
|
4082
4110
|
}
|
|
4083
|
-
|
|
4084
|
-
|
|
4111
|
+
catch (error) {
|
|
4112
|
+
if (!(error instanceof PipelineExecutionError)) {
|
|
4113
|
+
throw error;
|
|
4114
|
+
}
|
|
4115
|
+
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
4116
|
+
${error.message}
|
|
4085
4117
|
|
|
4086
|
-
|
|
4087
|
-
|
|
4118
|
+
This is error in FOREACH command when mapping data
|
|
4119
|
+
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
4088
4120
|
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4121
|
+
${block(pipelineIdentification)}
|
|
4122
|
+
Subparameter index: ${index}
|
|
4123
|
+
`));
|
|
4124
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
4125
|
+
console.error(highLevelError);
|
|
4126
|
+
return '~';
|
|
4127
|
+
}
|
|
4128
|
+
throw highLevelError;
|
|
4129
|
+
}
|
|
4130
|
+
const allSubparameters = {
|
|
4131
|
+
...parameters,
|
|
4132
|
+
...mappedParameters,
|
|
4133
|
+
};
|
|
4134
|
+
Object.freeze(allSubparameters);
|
|
4135
|
+
try {
|
|
4136
|
+
const subresultString = await executeAttempts({
|
|
4137
|
+
...options,
|
|
4138
|
+
priority: priority + index,
|
|
4139
|
+
parameters: allSubparameters,
|
|
4140
|
+
pipelineIdentification: spaceTrim((block) => `
|
|
4141
|
+
${block(pipelineIdentification)}
|
|
4142
|
+
Subparameter index: ${index}
|
|
4143
|
+
`),
|
|
4144
|
+
});
|
|
4145
|
+
return subresultString;
|
|
4146
|
+
}
|
|
4147
|
+
catch (error) {
|
|
4148
|
+
if (length > BIG_DATASET_TRESHOLD) {
|
|
4149
|
+
console.error(spaceTrim((block) => `
|
|
4150
|
+
Error in FOREACH command:
|
|
4151
|
+
|
|
4152
|
+
${block(pipelineIdentification)}
|
|
4153
|
+
|
|
4154
|
+
${block(pipelineIdentification)}
|
|
4155
|
+
Subparameter index: ${index}
|
|
4156
|
+
`));
|
|
4157
|
+
return '~';
|
|
4158
|
+
}
|
|
4159
|
+
throw error;
|
|
4160
|
+
}
|
|
4161
|
+
},
|
|
4109
4162
|
});
|
|
4110
4163
|
return resultString;
|
|
4111
4164
|
}
|
|
@@ -4239,7 +4292,11 @@ async function getKnowledgeForTask(options) {
|
|
|
4239
4292
|
*/
|
|
4240
4293
|
|
|
4241
4294
|
/**
|
|
4242
|
-
*
|
|
4295
|
+
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
4296
|
+
* Ensures all reserved parameters are defined and throws if any are missing.
|
|
4297
|
+
*
|
|
4298
|
+
* @param options - Options including tools, pipeline, task, and context.
|
|
4299
|
+
* @returns An object containing all reserved parameters for the task.
|
|
4243
4300
|
*
|
|
4244
4301
|
* @private internal utility of `createPipelineExecutor`
|
|
4245
4302
|
*/
|
|
@@ -4272,18 +4329,16 @@ async function getReservedParametersForTask(options) {
|
|
|
4272
4329
|
}
|
|
4273
4330
|
|
|
4274
4331
|
/**
|
|
4275
|
-
*
|
|
4332
|
+
* Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
|
|
4333
|
+
*
|
|
4334
|
+
* @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
|
|
4335
|
+
* @returns The output parameters produced by the task.
|
|
4276
4336
|
*
|
|
4277
4337
|
* @private internal utility of `createPipelineExecutor`
|
|
4278
4338
|
*/
|
|
4279
4339
|
async function executeTask(options) {
|
|
4280
4340
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
4281
4341
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
4282
|
-
await onProgress({
|
|
4283
|
-
outputParameters: {
|
|
4284
|
-
[currentTask.resultingParameterName]: '', // <- TODO: [π§ ] What is the best value here?
|
|
4285
|
-
},
|
|
4286
|
-
});
|
|
4287
4342
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
4288
4343
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
4289
4344
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
@@ -4358,6 +4413,7 @@ async function executeTask(options) {
|
|
|
4358
4413
|
preparedPipeline,
|
|
4359
4414
|
tools,
|
|
4360
4415
|
$executionReport,
|
|
4416
|
+
onProgress,
|
|
4361
4417
|
pipelineIdentification,
|
|
4362
4418
|
maxExecutionAttempts,
|
|
4363
4419
|
maxParallelCount,
|
|
@@ -4410,9 +4466,12 @@ function filterJustOutputParameters(options) {
|
|
|
4410
4466
|
}
|
|
4411
4467
|
|
|
4412
4468
|
/**
|
|
4413
|
-
*
|
|
4469
|
+
* Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress.
|
|
4470
|
+
*
|
|
4471
|
+
* Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`.
|
|
4414
4472
|
*
|
|
4415
|
-
*
|
|
4473
|
+
* @param options - Options for execution, including input parameters, pipeline, and callbacks.
|
|
4474
|
+
* @returns The result of the pipeline execution, including output parameters, errors, and usage statistics.
|
|
4416
4475
|
*
|
|
4417
4476
|
* @private internal utility of `createPipelineExecutor`
|
|
4418
4477
|
*/
|
|
@@ -5013,11 +5072,11 @@ function normalizeTo_snake_case(text) {
|
|
|
5013
5072
|
}
|
|
5014
5073
|
|
|
5015
5074
|
/**
|
|
5016
|
-
*
|
|
5075
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
5017
5076
|
*
|
|
5018
5077
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
5019
5078
|
*
|
|
5020
|
-
* @private internal utility, exported are only
|
|
5079
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
5021
5080
|
*/
|
|
5022
5081
|
class $Register {
|
|
5023
5082
|
constructor(registerName) {
|
|
@@ -5061,10 +5120,10 @@ class $Register {
|
|
|
5061
5120
|
}
|
|
5062
5121
|
|
|
5063
5122
|
/**
|
|
5064
|
-
*
|
|
5123
|
+
* Global registry for storing metadata about all available scrapers and converters.
|
|
5065
5124
|
*
|
|
5066
|
-
* Note: `$` is used to indicate that this interacts with the global scope
|
|
5067
|
-
* @singleton Only one instance of each register is created per build, but
|
|
5125
|
+
* Note: `$` is used to indicate that this interacts with the global scope.
|
|
5126
|
+
* @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
|
|
5068
5127
|
* @public exported from `@promptbook/core`
|
|
5069
5128
|
*/
|
|
5070
5129
|
const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
@@ -6603,11 +6662,12 @@ function removeQuotes(text) {
|
|
|
6603
6662
|
}
|
|
6604
6663
|
|
|
6605
6664
|
/**
|
|
6606
|
-
* Function `validateParameterName` will
|
|
6665
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
6666
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
6607
6667
|
*
|
|
6608
|
-
* @param parameterName
|
|
6609
|
-
* @returns
|
|
6610
|
-
* @throws {ParseError}
|
|
6668
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
6669
|
+
* @returns The validated and normalized parameter name.
|
|
6670
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
6611
6671
|
* @private within the repository
|
|
6612
6672
|
*/
|
|
6613
6673
|
function validateParameterName(parameterName) {
|
|
@@ -7781,10 +7841,10 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
7781
7841
|
}
|
|
7782
7842
|
|
|
7783
7843
|
/**
|
|
7784
|
-
*
|
|
7844
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
7785
7845
|
*
|
|
7786
|
-
* @param javascriptName
|
|
7787
|
-
* @returns
|
|
7846
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
7847
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
7788
7848
|
* @public exported from `@promptbook/utils`
|
|
7789
7849
|
*/
|
|
7790
7850
|
function isValidJavascriptName(javascriptName) {
|