@promptbook/markdown-utils 0.75.4 → 0.75.6
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 +60 -56
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +12 -0
- package/esm/typings/src/errors/{index.d.ts → 0-index.d.ts} +10 -2
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +60 -56
- package/umd/index.umd.js.map +1 -1
|
@@ -34,11 +34,12 @@ import { stringifyPipelineJson } from '../conversion/utils/stringifyPipelineJson
|
|
|
34
34
|
import { validatePipeline } from '../conversion/validation/validatePipeline';
|
|
35
35
|
import { CallbackInterfaceTools } from '../dialogs/callback/CallbackInterfaceTools';
|
|
36
36
|
import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
|
|
37
|
+
import { BoilerplateError } from '../errors/0-BoilerplateError';
|
|
38
|
+
import { ERRORS } from '../errors/0-index';
|
|
37
39
|
import { AbstractFormatError } from '../errors/AbstractFormatError';
|
|
38
40
|
import { CollectionError } from '../errors/CollectionError';
|
|
39
41
|
import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
|
|
40
42
|
import { ExpectError } from '../errors/ExpectError';
|
|
41
|
-
import { ERRORS } from '../errors/index';
|
|
42
43
|
import { KnowledgeScrapeError } from '../errors/KnowledgeScrapeError';
|
|
43
44
|
import { LimitReachedError } from '../errors/LimitReachedError';
|
|
44
45
|
import { MissingToolsError } from '../errors/MissingToolsError';
|
|
@@ -147,11 +148,12 @@ export { stringifyPipelineJson };
|
|
|
147
148
|
export { validatePipeline };
|
|
148
149
|
export { CallbackInterfaceTools };
|
|
149
150
|
export type { CallbackInterfaceToolsOptions };
|
|
151
|
+
export { BoilerplateError };
|
|
152
|
+
export { ERRORS };
|
|
150
153
|
export { AbstractFormatError };
|
|
151
154
|
export { CollectionError };
|
|
152
155
|
export { EnvironmentMismatchError };
|
|
153
156
|
export { ExpectError };
|
|
154
|
-
export { ERRORS };
|
|
155
157
|
export { KnowledgeScrapeError };
|
|
156
158
|
export { LimitReachedError };
|
|
157
159
|
export { MissingToolsError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This error indicates @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare class BoilerplateError extends Error {
|
|
7
|
+
readonly name = "BoilerplateError";
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* TODO: @@@ Do not forget to add the error into `0-index.ts` ERRORS
|
|
12
|
+
*/
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { CsvFormatError } from '../formats/csv/CsvFormatError';
|
|
2
|
+
import { AbstractFormatError } from './AbstractFormatError';
|
|
1
3
|
import { CollectionError } from './CollectionError';
|
|
2
4
|
import { EnvironmentMismatchError } from './EnvironmentMismatchError';
|
|
3
5
|
import { ExpectError } from './ExpectError';
|
|
6
|
+
import { KnowledgeScrapeError } from './KnowledgeScrapeError';
|
|
4
7
|
import { LimitReachedError } from './LimitReachedError';
|
|
8
|
+
import { MissingToolsError } from './MissingToolsError';
|
|
5
9
|
import { NotFoundError } from './NotFoundError';
|
|
6
10
|
import { NotYetImplementedError } from './NotYetImplementedError';
|
|
7
11
|
import { ParseError } from './ParseError';
|
|
@@ -15,10 +19,14 @@ import { UnexpectedError } from './UnexpectedError';
|
|
|
15
19
|
* @public exported from `@promptbook/core`
|
|
16
20
|
*/
|
|
17
21
|
export declare const ERRORS: {
|
|
18
|
-
readonly
|
|
22
|
+
readonly AbstractFormatError: typeof AbstractFormatError;
|
|
23
|
+
readonly CsvFormatError: typeof CsvFormatError;
|
|
19
24
|
readonly CollectionError: typeof CollectionError;
|
|
20
25
|
readonly EnvironmentMismatchError: typeof EnvironmentMismatchError;
|
|
26
|
+
readonly ExpectError: typeof ExpectError;
|
|
27
|
+
readonly KnowledgeScrapeError: typeof KnowledgeScrapeError;
|
|
21
28
|
readonly LimitReachedError: typeof LimitReachedError;
|
|
29
|
+
readonly MissingToolsError: typeof MissingToolsError;
|
|
22
30
|
readonly NotFoundError: typeof NotFoundError;
|
|
23
31
|
readonly NotYetImplementedError: typeof NotYetImplementedError;
|
|
24
32
|
readonly ParseError: typeof ParseError;
|
|
@@ -29,4 +37,4 @@ export declare const ERRORS: {
|
|
|
29
37
|
};
|
|
30
38
|
/**
|
|
31
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
32
|
-
*/
|
|
40
|
+
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.5';
|
|
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
|
|
@@ -1965,6 +1965,42 @@
|
|
|
1965
1965
|
return PipelineExecutionError;
|
|
1966
1966
|
}(Error));
|
|
1967
1967
|
|
|
1968
|
+
/**
|
|
1969
|
+
* This error indicates problems parsing the format value
|
|
1970
|
+
*
|
|
1971
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
1972
|
+
* This is not thrown directly but in extended classes
|
|
1973
|
+
*
|
|
1974
|
+
* @public exported from `@promptbook/core`
|
|
1975
|
+
*/
|
|
1976
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
1977
|
+
__extends(AbstractFormatError, _super);
|
|
1978
|
+
// Note: To allow instanceof do not put here error `name`
|
|
1979
|
+
// public readonly name = 'AbstractFormatError';
|
|
1980
|
+
function AbstractFormatError(message) {
|
|
1981
|
+
var _this = _super.call(this, message) || this;
|
|
1982
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
1983
|
+
return _this;
|
|
1984
|
+
}
|
|
1985
|
+
return AbstractFormatError;
|
|
1986
|
+
}(Error));
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* This error indicates problem with parsing of CSV
|
|
1990
|
+
*
|
|
1991
|
+
* @public exported from `@promptbook/core`
|
|
1992
|
+
*/
|
|
1993
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
1994
|
+
__extends(CsvFormatError, _super);
|
|
1995
|
+
function CsvFormatError(message) {
|
|
1996
|
+
var _this = _super.call(this, message) || this;
|
|
1997
|
+
_this.name = 'CsvFormatError';
|
|
1998
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
1999
|
+
return _this;
|
|
2000
|
+
}
|
|
2001
|
+
return CsvFormatError;
|
|
2002
|
+
}(AbstractFormatError));
|
|
2003
|
+
|
|
1968
2004
|
/**
|
|
1969
2005
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
1970
2006
|
*
|
|
@@ -2016,6 +2052,22 @@
|
|
|
2016
2052
|
return ExpectError;
|
|
2017
2053
|
}(Error));
|
|
2018
2054
|
|
|
2055
|
+
/**
|
|
2056
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2057
|
+
*
|
|
2058
|
+
* @public exported from `@promptbook/core`
|
|
2059
|
+
*/
|
|
2060
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2061
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2062
|
+
function KnowledgeScrapeError(message) {
|
|
2063
|
+
var _this = _super.call(this, message) || this;
|
|
2064
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2065
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2066
|
+
return _this;
|
|
2067
|
+
}
|
|
2068
|
+
return KnowledgeScrapeError;
|
|
2069
|
+
}(Error));
|
|
2070
|
+
|
|
2019
2071
|
/**
|
|
2020
2072
|
* This error type indicates that some limit was reached
|
|
2021
2073
|
*
|
|
@@ -2054,10 +2106,14 @@
|
|
|
2054
2106
|
* @public exported from `@promptbook/core`
|
|
2055
2107
|
*/
|
|
2056
2108
|
var ERRORS = {
|
|
2057
|
-
|
|
2109
|
+
AbstractFormatError: AbstractFormatError,
|
|
2110
|
+
CsvFormatError: CsvFormatError,
|
|
2058
2111
|
CollectionError: CollectionError,
|
|
2059
2112
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2113
|
+
ExpectError: ExpectError,
|
|
2114
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
2060
2115
|
LimitReachedError: LimitReachedError,
|
|
2116
|
+
MissingToolsError: MissingToolsError,
|
|
2061
2117
|
NotFoundError: NotFoundError,
|
|
2062
2118
|
NotYetImplementedError: NotYetImplementedError,
|
|
2063
2119
|
ParseError: ParseError,
|
|
@@ -2858,22 +2914,6 @@
|
|
|
2858
2914
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
2859
2915
|
*/
|
|
2860
2916
|
|
|
2861
|
-
/**
|
|
2862
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2863
|
-
*
|
|
2864
|
-
* @public exported from `@promptbook/core`
|
|
2865
|
-
*/
|
|
2866
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2867
|
-
__extends(KnowledgeScrapeError, _super);
|
|
2868
|
-
function KnowledgeScrapeError(message) {
|
|
2869
|
-
var _this = _super.call(this, message) || this;
|
|
2870
|
-
_this.name = 'KnowledgeScrapeError';
|
|
2871
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2872
|
-
return _this;
|
|
2873
|
-
}
|
|
2874
|
-
return KnowledgeScrapeError;
|
|
2875
|
-
}(Error));
|
|
2876
|
-
|
|
2877
2917
|
/**
|
|
2878
2918
|
* @@@
|
|
2879
2919
|
*
|
|
@@ -3893,42 +3933,6 @@
|
|
|
3893
3933
|
return union;
|
|
3894
3934
|
}
|
|
3895
3935
|
|
|
3896
|
-
/**
|
|
3897
|
-
* This error indicates problems parsing the format value
|
|
3898
|
-
*
|
|
3899
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
3900
|
-
* This is not thrown directly but in extended classes
|
|
3901
|
-
*
|
|
3902
|
-
* @public exported from `@promptbook/core`
|
|
3903
|
-
*/
|
|
3904
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
3905
|
-
__extends(AbstractFormatError, _super);
|
|
3906
|
-
// Note: To allow instanceof do not put here error `name`
|
|
3907
|
-
// public readonly name = 'AbstractFormatError';
|
|
3908
|
-
function AbstractFormatError(message) {
|
|
3909
|
-
var _this = _super.call(this, message) || this;
|
|
3910
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
3911
|
-
return _this;
|
|
3912
|
-
}
|
|
3913
|
-
return AbstractFormatError;
|
|
3914
|
-
}(Error));
|
|
3915
|
-
|
|
3916
|
-
/**
|
|
3917
|
-
* This error indicates problem with parsing of CSV
|
|
3918
|
-
*
|
|
3919
|
-
* @public exported from `@promptbook/core`
|
|
3920
|
-
*/
|
|
3921
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
3922
|
-
__extends(CsvFormatError, _super);
|
|
3923
|
-
function CsvFormatError(message) {
|
|
3924
|
-
var _this = _super.call(this, message) || this;
|
|
3925
|
-
_this.name = 'CsvFormatError';
|
|
3926
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
3927
|
-
return _this;
|
|
3928
|
-
}
|
|
3929
|
-
return CsvFormatError;
|
|
3930
|
-
}(AbstractFormatError));
|
|
3931
|
-
|
|
3932
3936
|
/**
|
|
3933
3937
|
* @@@
|
|
3934
3938
|
*
|
|
@@ -3969,7 +3973,7 @@
|
|
|
3969
3973
|
case 0:
|
|
3970
3974
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
3971
3975
|
if (csv.errors.length !== 0) {
|
|
3972
|
-
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
3976
|
+
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV setings:\n ").concat(block(JSON.stringify(__assign(__assign({}, settings), MANDATORY_CSV_SETTINGS), null, 2)), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
|
|
3973
3977
|
}
|
|
3974
3978
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3975
3979
|
var _a, _b;
|
|
@@ -4007,7 +4011,7 @@
|
|
|
4007
4011
|
case 0:
|
|
4008
4012
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
4009
4013
|
if (csv.errors.length !== 0) {
|
|
4010
|
-
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
4014
|
+
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV setings:\n ").concat(block(JSON.stringify(__assign(__assign({}, settings), MANDATORY_CSV_SETTINGS), null, 2)), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
|
|
4011
4015
|
}
|
|
4012
4016
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
4013
4017
|
var _this = this;
|