bxo 0.0.5-dev.61 → 0.0.5-dev.62
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/package.json +1 -1
- package/src/types/index.ts +4 -2
- package/tests/integration/bxo.test.ts +18 -18
package/package.json
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type ResponseConfig = StatusResponseSchema;
|
|
|
10
10
|
|
|
11
11
|
// Type utility to extract response type from response config
|
|
12
12
|
export type InferResponseType<T> = T extends StatusResponseSchema
|
|
13
|
-
?
|
|
13
|
+
? T[keyof T] extends z.ZodType<infer U> ? U : never
|
|
14
14
|
: never;
|
|
15
15
|
|
|
16
16
|
// Cookie options interface for setting cookies
|
|
@@ -100,7 +100,9 @@ export interface InternalCookie {
|
|
|
100
100
|
// Handler function type with proper response typing
|
|
101
101
|
export type Handler<TConfig extends RouteConfig = {}, EC = {}> = (
|
|
102
102
|
ctx: Context<TConfig> & EC
|
|
103
|
-
) =>
|
|
103
|
+
) => TConfig['response'] extends StatusResponseSchema
|
|
104
|
+
? Promise<InferResponseType<TConfig['response']>> | InferResponseType<TConfig['response']>
|
|
105
|
+
: Promise<any> | any;
|
|
104
106
|
|
|
105
107
|
// Route definition
|
|
106
108
|
export interface Route {
|
|
@@ -214,14 +214,14 @@ describe('BXO Framework Integration', () => {
|
|
|
214
214
|
body: formData
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
-
const data = await response.json() as {
|
|
218
|
-
formData: {
|
|
219
|
-
app: string,
|
|
220
|
-
model: string,
|
|
221
|
-
recordIds: string[],
|
|
222
|
-
fields: string
|
|
223
|
-
},
|
|
224
|
-
message: string
|
|
217
|
+
const data = await response.json() as {
|
|
218
|
+
formData: {
|
|
219
|
+
app: string,
|
|
220
|
+
model: string,
|
|
221
|
+
recordIds: string[],
|
|
222
|
+
fields: string
|
|
223
|
+
},
|
|
224
|
+
message: string
|
|
225
225
|
};
|
|
226
226
|
|
|
227
227
|
expect(response.status).toBe(200);
|
|
@@ -248,8 +248,8 @@ describe('BXO Framework Integration', () => {
|
|
|
248
248
|
body: formData
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
-
const data = await response.json() as {
|
|
252
|
-
formData: {
|
|
251
|
+
const data = await response.json() as {
|
|
252
|
+
formData: {
|
|
253
253
|
test: {
|
|
254
254
|
test: string,
|
|
255
255
|
new: string,
|
|
@@ -257,8 +257,8 @@ describe('BXO Framework Integration', () => {
|
|
|
257
257
|
hi: string
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
},
|
|
261
|
-
message: string
|
|
260
|
+
},
|
|
261
|
+
message: string
|
|
262
262
|
};
|
|
263
263
|
|
|
264
264
|
expect(response.status).toBe(200);
|
|
@@ -288,8 +288,8 @@ describe('BXO Framework Integration', () => {
|
|
|
288
288
|
body: formData
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
const data = await response.json() as {
|
|
292
|
-
formData: {
|
|
291
|
+
const data = await response.json() as {
|
|
292
|
+
formData: {
|
|
293
293
|
records: Array<{
|
|
294
294
|
qrPayment: {
|
|
295
295
|
type: string;
|
|
@@ -299,8 +299,8 @@ describe('BXO Framework Integration', () => {
|
|
|
299
299
|
},
|
|
300
300
|
name: string
|
|
301
301
|
}>
|
|
302
|
-
},
|
|
303
|
-
message: string
|
|
302
|
+
},
|
|
303
|
+
message: string
|
|
304
304
|
};
|
|
305
305
|
|
|
306
306
|
expect(response.status).toBe(200);
|
|
@@ -339,8 +339,8 @@ describe('BXO Framework Integration', () => {
|
|
|
339
339
|
console.log('File name:', records[0]?.qrPayment.name);
|
|
340
340
|
console.log('File size:', records[0]?.qrPayment.size);
|
|
341
341
|
console.log('File type:', records[0]?.qrPayment.type);
|
|
342
|
-
|
|
343
|
-
return {
|
|
342
|
+
|
|
343
|
+
return {
|
|
344
344
|
message: 'Files received',
|
|
345
345
|
fileInfo: {
|
|
346
346
|
isFile0: records[0]?.qrPayment instanceof File,
|