@promptbook/legacy-documents 0.92.0-24 → 0.92.0-26

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 (72) hide show
  1. package/esm/index.es.js +43 -38
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +0 -2
  4. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
  5. package/esm/typings/src/constants.d.ts +8 -2
  6. package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
  7. package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
  8. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
  9. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
  10. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
  11. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -5
  12. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
  13. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
  14. package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
  15. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
  16. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
  17. package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
  18. package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
  19. package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
  20. package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
  21. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  22. package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
  23. package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
  24. package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
  25. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
  26. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
  27. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
  28. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  29. package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
  30. package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
  31. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
  32. package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
  33. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
  34. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
  35. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
  36. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
  37. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
  38. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
  39. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
  40. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  41. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
  42. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
  43. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
  44. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
  45. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
  46. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
  47. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
  48. package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
  49. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
  50. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
  51. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
  52. package/esm/typings/src/types/ModelVariant.d.ts +5 -5
  53. package/esm/typings/src/types/typeAliases.d.ts +8 -6
  54. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
  55. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
  56. package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
  57. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
  58. package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
  59. package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
  60. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
  61. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
  62. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
  63. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
  64. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
  65. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
  66. package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
  67. package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
  68. package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
  69. package/esm/typings/src/version.d.ts +2 -1
  70. package/package.json +2 -2
  71. package/umd/index.umd.js +43 -38
  72. package/umd/index.umd.js.map +1 -1
