@promptbook/markdown-utils 0.85.0-4 → 0.85.0-6

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,12 +1,12 @@
1
1
  import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { format } from 'prettier';
3
3
  import parserHtml from 'prettier/parser-html';
4
- import { BehaviorSubject, concat, from } from 'rxjs';
4
+ import { BehaviorSubject } from 'rxjs';
5
5
  import { randomBytes } from 'crypto';
6
6
  import { forTime } from 'waitasecond';
7
7
  import hexEncoder from 'crypto-js/enc-hex';
8
8
  import sha256 from 'crypto-js/sha256';
9
- import { basename, join, dirname } from 'node:path';
9
+ import { basename, join, dirname } from 'path';
10
10
  import { SHA256 } from 'crypto-js';
11
11
  import { lookup, extension } from 'mime-types';
12
12
  import { unparse, parse } from 'papaparse';
@@ -25,7 +25,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- var PROMPTBOOK_ENGINE_VERSION = '0.85.0-3';
28
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-5';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2195,6 +2195,24 @@ function createTask(options) {
2195
2195
  var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2196
2196
  partialResultSubject.next(newOngoingResult);
2197
2197
  });
2198
+ finalResultPromise
2199
+ .catch(function (error) {
2200
+ // console.error('!!!!! Task failed:', error);
2201
+ partialResultSubject.error(error);
2202
+ })
2203
+ .then(function (value) {
2204
+ // console.error('!!!!! Task finished:', value);
2205
+ if (value) {
2206
+ try {
2207
+ assertsTaskSuccessful(value);
2208
+ partialResultSubject.next(value);
2209
+ }
2210
+ catch (error) {
2211
+ partialResultSubject.error(error);
2212
+ }
2213
+ }
2214
+ partialResultSubject.complete();
2215
+ });
2198
2216
  function asPromise(options) {
2199
2217
  return __awaiter(this, void 0, void 0, function () {
2200
2218
  var _a, isCrashedOnError, finalResult;
@@ -2205,7 +2223,9 @@ function createTask(options) {
2205
2223
  return [4 /*yield*/, finalResultPromise];
2206
2224
  case 1:
2207
2225
  finalResult = _b.sent();
2226
+ console.error('!!!!! finalResult:', finalResult);
2208
2227
  if (isCrashedOnError) {
2228
+ console.error('!!!!! isCrashedOnError:', finalResult);
2209
2229
  assertsTaskSuccessful(finalResult);
2210
2230
  }
2211
2231
  return [2 /*return*/, finalResult];
@@ -2218,9 +2238,7 @@ function createTask(options) {
2218
2238
  taskId: taskId,
2219
2239
  asPromise: asPromise,
2220
2240
  asObservable: function () {
2221
- return concat(partialResultSubject.asObservable(), from(asPromise({
2222
- isCrashedOnError: true,
2223
- })));
2241
+ return partialResultSubject.asObservable();
2224
2242
  },
2225
2243
  get currentValue() {
2226
2244
  return partialResultSubject.value;