@promptbook/cli 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 +59 -47
- 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 +59 -47
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Converter } from 'showdown';
|
|
|
27
27
|
/**
|
|
28
28
|
* The version of the Promptbook library
|
|
29
29
|
*/
|
|
30
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
30
|
+
var PROMPTBOOK_VERSION = '0.71.0-22';
|
|
31
31
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
32
32
|
|
|
33
33
|
/*! *****************************************************************************
|
|
@@ -5173,7 +5173,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5173
5173
|
return __awaiter(this, void 0, void 0, function () {
|
|
5174
5174
|
var sourceContent, name, _b, _c, rootDirname, _d,
|
|
5175
5175
|
// <- TODO: process.cwd() if running in Node.js
|
|
5176
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension,
|
|
5176
|
+
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5177
5177
|
return __generator(this, function (_e) {
|
|
5178
5178
|
switch (_e.label) {
|
|
5179
5179
|
case 0:
|
|
@@ -5195,19 +5195,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5195
5195
|
filename: null,
|
|
5196
5196
|
url: url,
|
|
5197
5197
|
mimeType: mimeType,
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
return [2 /*return*/, content];
|
|
5207
|
-
}
|
|
5208
|
-
});
|
|
5209
|
-
});
|
|
5210
|
-
},
|
|
5198
|
+
/*
|
|
5199
|
+
TODO: [🥽]
|
|
5200
|
+
> async asBlob() {
|
|
5201
|
+
> // TODO: [👨🏻🤝👨🏻] This can be called multiple times BUT when called second time, response in already consumed
|
|
5202
|
+
> const content = await response.blob();
|
|
5203
|
+
> return content;
|
|
5204
|
+
> },
|
|
5205
|
+
*/
|
|
5211
5206
|
asJson: function () {
|
|
5212
5207
|
return __awaiter(this, void 0, void 0, function () {
|
|
5213
5208
|
var content;
|
|
@@ -5247,34 +5242,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5247
5242
|
}
|
|
5248
5243
|
filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
|
|
5249
5244
|
fileExtension = getFileExtension(filename_1);
|
|
5250
|
-
|
|
5245
|
+
mimeType = extensionToMimeType(fileExtension || '');
|
|
5251
5246
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
5252
5247
|
case 3:
|
|
5253
5248
|
if (!(_e.sent())) {
|
|
5254
5249
|
throw new NotFoundError(spaceTrim$1(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
|
|
5255
5250
|
}
|
|
5256
|
-
// TODO:
|
|
5251
|
+
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
5257
5252
|
return [2 /*return*/, {
|
|
5258
5253
|
source: name,
|
|
5259
5254
|
filename: filename_1,
|
|
5260
5255
|
url: null,
|
|
5261
|
-
mimeType:
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
});
|
|
5276
|
-
});
|
|
5277
|
-
},
|
|
5256
|
+
mimeType: mimeType,
|
|
5257
|
+
/*
|
|
5258
|
+
TODO: [🥽]
|
|
5259
|
+
> async asBlob() {
|
|
5260
|
+
> const content = await tools.fs!.readFile(filename);
|
|
5261
|
+
> return new Blob(
|
|
5262
|
+
> [
|
|
5263
|
+
> content,
|
|
5264
|
+
> // <- TODO: [🥽] This is NOT tested, test it
|
|
5265
|
+
> ],
|
|
5266
|
+
> { type: mimeType },
|
|
5267
|
+
> );
|
|
5268
|
+
> },
|
|
5269
|
+
*/
|
|
5278
5270
|
asJson: function () {
|
|
5279
5271
|
return __awaiter(this, void 0, void 0, function () {
|
|
5280
5272
|
var _a, _b;
|
|
@@ -5310,9 +5302,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5310
5302
|
asJson: function () {
|
|
5311
5303
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
5312
5304
|
},
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5305
|
+
/*
|
|
5306
|
+
TODO: [🥽]
|
|
5307
|
+
> asBlob() {
|
|
5308
|
+
> throw new UnexpectedError(
|
|
5309
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
5310
|
+
> );
|
|
5311
|
+
> },
|
|
5312
|
+
*/
|
|
5316
5313
|
}];
|
|
5317
5314
|
}
|
|
5318
5315
|
});
|
|
@@ -5637,6 +5634,7 @@ var knowledgeCommandParser = {
|
|
|
5637
5634
|
'KNOWLEDGE ./hejny-cv.md',
|
|
5638
5635
|
'KNOWLEDGE ./hejny-cv.pdf',
|
|
5639
5636
|
'KNOWLEDGE ./hejny-cv.docx',
|
|
5637
|
+
// <- TODO: [😿] Allow ONLY files scoped in the (sub)directory NOT ../ and test it
|
|
5640
5638
|
],
|
|
5641
5639
|
/**
|
|
5642
5640
|
* Parses the KNOWLEDGE command
|
|
@@ -13389,9 +13387,14 @@ var DocumentScraper = /** @class */ (function () {
|
|
|
13389
13387
|
asJson: function () {
|
|
13390
13388
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
13391
13389
|
},
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13390
|
+
/*
|
|
13391
|
+
TODO: [🥽]
|
|
13392
|
+
> asBlob() {
|
|
13393
|
+
> throw new UnexpectedError(
|
|
13394
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
13395
|
+
> );
|
|
13396
|
+
> },
|
|
13397
|
+
*/
|
|
13395
13398
|
};
|
|
13396
13399
|
knowledge = this.markdownScraper.scrape(markdownSource);
|
|
13397
13400
|
return [4 /*yield*/, cacheFilehandler.destroy()];
|
|
@@ -13557,9 +13560,14 @@ var LegacyDocumentScraper = /** @class */ (function () {
|
|
|
13557
13560
|
asJson: function () {
|
|
13558
13561
|
throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asJson`');
|
|
13559
13562
|
},
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
+
/*
|
|
13564
|
+
TODO: [🥽]
|
|
13565
|
+
> asBlob() {
|
|
13566
|
+
> throw new UnexpectedError(
|
|
13567
|
+
> 'Did not expect that `documentScraper` would need to get the content `asBlob`',
|
|
13568
|
+
> );
|
|
13569
|
+
> },
|
|
13570
|
+
*/
|
|
13563
13571
|
};
|
|
13564
13572
|
knowledge = this.documentScraper.scrape(markdownSource);
|
|
13565
13573
|
return [4 /*yield*/, cacheFilehandler.destroy()];
|
|
@@ -13847,7 +13855,6 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
13847
13855
|
switch (_g.label) {
|
|
13848
13856
|
case 0:
|
|
13849
13857
|
_a = this.options, _b = _a.rootDirname, rootDirname = _b === void 0 ? process.cwd() : _b, _c = _a.cacheDirname, cacheDirname = _c === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _c, _d = _a.intermediateFilesStrategy, intermediateFilesStrategy = _d === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _d, _e = _a.isVerbose, isVerbose = _e === void 0 ? DEFAULT_IS_VERBOSE : _e;
|
|
13850
|
-
// TODO: !!!!!! Does this work in browser? Make it work.
|
|
13851
13858
|
if (source.url === null) {
|
|
13852
13859
|
throw new KnowledgeScrapeError('Website scraper requires URL');
|
|
13853
13860
|
}
|
|
@@ -13907,9 +13914,14 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
13907
13914
|
asJson: function () {
|
|
13908
13915
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
13909
13916
|
},
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13917
|
+
/*
|
|
13918
|
+
TODO: [🥽]
|
|
13919
|
+
> asBlob() {
|
|
13920
|
+
> throw new UnexpectedError(
|
|
13921
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
13922
|
+
> );
|
|
13923
|
+
> },
|
|
13924
|
+
*/
|
|
13913
13925
|
};
|
|
13914
13926
|
knowledge = this.markdownScraper.scrape(markdownSource);
|
|
13915
13927
|
return [4 /*yield*/, cacheFilehandler.destroy()];
|