@promptbook/legacy-documents 0.77.0-6 → 0.77.1

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.
@@ -35,7 +35,7 @@ import { validatePipeline } from '../conversion/validation/validatePipeline';
35
35
  import { CallbackInterfaceTools } from '../dialogs/callback/CallbackInterfaceTools';
36
36
  import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
37
37
  import { BoilerplateError } from '../errors/0-BoilerplateError';
38
- import { ERRORS } from '../errors/0-index';
38
+ import { PROMPTBOOK_ERRORS } from '../errors/0-index';
39
39
  import { AbstractFormatError } from '../errors/AbstractFormatError';
40
40
  import { CollectionError } from '../errors/CollectionError';
41
41
  import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
@@ -150,7 +150,7 @@ export { validatePipeline };
150
150
  export { CallbackInterfaceTools };
151
151
  export type { CallbackInterfaceToolsOptions };
152
152
  export { BoilerplateError };
153
- export { ERRORS };
153
+ export { PROMPTBOOK_ERRORS };
154
154
  export { AbstractFormatError };
155
155
  export { CollectionError };
156
156
  export { EnvironmentMismatchError };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ts-node
2
2
  /**
3
- * Note: [🔺] Purpose of this file is to test the CLI in development environment
3
+ * Note: [🔺] Purpose of this file is to test and use the current CLI in development environment
4
4
  */
5
5
  import '../../_packages/cli.index.ts';
@@ -18,7 +18,52 @@ import { UnexpectedError } from './UnexpectedError';
18
18
  *
19
19
  * @public exported from `@promptbook/core`
20
20
  */
