@vertesia/common 0.79.3 → 0.79.4
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/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/utils/schemas.js +26 -0
- package/lib/cjs/utils/schemas.js.map +1 -1
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/utils/schemas.js +25 -0
- package/lib/esm/utils/schemas.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/interaction.d.ts +1 -1
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/utils/schemas.d.ts +1 -0
- package/lib/types/utils/schemas.d.ts.map +1 -1
- package/lib/vertesia-common.js +1 -1
- package/lib/vertesia-common.js.map +1 -1
- package/package.json +2 -2
- package/src/interaction.ts +2 -1
- package/src/utils/schemas.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/common",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./lib/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"ajv": "^8.16.0",
|
|
29
29
|
"json-schema": "^0.4.0",
|
|
30
|
-
"@llumiverse/common": "0.22.
|
|
30
|
+
"@llumiverse/common": "0.22.3"
|
|
31
31
|
},
|
|
32
32
|
"ts_dual_module": {
|
|
33
33
|
"outDir": "lib"
|
package/src/interaction.ts
CHANGED
|
@@ -255,7 +255,8 @@ export interface InteractionExecutionPayload {
|
|
|
255
255
|
*/
|
|
256
256
|
data?: Record<string, any> | `memory:${string}`;
|
|
257
257
|
config?: InteractionExecutionConfiguration;
|
|
258
|
-
|
|
258
|
+
//Use null to explicitly state no schema, will not fallback to interaction schema
|
|
259
|
+
result_schema?: JSONSchema4 | null;
|
|
259
260
|
stream?: boolean;
|
|
260
261
|
do_validate?: boolean;
|
|
261
262
|
tags?: string | string[]; // tags to be added to the execution run
|
package/src/utils/schemas.ts
CHANGED
|
@@ -5,6 +5,28 @@ import { InteractionRefWithSchema, PopulatedInteraction } from "../interaction.j
|
|
|
5
5
|
import { PopulatedPromptSegmentDef, PromptSegmentDef, PromptSegmentDefType, PromptTemplateRefWithSchema } from "../prompt.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
// Remove custom properties from the JSON before sending further down execution pipeline
|
|
9
|
+
export function removeExtraProperties<T>(schema: T): T {
|
|
10
|
+
if (!schema) return schema;
|
|
11
|
+
if (Array.isArray(schema)) {
|
|
12
|
+
for (const item of schema) {
|
|
13
|
+
removeExtraProperties(item);
|
|
14
|
+
}
|
|
15
|
+
} else if (typeof schema === 'object') {
|
|
16
|
+
const obj = schema as Record<string, any>;
|
|
17
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
18
|
+
if (key === 'editor' && (value === 'textarea' || value === 'document' || value === 'media')) {
|
|
19
|
+
delete obj[key];
|
|
20
|
+
} else if (key === 'format' && (value === 'textarea' || value === 'document' || value === 'media')) {
|
|
21
|
+
delete obj[key];
|
|
22
|
+
} else if (typeof value === 'object') {
|
|
23
|
+
removeExtraProperties(value)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return schema;
|
|
28
|
+
}
|
|
29
|
+
|
|
8
30
|
export function mergeJSONSchemas(schemas: JSONSchema[]) {
|
|
9
31
|
const props: Record<string, JSONSchema4> = {};
|
|
10
32
|
let required: string[] = [];
|