rajt 0.0.78 → 0.0.80
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/create-app.ts +1 -1
- package/src/prod.ts +1 -1
- package/src/routes.ts +2 -3
package/package.json
CHANGED
package/src/create-app.ts
CHANGED
|
@@ -111,7 +111,7 @@ export const createApp = <E extends Env>(options?: ServerOptions<E>) => {
|
|
|
111
111
|
const routes = options?.routes || []
|
|
112
112
|
for (const route of routes) {
|
|
113
113
|
if (Array.isArray(route)) { // @ts-ignore
|
|
114
|
-
app[route[0]](route[1],
|
|
114
|
+
app[route[0]](route[1], ...mw(route[2], route[3]), ...resolve(getHandler(route[3]), route[3]))
|
|
115
115
|
} else { // @ts-ignore
|
|
116
116
|
app[route.method](route.path, describeRoute(route.desc), ...mw(route.middlewares, route.name), ...resolve(route.handle, route.name))
|
|
117
117
|
}
|
package/src/prod.ts
CHANGED
package/src/routes.ts
CHANGED
|
@@ -63,7 +63,7 @@ function isZodSchema(obj: any): obj is z.ZodType {
|
|
|
63
63
|
function ResolveDescribeSchema(obj: any, deep: boolean = false) {
|
|
64
64
|
if (!obj || typeof obj !== 'object') return obj
|
|
65
65
|
if (isZodSchema(obj))
|
|
66
|
-
return { content: {'
|
|
66
|
+
return { content: {'application/json': { schema: resolver(obj as unknown as StandardSchemaV1) }} }
|
|
67
67
|
|
|
68
68
|
if (obj.content && typeof obj.content == 'object') {
|
|
69
69
|
for (const mediaType in obj.content) {
|
|
@@ -322,7 +322,7 @@ export async function cacheRoutes() {
|
|
|
322
322
|
// @ts-ignore
|
|
323
323
|
const openApi = await OAS.generateSpecs(createApp({ routes }), configs?.rajt || {})
|
|
324
324
|
|
|
325
|
-
const iPath = join(__root, '.rajt/
|
|
325
|
+
const iPath = join(__root, '.rajt/imports.mjs')
|
|
326
326
|
ensureDir(iPath)
|
|
327
327
|
writeFileSync(iPath, `// AUTO-GENERATED FILE - DO NOT EDIT
|
|
328
328
|
${env?.length ? `import { Envir } from '../node_modules/t0n/dist/index'\nEnvir.add({${env.map(([key, val]) => key +':'+ stringifyToJS(val)).join(',')}})` : ''}
|
|
@@ -361,7 +361,6 @@ try {
|
|
|
361
361
|
route.path,
|
|
362
362
|
route.middlewares,
|
|
363
363
|
route.name,
|
|
364
|
-
route.desc,
|
|
365
364
|
])))
|
|
366
365
|
}
|
|
367
366
|
|