@promptbook/utils 0.60.1 → 0.61.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 (350) hide show
  1. package/README.md +17 -19
  2. package/esm/index.es.js +392 -274
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +61 -4
  5. package/esm/typings/src/_packages/core.index.d.ts +8 -8
  6. package/esm/typings/src/_packages/markdown-utils.d.ts +17 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +11 -6
  8. package/esm/typings/src/_packages/utils.index.d.ts +23 -19
  9. package/esm/typings/src/cli/cli-commands/hello.d.ts +7 -0
  10. package/esm/typings/src/cli/cli-commands/make.d.ts +7 -0
  11. package/esm/typings/src/cli/cli-commands/prettify.d.ts +7 -0
  12. package/esm/typings/src/collection/collectionToJson.d.ts +3 -0
  13. package/esm/typings/src/collection/collectionToJson.test.d.ts +6 -0
  14. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
  15. package/esm/typings/src/commands/BLOCK/BlockCommand.d.ts +11 -0
  16. package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +13 -0
  17. package/esm/typings/src/commands/BLOCK/blockCommandParser.d.ts +9 -0
  18. package/esm/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +14 -0
  19. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +9 -0
  20. package/esm/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +7 -0
  21. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +9 -0
  22. package/esm/typings/src/commands/JOKER/JokerCommand.d.ts +11 -0
  23. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +9 -0
  24. package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +12 -0
  25. package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +9 -0
  26. package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +13 -0
  27. package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +9 -0
  28. package/esm/typings/src/commands/PARAMETER/ParameterCommand.d.ts +15 -0
  29. package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +9 -0
  30. package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +11 -0
  31. package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +9 -0
  32. package/esm/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +11 -0
  33. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +9 -0
  34. package/esm/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +11 -0
  35. package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +9 -0
  36. package/esm/typings/src/commands/URL/UrlCommand.d.ts +10 -0
  37. package/esm/typings/src/commands/URL/urlCommandParser.d.ts +9 -0
  38. package/esm/typings/src/commands/X_ACTION/ActionCommand.d.ts +9 -0
  39. package/esm/typings/src/commands/X_ACTION/actionCommand.test.d.ts +1 -0
  40. package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +9 -0
  41. package/esm/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +9 -0
  42. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +1 -0
  43. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +9 -0
  44. package/esm/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +10 -0
  45. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +1 -0
  46. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +12 -0
  47. package/esm/typings/src/commands/_common/parseCommand.d.ts +12 -0
  48. package/esm/typings/src/commands/_common/parseCommand.test.d.ts +1 -0
  49. package/esm/typings/src/commands/_common/types/Command.d.ts +6 -0
  50. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -0
  51. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +9 -0
  52. package/esm/typings/src/commands/index.d.ts +4 -0
  53. package/esm/typings/src/config.d.ts +4 -0
  54. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +2 -0
  55. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -3
  56. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -2
  57. package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
  58. package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
  59. package/esm/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +3 -0
  60. package/esm/typings/src/errors/NotYetImplementedError.d.ts +7 -0
  61. package/esm/typings/src/errors/{SyntaxError.d.ts → ParsingError.d.ts} +2 -2
  62. package/{umd/typings/src/errors/ExecutionError.d.ts → esm/typings/src/errors/PipelineExecutionError.d.ts} +2 -2
  63. package/esm/typings/src/errors/_ExpectError.d.ts +2 -2
  64. package/esm/typings/src/execution/ExecutionTools.d.ts +4 -3
  65. package/esm/typings/src/execution/LlmExecutionTools.d.ts +24 -5
  66. package/esm/typings/src/execution/PromptResult.d.ts +2 -2
  67. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
  68. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
  69. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  70. package/esm/typings/src/execution/utils/replaceParameters.d.ts +1 -1
  71. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +5 -0
  72. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
  73. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  74. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -0
  75. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +5 -0
  76. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
  77. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +10 -0
  78. package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  79. package/esm/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +1 -0
  80. package/esm/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +1 -0
  81. package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
  82. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +14 -1
  83. package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +16 -0
  84. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -1
  85. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  86. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  87. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +13 -3
  88. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  89. package/esm/typings/src/personas/personaToModelRequirements.d.ts +6 -0
  90. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
  91. package/esm/typings/src/types/Arrayable.d.ts +10 -0
  92. package/esm/typings/src/types/PipelineJson/Expectations.d.ts +28 -0
  93. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +16 -0
  94. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +8 -2
  95. package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +7 -0
  96. package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +6 -142
  97. package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +77 -0
  98. package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +14 -0
  99. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -0
  100. package/esm/typings/src/types/Prompt.d.ts +3 -3
  101. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  102. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
  103. package/esm/typings/src/types/typeAliases.d.ts +50 -6
  104. package/esm/typings/src/utils/arrayableToArray.d.ts +11 -0
  105. package/esm/typings/src/utils/arrayableToArray.test.d.ts +1 -0
  106. package/esm/typings/src/utils/emojis.d.ts +1 -0
  107. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  108. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  109. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  110. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  111. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  112. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  113. package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -2
  114. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +14 -0
  115. package/esm/typings/src/utils/markdown/flattenMarkdown.test.d.ts +1 -0
  116. package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +30 -0
  117. package/esm/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +1 -0
  118. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +1 -0
  119. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +12 -0
  120. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +1 -0
  121. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +8 -1
  122. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +8 -1
  123. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +13 -1
  124. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +8 -1
  125. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +8 -1
  126. package/esm/typings/src/{conversion/utils → utils}/parseNumber.d.ts +1 -1
  127. package/esm/typings/src/utils/parseNumber.test.d.ts +1 -0
  128. package/esm/typings/src/utils/sets/difference.d.ts +2 -0
  129. package/esm/typings/src/utils/sets/intersection.d.ts +2 -0
  130. package/esm/typings/src/utils/sets/union.d.ts +2 -0
  131. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +5 -0
  132. package/esm/typings/src/utils/validators/email/isValidEmail.test.d.ts +1 -0
  133. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +7 -0
  134. package/esm/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +1 -0
  135. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -0
  136. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +1 -0
  137. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +12 -0
  138. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +1 -0
  139. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +9 -0
  140. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +1 -0
  141. package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +9 -0
  142. package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +1 -0
  143. package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +12 -0
  144. package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +1 -0
  145. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +12 -0
  146. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +1 -0
  147. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +3 -0
  148. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +5 -0
  149. package/esm/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +1 -0
  150. package/esm/typings/src/version.d.ts +3 -2
  151. package/package.json +1 -1
  152. package/umd/index.umd.js +400 -278
  153. package/umd/index.umd.js.map +1 -1
  154. package/umd/typings/promptbook-collection/index.d.ts +61 -4
  155. package/umd/typings/src/_packages/core.index.d.ts +8 -8
  156. package/umd/typings/src/_packages/markdown-utils.d.ts +17 -0
  157. package/umd/typings/src/_packages/types.index.d.ts +11 -6
  158. package/umd/typings/src/_packages/utils.index.d.ts +23 -19
  159. package/umd/typings/src/cli/cli-commands/hello.d.ts +7 -0
  160. package/umd/typings/src/cli/cli-commands/make.d.ts +7 -0
  161. package/umd/typings/src/cli/cli-commands/prettify.d.ts +7 -0
  162. package/umd/typings/src/collection/collectionToJson.d.ts +3 -0
  163. package/umd/typings/src/collection/collectionToJson.test.d.ts +6 -0
  164. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
  165. package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +11 -0
  166. package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +13 -0
  167. package/umd/typings/src/commands/BLOCK/blockCommand.test.d.ts +1 -0
  168. package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +9 -0
  169. package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +14 -0
  170. package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +9 -0
  171. package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +7 -0
  172. package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +1 -0
  173. package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +9 -0
  174. package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +11 -0
  175. package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +1 -0
  176. package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +9 -0
  177. package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +12 -0
  178. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +1 -0
  179. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +9 -0
  180. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +13 -0
  181. package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +1 -0
  182. package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +9 -0
  183. package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +15 -0
  184. package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +1 -0
  185. package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +9 -0
  186. package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +11 -0
  187. package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +1 -0
  188. package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +9 -0
  189. package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +11 -0
  190. package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +1 -0
  191. package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +9 -0
  192. package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +11 -0
  193. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +1 -0
  194. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +9 -0
  195. package/umd/typings/src/commands/URL/UrlCommand.d.ts +10 -0
  196. package/umd/typings/src/commands/URL/urlCommand.test.d.ts +1 -0
  197. package/umd/typings/src/commands/URL/urlCommandParser.d.ts +9 -0
  198. package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +9 -0
  199. package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +1 -0
  200. package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +9 -0
  201. package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +9 -0
  202. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +1 -0
  203. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +9 -0
  204. package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +10 -0
  205. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +1 -0
  206. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +12 -0
  207. package/umd/typings/src/commands/_common/parseCommand.d.ts +12 -0
  208. package/umd/typings/src/commands/_common/parseCommand.test.d.ts +1 -0
  209. package/umd/typings/src/commands/_common/types/Command.d.ts +6 -0
  210. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +36 -0
  211. package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +9 -0
  212. package/umd/typings/src/commands/index.d.ts +4 -0
  213. package/umd/typings/src/config.d.ts +4 -0
  214. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +2 -0
  215. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +2 -3
  216. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -2
  217. package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
  218. package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -1
  219. package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +3 -0
  220. package/umd/typings/src/errors/NotYetImplementedError.d.ts +7 -0
  221. package/umd/typings/src/errors/{SyntaxError.d.ts → ParsingError.d.ts} +2 -2
  222. package/{esm/typings/src/errors/ExecutionError.d.ts → umd/typings/src/errors/PipelineExecutionError.d.ts} +2 -2
  223. package/umd/typings/src/errors/_ExpectError.d.ts +2 -2
  224. package/umd/typings/src/execution/ExecutionTools.d.ts +4 -3
  225. package/umd/typings/src/execution/LlmExecutionTools.d.ts +24 -5
  226. package/umd/typings/src/execution/PromptResult.d.ts +2 -2
  227. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
  228. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
  229. package/umd/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  230. package/umd/typings/src/execution/utils/replaceParameters.d.ts +1 -1
  231. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +5 -0
  232. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
  233. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  234. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -0
  235. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +5 -0
  236. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
  237. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +10 -0
  238. package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  239. package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +1 -0
  240. package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +1 -0
  241. package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
  242. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +14 -1
  243. package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +16 -0
  244. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -1
  245. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  246. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  247. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +13 -3
  248. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  249. package/umd/typings/src/personas/personaToModelRequirements.d.ts +6 -0
  250. package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
  251. package/umd/typings/src/types/Arrayable.d.ts +10 -0
  252. package/umd/typings/src/types/PipelineJson/Expectations.d.ts +28 -0
  253. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +16 -0
  254. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +8 -2
  255. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +7 -0
  256. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +6 -142
  257. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +77 -0
  258. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +14 -0
  259. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -0
  260. package/umd/typings/src/types/Prompt.d.ts +3 -3
  261. package/umd/typings/src/types/TaskProgress.d.ts +2 -2
  262. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
  263. package/umd/typings/src/types/typeAliases.d.ts +50 -6
  264. package/umd/typings/src/utils/arrayableToArray.d.ts +11 -0
  265. package/umd/typings/src/utils/arrayableToArray.test.d.ts +1 -0
  266. package/umd/typings/src/utils/emojis.d.ts +1 -0
  267. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  268. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  269. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  270. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  271. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  272. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  273. package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -2
  274. package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +14 -0
  275. package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +1 -0
  276. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +30 -0
  277. package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +1 -0
  278. package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +1 -0
  279. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +12 -0
  280. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +1 -0
  281. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +8 -1
  282. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +8 -1
  283. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +13 -1
  284. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +8 -1
  285. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +8 -1
  286. package/umd/typings/src/{conversion/utils → utils}/parseNumber.d.ts +1 -1
  287. package/umd/typings/src/utils/parseNumber.test.d.ts +1 -0
  288. package/umd/typings/src/utils/sets/difference.d.ts +2 -0
  289. package/umd/typings/src/utils/sets/intersection.d.ts +2 -0
  290. package/umd/typings/src/utils/sets/union.d.ts +2 -0
  291. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +5 -0
  292. package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +1 -0
  293. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +7 -0
  294. package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +1 -0
  295. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -0
  296. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +1 -0
  297. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +12 -0
  298. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +1 -0
  299. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +9 -0
  300. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +1 -0
  301. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +9 -0
  302. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +1 -0
  303. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +12 -0
  304. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +1 -0
  305. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +12 -0
  306. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +1 -0
  307. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +3 -0
  308. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +5 -0
  309. package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +1 -0
  310. package/umd/typings/src/version.d.ts +3 -2
  311. package/esm/typings/src/cli/actions/hello.d.ts +0 -7
  312. package/esm/typings/src/cli/actions/make.d.ts +0 -7
  313. package/esm/typings/src/cli/actions/prettify.d.ts +0 -7
  314. package/esm/typings/src/conversion/utils/parseCommand.d.ts +0 -11
  315. package/esm/typings/src/conversion/utils/parseCommand.test.d.ts +0 -4
  316. package/esm/typings/src/errors/TemplateError.d.ts +0 -9
  317. package/esm/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +0 -4
  318. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -24
  319. package/esm/typings/src/types/Command.d.ts +0 -101
  320. package/esm/typings/src/types/ExecutionTypes.d.ts +0 -13
  321. package/esm/typings/src/utils/markdown-json/MarkdownStructure.d.ts +0 -25
  322. package/esm/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +0 -7
  323. package/esm/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +0 -13
  324. package/umd/typings/src/cli/actions/hello.d.ts +0 -7
  325. package/umd/typings/src/cli/actions/make.d.ts +0 -7
  326. package/umd/typings/src/cli/actions/prettify.d.ts +0 -7
  327. package/umd/typings/src/conversion/utils/parseCommand.d.ts +0 -11
  328. package/umd/typings/src/conversion/utils/parseCommand.test.d.ts +0 -4
  329. package/umd/typings/src/errors/TemplateError.d.ts +0 -9
  330. package/umd/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +0 -4
  331. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -24
  332. package/umd/typings/src/types/Command.d.ts +0 -101
  333. package/umd/typings/src/types/ExecutionTypes.d.ts +0 -13
  334. package/umd/typings/src/utils/markdown-json/MarkdownStructure.d.ts +0 -25
  335. package/umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +0 -7
  336. package/umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +0 -13
  337. /package/esm/typings/src/{conversion/utils/parseNumber.test.d.ts → commands/BLOCK/blockCommand.test.d.ts} +0 -0
  338. /package/esm/typings/src/{llm-providers/mocked/fakeTextToExpectations.test.d.ts → commands/EXPECT/expectCommand.test.d.ts} +0 -0
  339. /package/esm/typings/src/{llm-providers/mocked/faked-completion.test.d.ts → commands/JOKER/jokerCommand.test.d.ts} +0 -0
  340. /package/esm/typings/src/{utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → commands/KNOWLEDGE/knowledgeCommand.test.d.ts} +0 -0
  341. /package/esm/typings/src/{utils/markdown-json/markdownToMarkdownStructure.test.d.ts → commands/MODEL/modelCommand.test.d.ts} +0 -0
  342. /package/{umd/typings/src/conversion/utils/parseNumber.test.d.ts → esm/typings/src/commands/PARAMETER/parameterCommand.test.d.ts} +0 -0
  343. /package/{umd/typings/src/llm-providers/mocked/fakeTextToExpectations.test.d.ts → esm/typings/src/commands/PERSONA/personaCommand.test.d.ts} +0 -0
  344. /package/{umd/typings/src/llm-providers/mocked/faked-completion.test.d.ts → esm/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts} +0 -0
  345. /package/{umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts} +0 -0
  346. /package/{umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.test.d.ts → esm/typings/src/commands/URL/urlCommand.test.d.ts} +0 -0
  347. /package/esm/typings/src/llm-providers/mocked/{joker.test.d.ts → test/joker.test.d.ts} +0 -0
  348. /package/esm/typings/src/llm-providers/mocked/{mocked-completion.test.d.ts → test/mocked-completion.test.d.ts} +0 -0
  349. /package/umd/typings/src/llm-providers/mocked/{joker.test.d.ts → test/joker.test.d.ts} +0 -0
  350. /package/umd/typings/src/llm-providers/mocked/{mocked-completion.test.d.ts → test/mocked-completion.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -137,16 +137,15 @@
137
137
  return UnexpectedError;
138
138
  }(Error));
