@promptbook/utils 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 +18 -13
- 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 +1 -1
- package/umd/index.umd.js +18 -13
- package/umd/index.umd.js.map +1 -1
|
@@ -6,38 +6,41 @@ import type { ExecutionReportJson } from '../execution-report/ExecutionReportJso
|
|
|
6
6
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
7
7
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Options for executing a single pipeline task, including task details, pipeline context, parameters, and callbacks.
|
|
10
10
|
*
|
|
11
11
|
* @private internal type of `executeTask`
|
|
12
12
|
*/
|
|
13
13
|
type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* The task to be executed.
|
|
16
16
|
*/
|
|
17
17
|
readonly currentTask: ReadonlyDeep<TaskJson>;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The pipeline in which the task resides, fully prepared and validated.
|
|
20
20
|
*/
|
|
21
21
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The parameters to pass to the task execution.
|
|
24
24
|
*/
|
|
25
25
|
readonly parametersToPass: Readonly<Parameters>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Callback invoked with partial results as the execution progresses.
|
|
28
28
|
*/
|
|
29
29
|
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Mutable execution report object for tracking execution details.
|
|
32
32
|
*/
|
|
33
33
|
readonly $executionReport: WritableDeep<ExecutionReportJson>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* String identifier for the pipeline, used in error messages and reporting.
|
|
36
36
|
*/
|
|
37
37
|
readonly pipelineIdentification: string;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
|
|
43
|
+
* @returns The output parameters produced by the task.
|
|
41
44
|
*
|
|
42
45
|
* @private internal utility of `createPipelineExecutor`
|
|
43
46
|
*/
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
import type { PartialDeep, Promisable } from 'type-fest';
|
|
1
2
|
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
|
+
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
2
4
|
import type { ExecuteAttemptsOptions } from './40-executeAttempts';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Options for executing a pipeline task that involves formatting subvalues (e.g., iterating over CSV rows).
|
|
7
|
+
* Extends ExecuteAttemptsOptions with a progress callback.
|
|
5
8
|
*
|
|
6
9
|
* @private internal type of `executeFormatSubvalues`
|
|
7
10
|
*/
|
|
8
|
-
type ExecuteFormatCellsOptions = ExecuteAttemptsOptions
|
|
11
|
+
type ExecuteFormatCellsOptions = ExecuteAttemptsOptions & {
|
|
12
|
+
/**
|
|
13
|
+
* Callback invoked with partial results as the execution progresses.
|
|
14
|
+
*/
|
|
15
|
+
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
16
|
+
};
|
|
9
17
|
/**
|
|
10
|
-
*
|
|
18
|
+
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
19
|
+
* Handles format and subformat resolution, error handling, and progress reporting.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Options for execution, including task details and progress callback.
|
|
22
|
+
* @returns The result of the subvalue mapping or execution attempts.
|
|
11
23
|
*
|
|
12
24
|
* @private internal utility of `createPipelineExecutor`
|
|
13
25
|
*/
|
|
@@ -5,7 +5,7 @@ import type { Parameters } from '../../types/typeAliases';
|
|
|
5
5
|
import type { ReservedParameters } from '../../types/typeAliases';
|
|
6
6
|
import type { ExecutionTools } from '../ExecutionTools';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Options for retrieving reserved parameters for a pipeline task, including context, pipeline, and identification.
|
|
9
9
|
*
|
|
10
10
|
* @private internal type of `getReservedParametersForTask`
|
|
11
11
|
*/
|
|
@@ -15,26 +15,28 @@ type GetReservedParametersForTaskOptions = {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly tools: ExecutionTools;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* The prepared and validated pipeline in which the task resides.
|
|
19
19
|
*/
|
|
20
20
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The task for which reserved parameters are being retrieved.
|
|
23
23
|
*/
|
|
24
24
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* Parameters to complete the content of the task for embedding
|
|
26
|
+
* Parameters to complete the content of the task for embedding and context.
|
|
29
27
|
*/
|
|
30
28
|
readonly parameters: Readonly<Parameters>;
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* String identifier for the pipeline, used in error messages and reporting.
|
|
33
31
|
*/
|
|
34
32
|
readonly pipelineIdentification: string;
|
|
35
33
|
};
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
35
|
+
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
36
|
+
* Ensures all reserved parameters are defined and throws if any are missing.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Options including tools, pipeline, task, and context.
|
|
39
|
+
* @returns An object containing all reserved parameters for the task.
|
|
38
40
|
*
|
|
39
41
|
* @private internal utility of `createPipelineExecutor`
|
|
40
42
|
*/
|
|
@@ -4,9 +4,11 @@ import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeT
|
|
|
4
4
|
import type { empty_object } from '../../utils/organization/empty_object';
|
|
5
5
|
import type { FormatSubvalueParser } from './FormatSubvalueParser';
|
|
6
6
|
/**
|
|
7
|
-
* A format definition is a set of functions that define how to validate, heal and convert response from LLM
|
|
7
|
+
* A format definition is a set of functions that define how to validate, heal and convert response from LLM.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* - "settings" are runtime options that affect parsing (e.g., delimiter for CSV).
|
|
11
|
+
* - "schema" is a structural definition or contract for the data (e.g., expected fields in JSON).
|
|
10
12
|
*
|
|
11
13
|
* @see https://github.com/webgptorg/promptbook/discussions/36
|
|
12
14
|
* @private still in development [🏢]
|
|
@@ -56,7 +58,7 @@ export type FormatParser<TValue extends TPartialValue, TPartialValue extends str
|
|
|
56
58
|
*/
|
|
57
59
|
heal(value: string, settings?: TSettings, scheme?: TSchema): TValue;
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Parsers for extracting or mapping subvalues from the main value (e.g., rows from CSV, items from JSON array).
|
|
60
62
|
*/
|
|
61
63
|
readonly subvalueParsers: ReadonlyArray<FormatSubvalueParser<TValue, TSettings>>;
|
|
62
64
|
};
|
|
@@ -5,7 +5,8 @@ import type { string_parameter_name } from '../../types/typeAliases';
|
|
|
5
5
|
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
6
6
|
import type { empty_object } from '../../utils/organization/empty_object';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Defines how to extract or map subvalues from a main value in a specific format (e.g., cells from CSV, items from JSON array).
|
|
9
|
+
* Used for iterating or transforming structured data in pipeline tasks.
|
|
9
10
|
*/
|
|
10
11
|
export type FormatSubvalueParser<TValue extends string, TSettings extends empty_object> = {
|
|
11
12
|
/**
|
|
@@ -19,12 +20,46 @@ export type FormatSubvalueParser<TValue extends string, TSettings extends empty_
|
|
|
19
20
|
*/
|
|
20
21
|
readonly aliases?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
21
22
|
/**
|
|
22
|
-
* Maps
|
|
23
|
+
* Maps or transforms subvalues from the main value. For example, iterates over all CSV cells or JSON array items.
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* @param options - Options for mapping, including callbacks for progress and value transformation.
|
|
26
|
+
* @returns The final mapped string result.
|
|
26
27
|
*/
|
|
27
|
-
mapValues(
|
|
28
|
+
mapValues(options: FormatSubvalueParserMapValuesOptions<TValue, TSettings>): Promise<string>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Options for mapping or extracting subvalues from a main value using a FormatSubvalueParser.
|
|
32
|
+
*/
|
|
33
|
+
export type FormatSubvalueParserMapValuesOptions<TValue extends string, TSettings extends empty_object> = {
|
|
34
|
+
/**
|
|
35
|
+
* @@@
|
|
36
|
+
*/
|
|
37
|
+
readonly value: TValue;
|
|
38
|
+
/**
|
|
39
|
+
* @@@
|
|
40
|
+
*/
|
|
41
|
+
readonly outputParameterName: string_parameter_name;
|
|
42
|
+
/**
|
|
43
|
+
* @@@
|
|
44
|
+
*/
|
|
45
|
+
readonly settings: TSettings;
|
|
46
|
+
/**
|
|
47
|
+
* @@@
|
|
48
|
+
*
|
|
49
|
+
* @param subvalues @@@
|
|
50
|
+
* @param index Current index of the subvalue which is being mapped
|
|
51
|
+
* @param length Full length of the subvalues
|
|
52
|
+
* @param number @@@
|
|
53
|
+
* @returns @@@
|
|
54
|
+
*/
|
|
55
|
+
mapCallback(subvalues: Parameters, index: number, length: number): Promisable<TValue>;
|
|
56
|
+
/**
|
|
57
|
+
* @@@
|
|
58
|
+
*
|
|
59
|
+
* @param partialResultString @@@
|
|
60
|
+
* @returns @@@
|
|
61
|
+
*/
|
|
62
|
+
onProgress(partialResultString: TValue): Promisable<void>;
|
|
28
63
|
};
|
|
29
64
|
/**
|
|
30
65
|
* Note: [👩🏾🤝🧑🏽]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Function to check if a string is valid CSV
|
|
3
3
|
*
|
|
4
4
|
* @param value The string to check
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
3
3
|
*
|
|
4
4
|
* @param value The string to check
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Options for configuring LLM (Large Language Model) tools.
|
|
4
|
+
*
|
|
5
|
+
* This type is used to pass provider-specific options to LLM execution tools.
|
|
6
|
+
*
|
|
4
7
|
*
|
|
5
8
|
* @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
|
|
6
9
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { $Register } from '../../../utils/$Register';
|
|
2
2
|
import type { ScraperAndConverterMetadata } from './ScraperAndConverterMetadata';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Global registry for storing metadata about all available scrapers and converters.
|
|
5
5
|
*
|
|
6
|
-
* Note: `$` is used to indicate that this interacts with the global scope
|
|
7
|
-
* @singleton Only one instance of each register is created per build, but
|
|
6
|
+
* Note: `$` is used to indicate that this interacts with the global scope.
|
|
7
|
+
* @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare const $scrapersMetadataRegister: $Register<ScraperAndConverterMetadata>;
|
|
@@ -123,7 +123,8 @@ export type InputParameters = Exclude<Record<string_parameter_name, really_unkno
|
|
|
123
123
|
*/
|
|
124
124
|
export type string_reserved_parameter_name = TupleToUnion<typeof RESERVED_PARAMETER_NAMES>;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* Represents a mapping of reserved parameter names to their values.
|
|
127
|
+
* Reserved parameters are used internally by the pipeline and should not be set by users.
|
|
127
128
|
*
|
|
128
129
|
* Note: [🚉] This is fully serializable as JSON
|
|
129
130
|
*/
|
|
@@ -233,7 +234,9 @@ export type string_markdown_text = string;
|
|
|
233
234
|
*/
|
|
234
235
|
export type string_markdown_codeblock_language = 'book' | 'markdown' | 'text' | 'javascript' | 'css' | 'json';
|
|
235
236
|
/**
|
|
236
|
-
*
|
|
237
|
+
* A URL pointing to Promptbook documentation or a specific discussion.
|
|
238
|
+
*
|
|
239
|
+
* For example: `https://github.com/webgptorg/promptbook/discussions/123`
|
|
237
240
|
*/
|
|
238
241
|
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | `@@${string}`}`;
|
|
239
242
|
/**
|
|
@@ -448,15 +451,14 @@ export type string_uuid = string & {
|
|
|
448
451
|
readonly _type: 'uuid';
|
|
449
452
|
};
|
|
450
453
|
/**
|
|
451
|
-
* Application identifier
|
|
454
|
+
* Application identifier, used to distinguish different apps or clients.
|
|
452
455
|
*
|
|
453
|
-
*
|
|
456
|
+
* For example: 'cli', 'playground', or a custom app id.
|
|
454
457
|
*/
|
|
455
458
|
export type string_app_id = id | 'app';
|
|
456
459
|
/**
|
|
457
|
-
* End user identifier
|
|
458
|
-
*
|
|
459
|
-
* @@@
|
|
460
|
+
* End user identifier, can be a user id or email address.
|
|
461
|
+
* Used for tracking and abuse prevention.
|
|
460
462
|
*/
|
|
461
463
|
export type string_user_id = id | string_email;
|
|
462
464
|
/**
|
|
@@ -2,33 +2,34 @@ import { type IDestroyable } from 'destroyable';
|
|
|
2
2
|
import type { string_name } from '../types/typeAliases';
|
|
3
3
|
import type { TODO_string } from './organization/TODO_string';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Represents an entity in a global registry.
|
|
6
|
+
* Contains identifying information about the package and class.
|
|
6
7
|
*/
|
|
7
8
|
export type Registered = {
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* The name of the package where the registered entity is defined.
|
|
10
11
|
*/
|
|
11
12
|
readonly packageName: TODO_string;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* The name of the class being registered.
|
|
14
15
|
*/
|
|
15
16
|
readonly className: TODO_string;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* Represents a registration record, including destroyable interface and registry name.
|
|
19
20
|
*/
|
|
20
21
|
export type Registration = Registered & IDestroyable & {
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* The name of the register this entity is registered in.
|
|
23
24
|
*/
|
|
24
25
|
readonly registerName: string_name;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
28
29
|
*
|
|
29
30
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
30
31
|
*
|
|
31
|
-
* @private internal utility, exported are only
|
|
32
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
32
33
|
*/
|
|
33
34
|
export declare class $Register<TRegistered extends Registered> {
|
|
34
35
|
private readonly registerName;
|
|
@@ -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
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
const SMALL_NUMBER = 0.001;
|
|
79
79
|
// <- TODO: [🧜♂️]
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
82
82
|
*
|
|
83
83
|
* @public exported from `@promptbook/core`
|
|
84
84
|
*/
|
|
@@ -390,8 +390,12 @@
|
|
|
390
390
|
*/
|
|
391
391
|
|
|
392
392
|
/**
|
|
393
|
-
*
|
|
393
|
+
* Creates a deep clone of the given object
|
|
394
|
+
*
|
|
395
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
394
396
|
*
|
|
397
|
+
* @param objectValue The object to clone.
|
|
398
|
+
* @returns A deep, writable clone of the input object.
|
|
395
399
|
* @public exported from `@promptbook/utils`
|
|
396
400
|
*/
|
|
397
401
|
function deepClone(objectValue) {
|
|
@@ -1459,7 +1463,7 @@
|
|
|
1459
1463
|
* Function to check if a string is valid CSV
|
|
1460
1464
|
*
|
|
1461
1465
|
* @param value The string to check
|
|
1462
|
-
* @returns
|
|
1466
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
1463
1467
|
*
|
|
1464
1468
|
* @public exported from `@promptbook/utils`
|
|
1465
1469
|
*/
|
|
@@ -1481,7 +1485,7 @@
|
|
|
1481
1485
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1482
1486
|
*
|
|
1483
1487
|
* @param value The string to check
|
|
1484
|
-
* @returns
|
|
1488
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
1485
1489
|
*
|
|
1486
1490
|
* @public exported from `@promptbook/utils`
|
|
1487
1491
|
*/
|
|
@@ -1539,7 +1543,7 @@
|
|
|
1539
1543
|
* Function to check if a string is valid XML
|
|
1540
1544
|
*
|
|
1541
1545
|
* @param value
|
|
1542
|
-
* @returns
|
|
1546
|
+
* @returns `true` if the string is a valid XML string, false otherwise
|
|
1543
1547
|
*
|
|
1544
1548
|
* @public exported from `@promptbook/utils`
|
|
1545
1549
|
*/
|
|
@@ -2353,15 +2357,16 @@
|
|
|
2353
2357
|
}
|
|
2354
2358
|
|
|
2355
2359
|
/**
|
|
2356
|
-
*
|
|
2360
|
+
* Creates a deep clone of a PipelineJson object, copying all properties explicitly.
|
|
2357
2361
|
*
|
|
2358
|
-
* Note: It is
|
|
2362
|
+
* Note: It is useful for ensuring that modifications to the returned pipeline do not affect the original.
|
|
2359
2363
|
*
|
|
2360
|
-
* @param pipeline
|
|
2364
|
+
* @param pipeline The pipeline to clone.
|
|
2365
|
+
* @returns A new PipelineJson object with the same properties as the input.
|
|
2361
2366
|
* @public exported from `@promptbook/utils`
|
|
2362
2367
|
*/
|
|
2363
2368
|
function clonePipeline(pipeline) {
|
|
2364
|
-
// Note: Not using spread operator (...) because
|
|
2369
|
+
// Note: Not using spread operator (...) because it does not deeply copy nested objects and may miss non-enumerable properties.
|
|
2365
2370
|
const { pipelineUrl, sourceFile, title, bookVersion, description, formfactorName, parameters, tasks, knowledgeSources, knowledgePieces, personas, preparations, sources, } = pipeline;
|
|
2366
2371
|
return {
|
|
2367
2372
|
pipelineUrl,
|
|
@@ -2647,10 +2652,10 @@
|
|
|
2647
2652
|
*/
|
|
2648
2653
|
|
|
2649
2654
|
/**
|
|
2650
|
-
*
|
|
2655
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
2651
2656
|
*
|
|
2652
|
-
* @param javascriptName
|
|
2653
|
-
* @returns
|
|
2657
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
2658
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
2654
2659
|
* @public exported from `@promptbook/utils`
|
|
2655
2660
|
*/
|
|
2656
2661
|
function isValidJavascriptName(javascriptName) {
|