@promptbook/pdf 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 CHANGED
@@ -1,11 +1,11 @@
1
- import { mkdir, rm, readFile } from 'node:fs/promises';
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 'node:path';
5
+ import { basename, join, dirname } from 'path';
6
6
  import { format } from 'prettier';
7
7
  import parserHtml from 'prettier/parser-html';
8
- import { BehaviorSubject, concat, from } from 'rxjs';
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-3';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-4';
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
@@ -2532,6 +2532,24 @@ function createTask(options) {
2532
2532
  var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2533
2533
  partialResultSubject.next(newOngoingResult);
2534
2534
  });
2535
+ finalResultPromise
2536
+ .catch(function (error) {
2537
+ // console.error('!!!!! Task failed:', error);
2538
+ partialResultSubject.error(error);
2539
+ })
2540
+ .then(function (value) {
2541
+ // console.error('!!!!! Task finished:', value);
2542
+ if (value) {
2543
+ try {
2544
+ assertsTaskSuccessful(value);
2545
+ partialResultSubject.next(value);
2546
+ }
2547
+ catch (error) {
2548
+ partialResultSubject.error(error);
2549
+ }
2550
+ }
2551
+ partialResultSubject.complete();
2552
+ });
2535
2553
  function asPromise(options) {
2536
2554
  return __awaiter(this, void 0, void 0, function () {
2537
2555
  var _a, isCrashedOnError, finalResult;
@@ -2542,7 +2560,9 @@ function createTask(options) {
2542
2560
  return [4 /*yield*/, finalResultPromise];
2543
2561
  case 1:
2544
2562
  finalResult = _b.sent();
2563
+ console.error('!!!!! finalResult:', finalResult);
2545
2564
  if (isCrashedOnError) {
2565
+ console.error('!!!!! isCrashedOnError:', finalResult);
2546
2566
  assertsTaskSuccessful(finalResult);
2547
2567
  }
2548
2568
  return [2 /*return*/, finalResult];
@@ -2555,9 +2575,7 @@ function createTask(options) {
2555
2575
  taskId: taskId,
2556
2576
  asPromise: asPromise,
2557
2577
  asObservable: function () {
2558
- return concat(partialResultSubject.asObservable(), from(asPromise({
2559
- isCrashedOnError: true,
2560
- })));
2578
+ return partialResultSubject.asObservable();
2561
2579
  },
2562
2580
  get currentValue() {
2563
2581
  return partialResultSubject.value;