139
139
 
140
- /* tslint:disable */
141
- function normalizeTo_camelCase(sentence, __firstLetterCapital) {
140
+ function normalizeTo_camelCase(text, _isFirstLetterCapital) {
142
141
  var e_1, _a;
143
- if (__firstLetterCapital === void 0) { __firstLetterCapital = false; }
142
+ if (_isFirstLetterCapital === void 0) { _isFirstLetterCapital = false; }
144
143
  var charType;
145
144
  var lastCharType = null;
146
145
  var normalizedName = '';
147
146
  try {
148
- for (var sentence_1 = __values(sentence), sentence_1_1 = sentence_1.next(); !sentence_1_1.done; sentence_1_1 = sentence_1.next()) {
149
- var char = sentence_1_1.value;
147
+ for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
148
+ var char = text_1_1.value;
150
149
  var normalizedChar = void 0;
151
150
  if (/^[a-z]$/.test(char)) {
152
151
  charType = 'LOWERCASE';
@@ -165,7 +164,7 @@
165
164
  normalizedChar = '';
166
165
  }
167
166
  if (!lastCharType) {
168
- if (__firstLetterCapital) {
167
+ if (_isFirstLetterCapital) {
169
168
  normalizedChar = normalizedChar.toUpperCase(); //TODO: DRY
170
169
  }
171
170
  }
@@ -182,7 +181,7 @@
182
181
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
183
182
  finally {
184
183
  try {
185
- if (sentence_1_1 && !sentence_1_1.done && (_a = sentence_1.return)) _a.call(sentence_1);
184
+ if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
186
185
  }
187
186
  finally { if (e_1) throw e_1.error; }
188
187
  }
@@ -444,16 +443,15 @@
444
443
  });
445
444
  }
446
445
 
447
- /* tslint:disable */
448
- function normalizeToKebabCase(sentence) {
446
+ function normalizeToKebabCase(text) {
449
447
  var e_1, _a;
450
- sentence = removeDiacritics(sentence);
448
+ text = removeDiacritics(text);
451
449
  var charType;
452
450
  var lastCharType = 'OTHER';
453
451
  var normalizedName = '';
454
452
  try {
455
- for (var sentence_1 = __values(sentence), sentence_1_1 = sentence_1.next(); !sentence_1_1.done; sentence_1_1 = sentence_1.next()) {
456
- var char = sentence_1_1.value;
453
+ for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
454
+ var char = text_1_1.value;
457
455
  var normalizedChar = void 0;
458
456
  if (/^[a-z]$/.test(char)) {
459
457
  charType = 'LOWERCASE';
@@ -488,7 +486,7 @@
488
486
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
489
487
  finally {
490
488
  try {
491
- if (sentence_1_1 && !sentence_1_1.done && (_a = sentence_1.return)) _a.call(sentence_1);
489
+ if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
492
490
  }
493
491
  finally { if (e_1) throw e_1.error; }
494
492
  }
@@ -612,15 +610,15 @@
612
610
  /**
613
611
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
614
612
  */
615
- var SyntaxError = /** @class */ (function (_super) {
616
- __extends(SyntaxError, _super);
617
- function SyntaxError(message) {
613
+ var ParsingError = /** @class */ (function (_super) {
614
+ __extends(ParsingError, _super);
615
+ function ParsingError(message) {
618
616
  var _this = _super.call(this, message) || this;
619
- _this.name = 'SyntaxError';
620
- Object.setPrototypeOf(_this, SyntaxError.prototype);
617
+ _this.name = 'ParsingError';
618
+ Object.setPrototypeOf(_this, ParsingError.prototype);
621
619
  return _this;
622
620
  }
623
- return SyntaxError;
621
+ return ParsingError;
624
622
  }(Error));
625
623
 
626
624
  /**
@@ -628,7 +626,7 @@
628
626
  *
629
627
  * @param script from which to extract the variables
630
628
  * @returns the list of variable names
631
- * @throws {SyntaxError} if the script is invalid
629
+ * @throws {ParsingError} if the script is invalid
632
630
  */
633
631
  function extractVariables(script) {
634
632
  var variables = new Set();
@@ -644,9 +642,8 @@
644
642
  }
645
643
  var undefinedName = error.message.split(' ')[0];
646
644
  /*
647
- Note: Remapping error
648
- From: [ReferenceError: thing is not defined],
649
- To: [Error: Parameter {thing} is not defined],
645
+ Note: Parsing the error
646
+ [ReferenceError: thing is not defined]
650
647
  */
651
648
  if (!undefinedName) {
652
649
  throw error;
@@ -664,7 +661,7 @@
664
661
  if (!(error instanceof Error)) {
665
662
  throw error;
666
663
  }
667
- throw new SyntaxError(spacetrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.name), ": ").concat(block(error.message), "\n "); }));
664
+ throw new ParsingError(spacetrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.name), ": ").concat(block(error.message), "\n "); }));
668
665
  }
669
666
  return variables;
670
667
  }
@@ -677,7 +674,7 @@
677
674
  *
678
675
  * @param promptTemplate the template with used parameters
679
676
  * @returns the set of parameter names
680
- * @throws {SyntaxError} if the script is invalid
677
+ * @throws {ParsingError} if the script is invalid
681
678
  */
682
679
  function extractParametersFromPromptTemplate(promptTemplate) {
683
680
  var e_1, _a, e_2, _b;
@@ -695,7 +692,7 @@
695
692
  }
696
693
  finally { if (e_1) throw e_1.error; }
697
694
  }
