@promptbook/markdown-utils 0.71.0-21 → 0.71.0-24

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 CHANGED
@@ -12,7 +12,7 @@ import { unparse, parse } from 'papaparse';
12
12
  /**
13
13
  * The version of the Promptbook library
14
14
  */
15
- var PROMPTBOOK_VERSION = '0.71.0-20';
15
+ var PROMPTBOOK_VERSION = '0.71.0-23';
16
16
  // TODO: [main] !!!! List here all the versions and annotate + put into script
17
17
 
18
18
  /*! *****************************************************************************
@@ -3172,7 +3172,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3172
3172
  return __awaiter(this, void 0, void 0, function () {
3173
3173
  var sourceContent, name, _b, _c, rootDirname, _d,
3174
3174
  // <- TODO: process.cwd() if running in Node.js
3175
- isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType_1;
3175
+ isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
3176
3176
  return __generator(this, function (_e) {
3177
3177
  switch (_e.label) {
3178
3178
  case 0:
@@ -3194,19 +3194,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3194
3194
  filename: null,
3195
3195
  url: url,
3196
3196
  mimeType: mimeType,
3197
- asBlob: function () {
3198
- return __awaiter(this, void 0, void 0, function () {
3199
- var content;
3200
- return __generator(this, function (_a) {
3201
- switch (_a.label) {
3202
- case 0: return [4 /*yield*/, response_1.blob()];
3203
- case 1:
3204
- content = _a.sent();
3205
- return [2 /*return*/, content];
3206
- }
3207
- });
3208
- });
3209
- },
3197
+ /*
3198
+ TODO: [🥽]
3199
+ > async asBlob() {
3200
+ > // TODO: [👨🏻‍🤝‍👨🏻] This can be called multiple times BUT when called second time, response in already consumed
3201
+ > const content = await response.blob();
3202
+ > return content;
3203
+ > },
3204
+ */
3210
3205
  asJson: function () {
3211
3206
  return __awaiter(this, void 0, void 0, function () {
3212
3207
  var content;
@@ -3246,34 +3241,31 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3246
3241
  }
3247
3242
  filename_1 = join(rootDirname, sourceContent).split('\\').join('/');
3248
3243
  fileExtension = getFileExtension(filename_1);
3249
- mimeType_1 = extensionToMimeType(fileExtension || '');
3244
+ mimeType = extensionToMimeType(fileExtension || '');
3250
3245
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
3251
3246
  case 3:
3252
3247
  if (!(_e.sent())) {
3253
3248
  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 "); }));
3254
3249
  }
3255
- // TODO: !!!!!! Test security file - file is scoped to the project (maybe do this in `filesystemTools`)
3250
+ // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
3256
3251
  return [2 /*return*/, {
3257
3252
  source: name,
3258
3253
  filename: filename_1,
3259
3254
  url: null,
3260
- mimeType: mimeType_1,
3261
- asBlob: function () {
3262
- return __awaiter(this, void 0, void 0, function () {
3263
- var content;
3264
- return __generator(this, function (_a) {
3265
- switch (_a.label) {
3266
- case 0: return [4 /*yield*/, tools.fs.readFile(filename_1)];
3267
- case 1:
3268
- content = _a.sent();
3269
- return [2 /*return*/, new Blob([
3270
- content,
3271
- // <- TODO: !!!!!! Test that this is working
3272
- ], { type: mimeType_1 })];
3273
- }
3274
- });
3275
- });
3276
- },
3255
+ mimeType: mimeType,
3256
+ /*
3257
+ TODO: [🥽]
3258
+ > async asBlob() {
3259
+ > const content = await tools.fs!.readFile(filename);
3260
+ > return new Blob(
3261
+ > [
3262
+ > content,
3263
+ > // <- TODO: [🥽] This is NOT tested, test it
3264
+ > ],
3265
+ > { type: mimeType },
3266
+ > );
3267
+ > },
3268
+ */
3277
3269
  asJson: function () {
3278
3270
  return __awaiter(this, void 0, void 0, function () {
3279
3271
  var _a, _b;
@@ -3309,9 +3301,14 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3309
3301
  asJson: function () {
3310
3302
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
3311
3303
  },
3312
- asBlob: function () {
3313
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
3314
- },
3304
+ /*
3305
+ TODO: [🥽]
3306
+ > asBlob() {
3307
+ > throw new UnexpectedError(
3308
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
3309
+ > );
3310
+ > },
3311
+ */
3315
3312
  }];
3316
3313
  }
3317
3314
  });