@promptbook/core 0.85.0-4 → 0.85.0-6
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 +24 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +32 -14
- package/umd/index.umd.js.map +1 -1
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('rxjs'), require('crypto'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'rxjs', 'crypto', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.rxjs, global.crypto, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.
|
|
5
|
-
})(this, (function (exports, spaceTrim, prettier, parserHtml, rxjs, crypto, waitasecond, papaparse, hexEncoder, sha256,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('rxjs'), require('crypto'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('moment'), require('colors')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'rxjs', 'crypto', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'moment', 'colors'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.rxjs, global.crypto, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.moment, global.colors));
|
|
5
|
+
})(this, (function (exports, spaceTrim, prettier, parserHtml, rxjs, crypto, waitasecond, papaparse, hexEncoder, sha256, path, cryptoJs, mimeTypes, moment, colors) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
30
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-5';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2379,6 +2379,24 @@
|
|
|
2379
2379
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2380
2380
|
partialResultSubject.next(newOngoingResult);
|
|
2381
2381
|
});
|
|
2382
|
+
finalResultPromise
|
|
2383
|
+
.catch(function (error) {
|
|
2384
|
+
// console.error('!!!!! Task failed:', error);
|
|
2385
|
+
partialResultSubject.error(error);
|
|
2386
|
+
})
|
|
2387
|
+
.then(function (value) {
|
|
2388
|
+
// console.error('!!!!! Task finished:', value);
|
|
2389
|
+
if (value) {
|
|
2390
|
+
try {
|
|
2391
|
+
assertsTaskSuccessful(value);
|
|
2392
|
+
partialResultSubject.next(value);
|
|
2393
|
+
}
|
|
2394
|
+
catch (error) {
|
|
2395
|
+
partialResultSubject.error(error);
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
partialResultSubject.complete();
|
|
2399
|
+
});
|
|
2382
2400
|
function asPromise(options) {
|
|
2383
2401
|
return __awaiter(this, void 0, void 0, function () {
|
|
2384
2402
|
var _a, isCrashedOnError, finalResult;
|
|
@@ -2389,7 +2407,9 @@
|
|
|
2389
2407
|
return [4 /*yield*/, finalResultPromise];
|
|
2390
2408
|
case 1:
|
|
2391
2409
|
finalResult = _b.sent();
|
|
2410
|
+
console.error('!!!!! finalResult:', finalResult);
|
|
2392
2411
|
if (isCrashedOnError) {
|
|
2412
|
+
console.error('!!!!! isCrashedOnError:', finalResult);
|
|
2393
2413
|
assertsTaskSuccessful(finalResult);
|
|
2394
2414
|
}
|
|
2395
2415
|
return [2 /*return*/, finalResult];
|
|
@@ -2402,9 +2422,7 @@
|
|
|
2402
2422
|
taskId: taskId,
|
|
2403
2423
|
asPromise: asPromise,
|
|
2404
2424
|
asObservable: function () {
|
|
2405
|
-
return
|
|
2406
|
-
isCrashedOnError: true,
|
|
2407
|
-
})));
|
|
2425
|
+
return partialResultSubject.asObservable();
|
|
2408
2426
|
},
|
|
2409
2427
|
get currentValue() {
|
|
2410
2428
|
return partialResultSubject.value;
|
|
@@ -5941,7 +5959,7 @@
|
|
|
5941
5959
|
value = value.replace(/\.html$/, '');
|
|
5942
5960
|
}
|
|
5943
5961
|
else if (isValidFilePath(value)) {
|
|
5944
|
-
value =
|
|
5962
|
+
value = path.basename(value);
|
|
5945
5963
|
// Note: Keeping extension in the name
|
|
5946
5964
|
}
|
|
5947
5965
|
value = value.split('/').join('-');
|
|
@@ -6047,9 +6065,9 @@
|
|
|
6047
6065
|
}
|
|
6048
6066
|
basename = url.split('/').pop() || titleToName(url);
|
|
6049
6067
|
hash = sha256__default["default"](hexEncoder__default["default"].parse(url)).toString( /* hex */);
|
|
6050
|
-
rootDirname_1 =
|
|
6051
|
-
filepath =
|
|
6052
|
-
return [4 /*yield*/, tools.fs.mkdir(
|
|
6068
|
+
rootDirname_1 = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
6069
|
+
filepath = path.join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
|
|
6070
|
+
return [4 /*yield*/, tools.fs.mkdir(path.dirname(path.join(rootDirname_1, filepath)), { recursive: true })];
|
|
6053
6071
|
case 2:
|
|
6054
6072
|
_h.sent();
|
|
6055
6073
|
_g = (_f = Buffer).from;
|
|
@@ -6059,7 +6077,7 @@
|
|
|
6059
6077
|
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
6060
6078
|
throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
|
|
6061
6079
|
}
|
|
6062
|
-
return [4 /*yield*/, tools.fs.writeFile(
|
|
6080
|
+
return [4 /*yield*/, tools.fs.writeFile(path.join(rootDirname_1, filepath), fileContent)];
|
|
6063
6081
|
case 4:
|
|
6064
6082
|
_h.sent();
|
|
6065
6083
|
// TODO: [💵] Check the file security
|
|
@@ -6075,7 +6093,7 @@
|
|
|
6075
6093
|
throw new EnvironmentMismatchError('Can not import file knowledge in non-file pipeline');
|
|
6076
6094
|
// <- TODO: [🧠] What is the best error type here`
|
|
6077
6095
|
}
|
|
6078
|
-
filename_1 =
|
|
6096
|
+
filename_1 = path.join(rootDirname, knowledgeSourceContent).split('\\').join('/');
|
|
6079
6097
|
fileExtension = getFileExtension(filename_1);
|
|
6080
6098
|
mimeType = extensionToMimeType(fileExtension || '');
|
|
6081
6099
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|