698
- if (promptTemplate.executionType === 'SCRIPT') {
695
+ if (promptTemplate.blockType === 'SCRIPT') {
699
696
  try {
700
697
  for (var _e = __values(extractVariables(promptTemplate.content)), _f = _e.next(); !_f.done; _f = _e.next()) {
701
698
  var parameterName = _f.value;
@@ -716,73 +713,6 @@
716
713
  * TODO: [🔣] If script require contentLanguage
717
714
  */
718
715
 
719
- /**
720
- * Function parseNumber will parse number from string
721
- *
722
- * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
723
- * Note: it also works only with decimal numbers
724
- *
725
- * @returns parsed number
726
- * @throws {SyntaxError} if the value is not a number
727
- *
728
- * @private within the parseCommand
729
- */
730
- function parseNumber(value) {
731
- var originalValue = value;
732
- if (typeof value === 'number') {
733
- value = value.toString(); // <- TODO: Maybe more efficient way to do this
734
- }
735
- if (typeof value !== 'string') {
736
- return 0;
737
- }
738
- value = value.trim();
739
- if (value.startsWith('+')) {
740
- return parseNumber(value.substring(1));
741
- }
742
- if (value.startsWith('-')) {
743
- var number = parseNumber(value.substring(1));
744
- if (number === 0) {
745
- return 0; // <- Note: To prevent -0
746
- }
747
- return -number;
748
- }
749
- value = value.replace(/,/g, '.');
750
- value = value.toUpperCase();
751
- if (value === '') {
752
- return 0;
753
- }
754
- if (value === '♾' || value.startsWith('INF')) {
755
- return Infinity;
756
- }
757
- if (value.includes('/')) {
758
- var _a = __read(value.split('/'), 2), numerator_ = _a[0], denominator_ = _a[1];
759
- var numerator = parseNumber(numerator_);
760
- var denominator = parseNumber(denominator_);
761
- if (denominator === 0) {
762
- throw new SyntaxError("Unable to parse number from \"".concat(originalValue, "\" because denominator is zero"));
763
- }
764
- return numerator / denominator;
765
- }
766
- if (/^(NAN|NULL|NONE|UNDEFINED|ZERO|NO.*)$/.test(value)) {
767
- return 0;
768
- }
769
- if (value.includes('E')) {
770
- var _b = __read(value.split('E'), 2), significand = _b[0], exponent = _b[1];
771
- return parseNumber(significand) * Math.pow(10, parseNumber(exponent));
772
- }
773
- if (!/^[0-9.]+$/.test(value) || value.split('.').length > 2) {
774
- throw new SyntaxError("Unable to parse number from \"".concat(originalValue, "\""));
775
- }
776
- var num = parseFloat(value);
777
- if (isNaN(num)) {
778
- throw new SyntaxError("Unexpected NaN when parsing number from \"".concat(originalValue, "\""));
779
- }
780
- return num;
781
- }
782
- /**
783
- * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
784
- */
785
-
786
716
  /**
787
717
  * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
788
718
  */
@@ -933,19 +863,17 @@
933
863
  var LOOP_LIMIT = 1000;
934
864
 
935
865
  /**
936
- * This error occurs during the parameter replacement in the template
937
- *
938
- * Note: This is a kindof subtype of ExecutionError because it occurs during the execution of the pipeline
866
+ * This error indicates errors during the execution of the pipeline
939
867
  */
940
- var TemplateError = /** @class */ (function (_super) {
941
- __extends(TemplateError, _super);
942
- function TemplateError(message) {
868
+ var PipelineExecutionError = /** @class */ (function (_super) {
869
+ __extends(PipelineExecutionError, _super);
870
+ function PipelineExecutionError(message) {
943
871
  var _this = _super.call(this, message) || this;
944
- _this.name = 'TemplateError';
945
- Object.setPrototypeOf(_this, TemplateError.prototype);
872
+ _this.name = 'PipelineExecutionError';
873
+ Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
946
874
  return _this;
947
875
  }
948
- return TemplateError;
876
+ return PipelineExecutionError;
949
877
  }(Error));
950
878
 
951
879
  /**
@@ -954,7 +882,7 @@
954
882
  * @param template the template with parameters in {curly} braces
955
883
  * @param parameters the object with parameters
956
884
  * @returns the template with replaced parameters
957
- * @throws {TemplateError} if parameter is not defined, not closed, or not opened
885
+ * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
958
886
  *
959
887
  * @private within the createPipelineExecutor
960
888
  */
@@ -972,14 +900,14 @@
972
900
  return "continue";
973
901
  }
974
902
  if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {
975
- throw new TemplateError('Parameter is already opened or not closed');
903
+ throw new PipelineExecutionError('Parameter is already opened or not closed');
976
904
  }
977
905
  if (parameters[parameterName] === undefined) {
978
- throw new TemplateError("Parameter {".concat(parameterName, "} is not defined"));
906
+ throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
979
907
  }
980
908
  var parameterValue = parameters[parameterName];
981
909
  if (parameterValue === undefined) {
982
- throw new TemplateError("Parameter {".concat(parameterName, "} is not defined"));
910
+ throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
983
911
  }
984
912
  parameterValue = parameterValue.toString();
985
913
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
@@ -999,11 +927,11 @@
999
927
  }
1000
928
  // [💫] Check if there are parameters that are not closed properly
1001
929
  if (/{\w+$/.test(replacedTemplate)) {
1002
- throw new TemplateError('Parameter is not closed');
930
+ throw new PipelineExecutionError('Parameter is not closed');
1003
931
  }
1004
932
  // [💫] Check if there are parameters that are not opened properly
1005
933
  if (/^\w+}/.test(replacedTemplate)) {
1006
- throw new TemplateError('Parameter is not opened');
934
+ throw new PipelineExecutionError('Parameter is not opened');
1007
935
  }
1008
936
  return replacedTemplate;
1009
937
  }
@@ -1109,152 +1037,6 @@
1109
1037
  return word.substring(0, 1).toUpperCase() + word.substring(1);
1110
1038
  }
1111
1039
 
1112
- /**
1113
- * Extracts all code blocks from markdown.
1114
- *
1115
- * Note: There are 3 simmilar function:
1116
- * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1117
- * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1118
- * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1119
- *
1120
- * @param markdown any valid markdown
1121
- * @returns code blocks with language and content
1122
- *
1123
- */
1124
- function extractAllBlocksFromMarkdown(markdown) {
1125
- var e_1, _a;
1126
- var codeBlocks = [];
1127
- var lines = markdown.split('\n');
1128
- var currentCodeBlock = null;
1129
- try {
1130
- for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
1131
- var line = lines_1_1.value;
1132
- if (line.startsWith('```')) {
1133
- var language = line.slice(3).trim() || null;
1134
- if (currentCodeBlock === null) {
1135
- currentCodeBlock = { language: language, content: '' };
1136
- }
1137
- else {
1138
- if (language !== null) {
1139
- // [🌻]
1140
- throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed and already opening new ").concat(language, " code block"));
1141
- }
1142
- codeBlocks.push(currentCodeBlock);
1143
- currentCodeBlock = null;
1144
- }
1145
- }
1146
- else if (currentCodeBlock !== null) {
1147
- if (currentCodeBlock.content !== '') {
1148
- currentCodeBlock.content += '\n';
1149
- }
1150
- currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make propper unescape */;
1151
- }
1152
- }
1153
- }
1154
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1155
- finally {
1156
- try {
1157
- if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
1158
- }
1159
- finally { if (e_1) throw e_1.error; }
1160
- }
1161
- if (currentCodeBlock !== null) {
1162
- // [🌻]
1163
- throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed at the end of the markdown"));
1164
- }
1165
- return codeBlocks;
1166
- }
1167
-
1168
- /**
1169
- * Utility function to extract all list items from markdown
1170
- *
1171
- * Note: It works with both ul and ol
1172
- * Note: It omits list items in code blocks
1173
- * Note: It flattens nested lists
1174
- * Note: It can not work with html syntax and comments
1175
- *
1176
- * @param markdown any valid markdown
1177
- * @returns
1178
- */
1179
- function extractAllListItemsFromMarkdown(markdown) {
1180
- var e_1, _a;
1181
- var lines = markdown.split('\n');
1182
- var listItems = [];
1183
- var isInCodeBlock = false;
1184
- try {
1185
- for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
1186
- var line = lines_1_1.value;
1187
- var trimmedLine = line.trim();
1188
- if (trimmedLine.startsWith('```')) {
1189
- isInCodeBlock = !isInCodeBlock;
1190
- }
1191
- if (!isInCodeBlock && (trimmedLine.startsWith('-') || trimmedLine.match(/^\d+\./))) {
1192
- var listItem = trimmedLine.replace(/^-|\d+\./, '').trim();
1193
- listItems.push(listItem);
1194
- }
1195
- }
1196
- }
1197
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1198
- finally {
1199
- try {
1200
- if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
1201
- }
1202
- finally { if (e_1) throw e_1.error; }
1203
- }
1204
- return listItems;
1205
- }
1206
-
1207
- /**
1208
- * Extracts exactly ONE code block from markdown.
1209
- *
1210
- * Note: If there are multiple or no code blocks the function throws an error
1211
- *
1212
- * Note: There are 3 simmilar function:
1213
- * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1214
- * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1215
- * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1216
- *
1217
- * @param markdown any valid markdown
1218
- * @returns code block with language and content
1219
- */
1220
- function extractOneBlockFromMarkdown(markdown) {
1221
- var codeBlocks = extractAllBlocksFromMarkdown(markdown);
1222
- if (codeBlocks.length !== 1) {
1223
- // TODO: Report more specific place where the error happened
1224
- throw new Error(/* <- [🌻] */ 'There should be exactly one code block in the markdown');
1225
- }
1226
- return codeBlocks[0];
1227
- }
1228
- /***
1229
- * TODO: [🍓][🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
1230
- */
1231
-
1232
- /**
1233
- * Removes HTML or Markdown comments from a string.
1234
- *
1235
- * @param {string} content - The string to remove comments from.
1236
- * @returns {string} The input string with all comments removed.
1237
- */
1238
- function removeContentComments(content) {
1239
- return spacetrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
1240
- }
1241
-
1242
- /**
1243
- * Removes Markdown formatting tags from a string.
1244
- *
1245
- * @param {string} str - The string to remove Markdown tags from.
1246
- * @returns {string} The input string with all Markdown tags removed.
1247
- */
1248
- function removeMarkdownFormatting(str) {
1249
- // Remove bold formatting
1250
- str = str.replace(/\*\*(.*?)\*\*/g, '$1');
1251
- // Remove italic formatting
1252
- str = str.replace(/\*(.*?)\*/g, '$1');
1253
- // Remove code formatting
1254
- str = str.replace(/`(.*?)`/g, '$1');
1255
- return str;
1256
- }
1257
-
1258
1040
  /**
1259
1041
  * Makes first letter of a string uppercase
1260
1042
  *
@@ -1263,22 +1045,14 @@
1263
1045
  return word.substring(0, 1).toLowerCase() + word.substring(1);
1264
1046
  }
1265
1047
 
1266
- /* tslint:disable */
1267
- /*
1268
- TODO: Tests
1269
- expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
1270
- expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěščřžžýáíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
1271
- expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
1272
- expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
1273
- */
1274
- function normalizeTo_SCREAMING_CASE(sentence) {
1048
+ function normalizeTo_SCREAMING_CASE(text) {
1275
1049
  var e_1, _a;
1276
1050
  var charType;
1277
1051
  var lastCharType = 'OTHER';
1278
1052
  var normalizedName = '';
1279
1053
  try {
1280
- for (var sentence_1 = __values(sentence), sentence_1_1 = sentence_1.next(); !sentence_1_1.done; sentence_1_1 = sentence_1.next()) {
1281
- var char = sentence_1_1.value;
1054
+ for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
1055
+ var char = text_1_1.value;
1282
1056
  var normalizedChar = void 0;
1283
1057
  if (/^[a-z]$/.test(char)) {
1284
1058
  charType = 'LOWERCASE';
@@ -1313,7 +1087,7 @@
1313
1087
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1314
1088
  finally {
1315
1089
  try {
1316
- if (sentence_1_1 && !sentence_1_1.done && (_a = sentence_1.return)) _a.call(sentence_1);
1090
+ if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
1317
1091
  }
1318
1092
  finally { if (e_1) throw e_1.error; }
1319
1093
  }
@@ -1324,6 +1098,11 @@
1324
1098
  return normalizedName;
1325
1099
  }
1326
1100
  /**
1101
+ * TODO: Tests
1102
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
1103
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěščřžžýáíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
1104
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
1105
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
1327
1106
  * TODO: [🌺] Use some intermediate util splitWords
1328
1107
  */
1329
1108
 
@@ -1373,13 +1152,12 @@
1373
1152
  .filter(function (value) { return value !== ''; });
1374
1153
  }
1375
1154
 
1376
- function normalizeTo_PascalCase(sentence) {
1377
- return normalizeTo_camelCase(sentence, true);
1155
+ function normalizeTo_PascalCase(text) {
1156
+ return normalizeTo_camelCase(text, true);
1378
1157
  }
1379
1158
 
1380
- /* tslint:disable */
1381
- function normalizeTo_snake_case(sentence) {
1382
- return normalizeTo_SCREAMING_CASE(sentence).toLowerCase();
1159
+ function normalizeTo_snake_case(text) {
1160
+ return normalizeTo_SCREAMING_CASE(text).toLowerCase();
1383
1161
  }
1384
1162
 
1385
1163
  /**
@@ -1449,6 +1227,154 @@
1449
1227
  return true;
1450
1228
  }
1451
1229
 
1230
+ /**
1231
+ * Function parseNumber will parse number from string
1232
+ *
1233
+ * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
1234
+ * Note: it also works only with decimal numbers
1235
+ *
1236
+ * @returns parsed number
1237
+ * @throws {ParsingError} if the value is not a number
1238
+ *
1239
+ * @private within the parseCommand
1240
+ */
1241
+ function parseNumber(value) {
1242
+ var originalValue = value;
1243
+ if (typeof value === 'number') {
1244
+ value = value.toString(); // <- TODO: Maybe more efficient way to do this
1245
+ }
1246
+ if (typeof value !== 'string') {
1247
+ return 0;
1248
+ }
1249
+ value = value.trim();
1250
+ if (value.startsWith('+')) {
1251
+ return parseNumber(value.substring(1));
1252
+ }
1253
+ if (value.startsWith('-')) {
1254
+ var number = parseNumber(value.substring(1));
1255
+ if (number === 0) {
1256
+ return 0; // <- Note: To prevent -0
1257
+ }
1258
+ return -number;
1259
+ }
1260
+ value = value.replace(/,/g, '.');
1261
+ value = value.toUpperCase();
1262
+ if (value === '') {
1263
+ return 0;
1264
+ }
1265
+ if (value === '♾' || value.startsWith('INF')) {
1266
+ return Infinity;
1267
+ }
1268
+ if (value.includes('/')) {
1269
+ var _a = __read(value.split('/'), 2), numerator_ = _a[0], denominator_ = _a[1];
1270
+ var numerator = parseNumber(numerator_);
1271
+ var denominator = parseNumber(denominator_);
1272
+ if (denominator === 0) {
1273
+ throw new ParsingError("Unable to parse number from \"".concat(originalValue, "\" because denominator is zero"));
1274
+ }
1275
+ return numerator / denominator;
1276
+ }
1277
+ if (/^(NAN|NULL|NONE|UNDEFINED|ZERO|NO.*)$/.test(value)) {
1278
+ return 0;
1279
+ }
1280
+ if (value.includes('E')) {
1281
+ var _b = __read(value.split('E'), 2), significand = _b[0], exponent = _b[1];
1282
+ return parseNumber(significand) * Math.pow(10, parseNumber(exponent));
1283
+ }
1284
+ if (!/^[0-9.]+$/.test(value) || value.split('.').length > 2) {
1285
+ throw new ParsingError("Unable to parse number from \"".concat(originalValue, "\""));
1286
+ }
1287
+ var num = parseFloat(value);
1288
+ if (isNaN(num)) {
1289
+ throw new ParsingError("Unexpected NaN when parsing number from \"".concat(originalValue, "\""));
1290
+ }
1291
+ return num;
1292
+ }
1293
+ /**
1294
+ * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
1295
+ */
1296
+
1297
+ /**
1298
+ * Extracts all code blocks from markdown.
1299
+ *
1300
+ * Note: There are 3 simmilar function:
1301
+ * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1302
+ * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1303
+ * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1304
+ *
1305
+ * @param markdown any valid markdown
1306
+ * @returns code blocks with language and content
1307
+ *
1308
+ */
1309
+ function extractAllBlocksFromMarkdown(markdown) {
1310
+ var e_1, _a;
1311
+ var codeBlocks = [];
1312
+ var lines = markdown.split('\n');
1313
+ var currentCodeBlock = null;
1314
+ try {
1315
+ for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
1316
+ var line = lines_1_1.value;
1317
+ if (line.startsWith('```')) {
1318
+ var language = line.slice(3).trim() || null;
1319
+ if (currentCodeBlock === null) {
1320
+ currentCodeBlock = { language: language, content: '' };
1321
+ }
1322
+ else {
1323
+ if (language !== null) {
1324
+ // [🌻]
1325
+ throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed and already opening new ").concat(language, " code block"));
1326
+ }
1327
+ codeBlocks.push(currentCodeBlock);
1328
+ currentCodeBlock = null;
1329
+ }
1330
+ }
1331
+ else if (currentCodeBlock !== null) {
1332
+ if (currentCodeBlock.content !== '') {
1333
+ currentCodeBlock.content += '\n';
1334
+ }
1335
+ currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make propper unescape */;
1336
+ }
1337
+ }
1338
+ }
1339
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1340
+ finally {
1341
+ try {
1342
+ if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
1343
+ }
1344
+ finally { if (e_1) throw e_1.error; }
1345
+ }
1346
+ if (currentCodeBlock !== null) {
1347
+ // [🌻]
1348
+ throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed at the end of the markdown"));
1349
+ }
1350
+ return codeBlocks;
1351
+ }
1352
+
1353
+ /**
1354
+ * Extracts exactly ONE code block from markdown.
1355
+ *
1356
+ * Note: If there are multiple or no code blocks the function throws an error
1357
+ *
1358
+ * Note: There are 3 simmilar function:
1359
+ * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1360
+ * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1361
+ * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1362
+ *
1363
+ * @param markdown any valid markdown
1364
+ * @returns code block with language and content
1365
+ */
1366
+ function extractOneBlockFromMarkdown(markdown) {
1367
+ var codeBlocks = extractAllBlocksFromMarkdown(markdown);
1368
+ if (codeBlocks.length !== 1) {
1369
+ // TODO: Report more specific place where the error happened
1370
+ throw new Error(/* <- [🌻] */ 'There should be exactly one code block in the markdown');
1371
+ }
1372
+ return codeBlocks[0];
1373
+ }
1374
+ /***
1375
+ * TODO: [🍓][🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
1376
+ */
1377
+
1452
1378
  /**
1453
1379
  * Extracts code block from markdown.
1454
1380
  *
@@ -1489,6 +1415,8 @@
1489
1415
 
1490
1416
  /**
1491
1417
  * Create difference set of two sets.
1418
+ *
1419
+ * @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
1492
1420
  */
1493
1421
  function difference(a, b, isEqual) {
1494
1422
  var e_1, _a;
@@ -1517,6 +1445,8 @@
1517
1445
 
1518
1446
  /**
1519
1447
  * Creates a new set with all elements that are present in all sets
1448
+ *
1449
+ * @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
1520
1450
  */
1521
1451
  function intersection() {
1522
1452
  var e_1, _a;
@@ -1554,6 +1484,8 @@
1554
1484
 
1555
1485
  /**
1556
1486
  * Creates a new set with all elements that are present in either set
1487
+ *
1488
+ * @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
1557
1489
  */
1558
1490
  function union() {
1559
1491
  var e_1, _a, e_2, _b;
@@ -1692,10 +1624,196 @@
1692
1624
  * TODO: [🧠] Should this also unwrap the (parenthesis)
1693
1625
  */
1694
1626
 
1627
+ /**
1628
+ * Tests if given string is valid URL.
1629
+ *
1630
+ * Note: This does not check if the file exists only if the path is valid
1631
+ */
1632
+ function isValidFilePath(filePath) {
1633
+ if (typeof filePath !== 'string') {
1634
+ return false;
1635
+ }
1636
+ var filePathSlashes = filePath.split('\\').join('/');
1637
+ // Absolute Unix path: /hello.txt
1638
+ if (/^(\/)/i.test(filePathSlashes)) {
1639
+ return true;
1640
+ }
1641
+ // Absolute Windows path: /hello.txt
1642
+ if (/^([A-Z]{1,2}:\/?)\//i.test(filePathSlashes)) {
1643
+ return true;
1644
+ }
1645
+ // Relative path: ./hello.txt
1646
+ if (/^(\.\.?\/)+/i.test(filePathSlashes)) {
1647
+ return true;
1648
+ }
1649
+ return false;
1650
+ }
1651
+
1652
+ function isValidJavascriptName(javascriptName) {
1653
+ if (typeof javascriptName !== 'string') {
1654
+ return false;
1655
+ }
1656
+ return /^[a-zA-Z_$][0-9a-zA-Z_$]*$/i.test(javascriptName);
1657
+ }
1658
+
1659
+ /**
1660
+ * Tests if given string is valid semantic version
1661
+ *
1662
+ * Note: There are two simmilar functions:
1663
+ * - `isValidSemanticVersion` which tests any semantic version
1664
+ * - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
1665
+ */
1666
+ function isValidSemanticVersion(version) {
1667
+ if (typeof version !== 'string') {
1668
+ return false;
1669
+ }
1670
+ if (version.startsWith('0.0.0')) {
1671
+ return false;
1672
+ }
1673
+ return /^\d+\.\d+\.\d+(-\d+)?$/i.test(version);
1674
+ }
1675
+
1676
+ /**
1677
+ * Tests if given string is valid promptbook version
1678
+ * It looks into list of known promptbook versions.
1679
+ *
1680
+ * @see https://www.npmjs.com/package/promptbook?activeTab=versions
1681
+ * Note: When you are using for example promptbook 2.0.0 and there already is promptbook 3.0.0 it don`t know about it.
1682
+ * Note: There are two simmilar functions:
1683
+ * - `isValidSemanticVersion` which tests any semantic version
1684
+ * - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
1685
+ */
1686
+ function isValidPromptbookVersion(version) {
1687
+ if (!isValidSemanticVersion(version)) {
1688
+ return false;
1689
+ }
1690
+ if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
1691
+ return false;
1692
+ }
1693
+ // <- TODO: !!!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
1694
+ return true;
1695
+ }
1696
+
1697
+ /**
1698
+ * Checks if an URL is reserved for private networks or localhost.
1699
+ *
1700
+ * Note: There are two simmilar functions:
1701
+ * - `isUrlOnPrivateNetwork` which tests full URL
1702
+ * - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
1703
+ */
1704
+ function isHostnameOnPrivateNetwork(hostname) {
1705
+ if (hostname === 'example.com' ||
1706
+ hostname === 'localhost' ||
1707
+ hostname.endsWith('.localhost') ||
1708
+ hostname.endsWith('.local') ||
1709
+ hostname.endsWith('.test') ||
1710
+ hostname === '127.0.0.1' ||
1711
+ hostname === '::1') {
1712
+ return true;
1713
+ }
1714
+ if (hostname.includes(':')) {
1715
+ // IPv6
1716
+ var ipParts = hostname.split(':');
1717
+ return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
1718
+ }
1719
+ else {
1720
+ // IPv4
1721
+ var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
1722
+ return (ipParts[0] === 10 ||
1723
+ (ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
1724
+ (ipParts[0] === 192 && ipParts[1] === 168));
1725
+ }
1726
+ }
1727
+
1728
+ /**
1729
+ * Checks if an IP address or hostname is reserved for private networks or localhost.
1730
+ *
1731
+ * Note: There are two simmilar functions:
1732
+ * - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
1733
+ * - `isHostnameOnPrivateNetwork` which tests just hostname
1734
+ *
1735
+ * @param {string} ipAddress - The IP address to check.
1736
+ * @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
1737
+ */
1738
+ function isUrlOnPrivateNetwork(url) {
1739
+ if (typeof url === 'string') {
1740
+ url = new URL(url);
1741
+ }
1742
+ return isHostnameOnPrivateNetwork(url.hostname);
1743
+ }
1744
+
1745
+ /**
1746
+ * Tests if given string is valid URL.
1747
+ *
1748
+ * Note: Dataurl are considered perfectly valid.
1749
+ * Note: There are two simmilar functions:
1750
+ * - `isValidUrl` which tests any URL
1751
+ * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
1752
+ */
1753
+ function isValidUrl(url) {
1754
+ if (typeof url !== 'string') {
1755
+ return false;
1756
+ }
1757
+ try {
1758
+ if (url.startsWith('blob:')) {
1759
+ url = url.replace(/^blob:/, '');
1760
+ }
1761
+ var urlObject = new URL(url /* because fail is handled */);
1762
+ if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
1763
+ return false;
1764
+ }
1765
+ return true;
1766
+ }
1767
+ catch (error) {
1768
+ return false;
1769
+ }
1770
+ }
1771
+
1772
+ /**
1773
+ * Tests if given string is valid pipeline URL URL.
1774
+ *
1775
+ * Note: There are two simmilar functions:
1776
+ * - `isValidUrl` which tests any URL
1777
+ * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
1778
+ */
1779
+ function isValidPipelineUrl(url) {
1780
+ if (!isValidUrl(url)) {
1781
+ return false;
1782
+ }
1783
+ if (!url.startsWith('https://')) {
1784
+ return false;
1785
+ }
1786
+ if (!url.endsWith('.ptbk.md')) {
1787
+ return false;
1788
+ }
1789
+ if (url.includes('#')) {
1790
+ // TODO: [🐠]
1791
+ return false;
1792
+ }
1793
+ if (isUrlOnPrivateNetwork(url)) {
1794
+ return false;
1795
+ }
1796
+ return true;
1797
+ }
1798
+ /**
1799
+ * TODO: [🐠] Maybe more info why the URL is invalid
1800
+ */
1801
+
1802
+ /**
1803
+ * Checks if value is valid uuid
1804
+ */
1805
+ function isValidUuid(value) {
1806
+ if (typeof value !== 'string') {
1807
+ return false;
1808
+ }
1809
+ return /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i.test(value);
1810
+ }
1811
+
1695
1812
  /**
1696
1813
  * The version of the Promptbook library
1697
1814
  */
1698
- var PROMPTBOOK_VERSION = '0.60.0';
1815
+ var PROMPTBOOK_VERSION = '0.61.0-0';
1816
+ // TODO: !!!! List here all the versions and annotate + put into script
1699
1817
 
1700
1818
  // @promptbook/utils
1701
1819
  // And the normalization (originally n12 library) utilities:
@@ -1709,7 +1827,7 @@
1709
1827
  'kebab-case': normalizeToKebabCase,
1710
1828
  };
1711
1829
  /**
1712
- * TODO: [🧠] Maybe create some indipendent package like `markdown-tools` from both here exported and @private utilities
1830
+ * TODO: [🧠] Maybe create some indipendent package like `@promptbook/markdown-utils`
1713
1831
  * Note: [🕙] It does not make sence to have simple lower / UPPER case normalization
1714
1832
  */
1715
1833
 
@@ -1729,17 +1847,23 @@
1729
1847
  exports.countWords = countWords;
1730
1848
  exports.decapitalize = decapitalize;
1731
1849
  exports.difference = difference;
1732
- exports.extractAllBlocksFromMarkdown = extractAllBlocksFromMarkdown;
1733
- exports.extractAllListItemsFromMarkdown = extractAllListItemsFromMarkdown;
1734
1850
  exports.extractBlock = extractBlock;
1735
- exports.extractOneBlockFromMarkdown = extractOneBlockFromMarkdown;
1736
1851
  exports.extractParameters = extractParameters;
1737
1852
  exports.extractParametersFromPromptTemplate = extractParametersFromPromptTemplate;
1738
1853
  exports.extractVariables = extractVariables;
1739
1854
  exports.forEachAsync = forEachAsync;
1740
1855
  exports.intersection = intersection;
1856
+ exports.isHostnameOnPrivateNetwork = isHostnameOnPrivateNetwork;
1857
+ exports.isUrlOnPrivateNetwork = isUrlOnPrivateNetwork;
1858
+ exports.isValidFilePath = isValidFilePath;
1859
+ exports.isValidJavascriptName = isValidJavascriptName;
1741
1860
  exports.isValidJsonString = isValidJsonString;
1742
1861
  exports.isValidKeyword = isValidKeyword;
1862
+ exports.isValidPipelineUrl = isValidPipelineUrl;
1863
+ exports.isValidPromptbookVersion = isValidPromptbookVersion;
1864
+ exports.isValidSemanticVersion = isValidSemanticVersion;
1865
+ exports.isValidUrl = isValidUrl;
1866
+ exports.isValidUuid = isValidUuid;
1743
1867
  exports.nameToUriPart = nameToUriPart;
1744
1868
  exports.nameToUriParts = nameToUriParts;
1745
1869
  exports.normalizeTo = normalizeTo;
@@ -1752,10 +1876,8 @@
1752
1876
  exports.parseKeywords = parseKeywords;
1753
1877
  exports.parseKeywordsFromString = parseKeywordsFromString;
1754
1878
  exports.parseNumber = parseNumber;
1755
- exports.removeContentComments = removeContentComments;
1756
1879
  exports.removeDiacritics = removeDiacritics;
1757
1880
  exports.removeEmojis = removeEmojis;
1758
- exports.removeMarkdownFormatting = removeMarkdownFormatting;
1759
1881
  exports.removeQuotes = removeQuotes;
1760
1882
  exports.renameParameter = renameParameter;
1761
1883
  exports.renderPromptbookMermaid = renderPromptbookMermaid;