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