@promptbook/documents 0.84.0-13 → 0.84.0-14
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 +17 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +12 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +16 -5
- package/umd/index.umd.js.map +1 -1
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.84.0-
|
|
3
|
+
"version": "0.84.0-14",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/documents.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.84.0-
|
|
57
|
+
"@promptbook/core": "0.84.0-14"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-13';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3731,6 +3731,17 @@
|
|
|
3731
3731
|
return mimeTypes.lookup(value) || 'application/octet-stream';
|
|
3732
3732
|
}
|
|
3733
3733
|
|
|
3734
|
+
/**
|
|
3735
|
+
* Convert mime type to file extension
|
|
3736
|
+
*
|
|
3737
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
3738
|
+
*
|
|
3739
|
+
* @private within the repository
|
|
3740
|
+
*/
|
|
3741
|
+
function mimeTypeToExtension(value) {
|
|
3742
|
+
return mimeTypes.extension(value) || null;
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3734
3745
|
/**
|
|
3735
3746
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3736
3747
|
*
|
|
@@ -3784,7 +3795,7 @@
|
|
|
3784
3795
|
case 1:
|
|
3785
3796
|
response_1 = _l.sent();
|
|
3786
3797
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
3787
|
-
if (tools.fs === undefined || !url.endsWith('.pdf')) {
|
|
3798
|
+
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [💵] */)) {
|
|
3788
3799
|
return [2 /*return*/, {
|
|
3789
3800
|
source: name,
|
|
3790
3801
|
filename: null,
|
|
@@ -3829,7 +3840,7 @@
|
|
|
3829
3840
|
basename = url.split('/').pop() || titleToName(url);
|
|
3830
3841
|
hash = sha256__default["default"](hexEncoder__default["default"].parse(url)).toString( /* hex */);
|
|
3831
3842
|
rootDirname_1 = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
3832
|
-
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), ".
|
|
3843
|
+
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));
|
|
3833
3844
|
return [4 /*yield*/, tools.fs.mkdir(path.dirname(path.join(rootDirname_1, filepath)), { recursive: true })];
|
|
3834
3845
|
case 2:
|
|
3835
3846
|
_l.sent();
|
|
@@ -3840,9 +3851,9 @@
|
|
|
3840
3851
|
case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
|
|
3841
3852
|
case 4:
|
|
3842
3853
|
_l.sent();
|
|
3843
|
-
// TODO:
|
|
3854
|
+
// TODO: [💵] Check the file security
|
|
3844
3855
|
// TODO: !!!!!!!! Check the file size (if it is not too big)
|
|
3845
|
-
// TODO: !!!!!!!! Delete the file
|
|
3856
|
+
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
3846
3857
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
3847
3858
|
case 5:
|
|
3848
3859
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|