@promptbook/remote-client 0.92.0-21 → 0.92.0-22
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 +17 -7
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +8 -1
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +11 -1
- package/package.json +2 -2
- package/umd/index.umd.js +17 -7
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
* @generated
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
23
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-22';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1895,7 +1895,8 @@ const CsvFormatParser = {
|
|
|
1895
1895
|
subvalueParsers: [
|
|
1896
1896
|
{
|
|
1897
1897
|
subvalueName: 'ROW',
|
|
1898
|
-
async mapValues(
|
|
1898
|
+
async mapValues(options) {
|
|
1899
|
+
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
1899
1900
|
const csv = csvParse(value, settings);
|
|
1900
1901
|
if (csv.errors.length !== 0) {
|
|
1901
1902
|
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
@@ -1911,21 +1912,29 @@ const CsvFormatParser = {
|
|
|
1911
1912
|
${block(value)}
|
|
1912
1913
|
`));
|
|
1913
1914
|
}
|
|
1914
|
-
const mappedData =
|
|
1915
|
+
const mappedData = [];
|
|
1916
|
+
for (let index = 0; index < csv.data.length; index++) {
|
|
1917
|
+
const row = csv.data[index];
|
|
1915
1918
|
if (row[outputParameterName]) {
|
|
1916
1919
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
1917
1920
|
}
|
|
1918
|
-
|
|
1921
|
+
const mappedRow = {
|
|
1919
1922
|
...row,
|
|
1920
1923
|
[outputParameterName]: await mapCallback(row, index),
|
|
1921
1924
|
};
|
|
1922
|
-
|
|
1925
|
+
mappedData.push(mappedRow);
|
|
1926
|
+
if (onProgress) {
|
|
1927
|
+
// Note: Report the CSV with all rows mapped so far
|
|
1928
|
+
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1923
1931
|
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
1924
1932
|
},
|
|
1925
1933
|
},
|
|
1926
1934
|
{
|
|
1927
1935
|
subvalueName: 'CELL',
|
|
1928
|
-
async mapValues(
|
|
1936
|
+
async mapValues(options) {
|
|
1937
|
+
const { value, settings, mapCallback, onProgress } = options;
|
|
1929
1938
|
const csv = csvParse(value, settings);
|
|
1930
1939
|
if (csv.errors.length !== 0) {
|
|
1931
1940
|
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
@@ -2034,7 +2043,8 @@ const TextFormatParser = {
|
|
|
2034
2043
|
subvalueParsers: [
|
|
2035
2044
|
{
|
|
2036
2045
|
subvalueName: 'LINE',
|
|
2037
|
-
async mapValues(
|
|
2046
|
+
async mapValues(options) {
|
|
2047
|
+
const { value, mapCallback, onProgress } = options;
|
|
2038
2048
|
const lines = value.split('\n');
|
|
2039
2049
|
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2040
2050
|
// TODO: [🧠] Maybe option to skip empty line
|