@promptbook/legacy-documents 0.72.0-15 → 0.72.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.
Files changed (29) hide show
  1. package/esm/index.es.js +50 -44
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/cli.index.d.ts +0 -4
  4. package/esm/typings/src/_packages/core.index.d.ts +0 -2
  5. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  7. package/esm/typings/src/{scrapers/_common/register → executables}/$provideExecutablesForNode.d.ts +3 -3
  8. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
  9. package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
  10. package/esm/typings/src/executables/locateApp.d.ts +33 -0
  11. package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
  12. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
  13. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
  14. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
  15. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +0 -1
  16. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -4
  17. package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
  18. package/package.json +2 -2
  19. package/umd/index.umd.js +50 -44
  20. package/umd/index.umd.js.map +1 -1
  21. package/esm/typings/src/_packages/website-crawler.index.d.ts +0 -8
  22. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +0 -50
  23. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +0 -20
  24. package/esm/typings/src/scrapers/website/playground/website-scraper-playground.d.ts +0 -5
  25. package/esm/typings/src/scrapers/website/register-constructor.d.ts +0 -13
  26. package/esm/typings/src/scrapers/website/register-metadata.d.ts +0 -24
  27. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +0 -7
  28. /package/esm/typings/src/{scrapers/website/WebsiteScraper.test.d.ts → executables/apps/locateLibreoffice.test.d.ts} +0 -0
  29. /package/esm/typings/src/{scrapers/website/utils/createShowdownConverter.test.d.ts → executables/apps/locatePandoc.test.d.ts} +0 -0
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.72.0-14';
18
+ var PROMPTBOOK_VERSION = '0.72.0-22';
19
19
  // TODO: [main] !!!! List here all the versions and annotate + put into script
20
20
 
21
21
  /*! *****************************************************************************
@@ -3126,7 +3126,6 @@ var $scrapersRegister = new $Register('scraper_constructors');
3126
3126
  * TODO: [®] DRY Register logic
3127
3127
  */
3128
3128
 
3129
- // TODO: !!!!!!last - Maybe delete this function
3130
3129
  /**
3131
3130
  * Creates a message with all registered scrapers
3132
3131
  *
@@ -3268,7 +3267,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3268
3267
  return __awaiter(this, void 0, void 0, function () {
3269
3268
  var sourceContent, name, _b, _c, rootDirname, _d,
3270
3269
  // <- TODO: process.cwd() if running in Node.js
3271
- isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType_1;
3270
+ isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
3272
3271
  return __generator(this, function (_e) {
3273
3272
  switch (_e.label) {
3274
3273
  case 0:
@@ -3290,19 +3289,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3290
3289
  filename: null,
3291
3290
  url: url,
3292
3291
  mimeType: mimeType,
3293
- asBlob: function () {
3294
- return __awaiter(this, void 0, void 0, function () {
3295
- var content;
3296
- return __generator(this, function (_a) {
3297
- switch (_a.label) {
3298
- case 0: return [4 /*yield*/, response_1.blob()];
3299
- case 1:
3300
- content = _a.sent();
3301
- return [2 /*return*/, content];
3302
- }
3303
- });
3304
- });
3305
- },
3292
+ /*
3293
+ TODO: [🥽]
3294
+ > async asBlob() {
3295
+ > // TODO: [👨🏻‍🤝‍👨🏻] This can be called multiple times BUT when called second time, response in already consumed
3296
+ > const content = await response.blob();
3297
+ > return content;
3298
+ > },
3299
+ */
3306
3300
  asJson: function () {
3307
3301
  return __awaiter(this, void 0, void 0, function () {
3308
3302
  var content;
@@ -3342,34 +3336,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3342
3336
  }
3343
3337
  filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
3344
3338
  fileExtension = getFileExtension(filename_1);
3345
- mimeType_1 = extensionToMimeType(fileExtension || '');
3339
+ mimeType = extensionToMimeType(fileExtension || '');
3346
3340
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
3347
3341
  case 3:
3348
3342
  if (!(_e.sent())) {
3349
3343
  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 "); }));
3350
3344
  }
3351
- // TODO: !!!!!! Test security file - file is scoped to the project (maybe do this in `filesystemTools`)
3345
+ // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
3352
3346
  return [2 /*return*/, {
3353
3347
  source: name,
3354
3348
  filename: filename_1,
3355
3349
  url: null,
3356
- mimeType: mimeType_1,
3357
- asBlob: function () {
3358
- return __awaiter(this, void 0, void 0, function () {
3359
- var content;
3360
- return __generator(this, function (_a) {
3361
- switch (_a.label) {
3362
- case 0: return [4 /*yield*/, tools.fs.readFile(filename_1)];
3363
- case 1:
3364
- content = _a.sent();
3365
- return [2 /*return*/, new Blob([
3366
- content,
3367
- // <- TODO: !!!!!! Test that this is working
3368
- ], { type: mimeType_1 })];
3369
- }
3370
- });
3371
- });
3372
- },
3350
+ mimeType: mimeType,
3351
+ /*
3352
+ TODO: [🥽]
3353
+ > async asBlob() {
3354
+ > const content = await tools.fs!.readFile(filename);
3355
+ > return new Blob(
3356
+ > [
3357
+ > content,
3358
+ > // <- TODO: [🥽] This is NOT tested, test it
3359
+ > ],
3360
+ > { type: mimeType },
3361
+ > );
3362
+ > },
3363
+ */
3373
3364
  asJson: function () {
3374
3365
  return __awaiter(this, void 0, void 0, function () {
3375
3366
  var _a, _b;
@@ -3405,9 +3396,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3405
3396
  asJson: function () {
3406
3397
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
3407
3398
  },
3408
- asBlob: function () {
3409
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
3410
- },
3399
+ /*
3400
+ TODO: [🥽]
3401
+ > asBlob() {
3402
+ > throw new UnexpectedError(
3403
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
3404
+ > );
3405
+ > },
3406
+ */
3411
3407
  }];
3412
3408
  }
3413
3409
  });
@@ -6062,9 +6058,14 @@ var DocumentScraper = /** @class */ (function () {
6062
6058
  asJson: function () {
6063
6059
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
6064
6060
  },
6065
- asBlob: function () {
6066
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
6067
- },
6061
+ /*
6062
+ TODO: [🥽]
6063
+ > asBlob() {
6064
+ > throw new UnexpectedError(
6065
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
6066
+ > );
6067
+ > },
6068
+ */
6068
6069
  };
6069
6070
  knowledge = this.markdownScraper.scrape(markdownSource);
6070
6071
  return [4 /*yield*/, cacheFilehandler.destroy()];
@@ -6230,9 +6231,14 @@ var LegacyDocumentScraper = /** @class */ (function () {
6230
6231
  asJson: function () {
6231
6232
  throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asJson`');
6232
6233
  },
6233
- asBlob: function () {
6234
- throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asBlob`');
6235
- },
6234
+ /*
6235
+ TODO: [🥽]
6236
+ > asBlob() {
6237
+ > throw new UnexpectedError(
6238
+ > 'Did not expect that `documentScraper` would need to get the content `asBlob`',
6239
+ > );
6240
+ > },
6241
+ */
6236
6242
  };
6237
6243
  knowledge = this.documentScraper.scrape(markdownSource);
6238
6244
  return [4 /*yield*/, cacheFilehandler.destroy()];