@promptbook/core 0.71.0-21 → 0.71.0-23
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 +1 -1
- package/umd/index.umd.js +35 -37
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -14,7 +14,7 @@ import moment from 'moment';
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.71.0-22';
|
|
18
18
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -5338,7 +5338,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5338
5338
|
return __awaiter(this, void 0, void 0, function () {
|
|
5339
5339
|
var sourceContent, name, _b, _c, rootDirname, _d,
|
|
5340
5340
|
// <- TODO: process.cwd() if running in Node.js
|
|
5341
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension,
|
|
5341
|
+
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5342
5342
|
return __generator(this, function (_e) {
|
|
5343
5343
|
switch (_e.label) {
|
|
5344
5344
|
case 0:
|
|
@@ -5360,19 +5360,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5360
5360
|
filename: null,
|
|
5361
5361
|
url: url,
|
|
5362
5362
|
mimeType: mimeType,
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
return [2 /*return*/, content];
|
|
5372
|
-
}
|
|
5373
|
-
});
|
|
5374
|
-
});
|
|
5375
|
-
},
|
|
5363
|
+
/*
|
|
5364
|
+
TODO: [🥽]
|
|
5365
|
+
> async asBlob() {
|
|
5366
|
+
> // TODO: [👨🏻🤝👨🏻] This can be called multiple times BUT when called second time, response in already consumed
|
|
5367
|
+
> const content = await response.blob();
|
|
5368
|
+
> return content;
|
|
5369
|
+
> },
|
|
5370
|
+
*/
|
|
5376
5371
|
asJson: function () {
|
|
5377
5372
|
return __awaiter(this, void 0, void 0, function () {
|
|
5378
5373
|
var content;
|
|
@@ -5412,34 +5407,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5412
5407
|
}
|
|
5413
5408
|
filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
|
|
5414
5409
|
fileExtension = getFileExtension(filename_1);
|
|
5415
|
-
|
|
5410
|
+
mimeType = extensionToMimeType(fileExtension || '');
|
|
5416
5411
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
5417
5412
|
case 3:
|
|
5418
5413
|
if (!(_e.sent())) {
|
|
5419
5414
|
throw new NotFoundError(spaceTrim(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
|
|
5420
5415
|
}
|
|
5421
|
-
// TODO:
|
|
5416
|
+
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
5422
5417
|
return [2 /*return*/, {
|
|
5423
5418
|
source: name,
|
|
5424
5419
|
filename: filename_1,
|
|
5425
5420
|
url: null,
|
|
5426
|
-
mimeType:
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
});
|
|
5441
|
-
});
|
|
5442
|
-
},
|
|
5421
|
+
mimeType: mimeType,
|
|
5422
|
+
/*
|
|
5423
|
+
TODO: [🥽]
|
|
5424
|
+
> async asBlob() {
|
|
5425
|
+
> const content = await tools.fs!.readFile(filename);
|
|
5426
|
+
> return new Blob(
|
|
5427
|
+
> [
|
|
5428
|
+
> content,
|
|
5429
|
+
> // <- TODO: [🥽] This is NOT tested, test it
|
|
5430
|
+
> ],
|
|
5431
|
+
> { type: mimeType },
|
|
5432
|
+
> );
|
|
5433
|
+
> },
|
|
5434
|
+
*/
|
|
5443
5435
|
asJson: function () {
|
|
5444
5436
|
return __awaiter(this, void 0, void 0, function () {
|
|
5445
5437
|
var _a, _b;
|
|
@@ -5475,9 +5467,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5475
5467
|
asJson: function () {
|
|
5476
5468
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
5477
5469
|
},
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5470
|
+
/*
|
|
5471
|
+
TODO: [🥽]
|
|
5472
|
+
> asBlob() {
|
|
5473
|
+
> throw new UnexpectedError(
|
|
5474
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
5475
|
+
> );
|
|
5476
|
+
> },
|
|
5477
|
+
*/
|
|
5481
5478
|
}];
|
|
5482
5479
|
}
|
|
5483
5480
|
});
|
|
@@ -5802,6 +5799,7 @@ var knowledgeCommandParser = {
|
|
|
5802
5799
|
'KNOWLEDGE ./hejny-cv.md',
|
|
5803
5800
|
'KNOWLEDGE ./hejny-cv.pdf',
|
|
5804
5801
|
'KNOWLEDGE ./hejny-cv.docx',
|
|
5802
|
+
// <- TODO: [😿] Allow ONLY files scoped in the (sub)directory NOT ../ and test it
|
|
5805
5803
|
],
|
|
5806
5804
|
/**
|
|
5807
5805
|
* Parses the KNOWLEDGE command
|