@promptbook/markdown-utils 0.84.0-13 β†’ 0.84.0-15

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.
@@ -12,6 +12,8 @@ import { LOGO_LIGHT_SRC } from '../config';
12
12
  import { LOGO_DARK_SRC } from '../config';
13
13
  import { DEFAULT_BOOK_TITLE } from '../config';
14
14
  import { DEFAULT_TASK_TITLE } from '../config';
15
+ import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
16
+ import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
15
17
  import { MAX_FILENAME_LENGTH } from '../config';
16
18
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
17
19
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
@@ -139,6 +141,8 @@ export { LOGO_LIGHT_SRC };
139
141
  export { LOGO_DARK_SRC };
140
142
  export { DEFAULT_BOOK_TITLE };
141
143
  export { DEFAULT_TASK_TITLE };
144
+ export { DEFAULT_PROMPT_TASK_TITLE };
145
+ export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
142
146
  export { MAX_FILENAME_LENGTH };
143
147
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
144
148
  export { DEFAULT_MAX_PARALLEL_COUNT };
@@ -65,6 +65,18 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
65
65
  * @public exported from `@promptbook/core`
66
66
  */
67
67
  export declare const DEFAULT_TASK_TITLE = "Task";
68
+ /**
69
+ * When the title of the prompt task is not provided, the default title is used
70
+ *
71
+ * @public exported from `@promptbook/core`
72
+ */
73
+ export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
74
+ /**
75
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
76
+ *
77
+ * @public exported from `@promptbook/core`
78
+ */
79
+ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
68
80
  /**
69
81
  * Warning message for the generated sections and files files
70
82
  *
@@ -0,0 +1,10 @@
1
+ import type { string_file_extension } from '../../types/typeAliases';
2
+ import type { string_mime_type } from '../../types/typeAliases';
3
+ /**
4
+ * Convert mime type to file extension
5
+ *
6
+ * Note: If the mime type is invalid, `null` is returned
7
+ *
8
+ * @private within the repository
9
+ */
10
+ export declare function mimeTypeToExtension(value: string_mime_type): string_file_extension | null;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@promptbook/markdown-utils",
3
- "version": "0.84.0-13",
3
+ "version": "0.84.0-15",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
- "--note-0": " <- [🐊]",
6
5
  "private": false,
7
6
  "sideEffects": false,
8
7
  "repository": {
@@ -12,7 +11,6 @@
12
11
  "contributors": [
13
12
  "Pavol HejnΓ½ <pavol@ptbk.io> (https://www.pavolhejny.com/)"
14
13
  ],
15
- "--todo-0": "TODO: [❇️] Make better list of keywords",
16
14
  "keywords": [
17
15
  "ai",
18
16
  "llm",
@@ -35,21 +33,11 @@
35
33
  "anthropic",
36
34
  "LLMOps"
37
35
  ],
38
- "license": "CC-BY-4.0",
36
+ "license": "SEE LICENSE IN LICENSE.md",
39
37
  "bugs": {
40
38
  "url": "https://github.com/webgptorg/promptbook/issues"
41
39
  },
42
40
  "homepage": "https://www.npmjs.com/package/@promptbook/core",
43
- "funding": [
44
- {
45
- "type": "individual",
46
- "url": "https://buymeacoffee.com/hejny"
47
- },
48
- {
49
- "type": "github",
50
- "url": "https://github.com/webgptorg/promptbook/blob/main/README.md#%EF%B8%8F-contributing"
51
- }
52
- ],
53
41
  "main": "./umd/index.umd.js",
54
42
  "module": "./esm/index.es.js",
55
43
  "typings": "./esm/typings/src/_packages/markdown-utils.index.d.ts",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-12';
28
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-14';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [πŸ’ž] Ignore a discrepancy between file name and entity name
@@ -3616,6 +3616,17 @@
3616
3616
  * TODO: [πŸ–‡] What about symlinks?
3617
3617
  */
3618
3618
 
3619
+ /**
3620
+ * Convert mime type to file extension
3621
+ *
3622
+ * Note: If the mime type is invalid, `null` is returned
3623
+ *
3624
+ * @private within the repository
3625
+ */
3626
+ function mimeTypeToExtension(value) {
3627
+ return mimeTypes.extension(value) || null;
3628
+ }
3629
+
3619
3630
  /**
3620
3631
  * Removes emojis from a string and fix whitespaces
3621
3632
  *
@@ -3709,7 +3720,7 @@
3709
3720
  case 1:
3710
3721
  response_1 = _l.sent();
3711
3722
  mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
3712
- if (tools.fs === undefined || !url.endsWith('.pdf')) {
3723
+ if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [πŸ’΅] */)) {
3713
3724
  return [2 /*return*/, {
3714
3725
  source: name,
3715
3726
  filename: null,
@@ -3754,7 +3765,7 @@
3754
3765
  basename = url.split('/').pop() || titleToName(url);
3755
3766
  hash = sha256__default["default"](hexEncoder__default["default"].parse(url)).toString( /* hex */);
3756
3767
  rootDirname_1 = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
3757
- filepath = path.join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".pdf")], false));
3768
+ filepath = path.join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
3758
3769
  return [4 /*yield*/, tools.fs.mkdir(path.dirname(path.join(rootDirname_1, filepath)), { recursive: true })];
3759
3770
  case 2:
3760
3771
  _l.sent();
@@ -3765,9 +3776,9 @@
3765
3776
  case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
3766
3777
  case 4:
3767
3778
  _l.sent();
3768
- // TODO: !!!!!!!! Check the file security
3779
+ // TODO: [πŸ’΅] Check the file security
3769
3780
  // TODO: !!!!!!!! Check the file size (if it is not too big)
3770
- // TODO: !!!!!!!! Delete the file
3781
+ // TODO: !!!!!!!! Delete the file after the scraping is done
3771
3782
  return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
3772
3783
  case 5:
3773
3784
  if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];