@promptbook/utils 0.40.0-0 → 0.40.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/esm/index.es.js +147 -96
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/_packages/core.index.d.ts +1 -1
  4. package/esm/typings/_packages/types.index.d.ts +4 -1
  5. package/esm/typings/_packages/utils.index.d.ts +5 -2
  6. package/esm/typings/config.d.ts +4 -0
  7. package/esm/typings/conversion/{_importPromptbook.d.ts → test/_importPromptbook.d.ts} +2 -2
  8. package/{umd/typings/conversion → esm/typings/conversion/test}/validatePromptbookJson.d.ts +1 -1
  9. package/{umd/typings → esm/typings/conversion}/utils/extractVariables.d.ts +2 -2
  10. package/esm/typings/conversion/utils/parseCommand.d.ts +8 -0
  11. package/{umd/typings → esm/typings/conversion}/utils/parseNumber.d.ts +2 -0
  12. package/esm/typings/errors/ExpectError.d.ts +2 -0
  13. package/esm/typings/errors/NotFoundError.d.ts +1 -1
  14. package/esm/typings/errors/PromptbookExecutionError.d.ts +7 -0
  15. package/esm/typings/errors/PromptbookLogicError.d.ts +7 -0
  16. package/esm/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  17. package/esm/typings/errors/UnexpectedError.d.ts +7 -0
  18. package/esm/typings/execution/UserInterfaceTools.d.ts +1 -1
  19. package/{umd/typings → esm/typings/execution}/utils/replaceParameters.d.ts +3 -3
  20. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +3 -0
  21. package/package.json +2 -2
  22. package/umd/index.umd.js +147 -96
  23. package/umd/index.umd.js.map +1 -1
  24. package/umd/typings/_packages/core.index.d.ts +1 -1
  25. package/umd/typings/_packages/types.index.d.ts +4 -1
  26. package/umd/typings/_packages/utils.index.d.ts +5 -2
  27. package/umd/typings/config.d.ts +4 -0
  28. package/umd/typings/conversion/{_importPromptbook.d.ts → test/_importPromptbook.d.ts} +2 -2
  29. package/{esm/typings/conversion → umd/typings/conversion/test}/validatePromptbookJson.d.ts +1 -1
  30. package/{esm/typings → umd/typings/conversion}/utils/extractVariables.d.ts +2 -2
  31. package/umd/typings/conversion/utils/parseCommand.d.ts +8 -0
  32. package/{esm/typings → umd/typings/conversion}/utils/parseNumber.d.ts +2 -0
  33. package/umd/typings/errors/ExpectError.d.ts +2 -0
  34. package/umd/typings/errors/NotFoundError.d.ts +1 -1
  35. package/umd/typings/errors/PromptbookExecutionError.d.ts +7 -0
  36. package/umd/typings/errors/PromptbookLogicError.d.ts +7 -0
  37. package/umd/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  38. package/umd/typings/errors/UnexpectedError.d.ts +7 -0
  39. package/umd/typings/execution/UserInterfaceTools.d.ts +1 -1
  40. package/{esm/typings → umd/typings/execution}/utils/replaceParameters.d.ts +3 -3
  41. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +3 -0
  42. package/esm/typings/conversion/parseCommand.d.ts +0 -6
  43. package/umd/typings/conversion/parseCommand.d.ts +0 -6
  44. /package/esm/typings/conversion/{promptbookStringToJson-syntaxErrors.test.d.ts → test/promptbookStringToJson-syntaxErrors.test.d.ts} +0 -0
  45. /package/esm/typings/conversion/{promptbookStringToJson.test.d.ts → test/promptbookStringToJson.test.d.ts} +0 -0
  46. /package/esm/typings/conversion/{validatePromptbookJson-logicErrors.test.d.ts → test/validatePromptbookJson-logicErrors.test.d.ts} +0 -0
  47. /package/esm/typings/conversion/{validatePromptbookJson.test.d.ts → test/validatePromptbookJson.test.d.ts} +0 -0
  48. /package/esm/typings/{utils → conversion/utils}/extractVariables.test.d.ts +0 -0
  49. /package/esm/typings/conversion/{parseCommand.test.d.ts → utils/parseCommand.test.d.ts} +0 -0
  50. /package/esm/typings/{utils → conversion/utils}/parseNumber.test.d.ts +0 -0
  51. /package/esm/typings/{utils → execution/utils}/replaceParameters.test.d.ts +0 -0
  52. /package/umd/typings/conversion/{promptbookStringToJson-syntaxErrors.test.d.ts → test/promptbookStringToJson-syntaxErrors.test.d.ts} +0 -0
  53. /package/umd/typings/conversion/{promptbookStringToJson.test.d.ts → test/promptbookStringToJson.test.d.ts} +0 -0
  54. /package/umd/typings/conversion/{validatePromptbookJson-logicErrors.test.d.ts → test/validatePromptbookJson-logicErrors.test.d.ts} +0 -0
  55. /package/umd/typings/conversion/{validatePromptbookJson.test.d.ts → test/validatePromptbookJson.test.d.ts} +0 -0
  56. /package/umd/typings/{utils → conversion/utils}/extractVariables.test.d.ts +0 -0
  57. /package/umd/typings/conversion/{parseCommand.test.d.ts → utils/parseCommand.test.d.ts} +0 -0
  58. /package/umd/typings/{utils → conversion/utils}/parseNumber.test.d.ts +0 -0
  59. /package/umd/typings/{utils → execution/utils}/replaceParameters.test.d.ts +0 -0
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * This error occurs when some expectation is not met in the execution of the pipeline
3
+ *
4
+ * Note: This is a kindof subtype of PromptbookExecutionError
3
5
  */
