@promptbook/remote-client 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.
Files changed (27) hide show
  1. package/esm/index.es.js +40 -24
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  5. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
  6. package/esm/typings/src/config.d.ts +29 -11
  7. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +12 -9
  8. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +11 -8
  9. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
  10. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +10 -8
  11. package/esm/typings/src/formats/_common/FormatParser.d.ts +5 -3
  12. package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +40 -5
  13. package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
  14. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
  15. package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +4 -1
  17. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
  18. package/esm/typings/src/types/typeAliases.d.ts +9 -7
  19. package/esm/typings/src/utils/$Register.d.ts +8 -7
  20. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
  21. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
  22. package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
  23. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
  24. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
  25. package/package.json +2 -2
  26. package/umd/index.umd.js +40 -24
  27. package/umd/index.umd.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-client",
3
- "version": "0.92.0-21",
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/remote-client.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.92.0-21"
54
+ "@promptbook/core": "0.92.0-23"
55
55
  },
56
56
  "dependencies": {
57
57
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-21';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -364,7 +364,7 @@
364
364
  const CONNECTION_RETRIES_LIMIT = 5;
365
365
  // <- TODO: [🧜‍♂️]
366
366
  /**
367
- * @@@
367
+ * Default settings for parsing and generating CSV files in Promptbook.
368
368
  *
369
369
  * @public exported from `@promptbook/core`
370
370
  */
@@ -1859,7 +1859,7 @@
1859
1859
  * Function to check if a string is valid CSV
1860
1860
  *
1861
1861
  * @param value The string to check
1862
- * @returns True if the string is a valid CSV string, false otherwise
1862
+ * @returns `true` if the string is a valid CSV string, false otherwise
1863
1863
  *
1864
1864
  * @public exported from `@promptbook/utils`
1865
1865
  */
@@ -1898,7 +1898,8 @@
1898
1898
  subvalueParsers: [
1899
1899
  {
1900
1900
  subvalueName: 'ROW',
1901
- async mapValues(value, outputParameterName, settings, mapCallback) {
1901
+ async mapValues(options) {
1902
+ const { value, outputParameterName, settings, mapCallback, onProgress } = options;
1902
1903
  const csv = csvParse(value, settings);
1903
1904
  if (csv.errors.length !== 0) {
1904
1905
  throw new CsvFormatError(spaceTrim__default["default"]((block) => `
@@ -1914,21 +1915,30 @@
1914
1915
  ${block(value)}
1915
1916
  `));
1916
1917
  }
1917
- const mappedData = await Promise.all(csv.data.map(async (row, index) => {
1918
+ const mappedData = [];
1919
+ const length = csv.data.length;
1920
+ for (let index = 0; index < length; index++) {
1921
+ const row = csv.data[index];
1918
1922
  if (row[outputParameterName]) {
1919
1923
  throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
1920
1924
  }
1921
- return {
1925
+ const mappedRow = {
1922
1926
  ...row,
1923
- [outputParameterName]: await mapCallback(row, index),
1927
+ [outputParameterName]: await mapCallback(row, index, length),
1924
1928
  };
1925
- }));
1929
+ mappedData.push(mappedRow);
1930
+ if (onProgress) {
1931
+ // Note: Report the CSV with all rows mapped so far
1932
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
1933
+ }
1934
+ }
1926
1935
  return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
1927
1936
  },
1928
1937
  },
1929
1938
  {
1930
1939
  subvalueName: 'CELL',
1931
- async mapValues(value, outputParameterName, settings, mapCallback) {
1940
+ async mapValues(options) {
1941
+ const { value, settings, mapCallback, onProgress } = options;
1932
1942
  const csv = csvParse(value, settings);
1933
1943
  if (csv.errors.length !== 0) {
1934
1944
  throw new CsvFormatError(spaceTrim__default["default"]((block) => `
@@ -1945,9 +1955,9 @@
1945
1955
  `));
1946
1956
  }
1947
1957
  const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
1948
- return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
1958
+ return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
1949
1959
  const index = rowIndex * Object.keys(row).length + columnIndex;
1950
- return /* not await */ mapCallback({ [key]: value }, index);
1960
+ return /* not await */ mapCallback({ [key]: value }, index, array.length);
1951
1961
  }));
1952
1962
  }));
1953
1963
  return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
@@ -1967,7 +1977,7 @@
1967
1977
  * Function isValidJsonString will tell you if the string is valid JSON or not
1968
1978
  *
1969
1979
  * @param value The string to check
1970
- * @returns True if the string is a valid JSON string, false otherwise
1980
+ * @returns `true` if the string is a valid JSON string, false otherwise
1971
1981
  *
1972
1982
  * @public exported from `@promptbook/utils`
1973
1983
  */
@@ -2037,14 +2047,15 @@
2037
2047
  subvalueParsers: [
2038
2048
  {
2039
2049
  subvalueName: 'LINE',
2040
- async mapValues(value, outputParameterName, settings, mapCallback) {
2050
+ async mapValues(options) {
2051
+ const { value, mapCallback, onProgress } = options;
2041
2052
  const lines = value.split('\n');
2042
- const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
2053
+ const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
2043
2054
  // TODO: [🧠] Maybe option to skip empty line
2044
2055
  /* not await */ mapCallback({
2045
2056
  lineContent,
2046
2057
  // TODO: [🧠] Maybe also put here `lineNumber`
2047
- }, lineNumber)));
2058
+ }, lineNumber, array.length)));
2048
2059
  return mappedLines.join('\n');
2049
2060
  },
2050
2061
  },
@@ -2065,7 +2076,7 @@
2065
2076
  * Function to check if a string is valid XML
2066
2077
  *
2067
2078
  * @param value
2068
- * @returns True if the string is a valid XML string, false otherwise
2079
+ * @returns `true` if the string is a valid XML string, false otherwise
2069
2080
  *
2070
2081
  * @public exported from `@promptbook/utils`
2071
2082
  */
@@ -2362,8 +2373,12 @@
2362
2373
  */
2363
2374
 
2364
2375
  /**
2365
- * @@@
2376
+ * Creates a deep clone of the given object
2366
2377
  *
2378
+ * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
2379
+ *
2380
+ * @param objectValue The object to clone.
2381
+ * @returns A deep, writable clone of the input object.
2367
2382
  * @public exported from `@promptbook/utils`
2368
2383
  */
2369
2384
  function deepClone(objectValue) {
@@ -2554,11 +2569,12 @@
2554
2569
  }
2555
2570
 
2556
2571
  /**
2557
- * Function `validateParameterName` will @@@
2572
+ * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
2573
+ * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
2558
2574
  *
2559
- * @param parameterName @@@
2560
- * @returns @@@
2561
- * @throws {ParseError} @@@
2575
+ * @param parameterName The parameter name to validate and normalize.
2576
+ * @returns The validated and normalized parameter name.
2577
+ * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
2562
2578
  * @private within the repository
2563
2579
  */
2564
2580
  function validateParameterName(parameterName) {
@@ -3732,10 +3748,10 @@
3732
3748
  }
3733
3749
 
3734
3750
  /**
3735
- * @@@
3751
+ * Checks if the given value is a valid JavaScript identifier name.
3736
3752
  *
3737
- * @param javascriptName @@@
3738
- * @returns @@@
3753
+ * @param javascriptName The value to check for JavaScript identifier validity.
3754
+ * @returns `true` if the value is a valid JavaScript name, false otherwise.
3739
3755
  * @public exported from `@promptbook/utils`
3740
3756
  */
3741
3757
  function isValidJavascriptName(javascriptName) {