@promptbook/utils 0.60.0 → 0.61.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/README.md +17 -19
- package/esm/index.es.js +392 -274
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +61 -4
- package/esm/typings/src/_packages/core.index.d.ts +8 -8
- package/esm/typings/src/_packages/markdown-utils.d.ts +17 -0
- package/esm/typings/src/_packages/types.index.d.ts +11 -6
- package/esm/typings/src/_packages/utils.index.d.ts +23 -19
- package/esm/typings/src/cli/cli-commands/hello.d.ts +7 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +7 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +7 -0
- package/esm/typings/src/collection/collectionToJson.d.ts +3 -0
- package/esm/typings/src/collection/collectionToJson.test.d.ts +6 -0
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
- package/esm/typings/src/commands/BLOCK/BlockCommand.d.ts +11 -0
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +13 -0
- package/esm/typings/src/commands/BLOCK/blockCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +14 -0
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +9 -0
- package/esm/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +7 -0
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/JOKER/JokerCommand.d.ts +11 -0
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +12 -0
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +13 -0
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/PARAMETER/ParameterCommand.d.ts +15 -0
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +11 -0
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +11 -0
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +11 -0
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/URL/UrlCommand.d.ts +10 -0
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/X_ACTION/ActionCommand.d.ts +9 -0
- package/esm/typings/src/commands/X_ACTION/actionCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +9 -0
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +10 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +12 -0
- package/esm/typings/src/commands/_common/parseCommand.d.ts +12 -0
- package/esm/typings/src/commands/_common/parseCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/Command.d.ts +6 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -0
- package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +9 -0
- package/esm/typings/src/commands/index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +4 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +2 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -3
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -2
- package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +3 -0
- package/esm/typings/src/errors/NotYetImplementedError.d.ts +7 -0
- package/esm/typings/src/errors/{SyntaxError.d.ts → ParsingError.d.ts} +2 -2
- package/{umd/typings/src/errors/ExecutionError.d.ts → esm/typings/src/errors/PipelineExecutionError.d.ts} +2 -2
- package/esm/typings/src/errors/_ExpectError.d.ts +2 -2
- package/esm/typings/src/execution/ExecutionTools.d.ts +4 -3
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +24 -5
- package/esm/typings/src/execution/PromptResult.d.ts +2 -2
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/esm/typings/src/execution/utils/replaceParameters.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +5 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +10 -0
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +14 -1
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +16 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -1
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +13 -3
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/personas/personaToModelRequirements.d.ts +6 -0
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
- package/esm/typings/src/types/Arrayable.d.ts +10 -0
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +28 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +16 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +8 -2
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +6 -142
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +77 -0
- package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +14 -0
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -0
- package/esm/typings/src/types/Prompt.d.ts +3 -3
- package/esm/typings/src/types/TaskProgress.d.ts +2 -2
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
- package/esm/typings/src/types/typeAliases.d.ts +50 -6
- package/esm/typings/src/utils/arrayableToArray.d.ts +11 -0
- package/esm/typings/src/utils/arrayableToArray.test.d.ts +1 -0
- package/esm/typings/src/utils/emojis.d.ts +1 -0
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -2
- package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +14 -0
- package/esm/typings/src/utils/markdown/flattenMarkdown.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +30 -0
- package/esm/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +1 -0
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +12 -0
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +1 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +8 -1
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +8 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +13 -1
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +8 -1
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +8 -1
- package/esm/typings/src/{conversion/utils → utils}/parseNumber.d.ts +1 -1
- package/esm/typings/src/utils/parseNumber.test.d.ts +1 -0
- package/esm/typings/src/utils/sets/difference.d.ts +2 -0
- package/esm/typings/src/utils/sets/intersection.d.ts +2 -0
- package/esm/typings/src/utils/sets/union.d.ts +2 -0
- package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +5 -0
- package/esm/typings/src/utils/validators/email/isValidEmail.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +7 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -0
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +12 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +9 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +9 -0
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +12 -0
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +12 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +3 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +5 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +3 -2
- package/package.json +1 -1
- package/umd/index.umd.js +400 -278
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +61 -4
- package/umd/typings/src/_packages/core.index.d.ts +8 -8
- package/umd/typings/src/_packages/markdown-utils.d.ts +17 -0
- package/umd/typings/src/_packages/types.index.d.ts +11 -6
- package/umd/typings/src/_packages/utils.index.d.ts +23 -19
- package/umd/typings/src/cli/cli-commands/hello.d.ts +7 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +7 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +7 -0
- package/umd/typings/src/collection/collectionToJson.d.ts +3 -0
- package/umd/typings/src/collection/collectionToJson.test.d.ts +6 -0
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
- package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +11 -0
- package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +13 -0
- package/umd/typings/src/commands/BLOCK/blockCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +14 -0
- package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +9 -0
- package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +7 -0
- package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +11 -0
- package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +12 -0
- package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +13 -0
- package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +15 -0
- package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +11 -0
- package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +11 -0
- package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +11 -0
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/URL/UrlCommand.d.ts +10 -0
- package/umd/typings/src/commands/URL/urlCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/URL/urlCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +9 -0
- package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +9 -0
- package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +9 -0
- package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +10 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +12 -0
- package/umd/typings/src/commands/_common/parseCommand.d.ts +12 -0
- package/umd/typings/src/commands/_common/parseCommand.test.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/Command.d.ts +6 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +36 -0
- package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +9 -0
- package/umd/typings/src/commands/index.d.ts +4 -0
- package/umd/typings/src/config.d.ts +4 -0
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +2 -0
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +2 -3
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -2
- package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +3 -0
- package/umd/typings/src/errors/NotYetImplementedError.d.ts +7 -0
- package/umd/typings/src/errors/{SyntaxError.d.ts → ParsingError.d.ts} +2 -2
- package/{esm/typings/src/errors/ExecutionError.d.ts → umd/typings/src/errors/PipelineExecutionError.d.ts} +2 -2
- package/umd/typings/src/errors/_ExpectError.d.ts +2 -2
- package/umd/typings/src/execution/ExecutionTools.d.ts +4 -3
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +24 -5
- package/umd/typings/src/execution/PromptResult.d.ts +2 -2
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
- package/umd/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/umd/typings/src/execution/utils/replaceParameters.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +5 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +5 -0
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +10 -0
- package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +1 -0
- package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +1 -0
- package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +14 -1
- package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +16 -0
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -1
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +13 -3
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/umd/typings/src/personas/personaToModelRequirements.d.ts +6 -0
- package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
- package/umd/typings/src/types/Arrayable.d.ts +10 -0
- package/umd/typings/src/types/PipelineJson/Expectations.d.ts +28 -0
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +16 -0
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +8 -2
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +7 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +6 -142
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +77 -0
- package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +14 -0
- package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -0
- package/umd/typings/src/types/Prompt.d.ts +3 -3
- package/umd/typings/src/types/TaskProgress.d.ts +2 -2
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
- package/umd/typings/src/types/typeAliases.d.ts +50 -6
- package/umd/typings/src/utils/arrayableToArray.d.ts +11 -0
- package/umd/typings/src/utils/arrayableToArray.test.d.ts +1 -0
- package/umd/typings/src/utils/emojis.d.ts +1 -0
- package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -2
- package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +14 -0
- package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +1 -0
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +30 -0
- package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +1 -0
- package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +1 -0
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +12 -0
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +1 -0
- package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +8 -1
- package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +8 -1
- package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +13 -1
- package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +8 -1
- package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +8 -1
- package/umd/typings/src/{conversion/utils → utils}/parseNumber.d.ts +1 -1
- package/umd/typings/src/utils/parseNumber.test.d.ts +1 -0
- package/umd/typings/src/utils/sets/difference.d.ts +2 -0
- package/umd/typings/src/utils/sets/intersection.d.ts +2 -0
- package/umd/typings/src/utils/sets/union.d.ts +2 -0
- package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +5 -0
- package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +7 -0
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -0
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +12 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +9 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +9 -0
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +12 -0
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +12 -0
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +3 -0
- package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +5 -0
- package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +1 -0
- package/umd/typings/src/version.d.ts +3 -2
- package/esm/typings/src/cli/actions/hello.d.ts +0 -7
- package/esm/typings/src/cli/actions/make.d.ts +0 -7
- package/esm/typings/src/cli/actions/prettify.d.ts +0 -7
- package/esm/typings/src/conversion/utils/parseCommand.d.ts +0 -11
- package/esm/typings/src/conversion/utils/parseCommand.test.d.ts +0 -4
- package/esm/typings/src/errors/TemplateError.d.ts +0 -9
- package/esm/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +0 -4
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -24
- package/esm/typings/src/types/Command.d.ts +0 -101
- package/esm/typings/src/types/ExecutionTypes.d.ts +0 -13
- package/esm/typings/src/utils/markdown-json/MarkdownStructure.d.ts +0 -25
- package/esm/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +0 -7
- package/esm/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +0 -13
- package/umd/typings/src/cli/actions/hello.d.ts +0 -7
- package/umd/typings/src/cli/actions/make.d.ts +0 -7
- package/umd/typings/src/cli/actions/prettify.d.ts +0 -7
- package/umd/typings/src/conversion/utils/parseCommand.d.ts +0 -11
- package/umd/typings/src/conversion/utils/parseCommand.test.d.ts +0 -4
- package/umd/typings/src/errors/TemplateError.d.ts +0 -9
- package/umd/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +0 -4
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -24
- package/umd/typings/src/types/Command.d.ts +0 -101
- package/umd/typings/src/types/ExecutionTypes.d.ts +0 -13
- package/umd/typings/src/utils/markdown-json/MarkdownStructure.d.ts +0 -25
- package/umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +0 -7
- package/umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +0 -13
- /package/esm/typings/src/{conversion/utils/parseNumber.test.d.ts → commands/BLOCK/blockCommand.test.d.ts} +0 -0
- /package/esm/typings/src/{llm-providers/mocked/fakeTextToExpectations.test.d.ts → commands/EXPECT/expectCommand.test.d.ts} +0 -0
- /package/esm/typings/src/{llm-providers/mocked/faked-completion.test.d.ts → commands/JOKER/jokerCommand.test.d.ts} +0 -0
- /package/esm/typings/src/{utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → commands/KNOWLEDGE/knowledgeCommand.test.d.ts} +0 -0
- /package/esm/typings/src/{utils/markdown-json/markdownToMarkdownStructure.test.d.ts → commands/MODEL/modelCommand.test.d.ts} +0 -0
- /package/{umd/typings/src/conversion/utils/parseNumber.test.d.ts → esm/typings/src/commands/PARAMETER/parameterCommand.test.d.ts} +0 -0
- /package/{umd/typings/src/llm-providers/mocked/fakeTextToExpectations.test.d.ts → esm/typings/src/commands/PERSONA/personaCommand.test.d.ts} +0 -0
- /package/{umd/typings/src/llm-providers/mocked/faked-completion.test.d.ts → esm/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts} +0 -0
- /package/{umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts} +0 -0
- /package/{umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.test.d.ts → esm/typings/src/commands/URL/urlCommand.test.d.ts} +0 -0
- /package/esm/typings/src/llm-providers/mocked/{joker.test.d.ts → test/joker.test.d.ts} +0 -0
- /package/esm/typings/src/llm-providers/mocked/{mocked-completion.test.d.ts → test/mocked-completion.test.d.ts} +0 -0
- /package/umd/typings/src/llm-providers/mocked/{joker.test.d.ts → test/joker.test.d.ts} +0 -0
- /package/umd/typings/src/llm-providers/mocked/{mocked-completion.test.d.ts → test/mocked-completion.test.d.ts} +0 -0
|
@@ -1,145 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { number_positive } from '../typeAliases';
|
|
7
|
-
import type { string_javascript } from '../typeAliases';
|
|
8
|
-
import type { string_javascript_name } from '../typeAliases';
|
|
9
|
-
import type { string_markdown } from '../typeAliases';
|
|
10
|
-
import type { string_markdown_text } from '../typeAliases';
|
|
11
|
-
import type { string_name } from '../typeAliases';
|
|
12
|
-
import type { string_prompt } from '../typeAliases';
|
|
13
|
-
import type { string_template } from '../typeAliases';
|
|
1
|
+
import type { ___ } from '../typeAliases';
|
|
2
|
+
import type { LlmTemplateJson } from './LlmTemplateJson';
|
|
3
|
+
import type { PromptDialogJson } from './PromptDialogJson';
|
|
4
|
+
import type { ScriptJson } from './ScriptJson';
|
|
5
|
+
import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
14
6
|
/**
|
|
15
7
|
* Describes one prompt template in the promptbook
|
|
16
8
|
*/
|
|
17
|
-
export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptJson | PromptDialogJson;
|
|
18
|
-
/**
|
|
19
|
-
* Template for prompt to LLM
|
|
20
|
-
*/
|
|
21
|
-
export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
22
|
-
readonly executionType: 'PROMPT_TEMPLATE';
|
|
23
|
-
/**
|
|
24
|
-
* Requirements for the model
|
|
25
|
-
* - This is required only for executionType PROMPT_TEMPLATE
|
|
26
|
-
*/
|
|
27
|
-
readonly modelRequirements: ModelRequirements;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Expect this amount of each unit in the answer
|
|
31
|
-
*
|
|
32
|
-
* For example 5 words, 3 sentences, 2 paragraphs, ...
|
|
33
|
-
*
|
|
34
|
-
* Note: Expectations are performed after all postprocessing steps
|
|
35
|
-
*/
|
|
36
|
-
export type Expectations = Partial<Record<Lowercase<ExpectationUnit>, {
|
|
37
|
-
min?: ExpectationAmount;
|
|
38
|
-
max?: ExpectationAmount;
|
|
39
|
-
}>>;
|
|
40
|
-
/**
|
|
41
|
-
* Units of text measurement
|
|
42
|
-
*/
|
|
43
|
-
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "LINES", "PARAGRAPHS", "PAGES"];
|
|
44
|
-
/**
|
|
45
|
-
* Unit of text measurement
|
|
46
|
-
*/
|
|
47
|
-
export type ExpectationUnit = typeof EXPECTATION_UNITS[number];
|
|
48
|
-
/**
|
|
49
|
-
* Amount of text measurement
|
|
50
|
-
*/
|
|
51
|
-
export type ExpectationAmount = number_integer & (number_positive | 0);
|
|
52
|
-
/**
|
|
53
|
-
* Template for simple concatenation of strings
|
|
54
|
-
*/
|
|
55
|
-
export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
|
|
56
|
-
readonly executionType: 'SIMPLE_TEMPLATE';
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Template for script execution
|
|
60
|
-
*/
|
|
61
|
-
export interface ScriptJson extends PromptTemplateJsonCommon {
|
|
62
|
-
readonly executionType: 'SCRIPT';
|
|
63
|
-
/**
|
|
64
|
-
* Language of the script
|
|
65
|
-
* - This is required only for executionType SCRIPT
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
readonly contentLanguage?: ScriptLanguage;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Template for prompt to user
|
|
72
|
-
*/
|
|
73
|
-
export interface PromptDialogJson extends PromptTemplateJsonCommon {
|
|
74
|
-
readonly executionType: 'PROMPT_DIALOG';
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Common properties of all prompt templates
|
|
78
|
-
*/
|
|
79
|
-
interface PromptTemplateJsonCommon {
|
|
80
|
-
/**
|
|
81
|
-
* Name of the template
|
|
82
|
-
* - It must be unique across the pipeline
|
|
83
|
-
* - It should start uppercase and contain letters and numbers
|
|
84
|
-
* - The pipelineUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
85
|
-
*/
|
|
86
|
-
readonly name: string_name;
|
|
87
|
-
/**
|
|
88
|
-
* Title of the prompt template
|
|
89
|
-
* It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
90
|
-
*/
|
|
91
|
-
readonly title: string;
|
|
92
|
-
/**
|
|
93
|
-
* Description of the prompt template
|
|
94
|
-
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
95
|
-
*/
|
|
96
|
-
readonly description?: string_markdown_text;
|
|
97
|
-
/**
|
|
98
|
-
* List of parameter names that are used in the prompt template and must be defined before the prompt template is executed
|
|
99
|
-
*
|
|
100
|
-
* Note: Joker is one of the dependent parameters
|
|
101
|
-
*/
|
|
102
|
-
readonly dependentParameterNames: Array<string_name>;
|
|
103
|
-
/**
|
|
104
|
-
* If theese parameters meet the expectations requirements, they are used instead of executing this prompt template
|
|
105
|
-
*/
|
|
106
|
-
readonly jokers?: Array<string>;
|
|
107
|
-
/**
|
|
108
|
-
* Type of the execution
|
|
109
|
-
* This determines if the prompt template is send to LLM, user or some scripting evaluation
|
|
110
|
-
*/
|
|
111
|
-
readonly executionType: ExecutionType;
|
|
112
|
-
/**
|
|
113
|
-
* Content of the template with {placeholders} for parameters
|
|
114
|
-
*/
|
|
115
|
-
readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
|
|
116
|
-
/**
|
|
117
|
-
* List of postprocessing steps that are executed after the prompt template
|
|
118
|
-
*/
|
|
119
|
-
readonly postprocessing?: Array<string_javascript_name>;
|
|
120
|
-
/**
|
|
121
|
-
* Expect this amount of each unit in the answer
|
|
122
|
-
*
|
|
123
|
-
* For example 5 words, 3 sentences, 2 paragraphs, ...
|
|
124
|
-
*
|
|
125
|
-
* Note: Expectations are performed after all postprocessing steps
|
|
126
|
-
*/
|
|
127
|
-
readonly expectations?: Expectations;
|
|
128
|
-
/**
|
|
129
|
-
* Expect this format of the answer
|
|
130
|
-
*
|
|
131
|
-
* Note: Expectations are performed after all postprocessing steps
|
|
132
|
-
* @deprecated [💝]
|
|
133
|
-
*/
|
|
134
|
-
readonly expectFormat?: ExpectFormatCommand['format'];
|
|
135
|
-
/**
|
|
136
|
-
* Name of the parameter that is the result of the prompt template
|
|
137
|
-
*/
|
|
138
|
-
readonly resultingParameterName: string_name;
|
|
139
|
-
}
|
|
140
|
-
export {};
|
|
141
|
-
/**
|
|
142
|
-
* TODO: [💝] Unite object for expecting amount and format - remove expectFormat
|
|
143
|
-
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
144
|
-
* TODO: [👙][🧠] Just selecting gpt3 or gpt4 level of model
|
|
145
|
-
*/
|
|
9
|
+
export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptJson | PromptDialogJson | ___ | ___ | ___ | ___;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { BlockType } from '../../commands/BLOCK/BlockTypes';
|
|
2
|
+
import type { ExpectFormatCommand } from '../../commands/EXPECT/ExpectFormatCommand';
|
|
3
|
+
import type { string_javascript } from '../typeAliases';
|
|
4
|
+
import type { string_javascript_name } from '../typeAliases';
|
|
5
|
+
import type { string_markdown } from '../typeAliases';
|
|
6
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
7
|
+
import type { string_name } from '../typeAliases';
|
|
8
|
+
import type { string_prompt } from '../typeAliases';
|
|
9
|
+
import type { string_template } from '../typeAliases';
|
|
10
|
+
import type { Expectations } from './Expectations';
|
|
11
|
+
/**
|
|
12
|
+
* Common properties of all prompt templates
|
|
13
|
+
*/
|
|
14
|
+
export interface PromptTemplateJsonCommon {
|
|
15
|
+
/**
|
|
16
|
+
* Name of the template
|
|
17
|
+
* - It must be unique across the pipeline
|
|
18
|
+
* - It should start uppercase and contain letters and numbers
|
|
19
|
+
* - The pipelineUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
20
|
+
*/
|
|
21
|
+
readonly name: string_name;
|
|
22
|
+
/**
|
|
23
|
+
* Title of the prompt template
|
|
24
|
+
* It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
25
|
+
*/
|
|
26
|
+
readonly title: string;
|
|
27
|
+
/**
|
|
28
|
+
* Description of the prompt template
|
|
29
|
+
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
30
|
+
*/
|
|
31
|
+
readonly description?: string_markdown_text;
|
|
32
|
+
/**
|
|
33
|
+
* List of parameter names that are used in the prompt template and must be defined before the prompt template is executed
|
|
34
|
+
*
|
|
35
|
+
* Note: Joker is one of the dependent parameters
|
|
36
|
+
*/
|
|
37
|
+
readonly dependentParameterNames: Array<string_name>;
|
|
38
|
+
/**
|
|
39
|
+
* If theese parameters meet the expectations requirements, they are used instead of executing this prompt template
|
|
40
|
+
*/
|
|
41
|
+
readonly jokers?: Array<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Type of the execution
|
|
44
|
+
* This determines if the prompt template is send to LLM, user or some scripting evaluation
|
|
45
|
+
*/
|
|
46
|
+
readonly blockType: BlockType;
|
|
47
|
+
/**
|
|
48
|
+
* Content of the template with {placeholders} for parameters
|
|
49
|
+
*/
|
|
50
|
+
readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
|
|
51
|
+
/**
|
|
52
|
+
* List of postprocessing steps that are executed after the prompt template
|
|
53
|
+
*/
|
|
54
|
+
readonly postprocessing?: Array<string_javascript_name>;
|
|
55
|
+
/**
|
|
56
|
+
* Expect this amount of each unit in the answer
|
|
57
|
+
*
|
|
58
|
+
* For example 5 words, 3 sentences, 2 paragraphs, ...
|
|
59
|
+
*
|
|
60
|
+
* Note: Expectations are performed after all postprocessing steps
|
|
61
|
+
*/
|
|
62
|
+
readonly expectations?: Expectations;
|
|
63
|
+
/**
|
|
64
|
+
* Expect this format of the answer
|
|
65
|
+
*
|
|
66
|
+
* Note: Expectations are performed after all postprocessing steps
|
|
67
|
+
* @deprecated [💝]
|
|
68
|
+
*/
|
|
69
|
+
readonly expectFormat?: ExpectFormatCommand['format'];
|
|
70
|
+
/**
|
|
71
|
+
* Name of the parameter that is the result of the prompt template
|
|
72
|
+
*/
|
|
73
|
+
readonly resultingParameterName: string_name;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
77
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ScriptLanguage } from '../ScriptLanguage';
|
|
2
|
+
import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
|
|
3
|
+
/**
|
|
4
|
+
* Template for script execution
|
|
5
|
+
*/
|
|
6
|
+
export interface ScriptJson extends PromptTemplateJsonCommon {
|
|
7
|
+
readonly blockType: 'SCRIPT';
|
|
8
|
+
/**
|
|
9
|
+
* Language of the script
|
|
10
|
+
* - This is required only for blockType SCRIPT
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
readonly contentLanguage?: ScriptLanguage;
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { ExpectFormatCommand } from '../commands/EXPECT/ExpectFormatCommand';
|
|
1
2
|
import type { PostprocessingFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
|
-
import type { ExpectFormatCommand } from './Command';
|
|
3
3
|
import type { ModelRequirements } from './ModelRequirements';
|
|
4
|
-
import type { Expectations } from './PipelineJson/
|
|
4
|
+
import type { Expectations } from './PipelineJson/Expectations';
|
|
5
5
|
import type { string_name } from './typeAliases';
|
|
6
6
|
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
|
|
7
7
|
import type { string_prompt } from './typeAliases';
|
|
@@ -52,7 +52,7 @@ export type Prompt = {
|
|
|
52
52
|
*
|
|
53
53
|
* @example https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md#keywords
|
|
54
54
|
*/
|
|
55
|
-
readonly pipelineUrl
|
|
55
|
+
readonly pipelineUrl?: string_pipeline_url_with_hashtemplate;
|
|
56
56
|
/**
|
|
57
57
|
* Parameters used in the prompt
|
|
58
58
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlockType } from '../commands/BLOCK/BlockTypes';
|
|
2
2
|
import type { string_markdown_text } from './typeAliases';
|
|
3
3
|
import type { string_name } from './typeAliases';
|
|
4
4
|
/**
|
|
@@ -31,7 +31,7 @@ export type TaskProgress = {
|
|
|
31
31
|
* The type of the execution.
|
|
32
32
|
* Note: The pipeline executor reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
|
|
33
33
|
*/
|
|
34
|
-
readonly
|
|
34
|
+
readonly blockType: BlockType;
|
|
35
35
|
/**
|
|
36
36
|
* The parameter name that is being processed.
|
|
37
37
|
*/
|
|
@@ -2,7 +2,7 @@ import type { PromptResult } from '../../execution/PromptResult';
|
|
|
2
2
|
import type { Prompt } from '../Prompt';
|
|
3
3
|
import type { string_markdown_text } from '../typeAliases';
|
|
4
4
|
import type { string_pipeline_url } from '../typeAliases';
|
|
5
|
-
import type {
|
|
5
|
+
import type { string_semantic_version } from '../typeAliases';
|
|
6
6
|
/**
|
|
7
7
|
* ExecutionReport is result of executing one promptbook
|
|
8
8
|
* It is kind of a variant of the promptbook usefull for debugging, logging and transparency for users.
|
|
@@ -25,11 +25,11 @@ export type ExecutionReportJson = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Version from promptbook which was executed
|
|
27
27
|
*/
|
|
28
|
-
readonly promptbookUsedVersion:
|
|
28
|
+
readonly promptbookUsedVersion: string_semantic_version;
|
|
29
29
|
/**
|
|
30
30
|
* Version from promptbook which was requested by promptbook
|
|
31
31
|
*/
|
|
32
|
-
readonly promptbookRequestedVersion?:
|
|
32
|
+
readonly promptbookRequestedVersion?: string_semantic_version;
|
|
33
33
|
/**
|
|
34
34
|
* Description of the promptbook which was executed
|
|
35
35
|
*/
|
|
@@ -101,11 +101,24 @@ export type string_xml = string;
|
|
|
101
101
|
* For example `"**Hello** World!"`
|
|
102
102
|
*/
|
|
103
103
|
export type string_markdown = string;
|
|
104
|
+
/**
|
|
105
|
+
* Semantic helper
|
|
106
|
+
*
|
|
107
|
+
* Markdown text with exactly ONE heading on first line NO less NO more
|
|
108
|
+
*/
|
|
109
|
+
export type string_markdown_section = string;
|
|
110
|
+
/**
|
|
111
|
+
* Semantic helper
|
|
112
|
+
*
|
|
113
|
+
* Markdown without any headings like h1, h2
|
|
114
|
+
* BUT with formatting, lists, blockquotes, blocks, etc. is allowed
|
|
115
|
+
*/
|
|
116
|
+
export type string_markdown_section_content = string;
|
|
104
117
|
/**
|
|
105
118
|
* Semantic helper
|
|
106
119
|
*
|
|
107
120
|
* Markdown text without any structure like h1, h2, lists, blockquotes, blocks, etc.
|
|
108
|
-
* BUT with bold, italic, etc.
|
|
121
|
+
* BUT with bold, italic, etc. is allowed
|
|
109
122
|
*
|
|
110
123
|
* For example `"**Hello** World!"`
|
|
111
124
|
*/
|
|
@@ -230,10 +243,6 @@ export type string_uri_part = string;
|
|
|
230
243
|
* For example `"9SeSQTupmQHwuSrLi"` <- TODO: !! Update
|
|
231
244
|
*/
|
|
232
245
|
export type string_uriid = string_uri_part;
|
|
233
|
-
/**
|
|
234
|
-
* Semantic helper
|
|
235
|
-
*/
|
|
236
|
-
export type string_protocol = 'http:' | 'https:';
|
|
237
246
|
/**
|
|
238
247
|
* Semantic helper
|
|
239
248
|
*
|
|
@@ -246,12 +255,35 @@ export type string_hostname = string;
|
|
|
246
255
|
* For example `"localhost:9977"` or `"collboard.com"`
|
|
247
256
|
*/
|
|
248
257
|
export type string_host = string;
|
|
258
|
+
/**
|
|
259
|
+
* Semantic helper
|
|
260
|
+
*/
|
|
261
|
+
export type string_protocol = 'http:' | 'https:';
|
|
249
262
|
/**
|
|
250
263
|
* Semantic helper
|
|
251
264
|
*
|
|
252
265
|
* For example `"pavol@hejny.org"`
|
|
253
266
|
*/
|
|
254
267
|
export type string_email = string;
|
|
268
|
+
/**
|
|
269
|
+
* Semantic helper
|
|
270
|
+
*
|
|
271
|
+
* For example `"pavol@hejny.org, jirka@webgpt.cz"`
|
|
272
|
+
*/
|
|
273
|
+
export type string_emails = string;
|
|
274
|
+
/**
|
|
275
|
+
* Branded type for UUIDs version 4
|
|
276
|
+
* This will not allow to pass some random string where should be only a valid UUID
|
|
277
|
+
*
|
|
278
|
+
* Use utils:
|
|
279
|
+
* - `randomUuid` to generate
|
|
280
|
+
* - `isValidUuid to check validity
|
|
281
|
+
*
|
|
282
|
+
* For example `"5a0a153d-7be9-4018-9eda-e0e2e2b89bd9"`
|
|
283
|
+
*/
|
|
284
|
+
export type string_uuid = string & {
|
|
285
|
+
readonly _type: 'uuid';
|
|
286
|
+
};
|
|
255
287
|
/**
|
|
256
288
|
* Branded type client id
|
|
257
289
|
*/
|
|
@@ -269,7 +301,7 @@ export type string_sha256 = string;
|
|
|
269
301
|
*
|
|
270
302
|
* For example `"4.2.4"`
|
|
271
303
|
*/
|
|
272
|
-
export type
|
|
304
|
+
export type string_semantic_version = string;
|
|
273
305
|
/**
|
|
274
306
|
* Semantic helper
|
|
275
307
|
*
|
|
@@ -430,6 +462,18 @@ export type number_kilobytes = number_positive;
|
|
|
430
462
|
export type number_megabytes = number_positive;
|
|
431
463
|
export type number_gigabytes = number_positive;
|
|
432
464
|
export type number_terabytes = number_positive;
|
|
465
|
+
/**
|
|
466
|
+
* Formatting helper to put void to keep longer version of prettier
|
|
467
|
+
*/
|
|
468
|
+
export type ___ = never;
|
|
469
|
+
/**
|
|
470
|
+
* Organizational helper to better mark the place where the type is missing
|
|
471
|
+
*/
|
|
472
|
+
export type TODO = any;
|
|
473
|
+
/**
|
|
474
|
+
* Organizational helper to mark a place where to really use any
|
|
475
|
+
*/
|
|
476
|
+
export type really_any = any;
|
|
433
477
|
/**
|
|
434
478
|
* TODO: !! Cleanup
|
|
435
479
|
* TODO: !! Change to branded types
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Arrayable } from '../types/Arrayable';
|
|
2
|
+
/**
|
|
3
|
+
* Takes an item or an array of items and returns an array of items
|
|
4
|
+
*
|
|
5
|
+
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
6
|
+
* 2) Undefined returns empty array
|
|
7
|
+
* 3) Array returns itself
|
|
8
|
+
*
|
|
9
|
+
* @private Internal utility
|
|
10
|
+
*/
|
|
11
|
+
export declare function arrayableToArray<TItem>(input?: Arrayable<TItem>): Array<TItem>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ExpectationAmount } from '../../types/PipelineJson/
|
|
2
|
-
import type { ExpectationUnit } from '../../types/PipelineJson/
|
|
1
|
+
import type { ExpectationAmount } from '../../types/PipelineJson/Expectations';
|
|
2
|
+
import type { ExpectationUnit } from '../../types/PipelineJson/Expectations';
|
|
3
3
|
/**
|
|
4
4
|
* Index of all counter functions
|
|
5
5
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes the markdown by flattening the structure
|
|
4
|
+
*
|
|
5
|
+
* - It always have h1 - if there is no h1 in the markdown, it will be added "# Untitled"
|
|
6
|
+
* - All other headings are normalized to h2
|
|
7
|
+
*/
|
|
8
|
+
export declare function flattenMarkdown<TContent extends string_markdown>(markdown: TContent): TContent;
|
|
9
|
+
/**
|
|
10
|
+
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
11
|
+
* sophisticated implementation of this function through parsing markdown into JSON structure
|
|
12
|
+
* and flattening the actual structure
|
|
13
|
+
* NOW we are working just with markdown string and its good enough
|
|
14
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { string_markdown_section } from '../../types/typeAliases';
|
|
2
|
+
import type { string_markdown_section_content } from '../../types/typeAliases';
|
|
3
|
+
import type { string_markdown_text } from '../../types/typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* Parsed markdown section
|
|
6
|
+
*/
|
|
7
|
+
export type MarkdownSection = {
|
|
8
|
+
/**
|
|
9
|
+
* Title of the section
|
|
10
|
+
*/
|
|
11
|
+
title: string_markdown_text;
|
|
12
|
+
/**
|
|
13
|
+
* Level of the section like h1, h2, h3, h4, h5, h6
|
|
14
|
+
*/
|
|
15
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
|
+
/**
|
|
17
|
+
* Content of the section with markdown formatting, blocks, lists, etc.
|
|
18
|
+
*/
|
|
19
|
+
content: string_markdown_section_content;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Parses markdown section to title its level and content
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseMarkdownSection(value: string_markdown_section): MarkdownSection;
|
|
25
|
+
/**
|
|
26
|
+
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
27
|
+
* sophisticated implementation of this function through parsing markdown into JSON structure
|
|
28
|
+
* and flattening the actual structure
|
|
29
|
+
* NOW we are working just with markdown string and its good enough
|
|
30
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,5 +4,6 @@ import type { string_html } from '../../types/typeAliases';
|
|
|
4
4
|
*
|
|
5
5
|
* @param content raw html code
|
|
6
6
|
* @returns formatted html code
|
|
7
|
+
* @private withing the package because of HUGE size of prettier dependency
|
|
7
8
|
*/
|
|
8
9
|
export declare function prettifyMarkdown<TContent extends string_html>(content: TContent): TContent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
2
|
+
import type { string_markdown_section } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Splits the markdown into sections by headings
|
|
5
|
+
*/
|
|
6
|
+
export declare function splitMarkdownIntoSections(markdown: string_markdown): Array<string_markdown_section>;
|
|
7
|
+
/**
|
|
8
|
+
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
9
|
+
* sophisticated implementation of this function through parsing markdown into JSON structure
|
|
10
|
+
* and flattening the actual structure
|
|
11
|
+
* NOW we are working just with markdown string and its good enough
|
|
12
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Semantic helper for kebab-case strings
|
|
3
|
+
*
|
|
4
|
+
* @example 'hello-world'
|
|
5
|
+
* @example 'i-love-promptbook'
|
|
6
|
+
*/
|
|
7
|
+
export type string_kebab_case = string;
|
|
8
|
+
export declare function normalizeToKebabCase(text: string): string_kebab_case;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Semantic helper for PascalCase strings
|
|
3
|
+
*
|
|
4
|
+
* @example 'HelloWorld'
|
|
5
|
+
* @example 'ILovePromptbook'
|
|
6
|
+
*/
|
|
7
|
+
export type string_PascalCase = string;
|
|
8
|
+
export declare function normalizeTo_PascalCase(text: string): string_PascalCase;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
export declare function normalizeTo_SCREAMING_CASE(sentence: string): string;
|
|
2
1
|
/**
|
|
2
|
+
* Semantic helper for SCREAMING_CASE strings
|
|
3
|
+
*
|
|
4
|
+
* @example 'HELLO_WORLD'
|
|
5
|
+
* @example 'I_LOVE_PROMPTBOOK'
|
|
6
|
+
*/
|
|
7
|
+
export type string_SCREAMING_CASE = string;
|
|
8
|
+
export declare function normalizeTo_SCREAMING_CASE(text: string): string_SCREAMING_CASE;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: Tests
|
|
11
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
|
|
12
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěščřžžýáíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
|
|
13
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
|
|
14
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
|
|
3
15
|
* TODO: [🌺] Use some intermediate util splitWords
|
|
4
16
|
*/
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Semantic helper for camelCase strings
|
|
3
|
+
*
|
|
4
|
+
* @example 'helloWorld'
|
|
5
|
+
* @example 'iLovePromptbook'
|
|
6
|
+
*/
|
|
7
|
+
export type string_camelCase = string;
|
|
8
|
+
export declare function normalizeTo_camelCase(text: string, _isFirstLetterCapital?: boolean): string_camelCase;
|
|
2
9
|
/**
|
|
3
10
|
* TODO: [🌺] Use some intermediate util splitWords
|
|
4
11
|
*/
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Semantic helper for snake_case strings
|
|
3
|
+
*
|
|
4
|
+
* @example 'hello_world'
|
|
5
|
+
* @example 'i_love_promptbook'
|
|
6
|
+
*/
|
|
7
|
+
export type string_snake_case = string;
|
|
8
|
+
export declare function normalizeTo_snake_case(text: string): string_snake_case;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create difference set of two sets.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
3
5
|
*/
|
|
4
6
|
export declare function difference<TItem>(a: Set<TItem>, b: Set<TItem>, isEqual?: (a: TItem, b: TItem) => boolean): Set<TItem>;
|