21
- export declare const ERRORS: {
21
+ export declare const PROMPTBOOK_ERRORS: {
22
+ readonly AbstractFormatError: typeof AbstractFormatError;
23
+ readonly CsvFormatError: typeof CsvFormatError;
24
+ readonly CollectionError: typeof CollectionError;
25
+ readonly EnvironmentMismatchError: typeof EnvironmentMismatchError;
26
+ readonly ExpectError: typeof ExpectError;
27
+ readonly KnowledgeScrapeError: typeof KnowledgeScrapeError;
28
+ readonly LimitReachedError: typeof LimitReachedError;
29
+ readonly MissingToolsError: typeof MissingToolsError;
30
+ readonly NotFoundError: typeof NotFoundError;
31
+ readonly NotYetImplementedError: typeof NotYetImplementedError;
32
+ readonly ParseError: typeof ParseError;
33
+ readonly PipelineExecutionError: typeof PipelineExecutionError;
34
+ readonly PipelineLogicError: typeof PipelineLogicError;
35
+ readonly PipelineUrlError: typeof PipelineUrlError;
36
+ readonly UnexpectedError: typeof UnexpectedError;
37
+ };
38
+ /**
39
+ * Index of all javascript errors
40
+ *
41
+ * @private for internal usage
42
+ */
43
+ export declare const COMMON_JAVASCRIPT_ERRORS: {
44
+ readonly Error: ErrorConstructor;
45
+ readonly EvalError: EvalErrorConstructor;
46
+ readonly RangeError: RangeErrorConstructor;
47
+ readonly ReferenceError: ReferenceErrorConstructor;
48
+ readonly SyntaxError: SyntaxErrorConstructor;
49
+ readonly TypeError: TypeErrorConstructor;
50
+ readonly URIError: URIErrorConstructor;
51
+ readonly AggregateError: AggregateErrorConstructor;
52
+ };
53
+ /**
54
+ * Index of all errors
55
+ *
56
+ * @private for internal usage
57
+ */
58
+ export declare const ALL_ERRORS: {
59
+ readonly Error: ErrorConstructor;
60
+ readonly EvalError: EvalErrorConstructor;
61
+ readonly RangeError: RangeErrorConstructor;
62
+ readonly ReferenceError: ReferenceErrorConstructor;
63
+ readonly SyntaxError: SyntaxErrorConstructor;
64
+ readonly TypeError: TypeErrorConstructor;
65
+ readonly URIError: URIErrorConstructor;
66
+ readonly AggregateError: AggregateErrorConstructor;
22
67
  readonly AbstractFormatError: typeof AbstractFormatError;
23
68
  readonly CsvFormatError: typeof CsvFormatError;
24
69
  readonly CollectionError: typeof CollectionError;
@@ -1,4 +1,4 @@
1
- import type { ERRORS } from '../0-index';
1
+ import type { ALL_ERRORS } from '../0-index';
2
2
  /**
3
3
  * Represents a serialized error or custom Promptbook error
4
4
  *
@@ -8,7 +8,7 @@ export type ErrorJson = {
8
8
  /**
9
9
  * The type of the error
10
10
  */
11
- readonly name: keyof typeof ERRORS | 'Error';
11
+ readonly name: keyof typeof ALL_ERRORS;
12
12
  /**
13
13
  * The message of the error
14
14
  */
@@ -34,5 +34,5 @@ export type AvailableModel = {
34
34
  readonly modelDescription?: string_model_description;
35
35
  };
36
36
  /**
37
- * TODO: !!!!!! Put pricing information here
37
+ * TODO: (not only [🕘]) Put pricing information here
38
38
  */
@@ -10,9 +10,5 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
10
10
  className: string;
11
11
  };
12
12
  /**
13
- * TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
14
- * TODO: [🧠][🧱][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
15
- * TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
16
- * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
17
13
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
18
14
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/legacy-documents",
3
- "version": "0.77.0-6",
3
+ "version": "0.77.1",
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/legacy-documents.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.77.0-6"
57
+ "@promptbook/core": "0.77.1"
58
58
  },
59
59
  "dependencies": {
60
60
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.77.0-5';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
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
@@ -2228,7 +2228,7 @@
2228
2228
  *
2229
2229
  * @public exported from `@promptbook/core`
2230
2230
  */
2231
- var ERRORS = {
2231
+ var PROMPTBOOK_ERRORS = {
2232
2232
  AbstractFormatError: AbstractFormatError,
2233
2233
  CsvFormatError: CsvFormatError,
2234
2234
  CollectionError: CollectionError,
@@ -2246,6 +2246,35 @@
2246
2246
  UnexpectedError: UnexpectedError,
2247
2247
  // TODO: [🪑]> VersionMismatchError,
2248
2248
  };
2249
+ /**
2250
+ * Index of all javascript errors
2251
+ *
2252
+ * @private for internal usage
2253
+ */
2254
+ var COMMON_JAVASCRIPT_ERRORS = {
2255
+ Error: Error,
2256
+ EvalError: EvalError,
2257
+ RangeError: RangeError,
2258
+ ReferenceError: ReferenceError,
2259
+ SyntaxError: SyntaxError,
2260
+ TypeError: TypeError,
2261
+ URIError: URIError,
2262
+ AggregateError: AggregateError,
2263
+ /*
2264
+ Note: Not widely supported
2265
+ > InternalError,
2266
+ > ModuleError,
2267
+ > HeapError,
2268
+ > WebAssemblyCompileError,
2269
+ > WebAssemblyRuntimeError,
2270
+ */
2271
+ };
2272
+ /**
2273
+ * Index of all errors
2274
+ *
2275
+ * @private for internal usage
2276
+ */
2277
+ var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
2249
2278
  /**
2250
2279
  * Note: [💞] Ignore a discrepancy between file name and entity name
2251
2280
  */
@@ -2256,11 +2285,11 @@
2256
2285
  * @public exported from `@promptbook/utils`
2257
2286
  */
2258
2287
  function deserializeError(error) {
2259
- if (error.name === 'Error') {
2260
- return new Error(error.message);
2288
+ var ErrorClass = ALL_ERRORS[error.name];
2289
+ if (ErrorClass === undefined) {
2290
+ return new Error("".concat(error.name, ": ").concat(error.message));
2261
2291
  }
2262
- var CustomError = ERRORS[error.name];
2263
- return new CustomError(error.message);
2292
+ return new ErrorClass(error.message);
2264
2293
  }
2265
2294
 
2266
2295
  /**
@@ -2334,8 +2363,8 @@
2334
2363
  */
2335
2364
  function serializeError(error) {
2336
2365
  var name = error.name, message = error.message, stack = error.stack;
2337
- if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
2338
- throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
2366
+ if (!Object.keys(ALL_ERRORS).includes(name)) {
2367
+ console.error(spaceTrim__default["default"](function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
2339
2368
  }
2340
2369
  return {
2341
2370
  name: name,