4
6
  export declare class ExpectError extends Error {
5
7
  readonly name = "ExpectError";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This error !!!
2
+ * This error indicates that the requested resource (for example promptbook in the library ) was not found
3
3
  */
4
4
  export declare class NotFoundError extends Error {
5
5
  readonly name = "NotFoundError";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates errors during the execution of the promptbook
3
+ */
4
+ export declare class PromptbookExecutionError extends Error {
5
+ readonly name = "PromptbookExecutionError";
6
+ constructor(message: string);
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
3
+ */
4
+ export declare class PromptbookLogicError extends Error {
5
+ readonly name = "PromptbookLogicError";
6
+ constructor(message: string);
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
3
+ */
4
+ export declare class PromptbookSyntaxError extends Error {
5
+ readonly name = "PromptbookSyntaxError";
6
+ constructor(message: string);
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error type indicates that the error should not happen and its last check before crashing with some other error
3
+ */
4
+ export declare class UnexpectedError extends Error {
5
+ readonly name = "UnexpectedError";
6
+ constructor(message: string);
7
+ }
@@ -6,7 +6,7 @@ import { number_integer, number_positive } from '../types/typeAliases';
6
6
  */
7
7
  export type UserInterfaceTools = {
8
8
  /**
9
- * Asks the user to answer a free-text (multiline) question
9
+ * Asks the user to answer a free-text (multi-line) question
10
10
  *
11
11
  * @param options the question to ask
12
12
  * @returns the answer from the user
@@ -1,5 +1,5 @@
1
- import { string_template } from '.././types/typeAliases';
2
- import { Parameters } from '../types/Parameters';
1
+ import { Parameters } from '../../types/Parameters';
2
+ import { string_template } from '../../types/typeAliases';
3
3
  /**
4
4
  * Replaces parameters in template with values from parameters object
5
5
  *
@@ -7,6 +7,6 @@ import { Parameters } from '../types/Parameters';
7
7
  * @param parameters the object with parameters
8
8
  * @returns the template with replaced parameters
9
9
  *
10
- * @private within the library
10
+ * @private within the createPromptbookExecutor
11
11
  */
12
12
  export declare function replaceParameters(template: string_template, parameters: Parameters): string;
@@ -12,3 +12,6 @@ export declare function extractOneBlockFromMarkdown(markdown: string_markdown):
12
12
  language: string | null;
13
13
  content: string;
14
14
  };
15
+ /***
16
+ * TODO: [🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
17
+ */
@@ -1,6 +0,0 @@
1
- import type { string_markdown_text } from '.././types/typeAliases';
2
- import type { Command } from '../types/Command';
3
- /**
4
- * Parses one line of ul/ol to command
5
- */
6
- export declare function parseCommand(listItem: string_markdown_text): Command;
@@ -1,6 +0,0 @@
1
- import type { string_markdown_text } from '.././types/typeAliases';
2
- import type { Command } from '../types/Command';
3
- /**
4
- * Parses one line of ul/ol to command
5
- */
6
- export declare function parseCommand(listItem: string_markdown_text): Command;