@promptbook/markitdown 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
@@ -2519,6 +2519,24 @@ function createTask(options) {
2519
2519
  var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2520
2520
  partialResultSubject.next(newOngoingResult);
2521
2521
  });
2522
+ finalResultPromise
2523
+ .catch(function (error) {
2524
+ // console.error('!!!!! Task failed:', error);
2525
+ partialResultSubject.error(error);
2526
+ })
2527
+ .then(function (value) {
2528
+ // console.error('!!!!! Task finished:', value);
2529
+ if (value) {
2530
+ try {
2531
+ assertsTaskSuccessful(value);
2532
+ partialResultSubject.next(value);
2533
+ }
2534
+ catch (error) {
2535
+ partialResultSubject.error(error);
2536
+ }
2537
+ }
2538
+ partialResultSubject.complete();
2539
+ });
2522
2540
  function asPromise(options) {
2523
2541
  return __awaiter(this, void 0, void 0, function () {
2524
2542
  var _a, isCrashedOnError, finalResult;
@@ -2529,7 +2547,9 @@ function createTask(options) {
2529
2547
  return [4 /*yield*/, finalResultPromise];
2530
2548
  case 1:
2531
2549
  finalResult = _b.sent();
2550
+ console.error('!!!!! finalResult:', finalResult);
2532
2551
  if (isCrashedOnError) {
2552
+ console.error('!!!!! isCrashedOnError:', finalResult);
2533
2553
  assertsTaskSuccessful(finalResult);
2534
2554
  }
2535
2555
  return [2 /*return*/, finalResult];
@@ -2542,9 +2562,7 @@ function createTask(options) {
2542
2562
  taskId: taskId,
2543
2563
  asPromise: asPromise,
2544
2564
  asObservable: function () {
2545
- return concat(partialResultSubject.asObservable(), from(asPromise({
2546
- isCrashedOnError: true,
2547
- })));
2565
+ return partialResultSubject.asObservable();
2548
2566
  },
2549
2567
  get currentValue() {
2550
2568
  return partialResultSubject.value;