@promptbook/legacy-documents 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 +50 -43
- 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 +50 -43
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -15,7 +15,7 @@ import { unparse, parse } from 'papaparse';
|
|
|
15
15
|
/**
|
|
16
16
|
* The version of the Promptbook library
|
|
17
17
|
*/
|
|
18
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
18
|
+
var PROMPTBOOK_VERSION = '0.71.0-22';
|
|
19
19
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
20
20
|
|
|
21
21
|
/*! *****************************************************************************
|
|
@@ -3240,7 +3240,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3240
3240
|
return __awaiter(this, void 0, void 0, function () {
|
|
3241
3241
|
var sourceContent, name, _b, _c, rootDirname, _d,
|
|
3242
3242
|
// <- TODO: process.cwd() if running in Node.js
|
|
3243
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension,
|
|
3243
|
+
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
3244
3244
|
return __generator(this, function (_e) {
|
|
3245
3245
|
switch (_e.label) {
|
|
3246
3246
|
case 0:
|
|
@@ -3262,19 +3262,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3262
3262
|
filename: null,
|
|
3263
3263
|
url: url,
|
|
3264
3264
|
mimeType: mimeType,
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
return [2 /*return*/, content];
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
});
|
|
3277
|
-
},
|
|
3265
|
+
/*
|
|
3266
|
+
TODO: [🥽]
|
|
3267
|
+
> async asBlob() {
|
|
3268
|
+
> // TODO: [👨🏻🤝👨🏻] This can be called multiple times BUT when called second time, response in already consumed
|
|
3269
|
+
> const content = await response.blob();
|
|
3270
|
+
> return content;
|
|
3271
|
+
> },
|
|
3272
|
+
*/
|
|
3278
3273
|
asJson: function () {
|
|
3279
3274
|
return __awaiter(this, void 0, void 0, function () {
|
|
3280
3275
|
var content;
|
|
@@ -3314,34 +3309,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3314
3309
|
}
|
|
3315
3310
|
filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
|
|
3316
3311
|
fileExtension = getFileExtension(filename_1);
|
|
3317
|
-
|
|
3312
|
+
mimeType = extensionToMimeType(fileExtension || '');
|
|
3318
3313
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
3319
3314
|
case 3:
|
|
3320
3315
|
if (!(_e.sent())) {
|
|
3321
3316
|
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 "); }));
|
|
3322
3317
|
}
|
|
3323
|
-
// TODO:
|
|
3318
|
+
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
3324
3319
|
return [2 /*return*/, {
|
|
3325
3320
|
source: name,
|
|
3326
3321
|
filename: filename_1,
|
|
3327
3322
|
url: null,
|
|
3328
|
-
mimeType:
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
});
|
|
3343
|
-
});
|
|
3344
|
-
},
|
|
3323
|
+
mimeType: mimeType,
|
|
3324
|
+
/*
|
|
3325
|
+
TODO: [🥽]
|
|
3326
|
+
> async asBlob() {
|
|
3327
|
+
> const content = await tools.fs!.readFile(filename);
|
|
3328
|
+
> return new Blob(
|
|
3329
|
+
> [
|
|
3330
|
+
> content,
|
|
3331
|
+
> // <- TODO: [🥽] This is NOT tested, test it
|
|
3332
|
+
> ],
|
|
3333
|
+
> { type: mimeType },
|
|
3334
|
+
> );
|
|
3335
|
+
> },
|
|
3336
|
+
*/
|
|
3345
3337
|
asJson: function () {
|
|
3346
3338
|
return __awaiter(this, void 0, void 0, function () {
|
|
3347
3339
|
var _a, _b;
|
|
@@ -3377,9 +3369,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3377
3369
|
asJson: function () {
|
|
3378
3370
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
3379
3371
|
},
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3372
|
+
/*
|
|
3373
|
+
TODO: [🥽]
|
|
3374
|
+
> asBlob() {
|
|
3375
|
+
> throw new UnexpectedError(
|
|
3376
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
3377
|
+
> );
|
|
3378
|
+
> },
|
|
3379
|
+
*/
|
|
3383
3380
|
}];
|
|
3384
3381
|
}
|
|
3385
3382
|
});
|
|
@@ -6034,9 +6031,14 @@ var DocumentScraper = /** @class */ (function () {
|
|
|
6034
6031
|
asJson: function () {
|
|
6035
6032
|
throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
|
|
6036
6033
|
},
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6034
|
+
/*
|
|
6035
|
+
TODO: [🥽]
|
|
6036
|
+
> asBlob() {
|
|
6037
|
+
> throw new UnexpectedError(
|
|
6038
|
+
> 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
|
|
6039
|
+
> );
|
|
6040
|
+
> },
|
|
6041
|
+
*/
|
|
6040
6042
|
};
|
|
6041
6043
|
knowledge = this.markdownScraper.scrape(markdownSource);
|
|
6042
6044
|
return [4 /*yield*/, cacheFilehandler.destroy()];
|
|
@@ -6202,9 +6204,14 @@ var LegacyDocumentScraper = /** @class */ (function () {
|
|
|
6202
6204
|
asJson: function () {
|
|
6203
6205
|
throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asJson`');
|
|
6204
6206
|
},
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6207
|
+
/*
|
|
6208
|
+
TODO: [🥽]
|
|
6209
|
+
> asBlob() {
|
|
6210
|
+
> throw new UnexpectedError(
|
|
6211
|
+
> 'Did not expect that `documentScraper` would need to get the content `asBlob`',
|
|
6212
|
+
> );
|
|
6213
|
+
> },
|
|
6214
|
+
*/
|
|
6208
6215
|
};
|
|
6209
6216
|
knowledge = this.documentScraper.scrape(markdownSource);
|
|
6210
6217
|
return [4 /*yield*/, cacheFilehandler.destroy()];
|