@promptbook/legacy-documents 0.92.0-24 → 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 +43 -38
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +0 -2
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- 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/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/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/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 +43 -38
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-25';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -562,7 +562,8 @@ async function isFileExisting(filename, fs) {
|
|
|
562
562
|
*/
|
|
563
563
|
|
|
564
564
|
/**
|
|
565
|
-
*
|
|
565
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
566
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
566
567
|
*
|
|
567
568
|
* @private for `FileCacheStorage`
|
|
568
569
|
*/
|
|
@@ -815,10 +816,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
815
816
|
*/
|
|
816
817
|
|
|
817
818
|
/**
|
|
818
|
-
*
|
|
819
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
819
820
|
*
|
|
820
|
-
* @param input
|
|
821
|
-
* @returns
|
|
821
|
+
* @param input The string containing diacritics to be normalized.
|
|
822
|
+
* @returns The string with diacritics removed or normalized.
|
|
822
823
|
* @public exported from `@promptbook/utils`
|
|
823
824
|
*/
|
|
824
825
|
function removeDiacritics(input) {
|
|
@@ -832,10 +833,10 @@ function removeDiacritics(input) {
|
|
|
832
833
|
*/
|
|
833
834
|
|
|
834
835
|
/**
|
|
835
|
-
*
|
|
836
|
+
* Converts a given text to kebab-case format.
|
|
836
837
|
*
|
|
837
|
-
* @param text
|
|
838
|
-
* @returns
|
|
838
|
+
* @param text The text to be converted.
|
|
839
|
+
* @returns The kebab-case formatted string.
|
|
839
840
|
* @example 'hello-world'
|
|
840
841
|
* @example 'i-love-promptbook'
|
|
841
842
|
* @public exported from `@promptbook/utils`
|
|
@@ -977,11 +978,11 @@ function isValidUrl(url) {
|
|
|
977
978
|
}
|
|
978
979
|
|
|
979
980
|
/**
|
|
980
|
-
*
|
|
981
|
+
* Converts a title string into a normalized name.
|
|
981
982
|
*
|
|
982
|
-
* @param value
|
|
983
|
-
* @returns
|
|
984
|
-
* @example
|
|
983
|
+
* @param value The title string to be converted to a name.
|
|
984
|
+
* @returns A normalized name derived from the input title.
|
|
985
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
985
986
|
* @public exported from `@promptbook/utils`
|
|
986
987
|
*/
|
|
987
988
|
function titleToName(value) {
|
|
@@ -1001,9 +1002,8 @@ function titleToName(value) {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
|
|
1003
1004
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
* Note: It also checks if directory exists and creates it if not
|
|
1005
|
+
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
1006
|
+
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
1007
1007
|
*
|
|
1008
1008
|
* @private as internal utility for scrapers
|
|
1009
1009
|
*/
|
|
@@ -1637,13 +1637,13 @@ const ORDER_OF_PIPELINE_JSON = [
|
|
|
1637
1637
|
*/
|
|
1638
1638
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
1639
1639
|
/**
|
|
1640
|
-
*
|
|
1640
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
1641
1641
|
*
|
|
1642
1642
|
* @private within the repository
|
|
1643
1643
|
*/
|
|
1644
1644
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1645
1645
|
/**
|
|
1646
|
-
*
|
|
1646
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
1647
1647
|
*
|
|
1648
1648
|
* @private within the repository
|
|
1649
1649
|
*/
|
|
@@ -2288,8 +2288,8 @@ class PipelineExecutionError extends Error {
|
|
|
2288
2288
|
* @public exported from `@promptbook/core`
|
|
2289
2289
|
*/
|
|
2290
2290
|
function isPipelinePrepared(pipeline) {
|
|
2291
|
-
// Note: Ignoring `pipeline.preparations`
|
|
2292
|
-
// Note: Ignoring `pipeline.knowledgePieces`
|
|
2291
|
+
// Note: Ignoring `pipeline.preparations`
|
|
2292
|
+
// Note: Ignoring `pipeline.knowledgePieces`
|
|
2293
2293
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
2294
2294
|
// TODO: !!! Comment this out
|
|
2295
2295
|
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
@@ -3273,10 +3273,10 @@ function $getGlobalScope() {
|
|
|
3273
3273
|
}
|
|
3274
3274
|
|
|
3275
3275
|
/**
|
|
3276
|
-
*
|
|
3276
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
3277
3277
|
*
|
|
3278
|
-
* @param text
|
|
3279
|
-
* @returns
|
|
3278
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
3279
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
3280
3280
|
* @example 'HELLO_WORLD'
|
|
3281
3281
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
3282
3282
|
* @public exported from `@promptbook/utils`
|
|
@@ -3328,10 +3328,10 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
3328
3328
|
*/
|
|
3329
3329
|
|
|
3330
3330
|
/**
|
|
3331
|
-
*
|
|
3331
|
+
* Normalizes a text string to snake_case format.
|
|
3332
3332
|
*
|
|
3333
|
-
* @param text
|
|
3334
|
-
* @returns
|
|
3333
|
+
* @param text The text string to be converted to snake_case format.
|
|
3334
|
+
* @returns The normalized text in snake_case format.
|
|
3335
3335
|
* @example 'hello_world'
|
|
3336
3336
|
* @example 'i_love_promptbook'
|
|
3337
3337
|
* @public exported from `@promptbook/utils`
|
|
@@ -3401,10 +3401,11 @@ const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
|
3401
3401
|
*/
|
|
3402
3402
|
|
|
3403
3403
|
/**
|
|
3404
|
-
*
|
|
3404
|
+
* Registry for all available scrapers in the system.
|
|
3405
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
3405
3406
|
*
|
|
3406
3407
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
3407
|
-
* @singleton Only one instance of each register is created per build, but
|
|
3408
|
+
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
3408
3409
|
* @public exported from `@promptbook/core`
|
|
3409
3410
|
*/
|
|
3410
3411
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
@@ -3572,7 +3573,9 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
3572
3573
|
*/
|
|
3573
3574
|
|
|
3574
3575
|
/**
|
|
3575
|
-
*
|
|
3576
|
+
* Factory function that creates a handler for processing knowledge sources.
|
|
3577
|
+
* Provides standardized processing of different types of knowledge sources
|
|
3578
|
+
* across various scraper implementations.
|
|
3576
3579
|
*
|
|
3577
3580
|
* @public exported from `@promptbook/core`
|
|
3578
3581
|
*/
|
|
@@ -3813,9 +3816,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
3813
3816
|
*/
|
|
3814
3817
|
|
|
3815
3818
|
/**
|
|
3816
|
-
*
|
|
3819
|
+
* Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
|
|
3817
3820
|
*
|
|
3818
|
-
* @
|
|
3821
|
+
* @param tasks Sequence of tasks that are chained together to form a pipeline
|
|
3822
|
+
* @returns A promise that resolves to the prepared tasks.
|
|
3823
|
+
*
|
|
3824
|
+
* @private internal utility of `preparePipeline`
|
|
3819
3825
|
*/
|
|
3820
3826
|
async function prepareTasks(pipeline, tools, options) {
|
|
3821
3827
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
|
|
@@ -4578,7 +4584,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
4578
4584
|
else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
|
|
4579
4585
|
}
|
|
4580
4586
|
if (expectedParameterNames.size === 0) {
|
|
4581
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
4587
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
4582
4588
|
Object.freeze(mappedParameters);
|
|
4583
4589
|
return mappedParameters;
|
|
4584
4590
|
}
|
|
@@ -4609,7 +4615,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
4609
4615
|
for (let i = 0; i < expectedParameterNames.size; i++) {
|
|
4610
4616
|
mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
|
|
4611
4617
|
}
|
|
4612
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
4618
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
4613
4619
|
Object.freeze(mappedParameters);
|
|
4614
4620
|
return mappedParameters;
|
|
4615
4621
|
}
|
|
@@ -5362,11 +5368,10 @@ async function executeFormatSubvalues(options) {
|
|
|
5362
5368
|
const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
|
|
5363
5369
|
${error.message}
|
|
5364
5370
|
|
|
5365
|
-
This is error in FOREACH command when mapping data
|
|
5371
|
+
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
5366
5372
|
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
5367
5373
|
|
|
5368
5374
|
${block(pipelineIdentification)}
|
|
5369
|
-
Subparameter index: ${index}
|
|
5370
5375
|
`));
|
|
5371
5376
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5372
5377
|
console.error(highLevelError);
|
|
@@ -5394,12 +5399,11 @@ async function executeFormatSubvalues(options) {
|
|
|
5394
5399
|
catch (error) {
|
|
5395
5400
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5396
5401
|
console.error(spaceTrim$1((block) => `
|
|
5397
|
-
|
|
5402
|
+
${error.message}
|
|
5398
5403
|
|
|
5399
|
-
${
|
|
5404
|
+
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
5400
5405
|
|
|
5401
5406
|
${block(pipelineIdentification)}
|
|
5402
|
-
Subparameter index: ${index}
|
|
5403
5407
|
`));
|
|
5404
5408
|
return FAILED_VALUE_PLACEHOLDER;
|
|
5405
5409
|
}
|
|
@@ -6541,7 +6545,8 @@ class LegacyDocumentScraper {
|
|
|
6541
6545
|
*/
|
|
6542
6546
|
|
|
6543
6547
|
/**
|
|
6544
|
-
*
|
|
6548
|
+
* Creates a scraper for legacy document formats (.doc, .rtf, etc).
|
|
6549
|
+
* Uses LibreOffice for conversion to extract content from older document formats.
|
|
6545
6550
|
*
|
|
6546
6551
|
* @public exported from `@promptbook/legacy-documents`
|
|
6547
6552
|
*/
|