@promptbook/core 0.85.0-1 → 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 +24 -7
- 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 +1 -1
- package/umd/index.umd.js +32 -15
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
5
|
import { randomBytes } from 'crypto';
|
|
6
6
|
import { forTime } from 'waitasecond';
|
|
7
7
|
import { unparse, parse } from 'papaparse';
|
|
8
8
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
9
9
|
import sha256 from 'crypto-js/sha256';
|
|
10
|
-
import { basename, join, dirname } from '
|
|
10
|
+
import { basename, join, dirname } from 'path';
|
|
11
11
|
import { SHA256 } from 'crypto-js';
|
|
12
12
|
import { lookup, extension } from 'mime-types';
|
|
13
13
|
import moment from 'moment';
|
|
@@ -27,7 +27,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
30
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-9';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2374,11 +2374,27 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2374
2374
|
*/
|
|
2375
2375
|
function createTask(options) {
|
|
2376
2376
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2377
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
2377
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2378
2378
|
var partialResultSubject = new BehaviorSubject({});
|
|
2379
2379
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2380
2380
|
partialResultSubject.next(newOngoingResult);
|
|
2381
2381
|
});
|
|
2382
|
+
finalResultPromise
|
|
2383
|
+
.catch(function (error) {
|
|
2384
|
+
partialResultSubject.error(error);
|
|
2385
|
+
})
|
|
2386
|
+
.then(function (value) {
|
|
2387
|
+
if (value) {
|
|
2388
|
+
try {
|
|
2389
|
+
assertsTaskSuccessful(value);
|
|
2390
|
+
partialResultSubject.next(value);
|
|
2391
|
+
}
|
|
2392
|
+
catch (error) {
|
|
2393
|
+
partialResultSubject.error(error);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
partialResultSubject.complete();
|
|
2397
|
+
});
|
|
2382
2398
|
function asPromise(options) {
|
|
2383
2399
|
return __awaiter(this, void 0, void 0, function () {
|
|
2384
2400
|
var _a, isCrashedOnError, finalResult;
|
|
@@ -2402,9 +2418,10 @@ function createTask(options) {
|
|
|
2402
2418
|
taskId: taskId,
|
|
2403
2419
|
asPromise: asPromise,
|
|
2404
2420
|
asObservable: function () {
|
|
2405
|
-
return
|
|
2406
|
-
|
|
2407
|
-
|
|
2421
|
+
return partialResultSubject.asObservable();
|
|
2422
|
+
},
|
|
2423
|
+
get currentValue() {
|
|
2424
|
+
return partialResultSubject.value;
|
|
2408
2425
|
},
|
|
2409
2426
|
};
|
|
2410
2427
|
}
|