@promptbook/pdf 0.77.0 → 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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/pdf",
3
- "version": "0.77.0",
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/pdf.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.77.0"
57
+ "@promptbook/core": "0.77.1"
58
58
  },
59
59
  "dependencies": {
60
60
  "crypto-js": "4.2.0",
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.77.0-6';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
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
@@ -1943,7 +1943,7 @@
1943
1943
  *
1944
1944
  * @public exported from `@promptbook/core`
1945
1945
  */
1946
- var ERRORS = {
1946
+ var PROMPTBOOK_ERRORS = {
1947
1947
  AbstractFormatError: AbstractFormatError,
1948
1948
  CsvFormatError: CsvFormatError,
1949
1949
  CollectionError: CollectionError,
@@ -1961,6 +1961,35 @@
1961
1961
  UnexpectedError: UnexpectedError,
1962
1962
  // TODO: [🪑]> VersionMismatchError,
1963
1963
  };
1964
+ /**
1965
+ * Index of all javascript errors
1966
+ *
1967
+ * @private for internal usage
1968
+ */
1969
+ var COMMON_JAVASCRIPT_ERRORS = {
1970
+ Error: Error,
1971
+ EvalError: EvalError,
1972
+ RangeError: RangeError,
1973
+ ReferenceError: ReferenceError,
1974
+ SyntaxError: SyntaxError,
1975
+ TypeError: TypeError,
1976
+ URIError: URIError,
1977
+ AggregateError: AggregateError,
1978
+ /*
1979
+ Note: Not widely supported
1980
+ > InternalError,
1981
+ > ModuleError,
1982
+ > HeapError,
1983
+ > WebAssemblyCompileError,
1984
+ > WebAssemblyRuntimeError,
1985
+ */
1986
+ };
1987
+ /**
1988
+ * Index of all errors
1989
+ *
1990
+ * @private for internal usage
1991
+ */
1992
+ var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
1964
1993
  /**
1965
1994
  * Note: [💞] Ignore a discrepancy between file name and entity name
1966
1995
  */
@@ -1971,11 +2000,11 @@
1971
2000
  * @public exported from `@promptbook/utils`
1972
2001
  */
1973
2002
  function deserializeError(error) {
1974
- if (error.name === 'Error') {
1975
- return new Error(error.message);
2003
+ var ErrorClass = ALL_ERRORS[error.name];
2004
+ if (ErrorClass === undefined) {
2005
+ return new Error("".concat(error.name, ": ").concat(error.message));
1976
2006
  }
1977
- var CustomError = ERRORS[error.name];
1978
- return new CustomError(error.message);
2007
+ return new ErrorClass(error.message);
1979
2008
  }
1980
2009
 
1981
2010
  /**
@@ -2049,8 +2078,8 @@
2049
2078
  */
2050
2079
  function serializeError(error) {
2051
2080
  var name = error.name, message = error.message, stack = error.stack;
2052
- if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
2053
- 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 "); }));
2081
+ if (!Object.keys(ALL_ERRORS).includes(name)) {
2082
+ 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 "); }));
2054
2083
  }
2055
2084
  return {
2056
2085
  name: name,