@webtypen/webframez-core 0.3.44 → 0.3.46
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/dist/Api/ApiFunctionUtils.d.ts +50 -54
- package/dist/Api/ApiFunctionUtils.js +28 -26
- package/package.json +1 -1
|
@@ -54,75 +54,71 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
|
|
|
54
54
|
type: string;
|
|
55
55
|
pattern?: undefined;
|
|
56
56
|
items?: undefined;
|
|
57
|
-
|
|
57
|
+
additionalProperties?: undefined;
|
|
58
|
+
properties?: undefined;
|
|
58
59
|
"x-webframez-type"?: undefined;
|
|
59
|
-
"x-openai-file-parameter"?: undefined;
|
|
60
60
|
enum?: undefined;
|
|
61
61
|
} | {
|
|
62
62
|
type: string;
|
|
63
63
|
pattern: string;
|
|
64
64
|
items?: undefined;
|
|
65
|
-
|
|
65
|
+
additionalProperties?: undefined;
|
|
66
|
+
properties?: undefined;
|
|
66
67
|
"x-webframez-type"?: undefined;
|
|
67
|
-
"x-openai-file-parameter"?: undefined;
|
|
68
68
|
enum?: undefined;
|
|
69
69
|
} | {
|
|
70
70
|
type: string;
|
|
71
71
|
items: {};
|
|
72
72
|
pattern?: undefined;
|
|
73
|
-
|
|
73
|
+
additionalProperties?: undefined;
|
|
74
|
+
properties?: undefined;
|
|
74
75
|
"x-webframez-type"?: undefined;
|
|
75
|
-
"x-openai-file-parameter"?: undefined;
|
|
76
76
|
enum?: undefined;
|
|
77
77
|
} | {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
};
|
|
102
|
-
data_url: {
|
|
103
|
-
type: string;
|
|
104
|
-
};
|
|
105
|
-
id: {
|
|
106
|
-
type: string;
|
|
107
|
-
};
|
|
108
|
-
filename: {
|
|
109
|
-
type: string;
|
|
110
|
-
};
|
|
111
|
-
name: {
|
|
112
|
-
type: string;
|
|
113
|
-
};
|
|
114
|
-
mime: {
|
|
115
|
-
type: string;
|
|
116
|
-
};
|
|
117
|
-
mime_type: {
|
|
118
|
-
type: string;
|
|
119
|
-
};
|
|
78
|
+
type: string;
|
|
79
|
+
additionalProperties: boolean;
|
|
80
|
+
properties: {
|
|
81
|
+
download_url: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
file_id: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
mime_type: {
|
|
88
|
+
type: string;
|
|
89
|
+
};
|
|
90
|
+
file_name: {
|
|
91
|
+
type: string;
|
|
92
|
+
};
|
|
93
|
+
url: {
|
|
94
|
+
type: string;
|
|
95
|
+
};
|
|
96
|
+
download_link: {
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
file_url: {
|
|
100
|
+
type: string;
|
|
120
101
|
};
|
|
121
|
-
|
|
122
|
-
|
|
102
|
+
content_base64: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
data_url: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
id: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
filename: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
name: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
mime: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
123
121
|
"x-webframez-type": string;
|
|
124
|
-
"x-openai-file-parameter": boolean;
|
|
125
|
-
type?: undefined;
|
|
126
122
|
pattern?: undefined;
|
|
127
123
|
items?: undefined;
|
|
128
124
|
enum?: undefined;
|
|
@@ -131,9 +127,9 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
|
|
|
131
127
|
type?: undefined;
|
|
132
128
|
pattern?: undefined;
|
|
133
129
|
items?: undefined;
|
|
134
|
-
|
|
130
|
+
additionalProperties?: undefined;
|
|
131
|
+
properties?: undefined;
|
|
135
132
|
"x-webframez-type"?: undefined;
|
|
136
|
-
"x-openai-file-parameter"?: undefined;
|
|
137
133
|
};
|
|
138
134
|
export declare function toApiFunctionHttpResult(res: Response, result: any): Response;
|
|
139
135
|
export declare function toApiFunctionPayload(result: any): any;
|
|
@@ -251,10 +251,19 @@ function coerceApiFunctionParam(key, value, definition) {
|
|
|
251
251
|
throw new ApiFunctionRuntimeError(`Parameter "${key}" must be an object`, 400);
|
|
252
252
|
}
|
|
253
253
|
if (type === "file") {
|
|
254
|
-
if (
|
|
254
|
+
if (isPlainApiObject(value)) {
|
|
255
255
|
return value;
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
if (typeof value === "string") {
|
|
258
|
+
try {
|
|
259
|
+
const parsed = JSON.parse(value);
|
|
260
|
+
if (isPlainApiObject(parsed)) {
|
|
261
|
+
return parsed;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch (_error) { }
|
|
265
|
+
}
|
|
266
|
+
throw new ApiFunctionRuntimeError(`Parameter "${key}" must be a file reference object`, 400);
|
|
258
267
|
}
|
|
259
268
|
return value;
|
|
260
269
|
}
|
|
@@ -300,31 +309,24 @@ function apiFunctionParamToJsonSchema(definition) {
|
|
|
300
309
|
return { type: "object" };
|
|
301
310
|
if (type === "file") {
|
|
302
311
|
return {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
name: { type: "string" },
|
|
321
|
-
mime: { type: "string" },
|
|
322
|
-
mime_type: { type: "string" },
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
],
|
|
312
|
+
type: "object",
|
|
313
|
+
additionalProperties: true,
|
|
314
|
+
properties: {
|
|
315
|
+
download_url: { type: "string" },
|
|
316
|
+
file_id: { type: "string" },
|
|
317
|
+
mime_type: { type: "string" },
|
|
318
|
+
file_name: { type: "string" },
|
|
319
|
+
url: { type: "string" },
|
|
320
|
+
download_link: { type: "string" },
|
|
321
|
+
file_url: { type: "string" },
|
|
322
|
+
content_base64: { type: "string" },
|
|
323
|
+
data_url: { type: "string" },
|
|
324
|
+
id: { type: "string" },
|
|
325
|
+
filename: { type: "string" },
|
|
326
|
+
name: { type: "string" },
|
|
327
|
+
mime: { type: "string" },
|
|
328
|
+
},
|
|
326
329
|
"x-webframez-type": "file",
|
|
327
|
-
"x-openai-file-parameter": true,
|
|
328
330
|
};
|
|
329
331
|
}
|
|
330
332
|
if (type === "option" && Array.isArray(definition.options) && definition.options.length > 0) {
|
package/package.json
CHANGED