@promptbook/markitdown 0.85.0-0 → 0.85.0-10

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
@@ -5,7 +5,7 @@ import hexEncoder from 'crypto-js/enc-hex';
5
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.84.0';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-9';
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
@@ -2514,10 +2514,26 @@ function assertsTaskSuccessful(executionResult) {
2514
2514
  */
2515
2515
  function createTask(options) {
2516
2516
  var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
2517
- var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(256 /* <- TODO: !!! To global config */));
2518
- var resultSubject = new BehaviorSubject({});
2517
+ var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
2518
+ var partialResultSubject = new BehaviorSubject({});
2519
2519
  var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2520
- resultSubject.next(newOngoingResult);
2520
+ partialResultSubject.next(newOngoingResult);
2521
+ });
2522
+ finalResultPromise
2523
+ .catch(function (error) {
2524
+ partialResultSubject.error(error);
2525
+ })
2526
+ .then(function (value) {
2527
+ if (value) {
2528
+ try {
2529
+ assertsTaskSuccessful(value);
2530
+ partialResultSubject.next(value);
2531
+ }
2532
+ catch (error) {
2533
+ partialResultSubject.error(error);
2534
+ }
2535
+ }
2536
+ partialResultSubject.complete();
2521
2537
  });
2522
2538
  function asPromise(options) {
2523
2539
  return __awaiter(this, void 0, void 0, function () {
@@ -2542,9 +2558,10 @@ function createTask(options) {
2542
2558
  taskId: taskId,
2543
2559
  asPromise: asPromise,
2544
2560
  asObservable: function () {
2545
- return concat(resultSubject.asObservable(), from(asPromise({
2546
- isCrashedOnError: true,
2547
- })));
2561
+ return partialResultSubject.asObservable();
2562
+ },
2563
+ get currentValue() {
2564
+ return partialResultSubject.value;
2548
2565
  },
2549
2566
  };
2550
2567
  }