@promptbook/node 0.71.0-21 → 0.71.0-24
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 +35 -37
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -4
- package/package.json +2 -2
- package/umd/index.umd.js +35 -37
- package/umd/index.umd.js.map +1 -1
|
@@ -51,12 +51,9 @@ export type ScraperSourceHandler = {
|
|
|
51
51
|
* Get the content as a utf-8 string
|
|
52
52
|
*/
|
|
53
53
|
asText(): Promisable<string>;
|
|
54
|
-
/**
|
|
55
|
-
* Get the content as a blob
|
|
56
|
-
*/
|
|
57
|
-
asBlob(): Promisable<Blob>;
|
|
58
54
|
};
|
|
59
55
|
/**
|
|
56
|
+
* TODO: [🥽] Add ` asBlob(): Promisable<Blob>;` or asFile
|
|
60
57
|
* TODO: [🐝] @@@ Annotate all
|
|
61
58
|
* TODO: [🔼] Export via types
|
|
62
59
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.71.0-
|
|
3
|
+
"version": "0.71.0-24",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"module": "./esm/index.es.js",
|
|
53
53
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@promptbook/core": "0.71.0-
|
|
55
|
+
"@promptbook/core": "0.71.0-24"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* The version of the Promptbook library
|
|
37
37
|
*/
|
|
38
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
38
|
+
var PROMPTBOOK_VERSION = '0.71.0-23';
|
|
39
39
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
40
40
|
|
|
41
41
|
/*! *****************************************************************************
|
|
@@ -5019,7 +5019,7 @@
|
|
|
5019
5019
|
return __awaiter(this, void 0, void 0, function () {
|
|
5020
5020
|
var sourceContent, name, _b, _c, rootDirname, _d,
|
|
5021
5021
|
// <- TODO: process.cwd() if running in Node.js
|
|
5022
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension,
|
|
5022
|
+
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5023
5023
|
return __generator(this, function (_e) {
|
|
5024
5024
|
switch (_e.label) {
|
|
5025
5025
|
case 0:
|
|
@@ -5041,19 +5041,14 @@
|
|
|
5041
5041
|
filename: null,
|
|
5042
5042
|
url: url,
|
|
5043
5043
|
mimeType: mimeType,
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
return [2 /*return*/, content];
|
|
5053
|
-
}
|
|
5054
|
-
});
|
|
5055
|
-
});
|
|
5056
|
-
},
|
|
5044
|
+
/*
|
|
5045
|
+
TODO: [🥽]
|
|
5046
|
+
> async asBlob() {
|
|
5047
|
+
> // TODO: [👨🏻🤝👨🏻] This can be called multiple times BUT when called second time, response in already consumed
|
|
5048
|
+
> const content = await response.blob();
|
|
5049
|
+
> return content;
|
|
5050
|
+
> },
|
|
5051
|
+
*/
|
|
5057
5052
|
asJson: function () {
|
|
5058
5053
|
return __awaiter(this, void 0, void 0, function () {
|
|
5059
5054
|
var content;
|
|
@@ -5093,34 +5088,31 @@
|
|
|
5093
5088
|
}
|
|
5094
5089
|
filename_1 = path.join(rootDirname, sourceContent).split('\\').join('/');
|
|
5095
5090
|
fileExtension = getFileExtension(filename_1);
|
|
5096
|
-
|
|
5091
|
+
mimeType = extensionToMimeType(fileExtension || '');
|
|
5097
5092
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
5098
5093
|
case 3:
|
|
5099
5094
|
if (!(_e.sent())) {
|
|
5100
5095
|
throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
|
|
5101
5096
|
}
|
|
5102
|
-
// TODO:
|
|
5097
|
+
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
5103
5098
|
return [2 /*return*/, {
|
|
5104
5099
|
source: name,
|
|
5105
5100
|
filename: filename_1,
|
|
5106
5101
|
url: null,
|
|
5107
|
-
mimeType:
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
});
|
|
5122
|
-
});
|
|
5123
|
-
},
|
|
5102
|
+
mimeType: mimeType,
|
|
5103
|
+
/*
|
|
5104
|
+
TODO: [🥽]
|
|
5105
|
+
> async asBlob() {
|
|
5106
|
+
> const content = await tools.fs!.readFile(filename);
|
|
5107
|
+
> return new Blob(
|
|
5108
|
+
> [
|
|
5109
|
+
> content,
|
|
5110
|
+
> // <- TODO: [🥽] This is NOT tested, test it
|
|
5111
|
+
> ],
|
|
5112
|
+
> { type: mimeType },
|
|
5113
|
+
> );
|
|
5114
|
+
> },
|
|
5115
|
+
*/
|
|
5124
5116
|
asJson: function () {
|
|
5125
5117
|
return __awaiter(this, void 0, void 0, function () {
|
|
5126
5118
|
var _a, _b;
|
|
@@ -5156,9 +5148,14 @@
|
|
|
5156
5148
|
asJson: function () {
|
|
5157
5149
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
5158
5150
|
},
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5151
|
+
/*
|
|
5152
|
+
TODO: [🥽]
|
|
5153
|
+
> asBlob() {
|
|
5154
|
+
> throw new UnexpectedError(
|
|
5155
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
5156
|
+
> );
|
|
5157
|
+
> },
|
|
5158
|
+
*/
|
|
5162
5159
|
}];
|
|
5163
5160
|
}
|
|
5164
5161
|
});
|
|
@@ -5483,6 +5480,7 @@
|
|
|
5483
5480
|
'KNOWLEDGE ./hejny-cv.md',
|
|
5484
5481
|
'KNOWLEDGE ./hejny-cv.pdf',
|
|
5485
5482
|
'KNOWLEDGE ./hejny-cv.docx',
|
|
5483
|
+
// <- TODO: [😿] Allow ONLY files scoped in the (sub)directory NOT ../ and test it
|
|
5486
5484
|
],
|
|
5487
5485
|
/**
|
|
5488
5486
|
* Parses the KNOWLEDGE command
|