@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 +34 -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 +34 -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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
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,
|
|
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
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
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
|
-
|
|
3315
|
-
|
|
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
|
});
|