@promptbook/core 0.71.0-20 → 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 -38
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/{scrapers/_common/register → executables}/$provideExecutablesForNode.d.ts +3 -3
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
- package/esm/typings/src/executables/apps/locateLibreoffice.test.d.ts +1 -0
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
- package/esm/typings/src/executables/apps/locatePandoc.test.d.ts +1 -0
- package/esm/typings/src/executables/locateApp.d.ts +33 -0
- package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -4
- package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
- package/package.json +1 -1
- package/umd/index.umd.js +35 -38
- 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
|
/*! *****************************************************************************
|
|
@@ -5066,7 +5066,6 @@ var $scrapersRegister = new $Register('scraper_constructors');
|
|
|
5066
5066
|
* TODO: [®] DRY Register logic
|
|
5067
5067
|
*/
|
|
5068
5068
|
|
|
5069
|
-
// TODO: !!!!!!last - Maybe delete this function
|
|
5070
5069
|
/**
|
|
5071
5070
|
* Creates a message with all registered scrapers
|
|
5072
5071
|
*
|
|
@@ -5339,7 +5338,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5339
5338
|
return __awaiter(this, void 0, void 0, function () {
|
|
5340
5339
|
var sourceContent, name, _b, _c, rootDirname, _d,
|
|
5341
5340
|
// <- TODO: process.cwd() if running in Node.js
|
|
5342
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension,
|
|
5341
|
+
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5343
5342
|
return __generator(this, function (_e) {
|
|
5344
5343
|
switch (_e.label) {
|
|
5345
5344
|
case 0:
|
|
@@ -5361,19 +5360,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5361
5360
|
filename: null,
|
|
5362
5361
|
url: url,
|
|
5363
5362
|
mimeType: mimeType,
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
return [2 /*return*/, content];
|
|
5373
|
-
}
|
|
5374
|
-
});
|
|
5375
|
-
});
|
|
5376
|
-
},
|
|
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
|
+
*/
|
|
5377
5371
|
asJson: function () {
|
|
5378
5372
|
return __awaiter(this, void 0, void 0, function () {
|
|
5379
5373
|
var content;
|
|
@@ -5413,34 +5407,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5413
5407
|
}
|
|
5414
5408
|
filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
|
|
5415
5409
|
fileExtension = getFileExtension(filename_1);
|
|
5416
|
-
|
|
5410
|
+
mimeType = extensionToMimeType(fileExtension || '');
|
|
5417
5411
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
5418
5412
|
case 3:
|
|
5419
5413
|
if (!(_e.sent())) {
|
|
5420
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 "); }));
|
|
5421
5415
|
}
|
|
5422
|
-
// TODO:
|
|
5416
|
+
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
5423
5417
|
return [2 /*return*/, {
|
|
5424
5418
|
source: name,
|
|
5425
5419
|
filename: filename_1,
|
|
5426
5420
|
url: null,
|
|
5427
|
-
mimeType:
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
});
|
|
5442
|
-
});
|
|
5443
|
-
},
|
|
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
|
+
*/
|
|
5444
5435
|
asJson: function () {
|
|
5445
5436
|
return __awaiter(this, void 0, void 0, function () {
|
|
5446
5437
|
var _a, _b;
|
|
@@ -5476,9 +5467,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5476
5467
|
asJson: function () {
|
|
5477
5468
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
5478
5469
|
},
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
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
|
+
*/
|
|
5482
5478
|
}];
|
|
5483
5479
|
}
|
|
5484
5480
|
});
|
|
@@ -5803,6 +5799,7 @@ var knowledgeCommandParser = {
|
|
|
5803
5799
|
'KNOWLEDGE ./hejny-cv.md',
|
|
5804
5800
|
'KNOWLEDGE ./hejny-cv.pdf',
|
|
5805
5801
|
'KNOWLEDGE ./hejny-cv.docx',
|
|
5802
|
+
// <- TODO: [😿] Allow ONLY files scoped in the (sub)directory NOT ../ and test it
|
|
5806
5803
|
],
|
|
5807
5804
|
/**
|
|
5808
5805
|
* Parses the KNOWLEDGE command
|