@promptbook/pdf 0.85.0-1 → 0.85.0-11
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 +25 -8
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +0 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +7 -3
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/utils/normalization/suffixUrl.d.ts +7 -0
- package/esm/typings/src/utils/normalization/suffixUrl.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +34 -17
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { mkdir, rm, readFile } from '
|
|
1
|
+
import { mkdir, rm, readFile } from 'fs/promises';
|
|
2
2
|
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
3
3
|
import { SHA256 } from 'crypto-js';
|
|
4
4
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
5
|
-
import { basename, join, dirname } from '
|
|
5
|
+
import { basename, join, dirname } from 'path';
|
|
6
6
|
import { format } from 'prettier';
|
|
7
7
|
import parserHtml from 'prettier/parser-html';
|
|
8
|
-
import { BehaviorSubject
|
|
8
|
+
import { BehaviorSubject } from 'rxjs';
|
|
9
9
|
import { randomBytes } from 'crypto';
|
|
10
10
|
import { forTime } from 'waitasecond';
|
|
11
11
|
import sha256 from 'crypto-js/sha256';
|
|
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-10';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2527,11 +2527,27 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2527
2527
|
*/
|
|
2528
2528
|
function createTask(options) {
|
|
2529
2529
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2530
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
2530
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2531
2531
|
var partialResultSubject = new BehaviorSubject({});
|
|
2532
2532
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2533
2533
|
partialResultSubject.next(newOngoingResult);
|
|
2534
2534
|
});
|
|
2535
|
+
finalResultPromise
|
|
2536
|
+
.catch(function (error) {
|
|
2537
|
+
partialResultSubject.error(error);
|
|
2538
|
+
})
|
|
2539
|
+
.then(function (value) {
|
|
2540
|
+
if (value) {
|
|
2541
|
+
try {
|
|
2542
|
+
assertsTaskSuccessful(value);
|
|
2543
|
+
partialResultSubject.next(value);
|
|
2544
|
+
}
|
|
2545
|
+
catch (error) {
|
|
2546
|
+
partialResultSubject.error(error);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
partialResultSubject.complete();
|
|
2550
|
+
});
|
|
2535
2551
|
function asPromise(options) {
|
|
2536
2552
|
return __awaiter(this, void 0, void 0, function () {
|
|
2537
2553
|
var _a, isCrashedOnError, finalResult;
|
|
@@ -2555,9 +2571,10 @@ function createTask(options) {
|
|
|
2555
2571
|
taskId: taskId,
|
|
2556
2572
|
asPromise: asPromise,
|
|
2557
2573
|
asObservable: function () {
|
|
2558
|
-
return
|
|
2559
|
-
|
|
2560
|
-
|
|
2574
|
+
return partialResultSubject.asObservable();
|
|
2575
|
+
},
|
|
2576
|
+
get currentValue() {
|
|
2577
|
+
return partialResultSubject.value;
|
|
2561
2578
|
},
|
|
2562
2579
|
};
|
|
2563
2580
|
}
|