@promptbook/utils 0.62.0 → 0.63.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.
- package/esm/index.es.js +266 -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/package.json +1 -1
- package/umd/index.umd.js +270 -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/esm/index.es.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The version of the Promptbook library
|
|
5
|
+
*/
|
|
6
|
+
var PROMPTBOOK_VERSION = '0.63.0-0';
|
|
7
|
+
// TODO: !!!! List here all the versions and annotate + put into script
|
|
3
8
|
|
|
4
9
|
/*! *****************************************************************************
|
|
5
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -122,6 +127,8 @@ function __spreadArray(to, from, pack) {
|
|
|
122
127
|
|
|
123
128
|
/**
|
|
124
129
|
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
130
|
+
*
|
|
131
|
+
* @public exported from `@promptbook/core`
|
|
125
132
|
*/
|
|
126
133
|
var UnexpectedError = /** @class */ (function (_super) {
|
|
127
134
|
__extends(UnexpectedError, _super);
|
|
@@ -134,6 +141,16 @@ var UnexpectedError = /** @class */ (function (_super) {
|
|
|
134
141
|
return UnexpectedError;
|
|
135
142
|
}(Error));
|
|
136
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @@@
|
|
146
|
+
*
|
|
147
|
+
* @param text @@@
|
|
148
|
+
* @param _isFirstLetterCapital @@@
|
|
149
|
+
* @returns @@@
|
|
150
|
+
* @example 'helloWorld'
|
|
151
|
+
* @example 'iLovePromptbook'
|
|
152
|
+
* @public exported from `@promptbook/utils`
|
|
153
|
+
*/
|
|
137
154
|
function normalizeTo_camelCase(text, _isFirstLetterCapital) {
|
|
138
155
|
var e_1, _a;
|
|
139
156
|
if (_isFirstLetterCapital === void 0) { _isFirstLetterCapital = false; }
|
|
@@ -404,6 +421,8 @@ var defaultDiacriticsRemovalMap = [
|
|
|
404
421
|
* > "ě" => "e"
|
|
405
422
|
* > "Ă" => "A"
|
|
406
423
|
* > ...
|
|
424
|
+
*
|
|
425
|
+
* @public exported from `@promptbook/utils`
|
|
407
426
|
*/
|
|
408
427
|
var DIACRITIC_VARIANTS_LETTERS = {};
|
|
409
428
|
// tslint:disable-next-line: prefer-for-of
|
|
@@ -431,7 +450,11 @@ for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
431
450
|
*/
|
|
432
451
|
|
|
433
452
|
/**
|
|
453
|
+
* @@@
|
|
434
454
|
*
|
|
455
|
+
* @param input @@@
|
|
456
|
+
* @returns @@@
|
|
457
|
+
* @public exported from `@promptbook/utils`
|
|
435
458
|
*/
|
|
436
459
|
function removeDiacritics(input) {
|
|
437
460
|
/*eslint no-control-regex: "off"*/
|
|
@@ -439,7 +462,19 @@ function removeDiacritics(input) {
|
|
|
439
462
|
return DIACRITIC_VARIANTS_LETTERS[a] || a;
|
|
440
463
|
});
|
|
441
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
467
|
+
*/
|
|
442
468
|
|
|
469
|
+
/**
|
|
470
|
+
* @@@
|
|
471
|
+
*
|
|
472
|
+
* @param text @@@
|
|
473
|
+
* @returns @@@
|
|
474
|
+
* @example 'hello-world'
|
|
475
|
+
* @example 'i-love-promptbook'
|
|
476
|
+
* @public exported from `@promptbook/utils`
|
|
477
|
+
*/
|
|
443
478
|
function normalizeToKebabCase(text) {
|
|
444
479
|
var e_1, _a;
|
|
445
480
|
text = removeDiacritics(text);
|
|
@@ -499,6 +534,7 @@ function normalizeToKebabCase(text) {
|
|
|
499
534
|
*
|
|
500
535
|
* @param text with emojis
|
|
501
536
|
* @returns text without emojis
|
|
537
|
+
* @public exported from `@promptbook/utils`
|
|
502
538
|
*/
|
|
503
539
|
function removeEmojis(text) {
|
|
504
540
|
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
@@ -510,7 +546,12 @@ function removeEmojis(text) {
|
|
|
510
546
|
}
|
|
511
547
|
|
|
512
548
|
/**
|
|
513
|
-
*
|
|
549
|
+
* @@@
|
|
550
|
+
*
|
|
551
|
+
* @param value @@@
|
|
552
|
+
* @returns @@@
|
|
553
|
+
* @example @@@
|
|
554
|
+
* @public exported from `@promptbook/utils`
|
|
514
555
|
*/
|
|
515
556
|
function titleToName(value) {
|
|
516
557
|
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
@@ -531,6 +572,8 @@ function titleToName(value) {
|
|
|
531
572
|
* Creates a Mermaid graph based on the promptbook
|
|
532
573
|
*
|
|
533
574
|
* Note: The result is not wrapped in a Markdown code block
|
|
575
|
+
*
|
|
576
|
+
* @public exported from `@promptbook/utils`
|
|
534
577
|
*/
|
|
535
578
|
function renderPromptbookMermaid(pipelineJson, options) {
|
|
536
579
|
var _a = (options || {}).linkPromptTemplate, linkPromptTemplate = _a === void 0 ? function () { return null; } : _a;
|
|
@@ -590,6 +633,7 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
590
633
|
*
|
|
591
634
|
* @param template the template with parameters in {curly} braces
|
|
592
635
|
* @returns the list of parameter names
|
|
636
|
+
* @public exported from `@promptbook/utils`
|
|
593
637
|
*/
|
|
594
638
|
function extractParameterNames(template) {
|
|
595
639
|
var e_1, _a;
|
|
@@ -614,6 +658,8 @@ function extractParameterNames(template) {
|
|
|
614
658
|
|
|
615
659
|
/**
|
|
616
660
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
661
|
+
*
|
|
662
|
+
* @public exported from `@promptbook/core`
|
|
617
663
|
*/
|
|
618
664
|
var ParsingError = /** @class */ (function (_super) {
|
|
619
665
|
__extends(ParsingError, _super);
|
|
@@ -632,6 +678,7 @@ var ParsingError = /** @class */ (function (_super) {
|
|
|
632
678
|
* @param script from which to extract the variables
|
|
633
679
|
* @returns the list of variable names
|
|
634
680
|
* @throws {ParsingError} if the script is invalid
|
|
681
|
+
* @public exported from `@promptbook/utils`
|
|
635
682
|
*/
|
|
636
683
|
function extractVariables(script) {
|
|
637
684
|
var variables = new Set();
|
|
@@ -680,6 +727,7 @@ function extractVariables(script) {
|
|
|
680
727
|
* @param promptTemplate the template with used parameters
|
|
681
728
|
* @returns the set of parameter names
|
|
682
729
|
* @throws {ParsingError} if the script is invalid
|
|
730
|
+
* @public exported from `@promptbook/utils`
|
|
683
731
|
*/
|
|
684
732
|
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
685
733
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
@@ -736,6 +784,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
736
784
|
|
|
737
785
|
/**
|
|
738
786
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
787
|
+
*
|
|
788
|
+
* @public exported from `@promptbook/core`
|
|
739
789
|
*/
|
|
740
790
|
var PipelineLogicError = /** @class */ (function (_super) {
|
|
741
791
|
__extends(PipelineLogicError, _super);
|
|
@@ -753,6 +803,7 @@ var PipelineLogicError = /** @class */ (function (_super) {
|
|
|
753
803
|
* In other words, it will find all parameters that are not used in the prompt template itseld and all its dependencies
|
|
754
804
|
*
|
|
755
805
|
* @throws {PipelineLogicError} If the new parameter name is already used in the pipeline
|
|
806
|
+
* @public exported from `@promptbook/utils`
|
|
756
807
|
*/
|
|
757
808
|
function renameParameter(options) {
|
|
758
809
|
var e_1, _a, e_2, _b;
|
|
@@ -810,6 +861,7 @@ function renameParameter(options) {
|
|
|
810
861
|
* @param array - Array to iterate over
|
|
811
862
|
* @param options - Options for the function
|
|
812
863
|
* @param callbackfunction - Function to call for each item
|
|
864
|
+
* @public exported from `@promptbook/utils`
|
|
813
865
|
*/
|
|
814
866
|
function forEachAsync(array, options, callbackfunction) {
|
|
815
867
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -880,6 +932,8 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
880
932
|
|
|
881
933
|
/**
|
|
882
934
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
935
|
+
*
|
|
936
|
+
* @public exported from `@promptbook/utils`
|
|
883
937
|
*/
|
|
884
938
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
885
939
|
try {
|
|
@@ -900,6 +954,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
900
954
|
/**
|
|
901
955
|
* Makes first letter of a string uppercase
|
|
902
956
|
*
|
|
957
|
+
* @public exported from `@promptbook/utils`
|
|
903
958
|
*/
|
|
904
959
|
function capitalize(word) {
|
|
905
960
|
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
@@ -915,7 +970,7 @@ function capitalize(word) {
|
|
|
915
970
|
*
|
|
916
971
|
* @param markdown any valid markdown
|
|
917
972
|
* @returns code blocks with language and content
|
|
918
|
-
*
|
|
973
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
919
974
|
*/
|
|
920
975
|
function extractAllBlocksFromMarkdown(markdown) {
|
|
921
976
|
var e_1, _a;
|
|
@@ -992,6 +1047,7 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
992
1047
|
*
|
|
993
1048
|
* @param markdown any valid markdown
|
|
994
1049
|
* @returns code block with language and content
|
|
1050
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
995
1051
|
*/
|
|
996
1052
|
function extractOneBlockFromMarkdown(markdown) {
|
|
997
1053
|
var codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
@@ -1013,24 +1069,98 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
1013
1069
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
1014
1070
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
1015
1071
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
1072
|
+
*
|
|
1073
|
+
* @public exported from `@promptbook/utils`
|
|
1016
1074
|
*/
|
|
1017
1075
|
function extractBlock(markdown) {
|
|
1018
1076
|
var content = extractOneBlockFromMarkdown(markdown).content;
|
|
1019
1077
|
return content;
|
|
1020
1078
|
}
|
|
1021
|
-
|
|
1079
|
+
/**
|
|
1080
|
+
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
1081
|
+
*/
|
|
1022
1082
|
|
|
1023
1083
|
/**
|
|
1024
1084
|
* Simple wrapper `new Date().toISOString()`
|
|
1025
1085
|
*
|
|
1026
1086
|
* @returns string_date branded type
|
|
1087
|
+
* @public exported from `@promptbook/utils`
|
|
1027
1088
|
*/
|
|
1028
1089
|
function $currentDate() {
|
|
1029
1090
|
return new Date().toISOString();
|
|
1030
1091
|
}
|
|
1031
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* @@@
|
|
1095
|
+
*
|
|
1096
|
+
* @public exported from `@promptbook/utils`
|
|
1097
|
+
*/
|
|
1098
|
+
function deepClone(objectValue) {
|
|
1099
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1100
|
+
/*
|
|
1101
|
+
TODO: [🧠] Is there a better implementation?
|
|
1102
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1103
|
+
> for (const propertyName of propertyNames) {
|
|
1104
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1105
|
+
> if (value && typeof value === 'object') {
|
|
1106
|
+
> deepClone(value);
|
|
1107
|
+
> }
|
|
1108
|
+
> }
|
|
1109
|
+
> return Object.assign({}, objectValue);
|
|
1110
|
+
*/
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1114
|
+
*/
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* @@@
|
|
1118
|
+
*
|
|
1119
|
+
* @returns The same object as the input, but deeply frozen
|
|
1120
|
+
*
|
|
1121
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1122
|
+
*/
|
|
1123
|
+
function deepFreeze(objectValue) {
|
|
1124
|
+
var e_1, _a;
|
|
1125
|
+
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1126
|
+
try {
|
|
1127
|
+
for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
|
|
1128
|
+
var propertyName = propertyNames_1_1.value;
|
|
1129
|
+
var value = objectValue[propertyName];
|
|
1130
|
+
if (value && typeof value === 'object') {
|
|
1131
|
+
deepFreeze(value);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1136
|
+
finally {
|
|
1137
|
+
try {
|
|
1138
|
+
if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
|
|
1139
|
+
}
|
|
1140
|
+
finally { if (e_1) throw e_1.error; }
|
|
1141
|
+
}
|
|
1142
|
+
return Object.freeze(objectValue);
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* @@@
|
|
1146
|
+
* @@@
|
|
1147
|
+
*
|
|
1148
|
+
* @returns The same object as the input, but deeply frozen
|
|
1149
|
+
* @public exported from `@promptbook/utils`
|
|
1150
|
+
*
|
|
1151
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1152
|
+
*/
|
|
1153
|
+
function deepFreezeWithSameType(objectValue) {
|
|
1154
|
+
return deepFreeze(objectValue);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1158
|
+
*/
|
|
1159
|
+
|
|
1032
1160
|
/**
|
|
1033
1161
|
* Counts number of characters in the text
|
|
1162
|
+
*
|
|
1163
|
+
* @public exported from `@promptbook/utils`
|
|
1034
1164
|
*/
|
|
1035
1165
|
function countCharacters(text) {
|
|
1036
1166
|
// Remove null characters
|
|
@@ -1044,6 +1174,8 @@ function countCharacters(text) {
|
|
|
1044
1174
|
|
|
1045
1175
|
/**
|
|
1046
1176
|
* Counts number of lines in the text
|
|
1177
|
+
*
|
|
1178
|
+
* @public exported from `@promptbook/utils`
|
|
1047
1179
|
*/
|
|
1048
1180
|
function countLines(text) {
|
|
1049
1181
|
if (text === '') {
|
|
@@ -1054,6 +1186,8 @@ function countLines(text) {
|
|
|
1054
1186
|
|
|
1055
1187
|
/**
|
|
1056
1188
|
* Counts number of pages in the text
|
|
1189
|
+
*
|
|
1190
|
+
* @public exported from `@promptbook/utils`
|
|
1057
1191
|
*/
|
|
1058
1192
|
function countPages(text) {
|
|
1059
1193
|
var sentencesPerPage = 5; // Assuming each page has 5 sentences
|
|
@@ -1064,6 +1198,8 @@ function countPages(text) {
|
|
|
1064
1198
|
|
|
1065
1199
|
/**
|
|
1066
1200
|
* Counts number of paragraphs in the text
|
|
1201
|
+
*
|
|
1202
|
+
* @public exported from `@promptbook/utils`
|
|
1067
1203
|
*/
|
|
1068
1204
|
function countParagraphs(text) {
|
|
1069
1205
|
return text.split(/\n\s*\n/).filter(function (paragraph) { return paragraph.trim() !== ''; }).length;
|
|
@@ -1071,12 +1207,16 @@ function countParagraphs(text) {
|
|
|
1071
1207
|
|
|
1072
1208
|
/**
|
|
1073
1209
|
* Split text into sentences
|
|
1210
|
+
*
|
|
1211
|
+
* @public exported from `@promptbook/utils`
|
|
1074
1212
|
*/
|
|
1075
1213
|
function splitIntoSentences(text) {
|
|
1076
1214
|
return text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
|
|
1077
1215
|
}
|
|
1078
1216
|
/**
|
|
1079
1217
|
* Counts number of sentences in the text
|
|
1218
|
+
*
|
|
1219
|
+
* @public exported from `@promptbook/utils`
|
|
1080
1220
|
*/
|
|
1081
1221
|
function countSentences(text) {
|
|
1082
1222
|
return splitIntoSentences(text).length;
|
|
@@ -1084,6 +1224,8 @@ function countSentences(text) {
|
|
|
1084
1224
|
|
|
1085
1225
|
/**
|
|
1086
1226
|
* Counts number of words in the text
|
|
1227
|
+
*
|
|
1228
|
+
* @public exported from `@promptbook/utils`
|
|
1087
1229
|
*/
|
|
1088
1230
|
function countWords(text) {
|
|
1089
1231
|
text = text.replace(/[\p{Extended_Pictographic}]/gu, 'a');
|
|
@@ -1093,6 +1235,8 @@ function countWords(text) {
|
|
|
1093
1235
|
|
|
1094
1236
|
/**
|
|
1095
1237
|
* Index of all counter functions
|
|
1238
|
+
*
|
|
1239
|
+
* @public exported from `@promptbook/utils`
|
|
1096
1240
|
*/
|
|
1097
1241
|
var CountUtils = {
|
|
1098
1242
|
CHARACTERS: countCharacters,
|
|
@@ -1103,14 +1247,43 @@ var CountUtils = {
|
|
|
1103
1247
|
PAGES: countPages,
|
|
1104
1248
|
};
|
|
1105
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
1252
|
+
*
|
|
1253
|
+
* @public exported from `@promptbook/utils`
|
|
1254
|
+
*/
|
|
1255
|
+
var isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
1256
|
+
/**
|
|
1257
|
+
* Detects if the code is running in a Node.js environment
|
|
1258
|
+
*
|
|
1259
|
+
* @public exported from `@promptbook/utils`
|
|
1260
|
+
*/
|
|
1261
|
+
var isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
1262
|
+
/**
|
|
1263
|
+
* Detects if the code is running in a web worker
|
|
1264
|
+
*
|
|
1265
|
+
* @public exported from `@promptbook/utils`
|
|
1266
|
+
*/
|
|
1267
|
+
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");
|
|
1268
|
+
|
|
1106
1269
|
/**
|
|
1107
1270
|
* Makes first letter of a string uppercase
|
|
1108
1271
|
*
|
|
1272
|
+
* @public exported from `@promptbook/utils`
|
|
1109
1273
|
*/
|
|
1110
1274
|
function decapitalize(word) {
|
|
1111
1275
|
return word.substring(0, 1).toLowerCase() + word.substring(1);
|
|
1112
1276
|
}
|
|
1113
1277
|
|
|
1278
|
+
/**
|
|
1279
|
+
* @@@
|
|
1280
|
+
*
|
|
1281
|
+
* @param text @@@
|
|
1282
|
+
* @returns @@@
|
|
1283
|
+
* @example 'HELLO_WORLD'
|
|
1284
|
+
* @example 'I_LOVE_PROMPTBOOK'
|
|
1285
|
+
* @public exported from `@promptbook/utils`
|
|
1286
|
+
*/
|
|
1114
1287
|
function normalizeTo_SCREAMING_CASE(text) {
|
|
1115
1288
|
var e_1, _a;
|
|
1116
1289
|
var charType;
|
|
@@ -1177,6 +1350,7 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
1177
1350
|
*
|
|
1178
1351
|
* @param {string} input
|
|
1179
1352
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
1353
|
+
* @public exported from `@promptbook/utils`
|
|
1180
1354
|
*/
|
|
1181
1355
|
function parseKeywordsFromString(input) {
|
|
1182
1356
|
var keywords = normalizeTo_SCREAMING_CASE(removeDiacritics(input))
|
|
@@ -1191,6 +1365,8 @@ function parseKeywordsFromString(input) {
|
|
|
1191
1365
|
*
|
|
1192
1366
|
* @param keyword to test
|
|
1193
1367
|
* @returns if keyword is valid or not
|
|
1368
|
+
*
|
|
1369
|
+
* @public exported from `@promptbook/utils`
|
|
1194
1370
|
*/
|
|
1195
1371
|
function isValidKeyword(keyword) {
|
|
1196
1372
|
var keywordParsed = parseKeywordsFromString(keyword);
|
|
@@ -1202,6 +1378,14 @@ function isValidKeyword(keyword) {
|
|
|
1202
1378
|
return keywordParsedFirst === keyword;
|
|
1203
1379
|
}
|
|
1204
1380
|
|
|
1381
|
+
/**
|
|
1382
|
+
* @@@
|
|
1383
|
+
*
|
|
1384
|
+
* @param name @@@
|
|
1385
|
+
* @returns @@@
|
|
1386
|
+
* @example @@@
|
|
1387
|
+
* @public exported from `@promptbook/utils`
|
|
1388
|
+
*/
|
|
1205
1389
|
function nameToUriPart(name) {
|
|
1206
1390
|
var uriPart = name;
|
|
1207
1391
|
uriPart = uriPart.toLowerCase();
|
|
@@ -1212,25 +1396,43 @@ function nameToUriPart(name) {
|
|
|
1212
1396
|
return uriPart;
|
|
1213
1397
|
}
|
|
1214
1398
|
|
|
1399
|
+
/**
|
|
1400
|
+
* @@@
|
|
1401
|
+
*
|
|
1402
|
+
* @param name @@@
|
|
1403
|
+
* @returns @@@
|
|
1404
|
+
* @example @@@
|
|
1405
|
+
* @public exported from `@promptbook/utils`
|
|
1406
|
+
*/
|
|
1215
1407
|
function nameToUriParts(name) {
|
|
1216
1408
|
return nameToUriPart(name)
|
|
1217
1409
|
.split('-')
|
|
1218
1410
|
.filter(function (value) { return value !== ''; });
|
|
1219
1411
|
}
|
|
1220
1412
|
|
|
1413
|
+
/**
|
|
1414
|
+
*
|
|
1415
|
+
* @param text @public exported from `@promptbook/utils`
|
|
1416
|
+
* @returns
|
|
1417
|
+
* @example 'HelloWorld'
|
|
1418
|
+
* @example 'ILovePromptbook'
|
|
1419
|
+
* @public exported from `@promptbook/utils`
|
|
1420
|
+
*/
|
|
1221
1421
|
function normalizeTo_PascalCase(text) {
|
|
1222
1422
|
return normalizeTo_camelCase(text, true);
|
|
1223
1423
|
}
|
|
1224
1424
|
|
|
1225
|
-
function normalizeTo_snake_case(text) {
|
|
1226
|
-
return normalizeTo_SCREAMING_CASE(text).toLowerCase();
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
1425
|
/**
|
|
1230
|
-
*
|
|
1426
|
+
* @@@
|
|
1427
|
+
*
|
|
1428
|
+
* @param text @@@
|
|
1429
|
+
* @returns @@@
|
|
1430
|
+
* @example 'hello_world'
|
|
1431
|
+
* @example 'i_love_promptbook'
|
|
1432
|
+
* @public exported from `@promptbook/utils`
|
|
1231
1433
|
*/
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
1434
|
+
function normalizeTo_snake_case(text) {
|
|
1435
|
+
return normalizeTo_SCREAMING_CASE(text).toLowerCase();
|
|
1234
1436
|
}
|
|
1235
1437
|
|
|
1236
1438
|
/**
|
|
@@ -1240,6 +1442,7 @@ function normalizeWhitespaces(sentence) {
|
|
|
1240
1442
|
*
|
|
1241
1443
|
* @param input of any kind
|
|
1242
1444
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
1445
|
+
* @public exported from `@promptbook/utils`
|
|
1243
1446
|
*/
|
|
1244
1447
|
function parseKeywords(input) {
|
|
1245
1448
|
if (typeof input === 'string') {
|
|
@@ -1266,7 +1469,12 @@ function parseKeywords(input) {
|
|
|
1266
1469
|
*/
|
|
1267
1470
|
|
|
1268
1471
|
/**
|
|
1472
|
+
* @@@
|
|
1269
1473
|
*
|
|
1474
|
+
* @param haystack
|
|
1475
|
+
* @param needle
|
|
1476
|
+
* @returns
|
|
1477
|
+
* @public exported from `@promptbook/utils`
|
|
1270
1478
|
*/
|
|
1271
1479
|
function searchKeywords(haystack, needle) {
|
|
1272
1480
|
var e_1, _a;
|
|
@@ -1302,7 +1510,7 @@ function searchKeywords(haystack, needle) {
|
|
|
1302
1510
|
* @returns parsed number
|
|
1303
1511
|
* @throws {ParsingError} if the value is not a number
|
|
1304
1512
|
*
|
|
1305
|
-
* @
|
|
1513
|
+
* @public exported from `@promptbook/utils`
|
|
1306
1514
|
*/
|
|
1307
1515
|
function parseNumber(value) {
|
|
1308
1516
|
var originalValue = value;
|
|
@@ -1358,12 +1566,14 @@ function parseNumber(value) {
|
|
|
1358
1566
|
}
|
|
1359
1567
|
/**
|
|
1360
1568
|
* TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
1569
|
+
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
1361
1570
|
*/
|
|
1362
1571
|
|
|
1363
1572
|
/**
|
|
1364
1573
|
* Generates random seed
|
|
1365
1574
|
*
|
|
1366
1575
|
* Warning: This function is not cryptographically secure (it uses Math.random internally)
|
|
1576
|
+
* @public exported from `@promptbook/utils`
|
|
1367
1577
|
*/
|
|
1368
1578
|
function $randomSeed() {
|
|
1369
1579
|
return Math.random();
|
|
@@ -1380,6 +1590,7 @@ function $randomSeed() {
|
|
|
1380
1590
|
*
|
|
1381
1591
|
* @param text optionally quoted text
|
|
1382
1592
|
* @returns text without quotes
|
|
1593
|
+
* @public exported from `@promptbook/utils`
|
|
1383
1594
|
*/
|
|
1384
1595
|
function removeQuotes(text) {
|
|
1385
1596
|
if (text.startsWith('"') && text.endsWith('"')) {
|
|
@@ -1391,41 +1602,10 @@ function removeQuotes(text) {
|
|
|
1391
1602
|
return text;
|
|
1392
1603
|
}
|
|
1393
1604
|
|
|
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
1605
|
/**
|
|
1428
1606
|
* The maximum number of iterations for a loops
|
|
1607
|
+
*
|
|
1608
|
+
* @private within the repository - too low-level in comparison to other `MAX_...`
|
|
1429
1609
|
*/
|
|
1430
1610
|
var LOOP_LIMIT = 1000;
|
|
1431
1611
|
/**
|
|
@@ -1434,6 +1614,8 @@ var LOOP_LIMIT = 1000;
|
|
|
1434
1614
|
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
1435
1615
|
/**
|
|
1436
1616
|
* The names of the parameters that are reserved for special purposes
|
|
1617
|
+
*
|
|
1618
|
+
* @public exported from `@promptbook/core`
|
|
1437
1619
|
*/
|
|
1438
1620
|
deepFreeze([
|
|
1439
1621
|
'content',
|
|
@@ -1447,10 +1629,14 @@ deepFreeze([
|
|
|
1447
1629
|
]);
|
|
1448
1630
|
/**
|
|
1449
1631
|
* @@@
|
|
1632
|
+
*
|
|
1633
|
+
* @private within the repository
|
|
1450
1634
|
*/
|
|
1451
1635
|
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1452
1636
|
/**
|
|
1453
1637
|
* @@@
|
|
1638
|
+
*
|
|
1639
|
+
* @private within the repository
|
|
1454
1640
|
*/
|
|
1455
1641
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
1456
1642
|
/*
|
|
@@ -1458,11 +1644,13 @@ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
|
1458
1644
|
*/
|
|
1459
1645
|
// [🟡][🟢][🔵][⚪]
|
|
1460
1646
|
/**
|
|
1461
|
-
* TODO:
|
|
1647
|
+
* TODO: !!!!!! Check that all @private contains some normalized explanation
|
|
1462
1648
|
*/
|
|
1463
1649
|
|
|
1464
1650
|
/**
|
|
1465
1651
|
* This error type indicates that some limit was reached
|
|
1652
|
+
*
|
|
1653
|
+
* @public exported from `@promptbook/core`
|
|
1466
1654
|
*/
|
|
1467
1655
|
var LimitReachedError = /** @class */ (function (_super) {
|
|
1468
1656
|
__extends(LimitReachedError, _super);
|
|
@@ -1477,6 +1665,8 @@ var LimitReachedError = /** @class */ (function (_super) {
|
|
|
1477
1665
|
|
|
1478
1666
|
/**
|
|
1479
1667
|
* This error indicates errors during the execution of the pipeline
|
|
1668
|
+
*
|
|
1669
|
+
* @public exported from `@promptbook/core`
|
|
1480
1670
|
*/
|
|
1481
1671
|
var PipelineExecutionError = /** @class */ (function (_super) {
|
|
1482
1672
|
__extends(PipelineExecutionError, _super);
|
|
@@ -1496,6 +1686,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1496
1686
|
* @param parameters the object with parameters
|
|
1497
1687
|
* @returns the template with replaced parameters
|
|
1498
1688
|
* @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
|
|
1689
|
+
* @public exported from `@promptbook/utils`
|
|
1499
1690
|
*/
|
|
1500
1691
|
function replaceParameters(template, parameters) {
|
|
1501
1692
|
var e_1, _a;
|
|
@@ -1571,6 +1762,7 @@ function replaceParameters(template, parameters) {
|
|
|
1571
1762
|
* Create difference set of two sets.
|
|
1572
1763
|
*
|
|
1573
1764
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1765
|
+
* @public exported from `@promptbook/utils`
|
|
1574
1766
|
*/
|
|
1575
1767
|
function difference(a, b, isEqual) {
|
|
1576
1768
|
var e_1, _a;
|
|
@@ -1604,6 +1796,7 @@ function difference(a, b, isEqual) {
|
|
|
1604
1796
|
* Creates a new set with all elements that are present in all sets
|
|
1605
1797
|
*
|
|
1606
1798
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1799
|
+
* @public exported from `@promptbook/utils`
|
|
1607
1800
|
*/
|
|
1608
1801
|
function intersection() {
|
|
1609
1802
|
var e_1, _a;
|
|
@@ -1643,6 +1836,7 @@ function intersection() {
|
|
|
1643
1836
|
* Creates a new set with all elements that are present in either set
|
|
1644
1837
|
*
|
|
1645
1838
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1839
|
+
* @public exported from `@promptbook/utils`
|
|
1646
1840
|
*/
|
|
1647
1841
|
function union() {
|
|
1648
1842
|
var e_1, _a, e_2, _b;
|
|
@@ -1685,6 +1879,7 @@ function union() {
|
|
|
1685
1879
|
* Note: This is usefull for post-processing of the result of the chat LLM model
|
|
1686
1880
|
* when the model wraps the result in the (markdown) code block.
|
|
1687
1881
|
*
|
|
1882
|
+
* @public exported from `@promptbook/utils`
|
|
1688
1883
|
*/
|
|
1689
1884
|
function trimCodeBlock(value) {
|
|
1690
1885
|
value = spaceTrim(value);
|
|
@@ -1702,6 +1897,8 @@ function trimCodeBlock(value) {
|
|
|
1702
1897
|
*
|
|
1703
1898
|
* Note: This is usefull for post-processing of the result of the completion LLM model
|
|
1704
1899
|
* if you want to start code block in the prompt but you don't want to end it in the result.
|
|
1900
|
+
*
|
|
1901
|
+
* @public exported from `@promptbook/utils`
|
|
1705
1902
|
*/
|
|
1706
1903
|
function trimEndOfCodeBlock(value) {
|
|
1707
1904
|
value = spaceTrim(value);
|
|
@@ -1721,6 +1918,7 @@ function trimEndOfCodeBlock(value) {
|
|
|
1721
1918
|
*
|
|
1722
1919
|
* @param text optionally quoted text
|
|
1723
1920
|
* @returns text without quotes
|
|
1921
|
+
* @public exported from `@promptbook/utils`
|
|
1724
1922
|
*/
|
|
1725
1923
|
function unwrapResult(text, options) {
|
|
1726
1924
|
var _a = options || {}, _b = _a.isTrimmed, isTrimmed = _b === void 0 ? true : _b, _c = _a.isIntroduceSentenceRemoved, isIntroduceSentenceRemoved = _c === void 0 ? true : _c;
|
|
@@ -1785,6 +1983,7 @@ function unwrapResult(text, options) {
|
|
|
1785
1983
|
* Tests if given string is valid URL.
|
|
1786
1984
|
*
|
|
1787
1985
|
* Note: This does not check if the file exists only if the path is valid
|
|
1986
|
+
* @public exported from `@promptbook/utils`
|
|
1788
1987
|
*/
|
|
1789
1988
|
function isValidFilePath(filePath) {
|
|
1790
1989
|
if (typeof filePath !== 'string') {
|
|
@@ -1806,6 +2005,13 @@ function isValidFilePath(filePath) {
|
|
|
1806
2005
|
return false;
|
|
1807
2006
|
}
|
|
1808
2007
|
|
|
2008
|
+
/**
|
|
2009
|
+
* @@@
|
|
2010
|
+
*
|
|
2011
|
+
* @param javascriptName @@@
|
|
2012
|
+
* @returns @@@
|
|
2013
|
+
* @public exported from `@promptbook/utils`
|
|
2014
|
+
*/
|
|
1809
2015
|
function isValidJavascriptName(javascriptName) {
|
|
1810
2016
|
if (typeof javascriptName !== 'string') {
|
|
1811
2017
|
return false;
|
|
@@ -1819,6 +2025,8 @@ function isValidJavascriptName(javascriptName) {
|
|
|
1819
2025
|
* Note: There are two simmilar functions:
|
|
1820
2026
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
1821
2027
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
2028
|
+
*
|
|
2029
|
+
* @public exported from `@promptbook/utils`
|
|
1822
2030
|
*/
|
|
1823
2031
|
function isValidSemanticVersion(version) {
|
|
1824
2032
|
if (typeof version !== 'string') {
|
|
@@ -1839,6 +2047,8 @@ function isValidSemanticVersion(version) {
|
|
|
1839
2047
|
* Note: There are two simmilar functions:
|
|
1840
2048
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
1841
2049
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
2050
|
+
*
|
|
2051
|
+
* @public exported from `@promptbook/utils`
|
|
1842
2052
|
*/
|
|
1843
2053
|
function isValidPromptbookVersion(version) {
|
|
1844
2054
|
if (!isValidSemanticVersion(version)) {
|
|
@@ -1857,6 +2067,8 @@ function isValidPromptbookVersion(version) {
|
|
|
1857
2067
|
* Note: There are two simmilar functions:
|
|
1858
2068
|
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1859
2069
|
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
2070
|
+
*
|
|
2071
|
+
* @public exported from `@promptbook/utils`
|
|
1860
2072
|
*/
|
|
1861
2073
|
function isHostnameOnPrivateNetwork(hostname) {
|
|
1862
2074
|
if (hostname === 'example.com' ||
|
|
@@ -1891,6 +2103,7 @@ function isHostnameOnPrivateNetwork(hostname) {
|
|
|
1891
2103
|
*
|
|
1892
2104
|
* @param {string} ipAddress - The IP address to check.
|
|
1893
2105
|
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
2106
|
+
* @public exported from `@promptbook/utils`
|
|
1894
2107
|
*/
|
|
1895
2108
|
function isUrlOnPrivateNetwork(url) {
|
|
1896
2109
|
if (typeof url === 'string') {
|
|
@@ -1906,6 +2119,8 @@ function isUrlOnPrivateNetwork(url) {
|
|
|
1906
2119
|
* Note: There are two simmilar functions:
|
|
1907
2120
|
* - `isValidUrl` which tests any URL
|
|
1908
2121
|
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
2122
|
+
*
|
|
2123
|
+
* @public exported from `@promptbook/utils`
|
|
1909
2124
|
*/
|
|
1910
2125
|
function isValidUrl(url) {
|
|
1911
2126
|
if (typeof url !== 'string') {
|
|
@@ -1932,6 +2147,8 @@ function isValidUrl(url) {
|
|
|
1932
2147
|
* Note: There are two simmilar functions:
|
|
1933
2148
|
* - `isValidUrl` which tests any URL
|
|
1934
2149
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
2150
|
+
*
|
|
2151
|
+
* @public exported from `@promptbook/utils`
|
|
1935
2152
|
*/
|
|
1936
2153
|
function isValidPipelineUrl(url) {
|
|
1937
2154
|
if (!isValidUrl(url)) {
|
|
@@ -1958,6 +2175,8 @@ function isValidPipelineUrl(url) {
|
|
|
1958
2175
|
|
|
1959
2176
|
/**
|
|
1960
2177
|
* Checks if value is valid uuid
|
|
2178
|
+
*
|
|
2179
|
+
* @public exported from `@promptbook/utils`
|
|
1961
2180
|
*/
|
|
1962
2181
|
function isValidUuid(value) {
|
|
1963
2182
|
if (typeof value !== 'string') {
|
|
@@ -1966,26 +2185,5 @@ function isValidUuid(value) {
|
|
|
1966
2185
|
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
2186
|
}
|
|
1968
2187
|
|
|
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 };
|
|
2188
|
+
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
2189
|
//# sourceMappingURL=index.es.js.map
|