@promptbook/utils 0.84.0 → 0.85.0-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.
Files changed (35) hide show
  1. package/README.md +9 -6
  2. package/esm/index.es.js +7 -18
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +0 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +14 -2
  6. package/esm/typings/src/_packages/utils.index.d.ts +0 -2
  7. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
  8. package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
  9. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  10. package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
  11. package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
  12. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  13. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
  14. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
  15. package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
  16. package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts} +2 -3
  17. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
  18. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
  19. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
  20. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  21. package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -0
  22. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +6 -4
  23. package/esm/typings/src/types/typeAliases.d.ts +2 -0
  24. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +2 -2
  25. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +2 -2
  26. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +2 -2
  27. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  28. package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
  29. package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
  30. package/esm/typings/src/wizzard/wizzard.d.ts +2 -3
  31. package/package.json +1 -1
  32. package/umd/index.umd.js +10 -22
  33. package/umd/index.umd.js.map +1 -1
  34. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
  35. package/esm/typings/src/types/TaskProgress.d.ts +0 -43
@@ -54,7 +54,6 @@ import { numberToString } from '../utils/parameters/numberToString';
54
54
  import { templateParameters } from '../utils/parameters/templateParameters';
55
55
  import { valueToString } from '../utils/parameters/valueToString';
56
56
  import { parseNumber } from '../utils/parseNumber';
57
- import { $randomSeed } from '../utils/random/$randomSeed';
58
57
  import { removeEmojis } from '../utils/removeEmojis';
59
58
  import { removeQuotes } from '../utils/removeQuotes';
60
59
  import { $deepFreeze } from '../utils/serialization/$deepFreeze';
@@ -136,7 +135,6 @@ export { numberToString };
136
135
  export { templateParameters };
137
136
  export { valueToString };
138
137
  export { parseNumber };
139
- export { $randomSeed };
140
138
  export { removeEmojis };
141
139
  export { removeQuotes };
142
140
  export { $deepFreeze };
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `boilerplate` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeBoilerplateCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `start-server` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeStartServerCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -17,5 +17,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
17
17
  */
18
18
  export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
19
19
  /**
20
- * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
20
+ * TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
21
21
  */
