@promptbook/legacy-documents 0.71.0-16 → 0.71.0-18
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/README.md +5 -1
- package/esm/index.es.js +17 -17
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -8
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/execution/Executables.d.ts +18 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -2
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +0 -19
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideExecutablesForNode.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +5 -2
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/{IExecCommandOptions.d.ts → ExecCommandOptions.d.ts} +2 -6
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +3 -3
- package/esm/typings/src/utils/normalization/IKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
- package/esm/typings/src/utils/unwrapResult.d.ts +4 -4
- package/package.json +4 -3
- package/umd/index.umd.js +17 -17
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
- /package/esm/typings/src/scrapers/website/utils/{markdownConverter.test.d.ts → createShowdownConverter.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
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-17';
|
|
19
19
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
20
20
|
|
|
21
21
|
/*! *****************************************************************************
|
|
@@ -2555,8 +2555,7 @@
|
|
|
2555
2555
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
2556
2556
|
*
|
|
2557
2557
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
2558
|
-
* @public exported from `@promptbook/
|
|
2559
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
2558
|
+
* @public exported from `@promptbook/core`
|
|
2560
2559
|
*/
|
|
2561
2560
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
2562
2561
|
/**
|
|
@@ -3094,7 +3093,7 @@
|
|
|
3094
3093
|
* TODO: [®] DRY Register logic
|
|
3095
3094
|
*/
|
|
3096
3095
|
|
|
3097
|
-
// TODO: !!!!!! Maybe delete this function
|
|
3096
|
+
// TODO: !!!!!!last - Maybe delete this function
|
|
3098
3097
|
/**
|
|
3099
3098
|
* Creates a message with all registered scrapers
|
|
3100
3099
|
*
|
|
@@ -3202,7 +3201,6 @@
|
|
|
3202
3201
|
* @private within the repository
|
|
3203
3202
|
*/
|
|
3204
3203
|
function sourceContentToName(sourceContent) {
|
|
3205
|
-
// TODO: !!!!!! Better name for source than gibberish hash
|
|
3206
3204
|
var hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(sourceContent)))
|
|
3207
3205
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
3208
3206
|
.toString( /* hex */)
|
|
@@ -3333,7 +3331,7 @@
|
|
|
3333
3331
|
content = _a.sent();
|
|
3334
3332
|
return [2 /*return*/, new Blob([
|
|
3335
3333
|
content,
|
|
3336
|
-
// <- TODO: !!!!!!
|
|
3334
|
+
// <- TODO: !!!!!! Test that this is working
|
|
3337
3335
|
], { type: mimeType_1 })];
|
|
3338
3336
|
}
|
|
3339
3337
|
});
|
|
@@ -3346,7 +3344,7 @@
|
|
|
3346
3344
|
switch (_c.label) {
|
|
3347
3345
|
case 0:
|
|
3348
3346
|
_b = (_a = JSON).parse;
|
|
3349
|
-
return [4 /*yield*/,
|
|
3347
|
+
return [4 /*yield*/, tools.fs.readFile(filename_1, 'utf-8')];
|
|
3350
3348
|
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
3351
3349
|
}
|
|
3352
3350
|
});
|
|
@@ -3356,7 +3354,7 @@
|
|
|
3356
3354
|
return __awaiter(this, void 0, void 0, function () {
|
|
3357
3355
|
return __generator(this, function (_a) {
|
|
3358
3356
|
switch (_a.label) {
|
|
3359
|
-
case 0: return [4 /*yield*/,
|
|
3357
|
+
case 0: return [4 /*yield*/, tools.fs.readFile(filename_1, 'utf-8')];
|
|
3360
3358
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3361
3359
|
}
|
|
3362
3360
|
});
|
|
@@ -5962,12 +5960,13 @@
|
|
|
5962
5960
|
* Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object
|
|
5963
5961
|
*/
|
|
5964
5962
|
DocumentScraper.prototype.$convert = function (source) {
|
|
5963
|
+
var _a;
|
|
5965
5964
|
return __awaiter(this, void 0, void 0, function () {
|
|
5966
|
-
var
|
|
5965
|
+
var _b, _c, rootDirname, _d, cacheDirname, _e, isCacheCleaned, _f, isVerbose, extension, cacheFilehandler, command_1;
|
|
5967
5966
|
return __generator(this, function (_g) {
|
|
5968
5967
|
switch (_g.label) {
|
|
5969
5968
|
case 0:
|
|
5970
|
-
|
|
5969
|
+
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? SCRAPE_CACHE_DIRNAME : _d, _e = _b.isCacheCleaned, isCacheCleaned = _e === void 0 ? false : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? IS_VERBOSE : _f;
|
|
5971
5970
|
if (!$isRunningInNode()) {
|
|
5972
5971
|
throw new KnowledgeScrapeError('Scraping .docx files is only supported in Node environment');
|
|
5973
5972
|
}
|
|
@@ -5975,7 +5974,7 @@
|
|
|
5975
5974
|
throw new EnvironmentMismatchError('Can not scrape documents without filesystem tools');
|
|
5976
5975
|
// <- TODO: [🧠] What is the best error type here`
|
|
5977
5976
|
}
|
|
5978
|
-
if (
|
|
5977
|
+
if (((_a = this.tools.executables) === null || _a === void 0 ? void 0 : _a.pandocPath) === undefined) {
|
|
5979
5978
|
throw new MissingToolsError('Pandoc is required for scraping .docx files');
|
|
5980
5979
|
}
|
|
5981
5980
|
if (source.filename === null) {
|
|
@@ -5995,7 +5994,7 @@
|
|
|
5995
5994
|
return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
|
|
5996
5995
|
case 2:
|
|
5997
5996
|
if (!!(_g.sent())) return [3 /*break*/, 5];
|
|
5998
|
-
command_1 = "\"".concat(
|
|
5997
|
+
command_1 = "\"".concat(this.tools.executables.pandocPath, "\" -f ").concat(extension, " -t markdown \"").concat(source.filename, "\" -o \"").concat(cacheFilehandler.filename, "\"");
|
|
5999
5998
|
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook
|
|
6000
5999
|
return [4 /*yield*/, $execCommand(command_1)];
|
|
6001
6000
|
case 3:
|
|
@@ -6091,7 +6090,7 @@
|
|
|
6091
6090
|
$scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
|
|
6092
6091
|
|
|
6093
6092
|
/**
|
|
6094
|
-
* Scraper for .
|
|
6093
|
+
* Scraper for old document files (like .doc and .rtf)
|
|
6095
6094
|
*
|
|
6096
6095
|
* @see `documentationUrl` for more details
|
|
6097
6096
|
* @public exported from `@promptbook/legacy-documents`
|
|
@@ -6118,12 +6117,13 @@
|
|
|
6118
6117
|
* Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object
|
|
6119
6118
|
*/
|
|
6120
6119
|
LegacyDocumentScraper.prototype.$convert = function (source) {
|
|
6120
|
+
var _a;
|
|
6121
6121
|
return __awaiter(this, void 0, void 0, function () {
|
|
6122
|
-
var
|
|
6122
|
+
var _b, _c, rootDirname, _d, cacheDirname, _e, isCacheCleaned, _f, isVerbose, extension, cacheFilehandler, documentSourceOutdirPathForLibreOffice_1, command_1, files_1, file;
|
|
6123
6123
|
return __generator(this, function (_g) {
|
|
6124
6124
|
switch (_g.label) {
|
|
6125
6125
|
case 0:
|
|
6126
|
-
|
|
6126
|
+
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? SCRAPE_CACHE_DIRNAME : _d, _e = _b.isCacheCleaned, isCacheCleaned = _e === void 0 ? false : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? IS_VERBOSE : _f;
|
|
6127
6127
|
if (!$isRunningInNode()) {
|
|
6128
6128
|
throw new KnowledgeScrapeError('Scraping .doc files is only supported in Node environment');
|
|
6129
6129
|
}
|
|
@@ -6131,7 +6131,7 @@
|
|
|
6131
6131
|
throw new EnvironmentMismatchError('Can not scrape (legacy) documents without filesystem tools');
|
|
6132
6132
|
// <- TODO: [🧠] What is the best error type here`
|
|
6133
6133
|
}
|
|
6134
|
-
if (
|
|
6134
|
+
if (((_a = this.tools.executables) === null || _a === void 0 ? void 0 : _a.libreOfficePath) === undefined) {
|
|
6135
6135
|
throw new MissingToolsError('LibreOffice is required for scraping .doc and .rtf files');
|
|
6136
6136
|
}
|
|
6137
6137
|
if (source.filename === null) {
|
|
@@ -6157,7 +6157,7 @@
|
|
|
6157
6157
|
documentSourceOutdirPathForLibreOffice_1 = path.join(path.dirname(cacheFilehandler.filename), 'libreoffice')
|
|
6158
6158
|
.split('\\')
|
|
6159
6159
|
.join('/');
|
|
6160
|
-
command_1 = "\"".concat(
|
|
6160
|
+
command_1 = "\"".concat(this.tools.executables.libreOfficePath, "\" --headless --convert-to docx \"").concat(source.filename, "\" --outdir \"").concat(documentSourceOutdirPathForLibreOffice_1, "\"");
|
|
6161
6161
|
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook - this should trigger build polution error
|
|
6162
6162
|
return [4 /*yield*/, $execCommand(command_1)];
|
|
6163
6163
|
case 3:
|