@promptbook/node 0.89.0-15 โ 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 +2 -2
- 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/node",
|
|
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,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.89.0-
|
|
54
|
+
"@promptbook/core": "0.89.0-16"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* @generated
|
|
47
47
|
* @see https://github.com/webgptorg/promptbook
|
|
48
48
|
*/
|
|
49
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
49
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
|
|
50
50
|
/**
|
|
51
51
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
52
52
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
* @public exported from `@promptbook/core`
|
|
93
93
|
*/
|
|
94
94
|
const ADMIN_GITHUB_NAME = 'hejny';
|
|
95
|
+
// <- TODO: [๐] Pick the best claim
|
|
95
96
|
/**
|
|
96
97
|
* When the title is not provided, the default title is used
|
|
97
98
|
*
|
|
@@ -176,7 +177,7 @@
|
|
|
176
177
|
*/
|
|
177
178
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐คนโโ๏ธ]
|
|
178
179
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
179
|
-
// TODO:
|
|
180
|
+
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
180
181
|
/**
|
|
181
182
|
* Where to store the temporary downloads
|
|
182
183
|
*
|
|
@@ -365,44 +366,42 @@
|
|
|
365
366
|
constructor(whatWasThrown) {
|
|
366
367
|
const tag = `[๐คฎ]`;
|
|
367
368
|
console.error(tag, whatWasThrown);
|
|
368
|
-
super(spaceTrim.spaceTrim(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
Note: Look for ${tag} in the console for more details
|
|
372
|
-
!!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
|
|
373
|
-
|
|
374
|
-
Please report issue on ${ADMIN_EMAIL}
|
|
369
|
+
super(spaceTrim.spaceTrim(`
|
|
370
|
+
Non-Error object was thrown
|
|
375
371
|
|
|
376
|
-
|
|
372
|
+
Note: Look for ${tag} in the console for more details
|
|
373
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
374
|
+
`));
|
|
377
375
|
this.name = 'WrappedError';
|
|
378
376
|
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
379
377
|
}
|
|
380
378
|
}
|
|
381
379
|
|
|
382
380
|
/**
|
|
383
|
-
*
|
|
381
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
384
382
|
*
|
|
385
|
-
* @param whatWasThrown
|
|
386
|
-
* @returns
|
|
383
|
+
* @param whatWasThrown Any object that was thrown
|
|
384
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
385
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
387
386
|
*
|
|
388
387
|
* @private within the repository
|
|
389
388
|
*/
|
|
390
389
|
function assertsError(whatWasThrown) {
|
|
391
|
-
// Case 1:
|
|
390
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
392
391
|
if (whatWasThrown instanceof WrappedError) {
|
|
393
392
|
const wrappedError = whatWasThrown;
|
|
394
393
|
throw wrappedError;
|
|
395
394
|
}
|
|
396
|
-
// Case 2:
|
|
395
|
+
// Case 2: Handle unexpected errors
|
|
397
396
|
if (whatWasThrown instanceof UnexpectedError) {
|
|
398
397
|
const unexpectedError = whatWasThrown;
|
|
399
398
|
throw unexpectedError;
|
|
400
399
|
}
|
|
401
|
-
// Case 3:
|
|
400
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
402
401
|
if (whatWasThrown instanceof Error) {
|
|
403
402
|
return;
|
|
404
403
|
}
|
|
405
|
-
// Case 4:
|
|
404
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
406
405
|
throw new WrappedError(whatWasThrown);
|
|
407
406
|
}
|
|
408
407
|
|
|
@@ -1724,7 +1723,7 @@
|
|
|
1724
1723
|
}
|
|
1725
1724
|
}
|
|
1726
1725
|
/**
|
|
1727
|
-
* TODO:
|
|
1726
|
+
* TODO: [๐ง ][๐] Add id to all errors
|
|
1728
1727
|
*/
|
|
1729
1728
|
|
|
1730
1729
|
/**
|
|
@@ -2036,8 +2035,8 @@
|
|
|
2036
2035
|
updatedAt = new Date();
|
|
2037
2036
|
errors.push(...executionResult.errors);
|
|
2038
2037
|
warnings.push(...executionResult.warnings);
|
|
2039
|
-
// <- TODO:
|
|
2040
|
-
// TODO: [๐ง ]
|
|
2038
|
+
// <- TODO: [๐] Only unique errors and warnings should be added (or filtered)
|
|
2039
|
+
// TODO: [๐ง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
|
|
2041
2040
|
// Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
|
|
2042
2041
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
2043
2042
|
assertsTaskSuccessful(executionResult);
|