@promptbook/documents 0.85.0-4 → 0.85.0-5
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 +26 -8
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +35 -17
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { mkdir, rm, readFile } from '
|
|
1
|
+
import { mkdir, rm, readFile } from 'fs/promises';
|
|
2
2
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
3
|
+
import { spawn } from 'child_process';
|
|
3
4
|
import colors from 'colors';
|
|
4
|
-
import { spawn } from 'node:child_process';
|
|
5
5
|
import { forTime } from 'waitasecond';
|
|
6
6
|
import { SHA256 } from 'crypto-js';
|
|
7
7
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
8
|
-
import { basename, join, dirname } from '
|
|
8
|
+
import { basename, join, dirname } from 'path';
|
|
9
9
|
import { format } from 'prettier';
|
|
10
10
|
import parserHtml from 'prettier/parser-html';
|
|
11
|
-
import { BehaviorSubject
|
|
11
|
+
import { BehaviorSubject } from 'rxjs';
|
|
12
12
|
import { randomBytes } from 'crypto';
|
|
13
13
|
import sha256 from 'crypto-js/sha256';
|
|
14
14
|
import { lookup, extension } from 'mime-types';
|
|
@@ -28,7 +28,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
31
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-4';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2693,6 +2693,24 @@ function createTask(options) {
|
|
|
2693
2693
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2694
2694
|
partialResultSubject.next(newOngoingResult);
|
|
2695
2695
|
});
|
|
2696
|
+
finalResultPromise
|
|
2697
|
+
.catch(function (error) {
|
|
2698
|
+
// console.error('!!!!! Task failed:', error);
|
|
2699
|
+
partialResultSubject.error(error);
|
|
2700
|
+
})
|
|
2701
|
+
.then(function (value) {
|
|
2702
|
+
// console.error('!!!!! Task finished:', value);
|
|
2703
|
+
if (value) {
|
|
2704
|
+
try {
|
|
2705
|
+
assertsTaskSuccessful(value);
|
|
2706
|
+
partialResultSubject.next(value);
|
|
2707
|
+
}
|
|
2708
|
+
catch (error) {
|
|
2709
|
+
partialResultSubject.error(error);
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
partialResultSubject.complete();
|
|
2713
|
+
});
|
|
2696
2714
|
function asPromise(options) {
|
|
2697
2715
|
return __awaiter(this, void 0, void 0, function () {
|
|
2698
2716
|
var _a, isCrashedOnError, finalResult;
|
|
@@ -2703,7 +2721,9 @@ function createTask(options) {
|
|
|
2703
2721
|
return [4 /*yield*/, finalResultPromise];
|
|
2704
2722
|
case 1:
|
|
2705
2723
|
finalResult = _b.sent();
|
|
2724
|
+
console.error('!!!!! finalResult:', finalResult);
|
|
2706
2725
|
if (isCrashedOnError) {
|
|
2726
|
+
console.error('!!!!! isCrashedOnError:', finalResult);
|
|
2707
2727
|
assertsTaskSuccessful(finalResult);
|
|
2708
2728
|
}
|
|
2709
2729
|
return [2 /*return*/, finalResult];
|
|
@@ -2716,9 +2736,7 @@ function createTask(options) {
|
|
|
2716
2736
|
taskId: taskId,
|
|
2717
2737
|
asPromise: asPromise,
|
|
2718
2738
|
asObservable: function () {
|
|
2719
|
-
return
|
|
2720
|
-
isCrashedOnError: true,
|
|
2721
|
-
})));
|
|
2739
|
+
return partialResultSubject.asObservable();
|
|
2722
2740
|
},
|
|
2723
2741
|
get currentValue() {
|
|
2724
2742
|
return partialResultSubject.value;
|