@@ -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-25`).
18
19
  *
19
20
  * @generated
20
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/legacy-documents",
3
- "version": "0.92.0-24",
3
+ "version": "0.92.0-26",
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/legacy-documents.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.92.0-24"
54
+ "@promptbook/core": "0.92.0-26"
55
55
  },
56
56
  "dependencies": {
57
57
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-26';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -560,7 +560,8 @@
560
560
  */
561
561
 
562
562
  /**
563
- * @@@
563
+ * Converts a name to a properly formatted subfolder path for cache storage.
564
+ * Handles normalization and path formatting to create consistent cache directory structures.
564
565
  *
565
566
  * @private for `FileCacheStorage`
566
567
  */
@@ -813,10 +814,10 @@
813
814
  */
814
815
 
815
816
  /**
816
- * @@@
817
+ * Removes diacritic marks (accents) from characters in a string.
817
818
  *
818
- * @param input @@@
819
- * @returns @@@
819
+ * @param input The string containing diacritics to be normalized.
820
+ * @returns The string with diacritics removed or normalized.
820
821
  * @public exported from `@promptbook/utils`
821
822
  */
822
823
  function removeDiacritics(input) {
@@ -830,10 +831,10 @@
830
831
  */
831
832
 
832
833
  /**
833
- * @@@
834
+ * Converts a given text to kebab-case format.
834
835
  *
835
- * @param text @@@
836
- * @returns @@@
836
+ * @param text The text to be converted.
837
+ * @returns The kebab-case formatted string.
837
838
  * @example 'hello-world'
838
839
  * @example 'i-love-promptbook'
839
840
  * @public exported from `@promptbook/utils`
@@ -975,11 +976,11 @@
975
976
  }
976
977
 
977
978
  /**
978
- * @@@
979
+ * Converts a title string into a normalized name.
979
980
  *
980
- * @param value @@@
981
- * @returns @@@
982
- * @example @@@
981
+ * @param value The title string to be converted to a name.
982
+ * @returns A normalized name derived from the input title.
983
+ * @example 'Hello World!' -> 'hello-world'
983
984
  * @public exported from `@promptbook/utils`
984
985
  */
985
986
  function titleToName(value) {
@@ -999,9 +1000,8 @@
999
1000
  }
1000
1001
 
1001
1002
  /**
1002
- * Create a filename for intermediate cache for scrapers
1003
- *
1004
- * Note: It also checks if directory exists and creates it if not
1003
+ * Retrieves an intermediate source for a scraper based on the knowledge source.
1004
+ * Manages the caching and retrieval of intermediate scraper results for optimized performance.
1005
1005
  *
1006
1006
  * @private as internal utility for scrapers
1007
1007
  */
@@ -1635,13 +1635,13 @@
1635
1635
  */
1636
1636
  const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
1637
1637
  /**
1638
- * @@@
1638
+ * Placeholder value indicating a parameter is missing its value.
1639
1639
  *
1640
1640
  * @private within the repository
1641
1641
  */
1642
1642
  const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1643
1643
  /**
1644
- * @@@
1644
+ * Placeholder value indicating a parameter is restricted and cannot be used directly.
1645
1645
  *
1646
1646
  * @private within the repository
1647
1647
  */
@@ -2286,8 +2286,8 @@
2286
2286
  * @public exported from `@promptbook/core`
2287
2287
  */
2288
2288
  function isPipelinePrepared(pipeline) {
2289
- // Note: Ignoring `pipeline.preparations` @@@
2290
- // Note: Ignoring `pipeline.knowledgePieces` @@@
2289
+ // Note: Ignoring `pipeline.preparations`
2290
+ // Note: Ignoring `pipeline.knowledgePieces`
2291
2291
  if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2292
2292
  // TODO: !!! Comment this out
2293
2293
  console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
@@ -3271,10 +3271,10 @@
3271
3271
  }
3272
3272
 
3273
3273
  /**
3274
- * @@@
3274
+ * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
3275
3275
  *
3276
- * @param text @@@
3277
- * @returns @@@
3276
+ * @param text The text string to be converted to SCREAMING_CASE format.
3277
+ * @returns The normalized text in SCREAMING_CASE format.
3278
3278
  * @example 'HELLO_WORLD'
3279
3279
  * @example 'I_LOVE_PROMPTBOOK'
3280
3280
  * @public exported from `@promptbook/utils`
@@ -3326,10 +3326,10 @@
3326
3326
  */
3327
3327
 
3328
3328
  /**
3329
- * @@@
3329
+ * Normalizes a text string to snake_case format.
3330
3330
  *
3331
- * @param text @@@
3332
- * @returns @@@
3331
+ * @param text The text string to be converted to snake_case format.
3332
+ * @returns The normalized text in snake_case format.
3333
3333
  * @example 'hello_world'
3334
3334
  * @example 'i_love_promptbook'
3335
3335
  * @public exported from `@promptbook/utils`
@@ -3399,10 +3399,11 @@
3399
3399
  */
3400
3400
 
3401
3401
  /**
3402
- * @@@
3402
+ * Registry for all available scrapers in the system.
3403
+ * Central point for registering and accessing different types of content scrapers.
3403
3404
  *
3404
3405
  * Note: `$` is used to indicate that this interacts with the global scope
3405
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
3406
+ * @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
3406
3407
  * @public exported from `@promptbook/core`
3407
3408
  */
3408
3409
  const $scrapersRegister = new $Register('scraper_constructors');
@@ -3570,7 +3571,9 @@
3570
3571
  */
3571
3572
 
3572
3573
  /**
3573
- * @@@
3574
+ * Factory function that creates a handler for processing knowledge sources.
3575
+ * Provides standardized processing of different types of knowledge sources
3576
+ * across various scraper implementations.
3574
3577
  *
3575
3578
  * @public exported from `@promptbook/core`
3576
3579
  */
@@ -3811,9 +3814,12 @@
3811
3814
  */
3812
3815
 
3813
3816
  /**
3814
- * @@@
3817
+ * Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
3815
3818
  *
3816
- * @public exported from `@promptbook/core`
3819
+ * @param tasks Sequence of tasks that are chained together to form a pipeline
3820
+ * @returns A promise that resolves to the prepared tasks.
3821
+ *
3822
+ * @private internal utility of `preparePipeline`
3817
3823
  */
3818
3824
  async function prepareTasks(pipeline, tools, options) {
3819
3825
  const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
@@ -4576,7 +4582,7 @@
4576
4582
  else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
4577
4583
  }
4578
4584
  if (expectedParameterNames.size === 0) {
4579
- // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent @@@
4585
+ // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
4580
4586
  Object.freeze(mappedParameters);
4581
4587
  return mappedParameters;
4582
4588
  }
@@ -4607,7 +4613,7 @@
4607
4613
  for (let i = 0; i < expectedParameterNames.size; i++) {
4608
4614
  mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
4609
4615
  }
4610
- // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent @@@
4616
+ // Note: [👨‍👨‍👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
4611
4617
  Object.freeze(mappedParameters);
4612
4618
  return mappedParameters;
4613
4619
  }
@@ -5360,11 +5366,10 @@
5360
5366
  const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
5361
5367
  ${error.message}
5362
5368
 
5363
- This is error in FOREACH command when mapping data
5369
+ This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
5364
5370
  You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
5365
5371
 
5366
5372
  ${block(pipelineIdentification)}
5367
- Subparameter index: ${index}
5368
5373
  `));
5369
5374
  if (length > BIG_DATASET_TRESHOLD) {
5370
5375
  console.error(highLevelError);
@@ -5392,12 +5397,11 @@
5392
5397
  catch (error) {
5393
5398
  if (length > BIG_DATASET_TRESHOLD) {
5394
5399
  console.error(spaceTrim__default["default"]((block) => `
5395
- Error in FOREACH command:
5400
+ ${error.message}
5396
5401
 
5397
- ${block(pipelineIdentification)}
5402
+ This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
5398
5403
 
5399
5404
  ${block(pipelineIdentification)}
5400
- Subparameter index: ${index}
5401
5405
  `));
5402
5406
  return FAILED_VALUE_PLACEHOLDER;
5403
5407
  }
@@ -6539,7 +6543,8 @@
6539
6543
  */
6540
6544
 
6541
6545
  /**
6542
- * @@@
6546
+ * Creates a scraper for legacy document formats (.doc, .rtf, etc).
6547
+ * Uses LibreOffice for conversion to extract content from older document formats.
6543
6548
  *
6544
6549
  * @public exported from `@promptbook/legacy-documents`
6545
6550
  */