@@ -0,0 +1,25 @@
1
+ import { ReadonlyDeep } from 'type-fest';
2
+ import type { ErrorJson } from '../errors/utils/ErrorJson';
3
+ /**
4
+ * @@@
5
+ *
6
+ * Note: [🚉] This is fully serializable as JSON
7
+ */
8
+ export type AbstractTaskResult = {
9
+ /**
10
+ * Whether the execution was successful, details are aviable in `executionReport`
11
+ */
12
+ readonly isSuccessful: boolean;
13
+ /**
14
+ * Errors that occured during the execution, details are aviable in `executionReport`
15
+ */
16
+ readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
17
+ /**
18
+ * Warnings that occured during the execution, details are aviable in `executionReport`
19
+ */
20
+ readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
21
+ };
22
+ /**
23
+ * TODO: [🧠] Should this file be in /execution or /types folder?
24
+ * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
25
+ */
@@ -0,0 +1,71 @@
1
+ import type { Observable } from 'rxjs';
2
+ import { PartialDeep } from 'type-fest';
3
+ import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
4
+ import type { task_id } from '../types/typeAliases';
5
+ import type { AbstractTaskResult } from './AbstractTaskResult';
6
+ import type { PipelineExecutorResult } from './PipelineExecutorResult';
7
+ /**
8
+ * Options for creating a new task
9
+ */
10
+ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
11
+ /**
12
+ * The type of task to create
13
+ */
14
+ readonly taskType: AbstractTask<TTaskResult>['taskType'];
15
+ /**
16
+ * Callback that processes the task and updates the ongoing result
17
+ * @param ongoingResult The partial result of the task processing
18
+ * @returns The final task result
19
+ */
20
+ taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>) => void): Promise<TTaskResult>;
21
+ };
22
+ /**
23
+ * Helper to create a new task
24
+ *
25
+ * @private internal helper function
26
+ */
27
+ export declare function createTask<TTaskResult extends AbstractTaskResult>(options: CreateTaskOptions<TTaskResult>): AbstractTask<TTaskResult>;
28
+ /**
29
+ * Represents a task that executes a pipeline
30
+ */
31
+ export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
32
+ readonly taskType: 'EXECUTION';
33
+ readonly taskId: `execution-${task_id}`;
34
+ };
35
+ /**
36
+ * Represents a task that prepares a pipeline
37
+ * @deprecated TODO: [🐚] Currently unused - use
38
+ */
39
+ export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
40
+ readonly taskType: 'PREPARATION';
41
+ readonly taskId: `preparation-${task_id}`;
42
+ };
43
+ /**
44
+ * Base interface for all task types
45
+ */
46
+ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
47
+ /**
48
+ * Type of the task
49
+ */
50
+ readonly taskType: string_SCREAMING_CASE;
51
+ /**
52
+ * Unique identifier for the task
53
+ */
54
+ readonly taskId: task_id;
55
+ /**
56
+ * Gets a promise that resolves with the task result
57
+ */
58
+ asPromise(options?: {
59
+ readonly isCrashedOnError?: boolean;
60
+ }): Promise<TTaskResult>;
61
+ /**
62
+ * Gets an observable stream of partial task results
63
+ */
64
+ asObservable(): Observable<PartialDeep<TTaskResult>>;
65
+ };
66
+ export type Task = ExecutionTask | PreparationTask;
67
+ export {};
68
+ /**
69
+ * TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
70
+ * TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
71
+ */
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type fs from 'fs/promises';
2
+ import type fs from 'node:fs/promises';
3
3
  /**
4
4
  * Container for all the tools needed to manipulate with filesystem
5
5
  */
@@ -1,7 +1,5 @@
1
- import type { Promisable } from 'type-fest';
2
- import type { TaskProgress } from '../types/TaskProgress';
3
1
  import type { InputParameters } from '../types/typeAliases';
4
- import type { PipelineExecutorResult } from './PipelineExecutorResult';
2
+ import type { ExecutionTask } from './ExecutionTask';
5
3
  /**
6
4
  * Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
7
5
  * Executor is made by combining execution tools and pipeline collection.
@@ -11,9 +9,8 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
11
9
  * @see https://github.com/webgptorg/promptbook#executor
12
10
  */
