@promptbook/utils 0.62.0 → 0.63.0-0
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 +268 -68
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
- package/esm/typings/src/_packages/azure-openai.index.d.ts +4 -2
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +1 -7
- package/esm/typings/src/_packages/core.index.d.ts +87 -13
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +5 -45
- package/esm/typings/src/_packages/fake-llm.index.d.ts +4 -5
- package/esm/typings/src/_packages/langtail.index.d.ts +4 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +23 -4
- package/esm/typings/src/_packages/node.index.d.ts +5 -2
- package/esm/typings/src/_packages/openai.index.d.ts +5 -2
- package/esm/typings/src/_packages/remote-client.index.d.ts +5 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +441 -21
- package/esm/typings/src/_packages/utils.index.d.ts +84 -31
- package/esm/typings/src/cli/main.d.ts +12 -0
- package/esm/typings/src/collection/collectionToJson.d.ts +2 -0
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
- package/esm/typings/src/config.d.ts +27 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
- package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -0
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -0
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
- package/esm/typings/src/conversion/utils/titleToName.d.ts +6 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
- package/esm/typings/src/errors/CollectionError.d.ts +2 -0
- package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
- package/esm/typings/src/errors/LimitReachedError.d.ts +2 -0
- package/esm/typings/src/errors/NotFoundError.d.ts +2 -0
- package/esm/typings/src/errors/NotYetImplementedError.d.ts +2 -0
- package/esm/typings/src/errors/ParsingError.d.ts +2 -0
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +2 -0
- package/esm/typings/src/errors/PipelineLogicError.d.ts +2 -0
- package/esm/typings/src/errors/ReferenceError.d.ts +2 -0
- package/esm/typings/src/errors/UnexpectedError.d.ts +2 -0
- package/esm/typings/src/errors/VersionMismatchError.d.ts +2 -0
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -0
- package/esm/typings/src/execution/embeddingVectorToString.d.ts +2 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +3 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +2 -0
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +2 -1
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
- package/esm/typings/src/types/ModelRequirements.d.ts +0 -1
- package/esm/typings/src/types/Prompt.d.ts +0 -1
- package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
- package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
- package/esm/typings/src/types/typeAliases.d.ts +9 -2
- package/esm/typings/src/utils/currentDate.d.ts +1 -0
- package/esm/typings/src/utils/deepClone.d.ts +2 -1
- package/esm/typings/src/utils/deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -0
- package/esm/typings/src/utils/extractParameterNames.d.ts +1 -0
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +6 -3
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
- package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
- package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
- package/esm/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
- package/esm/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
- package/esm/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
- package/esm/typings/src/utils/normalization/IKeywords.d.ts +3 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +1 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +1 -0
- package/esm/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
- package/esm/typings/src/utils/parseNumber.d.ts +2 -1
- package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +1 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/replaceParameters.d.ts +1 -0
- package/esm/typings/src/utils/sets/difference.d.ts +1 -0
- package/esm/typings/src/utils/sets/intersection.d.ts +1 -0
- package/esm/typings/src/utils/sets/union.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
- package/esm/typings/src/utils/unwrapResult.d.ts +1 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +272 -72
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
- package/umd/typings/src/_packages/azure-openai.index.d.ts +4 -2
- package/umd/typings/src/_packages/browser.index.d.ts +6 -0
- package/umd/typings/src/_packages/cli.index.d.ts +1 -7
- package/umd/typings/src/_packages/core.index.d.ts +87 -13
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +5 -45
- package/umd/typings/src/_packages/fake-llm.index.d.ts +4 -5
- package/umd/typings/src/_packages/langtail.index.d.ts +4 -2
- package/umd/typings/src/_packages/markdown-utils.index.d.ts +23 -4
- package/umd/typings/src/_packages/node.index.d.ts +5 -2
- package/umd/typings/src/_packages/openai.index.d.ts +5 -2
- package/umd/typings/src/_packages/remote-client.index.d.ts +5 -2
- package/umd/typings/src/_packages/remote-server.index.d.ts +4 -2
- package/umd/typings/src/_packages/types.index.d.ts +441 -21
- package/umd/typings/src/_packages/utils.index.d.ts +84 -31
- package/umd/typings/src/cli/main.d.ts +12 -0
- package/umd/typings/src/collection/collectionToJson.d.ts +2 -0
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
- package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
- package/umd/typings/src/config.d.ts +27 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
- package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
- package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
- package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
- package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -0
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +1 -0
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
- package/umd/typings/src/conversion/utils/titleToName.d.ts +6 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
- package/umd/typings/src/errors/CollectionError.d.ts +2 -0
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
- package/umd/typings/src/errors/LimitReachedError.d.ts +2 -0
- package/umd/typings/src/errors/NotFoundError.d.ts +2 -0
- package/umd/typings/src/errors/NotYetImplementedError.d.ts +2 -0
- package/umd/typings/src/errors/ParsingError.d.ts +2 -0
- package/umd/typings/src/errors/PipelineExecutionError.d.ts +2 -0
- package/umd/typings/src/errors/PipelineLogicError.d.ts +2 -0
- package/umd/typings/src/errors/ReferenceError.d.ts +2 -0
- package/umd/typings/src/errors/UnexpectedError.d.ts +2 -0
- package/umd/typings/src/errors/VersionMismatchError.d.ts +2 -0
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +1 -0
- package/umd/typings/src/execution/embeddingVectorToString.d.ts +2 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +3 -1
- package/umd/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/umd/typings/src/execution/utils/usageToHuman.d.ts +2 -0
- package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
- package/umd/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
- package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
- package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/umd/typings/src/personas/preparePersona.d.ts +1 -1
- package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/umd/typings/src/prepare/prepareTemplates.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +2 -1
- package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
- package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
- package/umd/typings/src/types/ModelRequirements.d.ts +0 -1
- package/umd/typings/src/types/Prompt.d.ts +0 -1
- package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
- package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
- package/umd/typings/src/types/typeAliases.d.ts +9 -2
- package/umd/typings/src/utils/currentDate.d.ts +1 -0
- package/umd/typings/src/utils/deepClone.d.ts +2 -1
- package/umd/typings/src/utils/deepFreeze.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
- package/umd/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -0
- package/umd/typings/src/utils/extractParameterNames.d.ts +1 -0
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +6 -3
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
- package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
- package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
- package/umd/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
- package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
- package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
- package/umd/typings/src/utils/normalization/IKeywords.d.ts +3 -0
- package/umd/typings/src/utils/normalization/capitalize.d.ts +1 -0
- package/umd/typings/src/utils/normalization/decapitalize.d.ts +1 -0
- package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
- package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
- package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
- package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
- package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
- package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
- package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
- package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
- package/umd/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
- package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
- package/umd/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
- package/umd/typings/src/utils/parseNumber.d.ts +2 -1
- package/umd/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/umd/typings/src/utils/removeEmojis.d.ts +1 -0
- package/umd/typings/src/utils/removeQuotes.d.ts +1 -0
- package/umd/typings/src/utils/replaceParameters.d.ts +1 -0
- package/umd/typings/src/utils/sets/difference.d.ts +1 -0
- package/umd/typings/src/utils/sets/intersection.d.ts +1 -0
- package/umd/typings/src/utils/sets/union.d.ts +1 -0
- package/umd/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
- package/umd/typings/src/utils/unwrapResult.d.ts +1 -0
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
- package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/umd/typings/src/version.d.ts +2 -0
package/esm/index.es.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The version of the Promptbook library
|
|
5
|
+
*
|
|
6
|
+
* @public exported from all packages
|
|
7
|
+
*/
|
|
8
|
+
var PROMPTBOOK_VERSION = '0.62.0';
|
|
9
|
+
// TODO: !!!! List here all the versions and annotate + put into script
|
|
3
10
|
|
|
4
11
|
/*! *****************************************************************************
|
|
5
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -122,6 +129,8 @@ function __spreadArray(to, from, pack) {
|
|
|
122
129
|
|
|
123
130
|
/**
|
|
124
131
|
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
132
|
+
*
|
|
133
|
+
* @public exported from `@promptbook/core`
|
|
125
134
|
*/
|
|
126
135
|
var UnexpectedError = /** @class */ (function (_super) {
|
|
127
136
|
__extends(UnexpectedError, _super);
|
|
@@ -134,6 +143,16 @@ var UnexpectedError = /** @class */ (function (_super) {
|
|
|
134
143
|
return UnexpectedError;
|
|
135
144
|
}(Error));
|
|
136
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @@@
|
|
148
|
+
*
|
|
149
|
+
* @param text @@@
|
|
150
|
+
* @param _isFirstLetterCapital @@@
|
|
151
|
+
* @returns @@@
|
|
152
|
+
* @example 'helloWorld'
|
|
153
|
+
* @example 'iLovePromptbook'
|
|
154
|
+
* @public exported from `@promptbook/utils`
|
|
155
|
+
*/
|
|
137
156
|
function normalizeTo_camelCase(text, _isFirstLetterCapital) {
|
|
138
157
|
var e_1, _a;
|
|
139
158
|
if (_isFirstLetterCapital === void 0) { _isFirstLetterCapital = false; }
|
|
@@ -404,6 +423,8 @@ var defaultDiacriticsRemovalMap = [
|
|
|
404
423
|
* > "ě" => "e"
|
|
405
424
|
* > "Ă" => "A"
|
|
406
425
|
* > ...
|
|
426
|
+
*
|
|
427
|
+
* @public exported from `@promptbook/utils`
|
|
407
428
|
*/
|
|
408
429
|
var DIACRITIC_VARIANTS_LETTERS = {};
|
|
409
430
|
// tslint:disable-next-line: prefer-for-of
|
|
@@ -431,7 +452,11 @@ for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
431
452
|
*/
|
|
432
453
|
|
|
433
454
|
/**
|
|
455
|
+
* @@@
|
|
434
456
|
*
|
|
457
|
+
* @param input @@@
|
|
458
|
+
* @returns @@@
|
|
459
|
+
* @public exported from `@promptbook/utils`
|
|
435
460
|
*/
|
|
436
461
|
function removeDiacritics(input) {
|
|
437
462
|
/*eslint no-control-regex: "off"*/
|
|
@@ -439,7 +464,19 @@ function removeDiacritics(input) {
|
|
|
439
464
|
return DIACRITIC_VARIANTS_LETTERS[a] || a;
|
|
440
465
|
});
|
|
441
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
469
|
+
*/
|
|
442
470
|
|
|
471
|
+
/**
|
|
472
|
+
* @@@
|
|
473
|
+
*
|
|
474
|
+
* @param text @@@
|
|
475
|
+
* @returns @@@
|
|
476
|
+
* @example 'hello-world'
|
|
477
|
+
* @example 'i-love-promptbook'
|
|
478
|
+
* @public exported from `@promptbook/utils`
|
|
479
|
+
*/
|
|
443
480
|
function normalizeToKebabCase(text) {
|
|
444
481
|
var e_1, _a;
|
|
445
482
|
text = removeDiacritics(text);
|
|
@@ -499,6 +536,7 @@ function normalizeToKebabCase(text) {
|
|
|
499
536
|
*
|
|
500
537
|
* @param text with emojis
|
|
501
538
|
* @returns text without emojis
|
|
539
|
+
* @public exported from `@promptbook/utils`
|
|
502
540
|
*/
|
|
503
541
|
function removeEmojis(text) {
|
|
504
542
|
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
@@ -510,7 +548,12 @@ function removeEmojis(text) {
|
|
|
510
548
|
}
|
|
511
549
|
|
|
512
550
|
/**
|
|
513
|
-
*
|
|
551
|
+
* @@@
|
|
552
|
+
*
|
|
553
|
+
* @param value @@@
|
|
554
|
+
* @returns @@@
|
|
555
|
+
* @example @@@
|
|
556
|
+
* @public exported from `@promptbook/utils`
|
|
514
557
|
*/
|
|
515
558
|
function titleToName(value) {
|
|
516
559
|
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
@@ -531,6 +574,8 @@ function titleToName(value) {
|
|
|
531
574
|
* Creates a Mermaid graph based on the promptbook
|
|
532
575
|
*
|
|
533
576
|
* Note: The result is not wrapped in a Markdown code block
|
|
577
|
+
*
|
|
578
|
+
* @public exported from `@promptbook/utils`
|
|
534
579
|
*/
|
|
535
580
|
function renderPromptbookMermaid(pipelineJson, options) {
|
|
536
581
|
var _a = (options || {}).linkPromptTemplate, linkPromptTemplate = _a === void 0 ? function () { return null; } : _a;
|
|
@@ -590,6 +635,7 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
590
635
|
*
|
|
591
636
|
* @param template the template with parameters in {curly} braces
|
|
592
637
|
* @returns the list of parameter names
|
|
638
|
+
* @public exported from `@promptbook/utils`
|
|
593
639
|
*/
|
|
594
640
|
function extractParameterNames(template) {
|
|
595
641
|
var e_1, _a;
|
|
@@ -614,6 +660,8 @@ function extractParameterNames(template) {
|
|
|
614
660
|
|
|
615
661
|
/**
|
|
616
662
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
663
|
+
*
|
|
664
|
+
* @public exported from `@promptbook/core`
|
|
617
665
|
*/
|
|
618
666
|
var ParsingError = /** @class */ (function (_super) {
|
|
619
667
|
__extends(ParsingError, _super);
|
|
@@ -632,6 +680,7 @@ var ParsingError = /** @class */ (function (_super) {
|
|
|
632
680
|
* @param script from which to extract the variables
|
|
633
681
|
* @returns the list of variable names
|
|
634
682
|
* @throws {ParsingError} if the script is invalid
|
|
683
|
+
* @public exported from `@promptbook/utils`
|
|
635
684
|
*/
|
|
636
685
|
function extractVariables(script) {
|
|
637
686
|
var variables = new Set();
|
|
@@ -680,6 +729,7 @@ function extractVariables(script) {
|
|
|
680
729
|
* @param promptTemplate the template with used parameters
|
|
681
730
|
* @returns the set of parameter names
|
|
682
731
|
* @throws {ParsingError} if the script is invalid
|
|
732
|
+
* @public exported from `@promptbook/utils`
|
|
683
733
|
*/
|
|
684
734
|
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
685
735
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
@@ -736,6 +786,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
736
786
|
|
|
737
787
|
/**
|
|
738
788
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
789
|
+
*
|
|
790
|
+
* @public exported from `@promptbook/core`
|
|
739
791
|
*/
|
|
740
792
|
var PipelineLogicError = /** @class */ (function (_super) {
|
|
741
793
|
__extends(PipelineLogicError, _super);
|
|
@@ -753,6 +805,7 @@ var PipelineLogicError = /** @class */ (function (_super) {
|
|
|
753
805
|
* In other words, it will find all parameters that are not used in the prompt template itseld and all its dependencies
|
|
754
806
|
*
|
|
755
807
|
* @throws {PipelineLogicError} If the new parameter name is already used in the pipeline
|
|
808
|
+
* @public exported from `@promptbook/utils`
|
|
756
809
|
*/
|
|
757
810
|
function renameParameter(options) {
|
|
758
811
|
var e_1, _a, e_2, _b;
|
|
@@ -810,6 +863,7 @@ function renameParameter(options) {
|
|
|
810
863
|
* @param array - Array to iterate over
|
|
811
864
|
* @param options - Options for the function
|
|
812
865
|
* @param callbackfunction - Function to call for each item
|
|
866
|
+
* @public exported from `@promptbook/utils`
|
|
813
867
|
*/
|
|
814
868
|
function forEachAsync(array, options, callbackfunction) {
|
|
815
869
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -880,6 +934,8 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
880
934
|
|
|
881
935
|
/**
|
|
882
936
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
937
|
+
*
|
|
938
|
+
* @public exported from `@promptbook/utils`
|
|
883
939
|
*/
|
|
884
940
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
885
941
|
try {
|
|
@@ -900,6 +956,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
900
956
|
/**
|
|
901
957
|
* Makes first letter of a string uppercase
|
|
902
958
|
*
|
|
959
|
+
* @public exported from `@promptbook/utils`
|
|
903
960
|
*/
|
|
904
961
|
function capitalize(word) {
|
|
905
962
|
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
@@ -915,7 +972,7 @@ function capitalize(word) {
|
|
|
915
972
|
*
|
|
916
973
|
* @param markdown any valid markdown
|
|
917
974
|
* @returns code blocks with language and content
|
|
918
|
-
*
|
|
975
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
919
976
|
*/
|
|
920
977
|
function extractAllBlocksFromMarkdown(markdown) {
|
|
921
978
|
var e_1, _a;
|
|
@@ -992,6 +1049,7 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
992
1049
|
*
|
|
993
1050
|
* @param markdown any valid markdown
|
|
994
1051
|
* @returns code block with language and content
|
|
1052
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
995
1053
|
*/
|
|
996
1054
|
function extractOneBlockFromMarkdown(markdown) {
|
|
997
1055
|
var codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
@@ -1013,24 +1071,98 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
1013
1071
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
1014
1072
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
1015
1073
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
1074
|
+
*
|
|
1075
|
+
* @public exported from `@promptbook/utils`
|
|
1016
1076
|
*/
|
|
1017
1077
|
function extractBlock(markdown) {
|
|
1018
1078
|
var content = extractOneBlockFromMarkdown(markdown).content;
|
|
1019
1079
|
return content;
|
|
1020
1080
|
}
|
|
1021
|
-
|
|
1081
|
+
/**
|
|
1082
|
+
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
1083
|
+
*/
|
|
1022
1084
|
|
|
1023
1085
|
/**
|
|
1024
1086
|
* Simple wrapper `new Date().toISOString()`
|
|
1025
1087
|
*
|
|
1026
1088
|
* @returns string_date branded type
|
|
1089
|
+
* @public exported from `@promptbook/utils`
|
|
1027
1090
|
*/
|
|
1028
1091
|
function $currentDate() {
|
|
1029
1092
|
return new Date().toISOString();
|
|
1030
1093
|
}
|
|
1031
1094
|
|
|
1095
|
+
/**
|
|
1096
|
+
* @@@
|
|
1097
|
+
*
|
|
1098
|
+
* @public exported from `@promptbook/utils`
|
|
1099
|
+
*/
|
|
1100
|
+
function deepClone(objectValue) {
|
|
1101
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1102
|
+
/*
|
|
1103
|
+
TODO: [🧠] Is there a better implementation?
|
|
1104
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1105
|
+
> for (const propertyName of propertyNames) {
|
|
1106
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1107
|
+
> if (value && typeof value === 'object') {
|
|
1108
|
+
> deepClone(value);
|
|
1109
|
+
> }
|
|
1110
|
+
> }
|
|
1111
|
+
> return Object.assign({}, objectValue);
|
|
1112
|
+
*/
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1116
|
+
*/
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* @@@
|
|
1120
|
+
*
|
|
1121
|
+
* @returns The same object as the input, but deeply frozen
|
|
1122
|
+
*
|
|
1123
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1124
|
+
*/
|
|
1125
|
+
function deepFreeze(objectValue) {
|
|
1126
|
+
var e_1, _a;
|
|
1127
|
+
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1128
|
+
try {
|
|
1129
|
+
for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
|
|
1130
|
+
var propertyName = propertyNames_1_1.value;
|
|
1131
|
+
var value = objectValue[propertyName];
|
|
1132
|
+
if (value && typeof value === 'object') {
|
|
1133
|
+
deepFreeze(value);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1138
|
+
finally {
|
|
1139
|
+
try {
|
|
1140
|
+
if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
|
|
1141
|
+
}
|
|
1142
|
+
finally { if (e_1) throw e_1.error; }
|
|
1143
|
+
}
|
|
1144
|
+
return Object.freeze(objectValue);
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* @@@
|
|
1148
|
+
* @@@
|
|
1149
|
+
*
|
|
1150
|
+
* @returns The same object as the input, but deeply frozen
|
|
1151
|
+
* @public exported from `@promptbook/utils`
|
|
1152
|
+
*
|
|
1153
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1154
|
+
*/
|
|
1155
|
+
function deepFreezeWithSameType(objectValue) {
|
|
1156
|
+
return deepFreeze(objectValue);
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1160
|
+
*/
|
|
1161
|
+
|
|
1032
1162
|
/**
|
|
1033
1163
|
* Counts number of characters in the text
|
|
1164
|
+
*
|
|
1165
|
+
* @public exported from `@promptbook/utils`
|
|
1034
1166
|
*/
|
|
1035
1167
|
function countCharacters(text) {
|
|
1036
1168
|
// Remove null characters
|
|
@@ -1044,6 +1176,8 @@ function countCharacters(text) {
|
|
|
1044
1176
|
|
|
1045
1177
|
/**
|
|
1046
1178
|
* Counts number of lines in the text
|
|
1179
|
+
*
|
|
1180
|
+
* @public exported from `@promptbook/utils`
|
|
1047
1181
|
*/
|
|
1048
1182
|
function countLines(text) {
|
|
1049
1183
|
if (text === '') {
|
|
@@ -1054,6 +1188,8 @@ function countLines(text) {
|
|
|
1054
1188
|
|
|
1055
1189
|
/**
|
|
1056
1190
|
* Counts number of pages in the text
|
|
1191
|
+
*
|
|
1192
|
+
* @public exported from `@promptbook/utils`
|
|
1057
1193
|
*/
|
|
1058
1194
|
function countPages(text) {
|
|
1059
1195
|
var sentencesPerPage = 5; // Assuming each page has 5 sentences
|
|
@@ -1064,6 +1200,8 @@ function countPages(text) {
|
|
|
1064
1200
|
|
|
1065
1201
|
/**
|
|
1066
1202
|
* Counts number of paragraphs in the text
|
|
1203
|
+
*
|
|
1204
|
+
* @public exported from `@promptbook/utils`
|
|
1067
1205
|
*/
|
|
1068
1206
|
function countParagraphs(text) {
|
|
1069
1207
|
return text.split(/\n\s*\n/).filter(function (paragraph) { return paragraph.trim() !== ''; }).length;
|
|
@@ -1071,12 +1209,16 @@ function countParagraphs(text) {
|
|
|
1071
1209
|
|
|
1072
1210
|
/**
|
|
1073
1211
|
* Split text into sentences
|
|
1212
|
+
*
|
|
1213
|
+
* @public exported from `@promptbook/utils`
|
|
1074
1214
|
*/
|
|
1075
1215
|
function splitIntoSentences(text) {
|
|
1076
1216
|
return text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
|
|
1077
1217
|
}
|
|
1078
1218
|
/**
|
|
1079
1219
|
* Counts number of sentences in the text
|
|
1220
|
+
*
|
|
1221
|
+
* @public exported from `@promptbook/utils`
|
|
1080
1222
|
*/
|
|
1081
1223
|
function countSentences(text) {
|
|
1082
1224
|
return splitIntoSentences(text).length;
|
|
@@ -1084,6 +1226,8 @@ function countSentences(text) {
|
|
|
1084
1226
|
|
|
1085
1227
|
/**
|
|
1086
1228
|
* Counts number of words in the text
|
|
1229
|
+
*
|
|
1230
|
+
* @public exported from `@promptbook/utils`
|
|
1087
1231
|
*/
|
|
1088
1232
|
function countWords(text) {
|
|
1089
1233
|
text = text.replace(/[\p{Extended_Pictographic}]/gu, 'a');
|
|
@@ -1093,6 +1237,8 @@ function countWords(text) {
|
|
|
1093
1237
|
|
|
1094
1238
|
/**
|
|
1095
1239
|
* Index of all counter functions
|
|
1240
|
+
*
|
|
1241
|
+
* @public exported from `@promptbook/utils`
|
|
1096
1242
|
*/
|
|
1097
1243
|
var CountUtils = {
|
|
1098
1244
|
CHARACTERS: countCharacters,
|
|
@@ -1103,14 +1249,43 @@ var CountUtils = {
|
|
|
1103
1249
|
PAGES: countPages,
|
|
1104
1250
|
};
|
|
1105
1251
|
|
|
1252
|
+
/**
|
|
1253
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
1254
|
+
*
|
|
1255
|
+
* @public exported from `@promptbook/utils`
|
|
1256
|
+
*/
|
|
1257
|
+
var isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
1258
|
+
/**
|
|
1259
|
+
* Detects if the code is running in a Node.js environment
|
|
1260
|
+
*
|
|
1261
|
+
* @public exported from `@promptbook/utils`
|
|
1262
|
+
*/
|
|
1263
|
+
var isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
1264
|
+
/**
|
|
1265
|
+
* Detects if the code is running in a web worker
|
|
1266
|
+
*
|
|
1267
|
+
* @public exported from `@promptbook/utils`
|
|
1268
|
+
*/
|
|
1269
|
+
var isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
1270
|
+
|
|
1106
1271
|
/**
|
|
1107
1272
|
* Makes first letter of a string uppercase
|
|
1108
1273
|
*
|
|
1274
|
+
* @public exported from `@promptbook/utils`
|
|
1109
1275
|
*/
|
|
1110
1276
|
function decapitalize(word) {
|
|
1111
1277
|
return word.substring(0, 1).toLowerCase() + word.substring(1);
|
|
1112
1278
|
}
|
|
1113
1279
|
|
|
1280
|
+
/**
|
|
1281
|
+
* @@@
|
|
1282
|
+
*
|
|
1283
|
+
* @param text @@@
|
|
1284
|
+
* @returns @@@
|
|
1285
|
+
* @example 'HELLO_WORLD'
|
|
1286
|
+
* @example 'I_LOVE_PROMPTBOOK'
|
|
1287
|
+
* @public exported from `@promptbook/utils`
|
|
1288
|
+
*/
|
|
1114
1289
|
function normalizeTo_SCREAMING_CASE(text) {
|
|
1115
1290
|
var e_1, _a;
|
|
1116
1291
|
var charType;
|
|
@@ -1177,6 +1352,7 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
1177
1352
|
*
|
|
1178
1353
|
* @param {string} input
|
|
1179
1354
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
1355
|
+
* @public exported from `@promptbook/utils`
|
|
1180
1356
|
*/
|
|
1181
1357
|
function parseKeywordsFromString(input) {
|
|
1182
1358
|
var keywords = normalizeTo_SCREAMING_CASE(removeDiacritics(input))
|
|
@@ -1191,6 +1367,8 @@ function parseKeywordsFromString(input) {
|
|
|
1191
1367
|
*
|
|
1192
1368
|
* @param keyword to test
|
|
1193
1369
|
* @returns if keyword is valid or not
|
|
1370
|
+
*
|
|
1371
|
+
* @public exported from `@promptbook/utils`
|
|
1194
1372
|
*/
|
|
1195
1373
|
function isValidKeyword(keyword) {
|
|
1196
1374
|
var keywordParsed = parseKeywordsFromString(keyword);
|
|
@@ -1202,6 +1380,14 @@ function isValidKeyword(keyword) {
|
|
|
1202
1380
|
return keywordParsedFirst === keyword;
|
|
1203
1381
|
}
|
|
1204
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* @@@
|
|
1385
|
+
*
|
|
1386
|
+
* @param name @@@
|
|
1387
|
+
* @returns @@@
|
|
1388
|
+
* @example @@@
|
|
1389
|
+
* @public exported from `@promptbook/utils`
|
|
1390
|
+
*/
|
|
1205
1391
|
function nameToUriPart(name) {
|
|
1206
1392
|
var uriPart = name;
|
|
1207
1393
|
uriPart = uriPart.toLowerCase();
|
|
@@ -1212,25 +1398,43 @@ function nameToUriPart(name) {
|
|
|
1212
1398
|
return uriPart;
|
|
1213
1399
|
}
|
|
1214
1400
|
|
|
1401
|
+
/**
|
|
1402
|
+
* @@@
|
|
1403
|
+
*
|
|
1404
|
+
* @param name @@@
|
|
1405
|
+
* @returns @@@
|
|
1406
|
+
* @example @@@
|
|
1407
|
+
* @public exported from `@promptbook/utils`
|
|
1408
|
+
*/
|
|
1215
1409
|
function nameToUriParts(name) {
|
|
1216
1410
|
return nameToUriPart(name)
|
|
1217
1411
|
.split('-')
|
|
1218
1412
|
.filter(function (value) { return value !== ''; });
|
|
1219
1413
|
}
|
|
1220
1414
|
|
|
1415
|
+
/**
|
|
1416
|
+
*
|
|
1417
|
+
* @param text @public exported from `@promptbook/utils`
|
|
1418
|
+
* @returns
|
|
1419
|
+
* @example 'HelloWorld'
|
|
1420
|
+
* @example 'ILovePromptbook'
|
|
1421
|
+
* @public exported from `@promptbook/utils`
|
|
1422
|
+
*/
|
|
1221
1423
|
function normalizeTo_PascalCase(text) {
|
|
1222
1424
|
return normalizeTo_camelCase(text, true);
|
|
1223
1425
|
}
|
|
1224
1426
|
|
|
1225
|
-
function normalizeTo_snake_case(text) {
|
|
1226
|
-
return normalizeTo_SCREAMING_CASE(text).toLowerCase();
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
1427
|
/**
|
|
1230
|
-
*
|
|
1428
|
+
* @@@
|
|
1429
|
+
*
|
|
1430
|
+
* @param text @@@
|
|
1431
|
+
* @returns @@@
|
|
1432
|
+
* @example 'hello_world'
|
|
1433
|
+
* @example 'i_love_promptbook'
|
|
1434
|
+
* @public exported from `@promptbook/utils`
|
|
1231
1435
|
*/
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
1436
|
+
function normalizeTo_snake_case(text) {
|
|
1437
|
+
return normalizeTo_SCREAMING_CASE(text).toLowerCase();
|
|
1234
1438
|
}
|
|
1235
1439
|
|
|
1236
1440
|
/**
|
|
@@ -1240,6 +1444,7 @@ function normalizeWhitespaces(sentence) {
|
|
|
1240
1444
|
*
|
|
1241
1445
|
* @param input of any kind
|
|
1242
1446
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
1447
|
+
* @public exported from `@promptbook/utils`
|
|
1243
1448
|
*/
|
|
1244
1449
|
function parseKeywords(input) {
|
|
1245
1450
|
if (typeof input === 'string') {
|
|
@@ -1266,7 +1471,12 @@ function parseKeywords(input) {
|
|
|
1266
1471
|
*/
|
|
1267
1472
|
|
|
1268
1473
|
/**
|
|
1474
|
+
* @@@
|
|
1269
1475
|
*
|
|
1476
|
+
* @param haystack
|
|
1477
|
+
* @param needle
|
|
1478
|
+
* @returns
|
|
1479
|
+
* @public exported from `@promptbook/utils`
|
|
1270
1480
|
*/
|
|
1271
1481
|
function searchKeywords(haystack, needle) {
|
|
1272
1482
|
var e_1, _a;
|
|
@@ -1302,7 +1512,7 @@ function searchKeywords(haystack, needle) {
|
|
|
1302
1512
|
* @returns parsed number
|
|
1303
1513
|
* @throws {ParsingError} if the value is not a number
|
|
1304
1514
|
*
|
|
1305
|
-
* @
|
|
1515
|
+
* @public exported from `@promptbook/utils`
|
|
1306
1516
|
*/
|
|
1307
1517
|
function parseNumber(value) {
|
|
1308
1518
|
var originalValue = value;
|
|
@@ -1358,12 +1568,14 @@ function parseNumber(value) {
|
|
|
1358
1568
|
}
|
|
1359
1569
|
/**
|
|
1360
1570
|
* TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
1571
|
+
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
1361
1572
|
*/
|
|
1362
1573
|
|
|
1363
1574
|
/**
|
|
1364
1575
|
* Generates random seed
|
|
1365
1576
|
*
|
|
1366
1577
|
* Warning: This function is not cryptographically secure (it uses Math.random internally)
|
|
1578
|
+
* @public exported from `@promptbook/utils`
|
|
1367
1579
|
*/
|
|
1368
1580
|
function $randomSeed() {
|
|
1369
1581
|
return Math.random();
|
|
@@ -1380,6 +1592,7 @@ function $randomSeed() {
|
|
|
1380
1592
|
*
|
|
1381
1593
|
* @param text optionally quoted text
|
|
1382
1594
|
* @returns text without quotes
|
|
1595
|
+
* @public exported from `@promptbook/utils`
|
|
1383
1596
|
*/
|
|
1384
1597
|
function removeQuotes(text) {
|
|
1385
1598
|
if (text.startsWith('"') && text.endsWith('"')) {
|
|
@@ -1391,41 +1604,10 @@ function removeQuotes(text) {
|
|
|
1391
1604
|
return text;
|
|
1392
1605
|
}
|
|
1393
1606
|
|
|
1394
|
-
/**
|
|
1395
|
-
* @@@
|
|
1396
|
-
*
|
|
1397
|
-
* @returns The same object as the input, but deeply frozen
|
|
1398
|
-
*
|
|
1399
|
-
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1400
|
-
*/
|
|
1401
|
-
function deepFreeze(objectValue) {
|
|
1402
|
-
var e_1, _a;
|
|
1403
|
-
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1404
|
-
try {
|
|
1405
|
-
for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
|
|
1406
|
-
var propertyName = propertyNames_1_1.value;
|
|
1407
|
-
var value = objectValue[propertyName];
|
|
1408
|
-
if (value && typeof value === 'object') {
|
|
1409
|
-
deepFreeze(value);
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1414
|
-
finally {
|
|
1415
|
-
try {
|
|
1416
|
-
if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
|
|
1417
|
-
}
|
|
1418
|
-
finally { if (e_1) throw e_1.error; }
|
|
1419
|
-
}
|
|
1420
|
-
return Object.freeze(objectValue);
|
|
1421
|
-
}
|
|
1422
|
-
/**
|
|
1423
|
-
* TODO: [🔼] Export from `@promptbook/utils`
|
|
1424
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1425
|
-
*/
|
|
1426
|
-
|
|
1427
1607
|
/**
|
|
1428
1608
|
* The maximum number of iterations for a loops
|
|
1609
|
+
*
|
|
1610
|
+
* @private within the repository - too low-level in comparison to other `MAX_...`
|
|
1429
1611
|
*/
|
|
1430
1612
|
var LOOP_LIMIT = 1000;
|
|
1431
1613
|
/**
|
|
@@ -1434,6 +1616,8 @@ var LOOP_LIMIT = 1000;
|
|
|
1434
1616
|
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
1435
1617
|
/**
|
|
1436
1618
|
* The names of the parameters that are reserved for special purposes
|
|
1619
|
+
*
|
|
1620
|
+
* @public exported from `@promptbook/core`
|
|
1437
1621
|
*/
|
|
1438
1622
|
deepFreeze([
|
|
1439
1623
|
'content',
|
|
@@ -1447,10 +1631,14 @@ deepFreeze([
|
|
|
1447
1631
|
]);
|
|
1448
1632
|
/**
|
|
1449
1633
|
* @@@
|
|
1634
|
+
*
|
|
1635
|
+
* @private within the repository
|
|
1450
1636
|
*/
|
|
1451
1637
|
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1452
1638
|
/**
|
|
1453
1639
|
* @@@
|
|
1640
|
+
*
|
|
1641
|
+
* @private within the repository
|
|
1454
1642
|
*/
|
|
1455
1643
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
1456
1644
|
/*
|
|
@@ -1458,11 +1646,13 @@ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
|
1458
1646
|
*/
|
|
1459
1647
|
// [🟡][🟢][🔵][⚪]
|
|
1460
1648
|
/**
|
|
1461
|
-
* TODO:
|
|
1649
|
+
* TODO: !!!!!! Check that all @private contains some normalized explanation
|
|
1462
1650
|
*/
|
|
1463
1651
|
|
|
1464
1652
|
/**
|
|
1465
1653
|
* This error type indicates that some limit was reached
|
|
1654
|
+
*
|
|
1655
|
+
* @public exported from `@promptbook/core`
|
|
1466
1656
|
*/
|
|
1467
1657
|
var LimitReachedError = /** @class */ (function (_super) {
|
|
1468
1658
|
__extends(LimitReachedError, _super);
|
|
@@ -1477,6 +1667,8 @@ var LimitReachedError = /** @class */ (function (_super) {
|
|
|
1477
1667
|
|
|
1478
1668
|
/**
|
|
1479
1669
|
* This error indicates errors during the execution of the pipeline
|
|
1670
|
+
*
|
|
1671
|
+
* @public exported from `@promptbook/core`
|
|
1480
1672
|
*/
|
|
1481
1673
|
var PipelineExecutionError = /** @class */ (function (_super) {
|
|
1482
1674
|
__extends(PipelineExecutionError, _super);
|
|
@@ -1496,6 +1688,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1496
1688
|
* @param parameters the object with parameters
|
|
1497
1689
|
* @returns the template with replaced parameters
|
|
1498
1690
|
* @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
|
|
1691
|
+
* @public exported from `@promptbook/utils`
|
|
1499
1692
|
*/
|
|
1500
1693
|
function replaceParameters(template, parameters) {
|
|
1501
1694
|
var e_1, _a;
|
|
@@ -1571,6 +1764,7 @@ function replaceParameters(template, parameters) {
|
|
|
1571
1764
|
* Create difference set of two sets.
|
|
1572
1765
|
*
|
|
1573
1766
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1767
|
+
* @public exported from `@promptbook/utils`
|
|
1574
1768
|
*/
|
|
1575
1769
|
function difference(a, b, isEqual) {
|
|
1576
1770
|
var e_1, _a;
|
|
@@ -1604,6 +1798,7 @@ function difference(a, b, isEqual) {
|
|
|
1604
1798
|
* Creates a new set with all elements that are present in all sets
|
|
1605
1799
|
*
|
|
1606
1800
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1801
|
+
* @public exported from `@promptbook/utils`
|
|
1607
1802
|
*/
|
|
1608
1803
|
function intersection() {
|
|
1609
1804
|
var e_1, _a;
|
|
@@ -1643,6 +1838,7 @@ function intersection() {
|
|
|
1643
1838
|
* Creates a new set with all elements that are present in either set
|
|
1644
1839
|
*
|
|
1645
1840
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1841
|
+
* @public exported from `@promptbook/utils`
|
|
1646
1842
|
*/
|
|
1647
1843
|
function union() {
|
|
1648
1844
|
var e_1, _a, e_2, _b;
|
|
@@ -1685,6 +1881,7 @@ function union() {
|
|
|
1685
1881
|
* Note: This is usefull for post-processing of the result of the chat LLM model
|
|
1686
1882
|
* when the model wraps the result in the (markdown) code block.
|
|
1687
1883
|
*
|
|
1884
|
+
* @public exported from `@promptbook/utils`
|
|
1688
1885
|
*/
|
|
1689
1886
|
function trimCodeBlock(value) {
|
|
1690
1887
|
value = spaceTrim(value);
|
|
@@ -1702,6 +1899,8 @@ function trimCodeBlock(value) {
|
|
|
1702
1899
|
*
|
|
1703
1900
|
* Note: This is usefull for post-processing of the result of the completion LLM model
|
|
1704
1901
|
* if you want to start code block in the prompt but you don't want to end it in the result.
|
|
1902
|
+
*
|
|
1903
|
+
* @public exported from `@promptbook/utils`
|
|
1705
1904
|
*/
|
|
1706
1905
|
function trimEndOfCodeBlock(value) {
|
|
1707
1906
|
value = spaceTrim(value);
|
|
@@ -1721,6 +1920,7 @@ function trimEndOfCodeBlock(value) {
|
|
|
1721
1920
|
*
|
|
1722
1921
|
* @param text optionally quoted text
|
|
1723
1922
|
* @returns text without quotes
|
|
1923
|
+
* @public exported from `@promptbook/utils`
|
|
1724
1924
|
*/
|
|
1725
1925
|
function unwrapResult(text, options) {
|
|
1726
1926
|
var _a = options || {}, _b = _a.isTrimmed, isTrimmed = _b === void 0 ? true : _b, _c = _a.isIntroduceSentenceRemoved, isIntroduceSentenceRemoved = _c === void 0 ? true : _c;
|
|
@@ -1785,6 +1985,7 @@ function unwrapResult(text, options) {
|
|
|
1785
1985
|
* Tests if given string is valid URL.
|
|
1786
1986
|
*
|
|
1787
1987
|
* Note: This does not check if the file exists only if the path is valid
|
|
1988
|
+
* @public exported from `@promptbook/utils`
|
|
1788
1989
|
*/
|
|
1789
1990
|
function isValidFilePath(filePath) {
|
|
1790
1991
|
if (typeof filePath !== 'string') {
|
|
@@ -1806,6 +2007,13 @@ function isValidFilePath(filePath) {
|
|
|
1806
2007
|
return false;
|
|
1807
2008
|
}
|
|
1808
2009
|
|
|
2010
|
+
/**
|
|
2011
|
+
* @@@
|
|
2012
|
+
*
|
|
2013
|
+
* @param javascriptName @@@
|
|
2014
|
+
* @returns @@@
|
|
2015
|
+
* @public exported from `@promptbook/utils`
|
|
2016
|
+
*/
|
|
1809
2017
|
function isValidJavascriptName(javascriptName) {
|
|
1810
2018
|
if (typeof javascriptName !== 'string') {
|
|
1811
2019
|
return false;
|
|
@@ -1819,6 +2027,8 @@ function isValidJavascriptName(javascriptName) {
|
|
|
1819
2027
|
* Note: There are two simmilar functions:
|
|
1820
2028
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
1821
2029
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
2030
|
+
*
|
|
2031
|
+
* @public exported from `@promptbook/utils`
|
|
1822
2032
|
*/
|
|
1823
2033
|
function isValidSemanticVersion(version) {
|
|
1824
2034
|
if (typeof version !== 'string') {
|
|
@@ -1839,6 +2049,8 @@ function isValidSemanticVersion(version) {
|
|
|
1839
2049
|
* Note: There are two simmilar functions:
|
|
1840
2050
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
1841
2051
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
2052
|
+
*
|
|
2053
|
+
* @public exported from `@promptbook/utils`
|
|
1842
2054
|
*/
|
|
1843
2055
|
function isValidPromptbookVersion(version) {
|
|
1844
2056
|
if (!isValidSemanticVersion(version)) {
|
|
@@ -1857,6 +2069,8 @@ function isValidPromptbookVersion(version) {
|
|
|
1857
2069
|
* Note: There are two simmilar functions:
|
|
1858
2070
|
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1859
2071
|
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
2072
|
+
*
|
|
2073
|
+
* @public exported from `@promptbook/utils`
|
|
1860
2074
|
*/
|
|
1861
2075
|
function isHostnameOnPrivateNetwork(hostname) {
|
|
1862
2076
|
if (hostname === 'example.com' ||
|
|
@@ -1891,6 +2105,7 @@ function isHostnameOnPrivateNetwork(hostname) {
|
|
|
1891
2105
|
*
|
|
1892
2106
|
* @param {string} ipAddress - The IP address to check.
|
|
1893
2107
|
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
2108
|
+
* @public exported from `@promptbook/utils`
|
|
1894
2109
|
*/
|
|
1895
2110
|
function isUrlOnPrivateNetwork(url) {
|
|
1896
2111
|
if (typeof url === 'string') {
|
|
@@ -1906,6 +2121,8 @@ function isUrlOnPrivateNetwork(url) {
|
|
|
1906
2121
|
* Note: There are two simmilar functions:
|
|
1907
2122
|
* - `isValidUrl` which tests any URL
|
|
1908
2123
|
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
2124
|
+
*
|
|
2125
|
+
* @public exported from `@promptbook/utils`
|
|
1909
2126
|
*/
|
|
1910
2127
|
function isValidUrl(url) {
|
|
1911
2128
|
if (typeof url !== 'string') {
|
|
@@ -1932,6 +2149,8 @@ function isValidUrl(url) {
|
|
|
1932
2149
|
* Note: There are two simmilar functions:
|
|
1933
2150
|
* - `isValidUrl` which tests any URL
|
|
1934
2151
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
2152
|
+
*
|
|
2153
|
+
* @public exported from `@promptbook/utils`
|
|
1935
2154
|
*/
|
|
1936
2155
|
function isValidPipelineUrl(url) {
|
|
1937
2156
|
if (!isValidUrl(url)) {
|
|
@@ -1958,6 +2177,8 @@ function isValidPipelineUrl(url) {
|
|
|
1958
2177
|
|
|
1959
2178
|
/**
|
|
1960
2179
|
* Checks if value is valid uuid
|
|
2180
|
+
*
|
|
2181
|
+
* @public exported from `@promptbook/utils`
|
|
1961
2182
|
*/
|
|
1962
2183
|
function isValidUuid(value) {
|
|
1963
2184
|
if (typeof value !== 'string') {
|
|
@@ -1966,26 +2187,5 @@ function isValidUuid(value) {
|
|
|
1966
2187
|
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);
|
|
1967
2188
|
}
|
|
1968
2189
|
|
|
1969
|
-
|
|
1970
|
-
* The version of the Promptbook library
|
|
1971
|
-
*/
|
|
1972
|
-
var PROMPTBOOK_VERSION = '0.62.0-1';
|
|
1973
|
-
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1974
|
-
|
|
1975
|
-
// @promptbook/utils
|
|
1976
|
-
// And the normalization (originally n12 library) utilities:
|
|
1977
|
-
var normalizeTo = {
|
|
1978
|
-
// [🕙] lowercase: normalizeTo_lowercase,
|
|
1979
|
-
// [🕙] UPPERCASE: normalizeTo_UPPERCASE,
|
|
1980
|
-
camelCase: normalizeTo_camelCase,
|
|
1981
|
-
PascalCase: normalizeTo_PascalCase,
|
|
1982
|
-
SCREAMING_CASE: normalizeTo_SCREAMING_CASE,
|
|
1983
|
-
snake_case: normalizeTo_snake_case,
|
|
1984
|
-
'kebab-case': normalizeToKebabCase,
|
|
1985
|
-
};
|
|
1986
|
-
/**
|
|
1987
|
-
* Note: [🕙] It does not make sence to have simple lower / UPPER case normalization
|
|
1988
|
-
*/
|
|
1989
|
-
|
|
1990
|
-
export { $currentDate, $randomSeed, CountUtils, DIACRITIC_VARIANTS_LETTERS, PROMPTBOOK_VERSION, capitalize, countCharacters, countLines, countPages, countParagraphs, countSentences, countWords, decapitalize, difference, extractBlock, extractParameterNames, extractParameterNamesFromPromptTemplate, extractVariables, forEachAsync, intersection, isHostnameOnPrivateNetwork, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidKeyword, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, nameToUriPart, nameToUriParts, normalizeTo, normalizeToKebabCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_camelCase, normalizeTo_snake_case, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, parseNumber, removeDiacritics, removeEmojis, removeQuotes, renameParameter, renderPromptbookMermaid, replaceParameters, searchKeywords, splitIntoSentences, titleToName, trimCodeBlock, trimEndOfCodeBlock, union, unwrapResult };
|
|
2190
|
+
export { $currentDate, $randomSeed, CountUtils, DIACRITIC_VARIANTS_LETTERS, PROMPTBOOK_VERSION, capitalize, countCharacters, countLines, countPages, countParagraphs, countSentences, countWords, decapitalize, deepClone, deepFreezeWithSameType, difference, extractBlock, extractParameterNames, extractParameterNamesFromPromptTemplate, extractVariables, forEachAsync, intersection, isHostnameOnPrivateNetwork, isRunningInBrowser, isRunningInNode, isRunningInWebWorker, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidKeyword, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, nameToUriPart, nameToUriParts, normalizeToKebabCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_camelCase, normalizeTo_snake_case, parseKeywords, parseKeywordsFromString, parseNumber, removeDiacritics, removeEmojis, removeQuotes, renameParameter, renderPromptbookMermaid, replaceParameters, searchKeywords, splitIntoSentences, titleToName, trimCodeBlock, trimEndOfCodeBlock, union, unwrapResult };
|
|
1991
2191
|
//# sourceMappingURL=index.es.js.map
|