@promptbook/pdf 0.92.0-23 → 0.92.0-25
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 +71 -47
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +0 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/config.d.ts +8 -4
- package/esm/typings/src/constants.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +10 -10
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/index.d.ts +1 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +8 -6
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/version.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +71 -47
- package/umd/index.umd.js.map +1 -1
|
@@ -149,27 +149,29 @@ export type string_persona_description = string;
|
|
|
149
149
|
*/
|
|
150
150
|
export type string_model_description = string;
|
|
151
151
|
/**
|
|
152
|
-
* Source of one knowledge
|
|
152
|
+
* Source of one knowledge piece.
|
|
153
153
|
*
|
|
154
|
-
* It can be a link, a relative path to file or direct text
|
|
154
|
+
* It can be a link, a relative path to file or direct text content.
|
|
155
155
|
*
|
|
156
156
|
* For example `"https://pavolhejny.com/"`
|
|
157
157
|
* For example `"./pavol-hejny-cv.pdf"`
|
|
158
158
|
* For example `"Pavol Hejný has web https://pavolhejny.com/"`
|
|
159
159
|
* For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
|
|
160
160
|
*
|
|
161
|
-
*
|
|
161
|
+
* Note: Distinguishes between `string_knowledge_source_content` and `string_knowledge_source_link`:
|
|
162
|
+
* `string_knowledge_source_content` refers to the actual content or source of knowledge
|
|
163
|
+
* `string_knowledge_source_link` refers to a reference or link to the knowledge source
|
|
162
164
|
*/
|
|
163
165
|
export type string_knowledge_source_content = string_knowledge_source_link | string_markdown;
|
|
164
166
|
/**
|
|
165
|
-
* One link to knowledge source
|
|
167
|
+
* One link to a knowledge source.
|
|
166
168
|
*
|
|
167
|
-
* It can be a
|
|
169
|
+
* It can be a URL or relative path.
|
|
168
170
|
*
|
|
169
171
|
* For example `"https://pavolhejny.com/"`
|
|
170
172
|
* For example `"./pavol-hejny-cv.pdf"`
|
|
171
173
|
*
|
|
172
|
-
*
|
|
174
|
+
* Note: string_knowledge_source_link refers to a reference or link to the knowledge source, while string_knowledge_source_content can be the link or the actual content.
|
|
173
175
|
*/
|
|
174
176
|
export type string_knowledge_source_link = string_url | string_filename;
|
|
175
177
|
/**
|
|
@@ -5,7 +5,7 @@ type AddPipelineCommandOptions = {
|
|
|
5
5
|
pipelineString: PipelineString;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Adds a new command to a pipeline string in the correct format.
|
|
9
9
|
*
|
|
10
10
|
* @public exported from `@promptbook/editable`
|
|
11
11
|
*/
|
|
@@ -14,4 +14,4 @@ export {};
|
|
|
14
14
|
/**
|
|
15
15
|
* TODO: [🧠] What is the better solution - `- xxx`, - `- xxx` or preserve (see also next TODO)
|
|
16
16
|
* TODO: When existing commands 1) as 2) number 3) list, add 4) new command as next number
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PipelineString } from '../../../pipeline/PipelineString';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Converts a pipeline structure to its string representation.
|
|
4
|
+
*
|
|
5
|
+
* Transforms a flat, simple pipeline into a properly formatted pipeline string
|
|
6
|
+
* with sections for title, prompt, and return statement.
|
|
4
7
|
*
|
|
5
8
|
* @public exported from `@promptbook/editable`
|
|
6
9
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PipelineString } from '../../../pipeline/PipelineString';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Utility to determine if a pipeline string is in flat format.
|
|
4
|
+
* A flat pipeline is a simple text without proper structure (headers, blocks, etc).
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/editable`
|
|
6
7
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { really_any } from '../organization/really_any';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
4
|
+
* regardless of the JavaScript environment in which the code is running
|
|
4
5
|
*
|
|
5
6
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
6
7
|
*
|
|
@@ -9,7 +9,7 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
9
9
|
* Note: It can not work with html syntax and comments
|
|
10
10
|
*
|
|
11
11
|
* @param markdown any valid markdown
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
13
13
|
* @public exported from `@promptbook/markdown-utils`
|
|
14
14
|
*/
|
|
15
15
|
export declare function extractAllListItemsFromMarkdown(markdown: string_markdown): string_markdown_text[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a name string into a URI-compatible format.
|
|
3
3
|
*
|
|
4
|
-
* @param name
|
|
5
|
-
* @returns
|
|
6
|
-
* @example
|
|
4
|
+
* @param name The string to be converted to a URI-compatible format.
|
|
5
|
+
* @returns A URI-compatible string derived from the input name.
|
|
6
|
+
* @example 'Hello World' -> 'hello-world'
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function nameToUriPart(name: string): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a given name into URI-compatible parts.
|
|
3
3
|
*
|
|
4
|
-
* @param name
|
|
5
|
-
* @returns
|
|
6
|
-
* @example
|
|
4
|
+
* @param name The name to be converted into URI parts.
|
|
5
|
+
* @returns An array of URI-compatible parts derived from the name.
|
|
6
|
+
* @example 'Example Name' -> ['example', 'name']
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function nameToUriParts(name: string): string[];
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type string_kebab_case = string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Converts a given text to kebab-case format.
|
|
11
11
|
*
|
|
12
|
-
* @param text
|
|
13
|
-
* @returns
|
|
12
|
+
* @param text The text to be converted.
|
|
13
|
+
* @returns The kebab-case formatted string.
|
|
14
14
|
* @example 'hello-world'
|
|
15
15
|
* @example 'i-love-promptbook'
|
|
16
16
|
* @public exported from `@promptbook/utils`
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type string_SCREAMING_CASE = string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
11
11
|
*
|
|
12
|
-
* @param text
|
|
13
|
-
* @returns
|
|
12
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
13
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
14
14
|
* @example 'HELLO_WORLD'
|
|
15
15
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
16
16
|
* @public exported from `@promptbook/utils`
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type string_camelCase = string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Normalizes a given text to camelCase format.
|
|
11
11
|
*
|
|
12
|
-
* @param text
|
|
13
|
-
* @param _isFirstLetterCapital
|
|
14
|
-
* @returns
|
|
12
|
+
* @param text The text to be normalized.
|
|
13
|
+
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
14
|
+
* @returns The camelCase formatted string.
|
|
15
15
|
* @example 'helloWorld'
|
|
16
16
|
* @example 'iLovePromptbook'
|
|
17
17
|
* @public exported from `@promptbook/utils`
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type string_snake_case = string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Normalizes a text string to snake_case format.
|
|
10
10
|
*
|
|
11
|
-
* @param text
|
|
12
|
-
* @returns
|
|
11
|
+
* @param text The text string to be converted to snake_case format.
|
|
12
|
+
* @returns The normalized text in snake_case format.
|
|
13
13
|
* @example 'hello_world'
|
|
14
14
|
* @example 'i_love_promptbook'
|
|
15
15
|
* @public exported from `@promptbook/utils`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
3
3
|
*
|
|
4
|
-
* @param input
|
|
5
|
-
* @returns
|
|
4
|
+
* @param input The string containing diacritics to be normalized.
|
|
5
|
+
* @returns The string with diacritics removed or normalized.
|
|
6
6
|
* @public exported from `@promptbook/utils`
|
|
7
7
|
*/
|
|
8
8
|
export declare function removeDiacritics(input: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Keywords } from './IKeywords';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Searches set of keywords for a specific keyword
|
|
4
4
|
*
|
|
5
5
|
* @param haystack
|
|
6
6
|
* @param needle
|
|
@@ -8,3 +8,6 @@ import type { Keywords } from './IKeywords';
|
|
|
8
8
|
* @public exported from `@promptbook/utils`
|
|
9
9
|
*/
|
|
10
10
|
export declare function searchKeywords(haystack: Keywords, needle: Keywords): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Rename to `isKeywordInKeywords`
|
|
13
|
+
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a title string into a normalized name.
|
|
3
3
|
*
|
|
4
|
-
* @param value
|
|
5
|
-
* @returns
|
|
6
|
-
* @example
|
|
4
|
+
* @param value The title string to be converted to a name.
|
|
5
|
+
* @returns A normalized name derived from the input title.
|
|
6
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function titleToName(value: string): string;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Organizational helper to better mark the place where to really use empty object `{}`
|
|
3
3
|
*
|
|
4
4
|
* Note: There are 2 similar types>
|
|
5
|
-
* - `empty_object`
|
|
6
|
-
* - `just_empty_object`
|
|
5
|
+
* - `empty_object` Type used for empty data objects allowing for potential future extensions
|
|
6
|
+
* - `just_empty_object` Type used when an object must remain permanently empty
|
|
7
7
|
*
|
|
8
8
|
* @private within the repository
|
|
9
9
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Organizational helper to better
|
|
2
|
+
* Organizational helper to better distinguish different empty object use cases.
|
|
3
3
|
*
|
|
4
|
-
* Note: There are 2 similar types
|
|
5
|
-
* - `empty_object`
|
|
6
|
-
* - `just_empty_object`
|
|
4
|
+
* Note: There are 2 similar types:
|
|
5
|
+
* - `empty_object` Type used for empty data objects with potential extensions
|
|
6
|
+
* - `just_empty_object` Type used specifically for objects that must remain empty
|
|
7
7
|
*
|
|
8
8
|
* Note: In most cases, you should use `empty_object`
|
|
9
9
|
*
|
|
@@ -14,7 +14,8 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Represents the version string of the Promptbook engine.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.92.0-24`).
|
|
18
19
|
*
|
|
19
20
|
* @generated
|
|
20
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/pdf",
|
|
3
|
-
"version": "0.92.0-
|
|
3
|
+
"version": "0.92.0-25",
|
|
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/pdf.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0-
|
|
54
|
+
"@promptbook/core": "0.92.0-25"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-25';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -102,11 +102,20 @@
|
|
|
102
102
|
*/
|
|
103
103
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Threshold value that determines when a dataset is considered "big"
|
|
106
|
+
* and may require special handling or optimizations
|
|
107
|
+
*
|
|
108
|
+
* For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
|
|
106
109
|
*
|
|
107
110
|
* @public exported from `@promptbook/core`
|
|
108
111
|
*/
|
|
109
112
|
const BIG_DATASET_TRESHOLD = 50;
|
|
113
|
+
/**
|
|
114
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
115
|
+
*
|
|
116
|
+
* @public exported from `@promptbook/core`
|
|
117
|
+
*/
|
|
118
|
+
const FAILED_VALUE_PLACEHOLDER = '!?';
|
|
110
119
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
111
120
|
/**
|
|
112
121
|
* The maximum number of iterations for a loops
|
|
@@ -360,7 +369,8 @@
|
|
|
360
369
|
*/
|
|
361
370
|
|
|
362
371
|
/**
|
|
363
|
-
*
|
|
372
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
373
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
364
374
|
*
|
|
365
375
|
* @private for `FileCacheStorage`
|
|
366
376
|
*/
|
|
@@ -613,10 +623,10 @@
|
|
|
613
623
|
*/
|
|
614
624
|
|
|
615
625
|
/**
|
|
616
|
-
*
|
|
626
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
617
627
|
*
|
|
618
|
-
* @param input
|
|
619
|
-
* @returns
|
|
628
|
+
* @param input The string containing diacritics to be normalized.
|
|
629
|
+
* @returns The string with diacritics removed or normalized.
|
|
620
630
|
* @public exported from `@promptbook/utils`
|
|
621
631
|
*/
|
|
622
632
|
function removeDiacritics(input) {
|
|
@@ -630,10 +640,10 @@
|
|
|
630
640
|
*/
|
|
631
641
|
|
|
632
642
|
/**
|
|
633
|
-
*
|
|
643
|
+
* Converts a given text to kebab-case format.
|
|
634
644
|
*
|
|
635
|
-
* @param text
|
|
636
|
-
* @returns
|
|
645
|
+
* @param text The text to be converted.
|
|
646
|
+
* @returns The kebab-case formatted string.
|
|
637
647
|
* @example 'hello-world'
|
|
638
648
|
* @example 'i-love-promptbook'
|
|
639
649
|
* @public exported from `@promptbook/utils`
|
|
@@ -775,11 +785,11 @@
|
|
|
775
785
|
}
|
|
776
786
|
|
|
777
787
|
/**
|
|
778
|
-
*
|
|
788
|
+
* Converts a title string into a normalized name.
|
|
779
789
|
*
|
|
780
|
-
* @param value
|
|
781
|
-
* @returns
|
|
782
|
-
* @example
|
|
790
|
+
* @param value The title string to be converted to a name.
|
|
791
|
+
* @returns A normalized name derived from the input title.
|
|
792
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
783
793
|
* @public exported from `@promptbook/utils`
|
|
784
794
|
*/
|
|
785
795
|
function titleToName(value) {
|
|
@@ -812,9 +822,8 @@
|
|
|
812
822
|
}
|
|
813
823
|
|
|
814
824
|
/**
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
* Note: It also checks if directory exists and creates it if not
|
|
825
|
+
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
826
|
+
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
818
827
|
*
|
|
819
828
|
* @private as internal utility for scrapers
|
|
820
829
|
*/
|
|
@@ -1448,13 +1457,13 @@
|
|
|
1448
1457
|
*/
|
|
1449
1458
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
1450
1459
|
/**
|
|
1451
|
-
*
|
|
1460
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
1452
1461
|
*
|
|
1453
1462
|
* @private within the repository
|
|
1454
1463
|
*/
|
|
1455
1464
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1456
1465
|
/**
|
|
1457
|
-
*
|
|
1466
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
1458
1467
|
*
|
|
1459
1468
|
* @private within the repository
|
|
1460
1469
|
*/
|
|
@@ -1953,7 +1962,7 @@
|
|
|
1953
1962
|
/**
|
|
1954
1963
|
* Constructs a pipeline collection from pipelines
|
|
1955
1964
|
*
|
|
1956
|
-
* @param pipelines
|
|
1965
|
+
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
1957
1966
|
*
|
|
1958
1967
|
* Note: During the construction logic of all pipelines are validated
|
|
1959
1968
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
@@ -2117,8 +2126,8 @@
|
|
|
2117
2126
|
* @public exported from `@promptbook/core`
|
|
2118
2127
|
*/
|
|
2119
2128
|
function isPipelinePrepared(pipeline) {
|
|
2120
|
-
// Note: Ignoring `pipeline.preparations`
|
|
2121
|
-
// Note: Ignoring `pipeline.knowledgePieces`
|
|
2129
|
+
// Note: Ignoring `pipeline.preparations`
|
|
2130
|
+
// Note: Ignoring `pipeline.knowledgePieces`
|
|
2122
2131
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
2123
2132
|
// TODO: !!! Comment this out
|
|
2124
2133
|
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
@@ -3090,7 +3099,8 @@
|
|
|
3090
3099
|
*/
|
|
3091
3100
|
|
|
3092
3101
|
/**
|
|
3093
|
-
*
|
|
3102
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
3103
|
+
* regardless of the JavaScript environment in which the code is running
|
|
3094
3104
|
*
|
|
3095
3105
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
3096
3106
|
*
|
|
@@ -3101,10 +3111,10 @@
|
|
|
3101
3111
|
}
|
|
3102
3112
|
|
|
3103
3113
|
/**
|
|
3104
|
-
*
|
|
3114
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
3105
3115
|
*
|
|
3106
|
-
* @param text
|
|
3107
|
-
* @returns
|
|
3116
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
3117
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
3108
3118
|
* @example 'HELLO_WORLD'
|
|
3109
3119
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
3110
3120
|
* @public exported from `@promptbook/utils`
|
|
@@ -3156,10 +3166,10 @@
|
|
|
3156
3166
|
*/
|
|
3157
3167
|
|
|
3158
3168
|
/**
|
|
3159
|
-
*
|
|
3169
|
+
* Normalizes a text string to snake_case format.
|
|
3160
3170
|
*
|
|
3161
|
-
* @param text
|
|
3162
|
-
* @returns
|
|
3171
|
+
* @param text The text string to be converted to snake_case format.
|
|
3172
|
+
* @returns The normalized text in snake_case format.
|
|
3163
3173
|
* @example 'hello_world'
|
|
3164
3174
|
* @example 'i_love_promptbook'
|
|
3165
3175
|
* @public exported from `@promptbook/utils`
|
|
@@ -3229,10 +3239,11 @@
|
|
|
3229
3239
|
*/
|
|
3230
3240
|
|
|
3231
3241
|
/**
|
|
3232
|
-
*
|
|
3242
|
+
* Registry for all available scrapers in the system.
|
|
3243
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
3233
3244
|
*
|
|
3234
3245
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
3235
|
-
* @singleton Only one instance of each register is created per build, but
|
|
3246
|
+
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
3236
3247
|
* @public exported from `@promptbook/core`
|
|
3237
3248
|
*/
|
|
3238
3249
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
@@ -3410,7 +3421,9 @@
|
|
|
3410
3421
|
*/
|
|
3411
3422
|
|
|
3412
3423
|
/**
|
|
3413
|
-
*
|
|
3424
|
+
* Factory function that creates a handler for processing knowledge sources.
|
|
3425
|
+
* Provides standardized processing of different types of knowledge sources
|
|
3426
|
+
* across various scraper implementations.
|
|
3414
3427
|
*
|
|
3415
3428
|
* @public exported from `@promptbook/core`
|
|
3416
3429
|
*/
|
|
@@ -3651,9 +3664,12 @@
|
|
|
3651
3664
|
*/
|
|
3652
3665
|
|
|
3653
3666
|
/**
|
|
3654
|
-
*
|
|
3667
|
+
* Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
|
|
3655
3668
|
*
|
|
3656
|
-
* @
|
|
3669
|
+
* @param tasks Sequence of tasks that are chained together to form a pipeline
|
|
3670
|
+
* @returns A promise that resolves to the prepared tasks.
|
|
3671
|
+
*
|
|
3672
|
+
* @private internal utility of `preparePipeline`
|
|
3657
3673
|
*/
|
|
3658
3674
|
async function prepareTasks(pipeline, tools, options) {
|
|
3659
3675
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
|
|
@@ -4191,6 +4207,15 @@
|
|
|
4191
4207
|
mappedData.push(mappedRow);
|
|
4192
4208
|
if (onProgress) {
|
|
4193
4209
|
// Note: Report the CSV with all rows mapped so far
|
|
4210
|
+
/*
|
|
4211
|
+
!!!!
|
|
4212
|
+
// Report progress with updated value
|
|
4213
|
+
const progressData = mappedData.map((row, i) =>
|
|
4214
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
4215
|
+
);
|
|
4216
|
+
|
|
4217
|
+
|
|
4218
|
+
*/
|
|
4194
4219
|
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
4195
4220
|
}
|
|
4196
4221
|
}
|
|
@@ -4407,7 +4432,7 @@
|
|
|
4407
4432
|
else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
|
|
4408
4433
|
}
|
|
4409
4434
|
if (expectedParameterNames.size === 0) {
|
|
4410
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
4435
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
4411
4436
|
Object.freeze(mappedParameters);
|
|
4412
4437
|
return mappedParameters;
|
|
4413
4438
|
}
|
|
@@ -4438,7 +4463,7 @@
|
|
|
4438
4463
|
for (let i = 0; i < expectedParameterNames.size; i++) {
|
|
4439
4464
|
mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
|
|
4440
4465
|
}
|
|
4441
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
4466
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
4442
4467
|
Object.freeze(mappedParameters);
|
|
4443
4468
|
return mappedParameters;
|
|
4444
4469
|
}
|
|
@@ -5191,15 +5216,14 @@
|
|
|
5191
5216
|
const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
|
|
5192
5217
|
${error.message}
|
|
5193
5218
|
|
|
5194
|
-
This is error in FOREACH command when mapping data
|
|
5219
|
+
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
5195
5220
|
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
5196
5221
|
|
|
5197
5222
|
${block(pipelineIdentification)}
|
|
5198
|
-
Subparameter index: ${index}
|
|
5199
5223
|
`));
|
|
5200
5224
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5201
5225
|
console.error(highLevelError);
|
|
5202
|
-
return
|
|
5226
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
5203
5227
|
}
|
|
5204
5228
|
throw highLevelError;
|
|
5205
5229
|
}
|
|
@@ -5223,14 +5247,13 @@
|
|
|
5223
5247
|
catch (error) {
|
|
5224
5248
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5225
5249
|
console.error(spaceTrim__default["default"]((block) => `
|
|
5226
|
-
|
|
5250
|
+
${error.message}
|
|
5227
5251
|
|
|
5228
|
-
${
|
|
5252
|
+
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
5229
5253
|
|
|
5230
5254
|
${block(pipelineIdentification)}
|
|
5231
|
-
Subparameter index: ${index}
|
|
5232
5255
|
`));
|
|
5233
|
-
return
|
|
5256
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
5234
5257
|
}
|
|
5235
5258
|
throw error;
|
|
5236
5259
|
}
|
|
@@ -6146,8 +6169,8 @@
|
|
|
6146
6169
|
extension: 'md',
|
|
6147
6170
|
isVerbose,
|
|
6148
6171
|
});
|
|
6149
|
-
// TODO:
|
|
6150
|
-
// Note: Running
|
|
6172
|
+
// TODO: Determine if Markitdown conversion should run only if the cache file doesn't exist, or always.
|
|
6173
|
+
// Note: Running Markitdown conversion ONLY if the file in the cache does not exist
|
|
6151
6174
|
if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
|
|
6152
6175
|
const src = source.filename || source.url || null;
|
|
6153
6176
|
// console.log('!!', { src, source, cacheFilehandler });
|
|
@@ -6169,11 +6192,11 @@
|
|
|
6169
6192
|
return cacheFilehandler;
|
|
6170
6193
|
}
|
|
6171
6194
|
/**
|
|
6172
|
-
* Scrapes the
|
|
6195
|
+
* Scrapes the source document (PDF, DOCX, etc.) and returns the knowledge pieces or `null` if it can't scrape it.
|
|
6173
6196
|
*/
|
|
6174
6197
|
async scrape(source) {
|
|
6175
6198
|
const cacheFilehandler = await this.$convert(source);
|
|
6176
|
-
// TODO:
|
|
6199
|
+
// TODO: Ensure this correctly creates the source object for the internal MarkdownScraper using the converted file.
|
|
6177
6200
|
const markdownSource = {
|
|
6178
6201
|
source: source.source,
|
|
6179
6202
|
filename: cacheFilehandler.filename,
|
|
@@ -6317,7 +6340,8 @@
|
|
|
6317
6340
|
*/
|
|
6318
6341
|
|
|
6319
6342
|
/**
|
|
6320
|
-
*
|
|
6343
|
+
* Factory function to create an instance of PdfScraper.
|
|
6344
|
+
* It bundles the scraper class with its metadata.
|
|
6321
6345
|
*
|
|
6322
6346
|
* @public exported from `@promptbook/pdf`
|
|
6323
6347
|
*/
|