@promptbook/node 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 +25 -8
- 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/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +6 -4
- 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 +2 -2
- package/umd/index.umd.js +24 -7
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { basename, join, dirname } from 'path';
|
|
|
4
4
|
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
6
|
import parserHtml from 'prettier/parser-html';
|
|
7
|
-
import { BehaviorSubject
|
|
7
|
+
import { BehaviorSubject } from 'rxjs';
|
|
8
8
|
import { randomBytes } from 'crypto';
|
|
9
9
|
import { forTime } from 'waitasecond';
|
|
10
10
|
import { unparse, parse } from 'papaparse';
|
|
@@ -29,7 +29,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
32
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-9';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2044,10 +2044,26 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2044
2044
|
*/
|
|
2045
2045
|
function createTask(options) {
|
|
2046
2046
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2047
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
2048
|
-
var
|
|
2047
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2048
|
+
var partialResultSubject = new BehaviorSubject({});
|
|
2049
2049
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2050
|
-
|
|
2050
|
+
partialResultSubject.next(newOngoingResult);
|
|
2051
|
+
});
|
|
2052
|
+
finalResultPromise
|
|
2053
|
+
.catch(function (error) {
|
|
2054
|
+
partialResultSubject.error(error);
|
|
2055
|
+
})
|
|
2056
|
+
.then(function (value) {
|
|
2057
|
+
if (value) {
|
|
2058
|
+
try {
|
|
2059
|
+
assertsTaskSuccessful(value);
|
|
2060
|
+
partialResultSubject.next(value);
|
|
2061
|
+
}
|
|
2062
|
+
catch (error) {
|
|
2063
|
+
partialResultSubject.error(error);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
partialResultSubject.complete();
|
|
2051
2067
|
});
|
|
2052
2068
|
function asPromise(options) {
|
|
2053
2069
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2072,9 +2088,10 @@ function createTask(options) {
|
|
|
2072
2088
|
taskId: taskId,
|
|
2073
2089
|
asPromise: asPromise,
|
|
2074
2090
|
asObservable: function () {
|
|
2075
|
-
return
|
|
2076
|
-
|
|
2077
|
-
|
|
2091
|
+
return partialResultSubject.asObservable();
|
|
2092
|
+
},
|
|
2093
|
+
get currentValue() {
|
|
2094
|
+
return partialResultSubject.value;
|
|
2078
2095
|
},
|
|
2079
2096
|
};
|
|
2080
2097
|
}
|