@promptbook/documents 0.88.0-8 → 0.88.0-9
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/README.md +3 -26
- package/esm/index.es.js +35 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/utils/serialization/jsonStringsToJsons.d.ts +9 -0
- package/esm/typings/src/utils/serialization/jsonStringsToJsons.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +35 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -62,6 +62,7 @@ import { clonePipeline } from '../utils/serialization/clonePipeline';
|
|
|
62
62
|
import { deepClone } from '../utils/serialization/deepClone';
|
|
63
63
|
import { exportJson } from '../utils/serialization/exportJson';
|
|
64
64
|
import { isSerializableAsJson } from '../utils/serialization/isSerializableAsJson';
|
|
65
|
+
import { jsonStringsToJsons } from '../utils/serialization/jsonStringsToJsons';
|
|
65
66
|
import { difference } from '../utils/sets/difference';
|
|
66
67
|
import { intersection } from '../utils/sets/intersection';
|
|
67
68
|
import { union } from '../utils/sets/union';
|
|
@@ -143,6 +144,7 @@ export { clonePipeline };
|
|
|
143
144
|
export { deepClone };
|
|
144
145
|
export { exportJson };
|
|
145
146
|
export { isSerializableAsJson };
|
|
147
|
+
export { jsonStringsToJsons };
|
|
146
148
|
export { difference };
|
|
147
149
|
export { intersection };
|
|
148
150
|
export { union };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.88.0-
|
|
3
|
+
"version": "0.88.0-9",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/documents.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.88.0-
|
|
50
|
+
"@promptbook/core": "0.88.0-9"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.88.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
|
|
@@ -2236,6 +2236,36 @@
|
|
|
2236
2236
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2237
2237
|
*/
|
|
2238
2238
|
|
|
2239
|
+
/**
|
|
2240
|
+
* Recursively converts JSON strings to JSON objects
|
|
2241
|
+
|
|
2242
|
+
* @public exported from `@promptbook/utils`
|
|
2243
|
+
*/
|
|
2244
|
+
function jsonStringsToJsons(object) {
|
|
2245
|
+
if (object === null) {
|
|
2246
|
+
return object;
|
|
2247
|
+
}
|
|
2248
|
+
if (Array.isArray(object)) {
|
|
2249
|
+
return object.map(jsonStringsToJsons);
|
|
2250
|
+
}
|
|
2251
|
+
if (typeof object !== 'object') {
|
|
2252
|
+
return object;
|
|
2253
|
+
}
|
|
2254
|
+
const newObject = { ...object };
|
|
2255
|
+
for (const [key, value] of Object.entries(object)) {
|
|
2256
|
+
if (typeof value === 'string' && isValidJsonString(value)) {
|
|
2257
|
+
newObject[key] = JSON.parse(value);
|
|
2258
|
+
}
|
|
2259
|
+
else {
|
|
2260
|
+
newObject[key] = jsonStringsToJsons(value);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
return newObject;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* TODO: Type the return type correctly
|
|
2267
|
+
*/
|
|
2268
|
+
|
|
2239
2269
|
/**
|
|
2240
2270
|
* This error indicates problems parsing the format value
|
|
2241
2271
|
*
|
|
@@ -2467,11 +2497,12 @@
|
|
|
2467
2497
|
let updatedAt = createdAt;
|
|
2468
2498
|
const errors = [];
|
|
2469
2499
|
const warnings = [];
|
|
2470
|
-
|
|
2500
|
+
let currentValue = {};
|
|
2471
2501
|
const partialResultSubject = new rxjs.Subject();
|
|
2472
2502
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
|
2473
2503
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
|
2474
2504
|
Object.assign(currentValue, newOngoingResult);
|
|
2505
|
+
// <- TODO: assign deep
|
|
2475
2506
|
partialResultSubject.next(newOngoingResult);
|
|
2476
2507
|
});
|
|
2477
2508
|
finalResultPromise
|
|
@@ -2491,7 +2522,8 @@
|
|
|
2491
2522
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
2492
2523
|
assertsTaskSuccessful(executionResult);
|
|
2493
2524
|
status = 'FINISHED';
|
|
2494
|
-
|
|
2525
|
+
currentValue = jsonStringsToJsons(executionResult);
|
|
2526
|
+
// <- TODO: Convert JSON values in string to JSON objects
|
|
2495
2527
|
partialResultSubject.next(executionResult);
|
|
2496
2528
|
}
|
|
2497
2529
|
catch (error) {
|