@promptbook/types 0.81.0-11 → 0.81.0-13

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/README.md CHANGED
@@ -280,7 +280,7 @@ Or you can install them separately:
280
280
  - **[@promptbook/editable](https://www.npmjs.com/package/@promptbook/editable)** - Editable book as native javascript object with imperative object API
281
281
  - **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** - Usefull templates and examples of books which can be used as a starting point
282
282
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
283
- - **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
283
+ - **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
284
284
 
285
285
 
286
286
 
@@ -1,4 +1,4 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
- import { getBookTemplate } from '../other/templates/getBookTemplate';
2
+ import { getBookTemplates } from '../other/templates/getBookTemplates';
3
3
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
4
- export { getBookTemplate };
4
+ export { getBookTemplates };
@@ -68,6 +68,7 @@ import { trimCodeBlock } from '../utils/trimCodeBlock';
68
68
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
69
69
  import { unwrapResult } from '../utils/unwrapResult';
70
70
  import { isValidEmail } from '../utils/validators/email/isValidEmail';
71
+ import { isPathRoot } from '../utils/validators/filePath/isPathRoot';
71
72
  import { isValidFilePath } from '../utils/validators/filePath/isValidFilePath';
72
73
  import { isValidJavascriptName } from '../utils/validators/javascriptName/isValidJavascriptName';
73
74
  import { isValidPromptbookVersion } from '../utils/validators/semanticVersion/isValidPromptbookVersion';
@@ -147,6 +148,7 @@ export { trimCodeBlock };
147
148
  export { trimEndOfCodeBlock };
148
149
  export { unwrapResult };
149
150
  export { isValidEmail };
151
+ export { isPathRoot };
150
152
  export { isValidFilePath };
151
153
  export { isValidJavascriptName };
152
154
  export { isValidPromptbookVersion };
@@ -1,4 +1,3 @@
1
- import type { PipelineCollection } from '../../collection/PipelineCollection';
2
1
  import type { string_formfactor_name } from '../../formfactors/_common/string_formfactor_name';
3
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
4
3
  /**
@@ -7,15 +6,16 @@ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
7
6
  * @singleton
8
7
  * @private internal cache of `getBookTemplate`
9
8
  */
10
- export declare let templatesPipelineCollection: PipelineCollection | null;
9
+ export declare let pipelines: Array<PipelineJson> | null;
11
10
  /**
12
11
  * Get template for new book
13
12
  *
13
+ * @param formfactorName - optional filter for FORMFACTOR - get only pipelines for this formfactor
14
+ * @returns list of pipelines
14
15
  * @public exported from `@promptbook/templates`
15
16
  */
16
- export declare function getBookTemplate(formfactorName: string_formfactor_name): PipelineJson;
17
+ export declare function getBookTemplates(formfactorName?: string_formfactor_name): ReadonlyArray<PipelineJson>;
17
18
  /**
18
- * TODO: !!!!!! Test
19
+ * TODO: Unit test
19
20
  * TODO: [🧠] Which is the best place for this function
20
- * TODO: !!!!!! `book string template notation
21
21
  */
@@ -5,3 +5,6 @@ import type { PromptbookFetch } from '../../../execution/PromptbookFetch';
5
5
  * @private as default `fetch` function used in Promptbook scrapers
6
6
  */
7
7
  export declare const scraperFetch: PromptbookFetch;
8
+ /**
9
+ * TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
10
+ */
@@ -9,5 +9,6 @@ import type { really_any } from '../../../utils/organization/really_any';
9
9
  */
10
10
  export declare function preserve(func: (...params: ReadonlyArray<really_any>) => unknown): void;
11
11
  /**
12
+ * TODO: Probbably remove in favour of `keepImported`
12
13
  * TODO: !! [1] This maybe does memory leak
13
14
  */
@@ -0,0 +1,12 @@
1
+ import type { string_dirname } from '../../../types/typeAliases';
2
+ import type { string_filename } from '../../../types/typeAliases';
3
+ /**
4
+ * Determines if the given path is a root path.
5
+ *
6
+ * Note: This does not check if the file exists only if the path is valid
7
+ * @public exported from `@promptbook/utils`
8
+ */
9
+ export declare function isPathRoot(value: string_dirname | string_filename): boolean;
10
+ /**
11
+ * TODO: [🍏] Make for MacOS paths
12
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * TODO: [🍏] Make for MacOS paths
4
+ */
@@ -7,3 +7,6 @@ import type { really_unknown } from '../../organization/really_unknown';
7
7
  * @public exported from `@promptbook/utils`
8
8
  */
9
9
  export declare function isValidFilePath(filename: really_unknown): filename is string_filename;
10
+ /**
11
+ * TODO: [🍏] Implement for MacOs
12
+ */
@@ -0,0 +1,16 @@
1
+ import type { ExecutionTools } from '../execution/ExecutionTools';
2
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
+ import type { PipelineString } from '../pipeline/PipelineString';
4
+ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
5
+ import type { string_filename } from '../types/typeAliases';
6
+ import type { string_pipeline_url } from '../types/typeAliases';
7
+ /**
8
+ * @see ./wizzard.ts `getPipeline` method
9
+ *
10
+ * @private usable through `ptbk run` and `@prompbook/wizzard`
11
+ */
12
+ export declare function $getCompiledBook(tools: Required<Pick<ExecutionTools, 'fs' | 'fetch'>>, pipelineSource: string_filename | string_pipeline_url | PipelineString, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
13
+ /**
14
+ * TODO: Write unit test
15
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16
+ */
@@ -1,7 +1,7 @@
1
1
  import { Promisable } from 'type-fest';
2
- import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
2
  import type { ExecutionTools } from '../execution/ExecutionTools';
4
3
  import type { PipelineExecutorResult } from '../execution/PipelineExecutorResult';
4
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
5
5
  import type { PipelineString } from '../pipeline/PipelineString';
6
6
  import type { TaskProgress } from '../types/TaskProgress';
7
7
  import type { InputParameters } from '../types/typeAliases';
@@ -23,7 +23,7 @@ declare class Wizzard {
23
23
  *
24
24
  * @param pipelineSource
25
25
  */
26
- getExecutionTools(): Promise<ExecutionTools>;
26
+ getExecutionTools(): Promise<Required<Pick<ExecutionTools, 'fs' | 'fetch'>>>;
27
27
  /**
28
28
  * TODO: Make standalone function from this exported from node and used here and in `ptbk run`
29
29
  * @@@!!!
@@ -34,7 +34,7 @@ declare class Wizzard {
34
34
  *
35
35
  * @param pipelineSource
36
36
  */
37
- getPipeline(pipelineSource: string_filename | string_pipeline_url | PipelineString): Promise<PipelineJson>;
37
+ getCompiledBook(pipelineSource: string_filename | string_pipeline_url | PipelineString): Promise<PipelineJson>;
38
38
  }
39
39
  /**
40
40
  * 🧙‍♂️ @@@
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.81.0-11",
3
+ "version": "0.81.0-13",
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,
@@ -52,6 +52,6 @@
52
52
  ],
53
53
  "typings": "./esm/typings/src/_packages/types.index.d.ts",
54
54
  "peerDependencies": {
55
- "@promptbook/core": "0.81.0-11"
55
+ "@promptbook/core": "0.81.0-13"
56
56
  }
57
57
  }
@@ -1,8 +0,0 @@
1
- import type { really_unknown } from '../../../utils/organization/really_unknown';
2
- /**
3
- * Converts anything to string that can be used for debugging and logging
4
- *
5
- * @param value String value for logging
6
- * @private internal util
7
- */
8
- export declare function unknownToString(value: really_unknown): string;