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