@webtypen/webframez-core 0.3.45 → 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 -59
- package/dist/Api/ApiFunctionUtils.js +28 -27
- package/package.json +1 -1
|
@@ -54,79 +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
|
-
"x-openai-file-arg-rewrite"?: undefined;
|
|
61
60
|
enum?: undefined;
|
|
62
61
|
} | {
|
|
63
62
|
type: string;
|
|
64
63
|
pattern: string;
|
|
65
64
|
items?: undefined;
|
|
66
|
-
|
|
65
|
+
additionalProperties?: undefined;
|
|
66
|
+
properties?: undefined;
|
|
67
67
|
"x-webframez-type"?: undefined;
|
|
68
|
-
"x-openai-file-parameter"?: undefined;
|
|
69
|
-
"x-openai-file-arg-rewrite"?: undefined;
|
|
70
68
|
enum?: undefined;
|
|
71
69
|
} | {
|
|
72
70
|
type: string;
|
|
73
71
|
items: {};
|
|
74
72
|
pattern?: undefined;
|
|
75
|
-
|
|
73
|
+
additionalProperties?: undefined;
|
|
74
|
+
properties?: undefined;
|
|
76
75
|
"x-webframez-type"?: undefined;
|
|
77
|
-
"x-openai-file-parameter"?: undefined;
|
|
78
|
-
"x-openai-file-arg-rewrite"?: undefined;
|
|
79
76
|
enum?: undefined;
|
|
80
77
|
} | {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
mime_type: {
|
|
121
|
-
type: string;
|
|
122
|
-
};
|
|
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;
|
|
123
101
|
};
|
|
124
|
-
|
|
125
|
-
|
|
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
|
+
};
|
|
126
121
|
"x-webframez-type": string;
|
|
127
|
-
"x-openai-file-parameter": boolean;
|
|
128
|
-
"x-openai-file-arg-rewrite": boolean;
|
|
129
|
-
type?: undefined;
|
|
130
122
|
pattern?: undefined;
|
|
131
123
|
items?: undefined;
|
|
132
124
|
enum?: undefined;
|
|
@@ -135,10 +127,9 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
|
|
|
135
127
|
type?: undefined;
|
|
136
128
|
pattern?: undefined;
|
|
137
129
|
items?: undefined;
|
|
138
|
-
|
|
130
|
+
additionalProperties?: undefined;
|
|
131
|
+
properties?: undefined;
|
|
139
132
|
"x-webframez-type"?: undefined;
|
|
140
|
-
"x-openai-file-parameter"?: undefined;
|
|
141
|
-
"x-openai-file-arg-rewrite"?: undefined;
|
|
142
133
|
};
|
|
143
134
|
export declare function toApiFunctionHttpResult(res: Response, result: any): Response;
|
|
144
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,32 +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
|
-
"x-openai-file-arg-rewrite": true,
|
|
329
330
|
};
|
|
330
331
|
}
|
|
331
332
|
if (type === "option" && Array.isArray(definition.options) && definition.options.length > 0) {
|
package/package.json
CHANGED