13
11
  export type PipelineExecutor = {
14
- (inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
12
+ (inputParameters: InputParameters): ExecutionTask;
15
13
  };
16
14
  /**
17
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
18
15
  * TODO: [🧠] Should this file be in /execution or /types folder?
19
16
  */
@@ -1,7 +1,7 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import type { ErrorJson } from '../errors/utils/ErrorJson';
3
2
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
4
3
  import type { Parameters } from '../types/typeAliases';
4
+ import type { AbstractTaskResult } from './AbstractTaskResult';
5
5
  import type { ExecutionReportJson } from './execution-report/ExecutionReportJson';
6
6
  import type { PromptResultUsage } from './PromptResultUsage';
7
7
  /**
@@ -9,29 +9,17 @@ import type { PromptResultUsage } from './PromptResultUsage';
9
9
  *
10
10
  * Note: [🚉] This is fully serializable as JSON
11
11
  */
12
- export type PipelineExecutorResult = {
12
+ export type PipelineExecutorResult = AbstractTaskResult & {
13
13
  /**
14
14
  * Result parameters of the execution
15
15
  *
16
16
  * Note: If the execution was not successful, there are only some of the result parameters
17
17
  */
18
18
  readonly outputParameters: Readonly<Parameters>;
19
- /**
20
- * Whether the execution was successful, details are aviable in `executionReport`
21
- */
22
- readonly isSuccessful: boolean;
23
19
  /**
24
20
  * Added usage of whole execution, detailed usage is aviable in `executionReport`
25
21
  */
26
22
  readonly usage: ReadonlyDeep<PromptResultUsage>;
27
- /**
28
- * Errors that occured during the execution, details are aviable in `executionReport`
29
- */
30
- readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
31
- /**
32
- * Warnings that occured during the execution, details are aviable in `executionReport`
33
- */
34
- readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
35
23
  /**
36
24
  * The report of the execution with all details
37
25
  */
@@ -46,5 +34,4 @@ export type PipelineExecutorResult = {
46
34
  };
47
35
  /**
48
36
  * TODO: [🧠] Should this file be in /execution or /types folder?
49
- * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
50
37
  */
@@ -1,5 +1,12 @@
1
1
  import type { string_url } from '../types/typeAliases';
2
2
  /**
3
- * Fetch function for fetching data from the internet used in scraping
3
+ * Fetch function used in Promptbook engine
4
+ *
5
+ * In most cases it is just native `fetch` function with a lightweight error handling wrapper
6
+ * But it can be replaced with any other fetch function, polyfill, custom implementation, security layer, etc.
7
+ *
8
+ * It is used in theese places:
9
+ * - Fetching knowledge sources
10
+ * - Callbacks from remote server ([👩🏾‍🤝‍🧑🏾] Not yet implemented)
4
11
  */
5
12
  export type PromptbookFetch = (url: string_url, init?: RequestInit) => Promise<Response>;
@@ -6,10 +6,9 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
6
6
  *
7
7
  * @param executionResult - The partial result of the Promptbook execution
8
8
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
9
- * @public exported from `@promptbook/core`
9
+ * @private internal helper function of `asPromise` method of `ExecutionTask`
10
10
  */
11
- export declare function assertsExecutionSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors' | 'warnings'>): void;
11
+ export declare function assertsTaskSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors' | 'warnings'>): void;
12
12
  /**
13
- * TODO: [🐚] This function should be removed OR changed OR be completely rewritten
14
13
  * TODO: [🧠] Can this return type be better typed than void
15
14
  */
@@ -8,6 +8,3 @@ import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorO
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
10
  export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
11
- /**
12
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
13
- */
@@ -1,6 +1,5 @@
1
- import type { Promisable, ReadonlyDeep } from 'type-fest';
1
+ import type { PartialDeep, Promisable, ReadonlyDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
- import type { TaskProgress } from '../../types/TaskProgress';
4
3
  import type { InputParameters } from '../../types/typeAliases';
5
4
  import type { PipelineExecutorResult } from '../PipelineExecutorResult';
6
5
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
@@ -17,7 +16,7 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
17
16
  /**
18
17
  * @@@
19
18
  */
20
- onProgress?(taskProgress: TaskProgress): Promisable<void>;
19
+ onProgress?(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
21
20
  /**
22
21
  * @@@
23
22
  */
@@ -44,6 +43,3 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
44
43
  */
45
44
  export declare function executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecutorResult>;
46
45
  export {};
47
- /**
48
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
49
- */
@@ -1,9 +1,9 @@
1
- import type { Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
1
+ import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
4
- import type { TaskProgress } from '../../types/TaskProgress';
5
4
  import type { Parameters } from '../../types/typeAliases';
6
5
  import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
6
+ import type { PipelineExecutorResult } from '../PipelineExecutorResult';
7
7
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
8
8
  /**
9
9
  * @@@
@@ -26,7 +26,7 @@ type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & {
26
26
  /**
27
27
  * @@@
28
28
  */
29
- readonly onProgress: (taskProgress: TaskProgress) => Promisable<void>;
29
+ readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
30
30
  /**
31
31
  * @@@
32
32
  */
@@ -46,6 +46,3 @@ export {};
46
46
  /**
47
47
  * TODO: [🤹‍♂️]
48
48
  */
49
- /**
50
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
51
- */
@@ -13,5 +13,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
13
13
  */
14
14
  export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
15
15
  /**
16
- * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
16
+ * TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
17
17
  */
@@ -11,6 +11,9 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
13
13
  /**
14
+ * TODO: !!!!!!! CORS and security
15
+ * TODO: !!!!!!! Allow to pass tokem here
16
+ * TODO: [👩🏾‍🤝‍🧑🏾] Allow to pass custom fetch function here - PromptbookFetch
14
17
  * TODO: Split this file into multiple functions - handler for each request
15
18
  * TODO: Maybe use `$exportJson`
16
19
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
@@ -25,12 +25,14 @@ export type RemoteServerOptions<TCustomOptions> = CommonToolsOptions & {
25
25
  */
26
26
  readonly port: number;
27
27
  /**
28
- * Path for the Socket.io server to listen
28
+ * Root path of the server
29
29
  *
30
- * @default '/socket.io'
31
- * @example '/promptbook/socket.io'
30
+ * Note: This is useful when you reverse proxy the server without changing the path
31
+ *
32
+ * @default '/'
33
+ * @example '/api/promptbook/'
32
34
  */
33
- readonly path: string_uri;
35
+ readonly rootPath: string_uri;
34
36
  } & (AnonymousRemoteServerOptions | ApplicationRemoteServerOptions<TCustomOptions> | (AnonymousRemoteServerOptions & ApplicationRemoteServerOptions<TCustomOptions>));
35
37
  export type AnonymousRemoteServerOptions = {
36
38
  /**
@@ -556,6 +556,7 @@ export type string_javascript_name = string;
556
556
  */
557
557
  export type string_postprocessing_function_name = string;
558
558
  export type id = string | number;
559
+ export type task_id = string;
559
560
  export type string_token = string;
560
561
  export type string_license_token = string_token;
561
562
  export type string_password = string;
@@ -588,6 +589,7 @@ export type number_tokens = number_integer & (number_positive | 0);
588
589
  export type number_positive = number;
589
590
  export type number_negative = number;
590
591
  export type number_integer = number;
592
+ export type number_port = number_positive & number_integer;
591
593
  /**
592
594
  * Semantic helper;
593
595
  * Percentage from 0 to 1 (100%) (and bellow and above)
@@ -7,5 +7,5 @@
7
7
  */
8
8
  export declare const $isRunningInBrowser: Function;
9
9
  /**
10
- * TODO: []
11
- */
10
+ * TODO: [🎺]
11
+ */
@@ -7,5 +7,5 @@
7
7
  */
8
8
  export declare const $isRunningInJest: Function;
9
9
  /**
10
- * TODO: []
11
- */
10
+ * TODO: [🎺]
11
+ */
@@ -7,5 +7,5 @@
7
7
  */
8
8
  export declare const $isRunningInNode: Function;
9
9
  /**
10
- * TODO: []
11
- */
10
+ * TODO: [🎺]
11
+ */
@@ -7,5 +7,5 @@
7
7
  */
8
8
  export declare const $isRunningInWebWorker: Function;
9
9
  /**
10
- * TODO: []
10
+ * TODO: [🎺]
11
11
  */
@@ -4,6 +4,7 @@ import type { number_seed } from '../../types/typeAliases';
4
4
  *
5
5
  * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
6
6
  * Warning: This function is NOT cryptographically secure (it uses Math.random internally)
7
- * @public exported from `@promptbook/utils`
7
+ *
8
+ * @private internal helper function
8
9
  */
9
10
  export declare function $randomSeed(): number_seed;
@@ -0,0 +1,13 @@
1
+ import type { string_token } from '../../types/typeAliases';
2
+ /**
3
+ * Generates random token
4
+ *
5
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
6
+ *
7
+ * @private internal helper function
8
+ * @returns secure random token
9
+ */
10
+ export declare function $randomToken(randomness: number): string_token;
11
+ /**
12
+ * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
13
+ */
@@ -1,9 +1,7 @@
1
- import { Promisable } from 'type-fest';
2
1
  import type { ExecutionTools } from '../execution/ExecutionTools';
3
2
  import type { PipelineExecutorResult } from '../execution/PipelineExecutorResult';
4
3
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
5
4
  import type { PipelineString } from '../pipeline/PipelineString';
6
- import type { TaskProgress } from '../types/TaskProgress';
7
5
  import type { InputParameters } from '../types/typeAliases';
8
6
  import type { string_filename } from '../types/typeAliases';
9
7
  import type { string_parameter_value } from '../types/typeAliases';
@@ -28,7 +26,7 @@ declare class Wizzard {
28
26
  *
29
27
  * Note: This works simmilar to the `ptbk run` command
30
28
  */
31
- execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
29
+ execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters): Promise<{
32
30
  /**
33
31
  * Simple result of the execution
34
32
  */
@@ -65,5 +63,6 @@ declare class Wizzard {
65
63
  export declare const wizzard: Wizzard;
66
64
  export {};
67
65
  /**
66
+ * TODO: [🧠] Maybe some way how to handle the progress and streaming?
68
67
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
69
68
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/utils",
3
- "version": "0.84.0",
3
+ "version": "0.85.0-1",
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,
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('path')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'path'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spaceTrim$1, global.path));
5
- })(this, (function (exports, spaceTrim$1, path) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('node:path')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'node:path'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spaceTrim$1, global.node_path));
5
+ })(this, (function (exports, spaceTrim$1, node_path) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-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
@@ -740,7 +740,7 @@
740
740
  value = value.replace(/\.html$/, '');
741
741
  }
742
742
  else if (isValidFilePath(value)) {
743
- value = path.basename(value);
743
+ value = node_path.basename(value);
744
744
  // Note: Keeping extension in the name
745
745
  }
746
746
  value = value.split('/').join('-');
@@ -1823,7 +1823,7 @@
1823
1823
  */
1824
1824
  var $isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
1825
1825
  /**
1826
- * TODO: []
1826
+ * TODO: [🎺]
1827
1827
  */
1828
1828
 
1829
1829
  /**
@@ -1835,7 +1835,7 @@
1835
1835
  */
1836
1836
  var $isRunningInJest = new Function("\n try {\n return process.env.JEST_WORKER_ID !== undefined;\n } catch (e) {\n return false;\n }\n");
1837
1837
  /**
1838
- * TODO: []
1838
+ * TODO: [🎺]
1839
1839
  */
1840
1840
 
1841
1841
  /**
@@ -1847,7 +1847,7 @@
1847
1847
  */
1848
1848
  var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
1849
1849
  /**
1850
- * TODO: []
1850
+ * TODO: [🎺]
1851
1851
  */
1852
1852
 
1853
1853
  /**
@@ -1859,7 +1859,7 @@
1859
1859
  */
1860
1860
  var $isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
1861
1861
  /**
1862
- * TODO: []
1862
+ * TODO: [🎺]
1863
1863
  */
1864
1864
 
1865
1865
  /**
@@ -2330,17 +2330,6 @@
2330
2330
  * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
2331
2331
  */
2332
2332
 
2333
- /**
2334
- * Generates random seed
2335
- *
2336
- * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
2337
- * Warning: This function is NOT cryptographically secure (it uses Math.random internally)
2338
- * @public exported from `@promptbook/utils`
2339
- */
2340
- function $randomSeed() {
2341
- return Math.random();
2342
- }
2343
-
2344
2333
  /**
2345
2334
  * Removes quotes from a string
2346
2335
  *
@@ -2838,7 +2827,6 @@
2838
2827
  exports.$isRunningInJest = $isRunningInJest;
2839
2828
  exports.$isRunningInNode = $isRunningInNode;
2840
2829
  exports.$isRunningInWebWorker = $isRunningInWebWorker;
2841
- exports.$randomSeed = $randomSeed;
2842
2830
  exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
2843
2831
  exports.CHARACTERS_PER_STANDARD_LINE = CHARACTERS_PER_STANDARD_LINE;
2844
2832
  exports.CountUtils = CountUtils;