@promptbook/documents 0.89.0-14 โ 0.89.0-16
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 +19 -20
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -4
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +16 -3
- package/esm/typings/src/config.d.ts +15 -19
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
- package/esm/typings/src/errors/assertsError.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +10 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +4 -1
- package/esm/typings/src/types/typeAliases.d.ts +12 -0
- package/package.json +8 -4
- package/umd/index.umd.js +19 -20
- package/umd/index.umd.js.map +1 -1
|
@@ -8,8 +8,6 @@ import { NAME } from '../config';
|
|
|
8
8
|
import { ADMIN_EMAIL } from '../config';
|
|
9
9
|
import { ADMIN_GITHUB_NAME } from '../config';
|
|
10
10
|
import { CLAIM } from '../config';
|
|
11
|
-
import { LOGO_LIGHT_SRC } from '../config';
|
|
12
|
-
import { LOGO_DARK_SRC } from '../config';
|
|
13
11
|
import { DEFAULT_BOOK_TITLE } from '../config';
|
|
14
12
|
import { DEFAULT_TASK_TITLE } from '../config';
|
|
15
13
|
import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
|
|
@@ -28,6 +26,7 @@ import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config';
|
|
|
28
26
|
import { CLI_APP_ID } from '../config';
|
|
29
27
|
import { PLAYGROUND_APP_ID } from '../config';
|
|
30
28
|
import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
|
|
29
|
+
import { REMOTE_SERVER_URLS } from '../config';
|
|
31
30
|
import { DEFAULT_REMOTE_SERVER_URL } from '../config';
|
|
32
31
|
import { DEFAULT_CSV_SETTINGS } from '../config';
|
|
33
32
|
import { DEFAULT_IS_VERBOSE } from '../config';
|
|
@@ -116,6 +115,8 @@ import { isPipelinePrepared } from '../prepare/isPipelinePrepared';
|
|
|
116
115
|
import { preparePipeline } from '../prepare/preparePipeline';
|
|
117
116
|
import { prepareTasks } from '../prepare/prepareTasks';
|
|
118
117
|
import { unpreparePipeline } from '../prepare/unpreparePipeline';
|
|
118
|
+
import { identificationToPromptbookToken } from '../remote-server/socket-types/_subtypes/identificationToPromptbookToken';
|
|
119
|
+
import { promptbookTokenToIdentification } from '../remote-server/socket-types/_subtypes/promptbookTokenToIdentification';
|
|
119
120
|
import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
|
|
120
121
|
import { prepareKnowledgePieces } from '../scrapers/_common/prepareKnowledgePieces';
|
|
121
122
|
import { $scrapersMetadataRegister } from '../scrapers/_common/register/$scrapersMetadataRegister';
|
|
@@ -145,8 +146,6 @@ export { NAME };
|
|
|
145
146
|
export { ADMIN_EMAIL };
|
|
146
147
|
export { ADMIN_GITHUB_NAME };
|
|
147
148
|
export { CLAIM };
|
|
148
|
-
export { LOGO_LIGHT_SRC };
|
|
149
|
-
export { LOGO_DARK_SRC };
|
|
150
149
|
export { DEFAULT_BOOK_TITLE };
|
|
151
150
|
export { DEFAULT_TASK_TITLE };
|
|
152
151
|
export { DEFAULT_PROMPT_TASK_TITLE };
|
|
@@ -165,6 +164,7 @@ export { DEFAULT_SCRAPE_CACHE_DIRNAME };
|
|
|
165
164
|
export { CLI_APP_ID };
|
|
166
165
|
export { PLAYGROUND_APP_ID };
|
|
167
166
|
export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME };
|
|
167
|
+
export { REMOTE_SERVER_URLS };
|
|
168
168
|
export { DEFAULT_REMOTE_SERVER_URL };
|
|
169
169
|
export { DEFAULT_CSV_SETTINGS };
|
|
170
170
|
export { DEFAULT_IS_VERBOSE };
|
|
@@ -253,6 +253,8 @@ export { isPipelinePrepared };
|
|
|
253
253
|
export { preparePipeline };
|
|
254
254
|
export { prepareTasks };
|
|
255
255
|
export { unpreparePipeline };
|
|
256
|
+
export { identificationToPromptbookToken };
|
|
257
|
+
export { promptbookTokenToIdentification };
|
|
256
258
|
export { _BoilerplateScraperMetadataRegistration };
|
|
257
259
|
export { prepareKnowledgePieces };
|
|
258
260
|
export { $scrapersMetadataRegister };
|
|
@@ -190,6 +190,7 @@ import type { string_css_property } from '../types/typeAliases';
|
|
|
190
190
|
import type { string_css_value } from '../types/typeAliases';
|
|
191
191
|
import type { string_css_selector } from '../types/typeAliases';
|
|
192
192
|
import type { string_url } from '../types/typeAliases';
|
|
193
|
+
import type { string_promptbook_server_url } from '../types/typeAliases';
|
|
193
194
|
import type { string_base_url } from '../types/typeAliases';
|
|
194
195
|
import type { string_pipeline_root_url } from '../types/typeAliases';
|
|
195
196
|
import type { string_pipeline_url } from '../types/typeAliases';
|
|
@@ -233,6 +234,7 @@ import type { string_postprocessing_function_name } from '../types/typeAliases';
|
|
|
233
234
|
import type { id } from '../types/typeAliases';
|
|
234
235
|
import type { task_id } from '../types/typeAliases';
|
|
235
236
|
import type { string_token } from '../types/typeAliases';
|
|
237
|
+
import type { string_promptbook_token } from '../types/typeAliases';
|
|
236
238
|
import type { string_license_token } from '../types/typeAliases';
|
|
237
239
|
import type { string_password } from '../types/typeAliases';
|
|
238
240
|
import type { string_ssh_key } from '../types/typeAliases';
|
|
@@ -477,6 +479,7 @@ export type { string_css_property };
|
|
|
477
479
|
export type { string_css_value };
|
|
478
480
|
export type { string_css_selector };
|
|
479
481
|
export type { string_url };
|
|
482
|
+
export type { string_promptbook_server_url };
|
|
480
483
|
export type { string_base_url };
|
|
481
484
|
export type { string_pipeline_root_url };
|
|
482
485
|
export type { string_pipeline_url };
|
|
@@ -520,6 +523,7 @@ export type { string_postprocessing_function_name };
|
|
|
520
523
|
export type { id };
|
|
521
524
|
export type { task_id };
|
|
522
525
|
export type { string_token };
|
|
526
|
+
export type { string_promptbook_token };
|
|
523
527
|
export type { string_license_token };
|
|
524
528
|
export type { string_password };
|
|
525
529
|
export type { string_ssh_key };
|
|
@@ -8,7 +8,6 @@ import type { Command as Program } from 'commander';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function $initializeLoginCommand(program: Program): void;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: Pass remote server URL (and path)
|
|
12
11
|
* TODO: Implement non-interactive login
|
|
13
12
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
14
13
|
* Note: [๐ก] Code in this file should never be published outside of `@promptbook/cli`
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
import type { LlmExecutionToolsWithTotalUsage } from '../../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
1
2
|
import type { CacheLlmToolsOptions } from '../../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
|
|
2
|
-
import type {
|
|
3
|
+
import type { string_promptbook_server_url } from '../../types/typeAliases';
|
|
3
4
|
type ProvideLlmToolsForCliOptions = Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & {
|
|
5
|
+
/**
|
|
6
|
+
* If true, user will be always prompted for login
|
|
7
|
+
*
|
|
8
|
+
* Note: This is used in `ptbk login` command
|
|
9
|
+
*/
|
|
10
|
+
isLoginloaded?: true;
|
|
11
|
+
/**
|
|
12
|
+
* CLI options
|
|
13
|
+
*/
|
|
4
14
|
cliOptions: {
|
|
5
15
|
verbose: boolean;
|
|
6
16
|
interactive: boolean;
|
|
7
17
|
provider: 'BYOK' | 'BRING_YOUR_OWN_KEYS' | 'REMOTE_SERVER' | 'RS' | string;
|
|
8
|
-
remoteServerUrl:
|
|
18
|
+
remoteServerUrl: string_promptbook_server_url;
|
|
9
19
|
};
|
|
10
20
|
};
|
|
11
21
|
/**
|
|
12
22
|
* @private utility of CLI
|
|
13
23
|
*/
|
|
14
|
-
export declare function $provideLlmToolsForCli(options: ProvideLlmToolsForCliOptions): Promise<
|
|
24
|
+
export declare function $provideLlmToolsForCli(options: ProvideLlmToolsForCliOptions): Promise<{
|
|
25
|
+
strategy: 'BRING_YOUR_OWN_KEYS' | 'REMOTE_SERVER';
|
|
26
|
+
llm: LlmExecutionToolsWithTotalUsage;
|
|
27
|
+
}>;
|
|
15
28
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrateg
|
|
|
3
3
|
import type { string_app_id } from './types/typeAliases';
|
|
4
4
|
import type { string_email } from './types/typeAliases';
|
|
5
5
|
import type { string_name } from './types/typeAliases';
|
|
6
|
-
import type {
|
|
6
|
+
import type { string_promptbook_server_url } from './types/typeAliases';
|
|
7
7
|
/**
|
|
8
8
|
* Warning message for the generated sections and files files
|
|
9
9
|
*
|
|
@@ -38,22 +38,6 @@ export declare const ADMIN_GITHUB_NAME: string_name;
|
|
|
38
38
|
* @public exported from `@promptbook/core`
|
|
39
39
|
*/
|
|
40
40
|
export declare const CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
|
|
41
|
-
/**
|
|
42
|
-
* Logo for the light theme
|
|
43
|
-
*
|
|
44
|
-
* TODO: [๐ฝ] Unite branding and make single place for it
|
|
45
|
-
*
|
|
46
|
-
* @public exported from `@promptbook/core`
|
|
47
|
-
*/
|
|
48
|
-
export declare const LOGO_LIGHT_SRC: string_url_image;
|
|
49
|
-
/**
|
|
50
|
-
* Logo for the dark theme
|
|
51
|
-
*
|
|
52
|
-
* TODO: [๐ฝ] Unite branding and make single place for it
|
|
53
|
-
*
|
|
54
|
-
* @public exported from `@promptbook/core`
|
|
55
|
-
*/
|
|
56
|
-
export declare const LOGO_DARK_SRC: string_url_image;
|
|
57
41
|
/**
|
|
58
42
|
* When the title is not provided, the default title is used
|
|
59
43
|
*
|
|
@@ -90,6 +74,12 @@ export declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
|
90
74
|
* @private within the repository
|
|
91
75
|
*/
|
|
92
76
|
export declare const GENERATOR_WARNING_BY_PROMPTBOOK_CLI = "\u26A0\uFE0F WARNING: This code has been generated by `@promptbook/cli` so that any manual changes will be overwritten";
|
|
77
|
+
/**
|
|
78
|
+
* Warning message for the automatically generated sections of `.env` files
|
|
79
|
+
*
|
|
80
|
+
* @private within the repository
|
|
81
|
+
*/
|
|
82
|
+
export declare const GENERATOR_WARNING_IN_ENV = "Note: Added by Promptbook";
|
|
93
83
|
/**
|
|
94
84
|
* The maximum number of iterations for a loops
|
|
95
85
|
*
|
|
@@ -238,11 +228,17 @@ export declare const MOMENT_ARG_THRESHOLDS: {
|
|
|
238
228
|
readonly ss: 3;
|
|
239
229
|
};
|
|
240
230
|
/**
|
|
241
|
-
*
|
|
231
|
+
* Available remote servers for the Promptbook
|
|
232
|
+
*
|
|
233
|
+
* @public exported from `@promptbook/core`
|
|
234
|
+
*/
|
|
235
|
+
export declare const REMOTE_SERVER_URLS: Array<string_promptbook_server_url>;
|
|
236
|
+
/**
|
|
237
|
+
* Default remote server URL for the Promptbook
|
|
242
238
|
*
|
|
243
239
|
* @public exported from `@promptbook/core`
|
|
244
240
|
*/
|
|
245
|
-
export declare const DEFAULT_REMOTE_SERVER_URL
|
|
241
|
+
export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
|
|
246
242
|
/**
|
|
247
243
|
* @@@
|
|
248
244
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { really_unknown } from '../utils/organization/really_unknown';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
4
4
|
*
|
|
5
|
-
* @param whatWasThrown
|
|
6
|
-
* @returns
|
|
5
|
+
* @param whatWasThrown Any object that was thrown
|
|
6
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
7
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
7
8
|
*
|
|
8
9
|
* @private within the repository
|
|
9
10
|
*/
|
|
@@ -5,7 +5,14 @@ import type { string_url } from '../../../types/typeAliases';
|
|
|
5
5
|
import type { really_any } from '../../../utils/organization/really_any';
|
|
6
6
|
import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions';
|
|
7
7
|
import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
8
|
-
type ProvideLlmToolsForWizzardOrCliOptions =
|
|
8
|
+
type ProvideLlmToolsForWizzardOrCliOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* If true, user will be always prompted for login
|
|
11
|
+
*
|
|
12
|
+
* Note: This is used in `ptbk login` command
|
|
13
|
+
*/
|
|
14
|
+
isLoginloaded?: true;
|
|
15
|
+
} & Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & ({
|
|
9
16
|
/**
|
|
10
17
|
* Use local keys and execute LLMs directly
|
|
11
18
|
*/
|
|
@@ -29,6 +36,8 @@ type ProvideLlmToolsForWizzardOrCliOptions = Pick<CacheLlmToolsOptions, 'isCache
|
|
|
29
36
|
readonly appId: string_app_id;
|
|
30
37
|
/**
|
|
31
38
|
*
|
|
39
|
+
*
|
|
40
|
+
* Note: When login prompt fails, `process.exit(1)` is called
|
|
32
41
|
*/
|
|
33
42
|
loginPrompt(): Promisable<Identification<really_any>>;
|
|
34
43
|
});
|
package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { string_promptbook_token } from '../../../types/typeAliases';
|
|
2
|
+
import type { really_unknown } from '../../../utils/organization/really_unknown';
|
|
3
|
+
import type { ApplicationModeIdentification } from './Identification';
|
|
4
|
+
/**
|
|
5
|
+
* Convert identification to Promptbook token
|
|
6
|
+
*
|
|
7
|
+
* @param identification
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/core`
|
|
10
|
+
*/
|
|
11
|
+
export declare function identificationToPromptbookToken(identification: ApplicationModeIdentification<really_unknown>): string_promptbook_token;
|
package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { string_promptbook_token } from '../../../types/typeAliases';
|
|
2
|
+
import type { ApplicationModeIdentification } from './Identification';
|
|
3
|
+
/**
|
|
4
|
+
* Convert Promptbook token to identification
|
|
5
|
+
*
|
|
6
|
+
* @param promptbookToken
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/core`
|
|
9
|
+
*/
|
|
10
|
+
export declare function promptbookTokenToIdentification(promptbookToken: string_promptbook_token): ApplicationModeIdentification<undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
2
|
/**
|
|
3
|
-
* Stores data in .env variables
|
|
3
|
+
* Stores data in .env variables
|
|
4
4
|
*
|
|
5
5
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file and also writes to `process.env`
|
|
6
6
|
*
|
|
@@ -35,3 +35,6 @@ export declare class $EnvStorage<TItem> implements PromptbookStorage<TItem> {
|
|
|
35
35
|
*/
|
|
36
36
|
removeItem(key: string): void;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* TODO: Write file more securely - ensure that there can be no accidental overwriting of existing variables and other content
|
|
40
|
+
*/
|
|
@@ -325,6 +325,12 @@ export type string_css_selector = string;
|
|
|
325
325
|
* For example `"https://collboard.com/9SeSQTupmQHwuSrLi"`
|
|
326
326
|
*/
|
|
327
327
|
export type string_url = string;
|
|
328
|
+
/**
|
|
329
|
+
* Semantic helper
|
|
330
|
+
*
|
|
331
|
+
* For example `"https://s1.ptbk.io/promptbook"`
|
|
332
|
+
*/
|
|
333
|
+
export type string_promptbook_server_url = string;
|
|
328
334
|
/**
|
|
329
335
|
* Semantic helper
|
|
330
336
|
*
|
|
@@ -570,6 +576,12 @@ export type string_postprocessing_function_name = string;
|
|
|
570
576
|
export type id = string | number;
|
|
571
577
|
export type task_id = string;
|
|
572
578
|
export type string_token = string;
|
|
579
|
+
/**
|
|
580
|
+
* Semantic helper
|
|
581
|
+
*
|
|
582
|
+
* Made by `identificationToPromptbookToken` exported from `@promptbook/core`
|
|
583
|
+
*/
|
|
584
|
+
export type string_promptbook_token = string_token;
|
|
573
585
|
export type string_license_token = string_token;
|
|
574
586
|
export type string_password = string;
|
|
575
587
|
export type string_ssh_key = string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.89.0-
|
|
3
|
+
"version": "0.89.0-16",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,19 +43,23 @@
|
|
|
43
43
|
"url": "https://github.com/webgptorg/promptbook/issues"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://ptbk.io/",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=16.0.0",
|
|
48
|
+
"npm": ">=8.0.0"
|
|
49
|
+
},
|
|
46
50
|
"main": "./umd/index.umd.js",
|
|
47
51
|
"module": "./esm/index.es.js",
|
|
48
52
|
"typings": "./esm/typings/src/_packages/documents.index.d.ts",
|
|
49
53
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.89.0-
|
|
54
|
+
"@promptbook/core": "0.89.0-16"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
57
|
"colors": "1.4.0",
|
|
54
|
-
"crypto": "
|
|
58
|
+
"crypto": "1.0.1",
|
|
55
59
|
"crypto-js": "4.2.0",
|
|
56
60
|
"papaparse": "5.4.1",
|
|
57
61
|
"prettier": "2.8.1",
|
|
58
|
-
"rxjs": "
|
|
62
|
+
"rxjs": "7.8.1",
|
|
59
63
|
"spacetrim": "0.11.59",
|
|
60
64
|
"waitasecond": "1.11.83"
|
|
61
65
|
}
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
* @public exported from `@promptbook/core`
|
|
90
90
|
*/
|
|
91
91
|
const ADMIN_GITHUB_NAME = 'hejny';
|
|
92
|
+
// <- TODO: [๐] Pick the best claim
|
|
92
93
|
/**
|
|
93
94
|
* When the title is not provided, the default title is used
|
|
94
95
|
*
|
|
@@ -161,7 +162,7 @@
|
|
|
161
162
|
*/
|
|
162
163
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐คนโโ๏ธ]
|
|
163
164
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
164
|
-
// TODO:
|
|
165
|
+
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
165
166
|
/**
|
|
166
167
|
* Where to store the temporary downloads
|
|
167
168
|
*
|
|
@@ -1078,44 +1079,42 @@
|
|
|
1078
1079
|
constructor(whatWasThrown) {
|
|
1079
1080
|
const tag = `[๐คฎ]`;
|
|
1080
1081
|
console.error(tag, whatWasThrown);
|
|
1081
|
-
super(spaceTrim.spaceTrim(
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
Note: Look for ${tag} in the console for more details
|
|
1085
|
-
!!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
|
|
1082
|
+
super(spaceTrim.spaceTrim(`
|
|
1083
|
+
Non-Error object was thrown
|
|
1086
1084
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1085
|
+
Note: Look for ${tag} in the console for more details
|
|
1086
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
1087
|
+
`));
|
|
1090
1088
|
this.name = 'WrappedError';
|
|
1091
1089
|
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
1092
1090
|
}
|
|
1093
1091
|
}
|
|
1094
1092
|
|
|
1095
1093
|
/**
|
|
1096
|
-
*
|
|
1094
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
1097
1095
|
*
|
|
1098
|
-
* @param whatWasThrown
|
|
1099
|
-
* @returns
|
|
1096
|
+
* @param whatWasThrown Any object that was thrown
|
|
1097
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
1098
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
1100
1099
|
*
|
|
1101
1100
|
* @private within the repository
|
|
1102
1101
|
*/
|
|
1103
1102
|
function assertsError(whatWasThrown) {
|
|
1104
|
-
// Case 1:
|
|
1103
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
1105
1104
|
if (whatWasThrown instanceof WrappedError) {
|
|
1106
1105
|
const wrappedError = whatWasThrown;
|
|
1107
1106
|
throw wrappedError;
|
|
1108
1107
|
}
|
|
1109
|
-
// Case 2:
|
|
1108
|
+
// Case 2: Handle unexpected errors
|
|
1110
1109
|
if (whatWasThrown instanceof UnexpectedError) {
|
|
1111
1110
|
const unexpectedError = whatWasThrown;
|
|
1112
1111
|
throw unexpectedError;
|
|
1113
1112
|
}
|
|
1114
|
-
// Case 3:
|
|
1113
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
1115
1114
|
if (whatWasThrown instanceof Error) {
|
|
1116
1115
|
return;
|
|
1117
1116
|
}
|
|
1118
|
-
// Case 4:
|
|
1117
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
1119
1118
|
throw new WrappedError(whatWasThrown);
|
|
1120
1119
|
}
|
|
1121
1120
|
|
|
@@ -2254,7 +2253,7 @@
|
|
|
2254
2253
|
}
|
|
2255
2254
|
}
|
|
2256
2255
|
/**
|
|
2257
|
-
* TODO:
|
|
2256
|
+
* TODO: [๐ง ][๐] Add id to all errors
|
|
2258
2257
|
*/
|
|
2259
2258
|
|
|
2260
2259
|
/**
|
|
@@ -2607,8 +2606,8 @@
|
|
|
2607
2606
|
updatedAt = new Date();
|
|
2608
2607
|
errors.push(...executionResult.errors);
|
|
2609
2608
|
warnings.push(...executionResult.warnings);
|
|
2610
|
-
// <- TODO:
|
|
2611
|
-
// TODO: [๐ง ]
|
|
2609
|
+
// <- TODO: [๐] Only unique errors and warnings should be added (or filtered)
|
|
2610
|
+
// TODO: [๐ง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
|
|
2612
2611
|
// Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
|
|
2613
2612
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
2614
2613
|
assertsTaskSuccessful(executionResult);
|