@promptbook/node 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 +2 -2
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.6",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.75.
|
|
57
|
+
"@promptbook/core": "0.75.6"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
*
|
|
44
44
|
* @see https://github.com/webgptorg/promptbook
|
|
45
45
|
*/
|
|
46
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
46
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.5';
|
|
47
47
|
/**
|
|
48
48
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
49
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2026,6 +2026,42 @@
|
|
|
2026
2026
|
return new (SimplePipelineCollection.bind.apply(SimplePipelineCollection, __spreadArray([void 0], __read(promptbooks), false)))();
|
|
2027
2027
|
}
|
|
2028
2028
|
|
|
2029
|
+
/**
|
|
2030
|
+
* This error indicates problems parsing the format value
|
|
2031
|
+
*
|
|
2032
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
2033
|
+
* This is not thrown directly but in extended classes
|
|
2034
|
+
*
|
|
2035
|
+
* @public exported from `@promptbook/core`
|
|
2036
|
+
*/
|
|
2037
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2038
|
+
__extends(AbstractFormatError, _super);
|
|
2039
|
+
// Note: To allow instanceof do not put here error `name`
|
|
2040
|
+
// public readonly name = 'AbstractFormatError';
|
|
2041
|
+
function AbstractFormatError(message) {
|
|
2042
|
+
var _this = _super.call(this, message) || this;
|
|
2043
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2044
|
+
return _this;
|
|
2045
|
+
}
|
|
2046
|
+
return AbstractFormatError;
|
|
2047
|
+
}(Error));
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* This error indicates problem with parsing of CSV
|
|
2051
|
+
*
|
|
2052
|
+
* @public exported from `@promptbook/core`
|
|
2053
|
+
*/
|
|
2054
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
2055
|
+
__extends(CsvFormatError, _super);
|
|
2056
|
+
function CsvFormatError(message) {
|
|
2057
|
+
var _this = _super.call(this, message) || this;
|
|
2058
|
+
_this.name = 'CsvFormatError';
|
|
2059
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2060
|
+
return _this;
|
|
2061
|
+
}
|
|
2062
|
+
return CsvFormatError;
|
|
2063
|
+
}(AbstractFormatError));
|
|
2064
|
+
|
|
2029
2065
|
/**
|
|
2030
2066
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2031
2067
|
*
|
|
@@ -2077,6 +2113,22 @@
|
|
|
2077
2113
|
return ExpectError;
|
|
2078
2114
|
}(Error));
|
|
2079
2115
|
|
|
2116
|
+
/**
|
|
2117
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2118
|
+
*
|
|
2119
|
+
* @public exported from `@promptbook/core`
|
|
2120
|
+
*/
|
|
2121
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2122
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2123
|
+
function KnowledgeScrapeError(message) {
|
|
2124
|
+
var _this = _super.call(this, message) || this;
|
|
2125
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2126
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2127
|
+
return _this;
|
|
2128
|
+
}
|
|
2129
|
+
return KnowledgeScrapeError;
|
|
2130
|
+
}(Error));
|
|
2131
|
+
|
|
2080
2132
|
/**
|
|
2081
2133
|
* This error type indicates that some limit was reached
|
|
2082
2134
|
*
|
|
@@ -2115,10 +2167,14 @@
|
|
|
2115
2167
|
* @public exported from `@promptbook/core`
|
|
2116
2168
|
*/
|
|
2117
2169
|
var ERRORS = {
|
|
2118
|
-
|
|
2170
|
+
AbstractFormatError: AbstractFormatError,
|
|
2171
|
+
CsvFormatError: CsvFormatError,
|
|
2119
2172
|
CollectionError: CollectionError,
|
|
2120
2173
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2174
|
+
ExpectError: ExpectError,
|
|
2175
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
2121
2176
|
LimitReachedError: LimitReachedError,
|
|
2177
|
+
MissingToolsError: MissingToolsError,
|
|
2122
2178
|
NotFoundError: NotFoundError,
|
|
2123
2179
|
NotYetImplementedError: NotYetImplementedError,
|
|
2124
2180
|
ParseError: ParseError,
|
|
@@ -2431,42 +2487,6 @@
|
|
|
2431
2487
|
return union;
|
|
2432
2488
|
}
|
|
2433
2489
|
|
|
2434
|
-
/**
|
|
2435
|
-
* This error indicates problems parsing the format value
|
|
2436
|
-
*
|
|
2437
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
2438
|
-
* This is not thrown directly but in extended classes
|
|
2439
|
-
*
|
|
2440
|
-
* @public exported from `@promptbook/core`
|
|
2441
|
-
*/
|
|
2442
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2443
|
-
__extends(AbstractFormatError, _super);
|
|
2444
|
-
// Note: To allow instanceof do not put here error `name`
|
|
2445
|
-
// public readonly name = 'AbstractFormatError';
|
|
2446
|
-
function AbstractFormatError(message) {
|
|
2447
|
-
var _this = _super.call(this, message) || this;
|
|
2448
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2449
|
-
return _this;
|
|
2450
|
-
}
|
|
2451
|
-
return AbstractFormatError;
|
|
2452
|
-
}(Error));
|
|
2453
|
-
|
|
2454
|
-
/**
|
|
2455
|
-
* This error indicates problem with parsing of CSV
|
|
2456
|
-
*
|
|
2457
|
-
* @public exported from `@promptbook/core`
|
|
2458
|
-
*/
|
|
2459
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
2460
|
-
__extends(CsvFormatError, _super);
|
|
2461
|
-
function CsvFormatError(message) {
|
|
2462
|
-
var _this = _super.call(this, message) || this;
|
|
2463
|
-
_this.name = 'CsvFormatError';
|
|
2464
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2465
|
-
return _this;
|
|
2466
|
-
}
|
|
2467
|
-
return CsvFormatError;
|
|
2468
|
-
}(AbstractFormatError));
|
|
2469
|
-
|
|
2470
2490
|
/**
|
|
2471
2491
|
* @@@
|
|
2472
2492
|
*
|
|
@@ -2507,7 +2527,7 @@
|
|
|
2507
2527
|
case 0:
|
|
2508
2528
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2509
2529
|
if (csv.errors.length !== 0) {
|
|
2510
|
-
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 "); }));
|
|
2530
|
+
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 "); }));
|
|
2511
2531
|
}
|
|
2512
2532
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
2513
2533
|
var _a, _b;
|
|
@@ -2545,7 +2565,7 @@
|
|
|
2545
2565
|
case 0:
|
|
2546
2566
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2547
2567
|
if (csv.errors.length !== 0) {
|
|
2548
|
-
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 "); }));
|
|
2568
|
+
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 "); }));
|
|
2549
2569
|
}
|
|
2550
2570
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
2551
2571
|
var _this = this;
|
|
@@ -4583,22 +4603,6 @@
|
|
|
4583
4603
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
4584
4604
|
*/
|
|
4585
4605
|
|
|
4586
|
-
/**
|
|
4587
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
4588
|
-
*
|
|
4589
|
-
* @public exported from `@promptbook/core`
|
|
4590
|
-
*/
|
|
4591
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
4592
|
-
__extends(KnowledgeScrapeError, _super);
|
|
4593
|
-
function KnowledgeScrapeError(message) {
|
|
4594
|
-
var _this = _super.call(this, message) || this;
|
|
4595
|
-
_this.name = 'KnowledgeScrapeError';
|
|
4596
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
4597
|
-
return _this;
|
|
4598
|
-
}
|
|
4599
|
-
return KnowledgeScrapeError;
|
|
4600
|
-
}(Error));
|
|
4601
|
-
|
|
4602
4606
|
/**
|
|
4603
4607
|
* @@@
|
|
4604
4608
|
*
|