@faapi/faapi 6.18.1 → 6.19.0
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/cli/index.js +29 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/{routeTypes-BAhPIzcG.d.ts → routeTypes-DTqdo28V.d.ts} +8 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +29 -2
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2608,6 +2608,15 @@ function collectRouteSchemaSources(routes, rootDir) {
|
|
|
2608
2608
|
typeInfo,
|
|
2609
2609
|
coerce: isForm || void 0
|
|
2610
2610
|
});
|
|
2611
|
+
const paramsArg = meta.params.find((p) => p.type === "params");
|
|
2612
|
+
if (paramsArg?.typeName) {
|
|
2613
|
+
sources.push({
|
|
2614
|
+
urlPath: entry.urlPath,
|
|
2615
|
+
filePath,
|
|
2616
|
+
schemaName: getSchemaName(method, "params"),
|
|
2617
|
+
typeInfo: resolver.resolve(paramsArg.typeName) ?? null
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2611
2620
|
}
|
|
2612
2621
|
}
|
|
2613
2622
|
return { sources, resolversByFile };
|
|
@@ -7474,8 +7483,10 @@ var init_agentHandle = __esm({
|
|
|
7474
7483
|
// src/injection/injectParams.ts
|
|
7475
7484
|
function getBuiltinInjectionValue(type, ctx, body) {
|
|
7476
7485
|
switch (type) {
|
|
7477
|
-
case "query":
|
|
7478
|
-
|
|
7486
|
+
case "query": {
|
|
7487
|
+
const validated = ctx.__validatedQuery;
|
|
7488
|
+
return validated ?? queryToObject(ctx.query);
|
|
7489
|
+
}
|
|
7479
7490
|
case "params":
|
|
7480
7491
|
return ctx.params;
|
|
7481
7492
|
case "headers":
|
|
@@ -8738,6 +8749,22 @@ function createRoutePipeline(opts) {
|
|
|
8738
8749
|
if (!result.valid) {
|
|
8739
8750
|
throw new ValidationError("\u53C2\u6570\u6821\u9A8C\u5931\u8D25", result.issues);
|
|
8740
8751
|
}
|
|
8752
|
+
if (inputType === "query" && result.data !== input && typeof result.data === "object" && result.data !== null) {
|
|
8753
|
+
ctx.__validatedQuery = {
|
|
8754
|
+
...input,
|
|
8755
|
+
...result.data
|
|
8756
|
+
};
|
|
8757
|
+
}
|
|
8758
|
+
const paramsResult = await validateInput(schemaPath, route.method, "params", match.params);
|
|
8759
|
+
if (!paramsResult.valid) {
|
|
8760
|
+
throw new ValidationError("\u53C2\u6570\u6821\u9A8C\u5931\u8D25", paramsResult.issues);
|
|
8761
|
+
}
|
|
8762
|
+
if (paramsResult.data !== match.params) {
|
|
8763
|
+
ctx.params = typeof paramsResult.data === "object" && paramsResult.data !== null ? {
|
|
8764
|
+
...match.params,
|
|
8765
|
+
...paramsResult.data
|
|
8766
|
+
} : match.params;
|
|
8767
|
+
}
|
|
8741
8768
|
const body = inputType === "query" && hasBody(route.method) ? await resolveBodyForQueryMethod(request) : hasBody(route.method) ? result.data : void 0;
|
|
8742
8769
|
if (route.middlewares === void 0 && route.injectors === void 0 && route.middlewarePaths) {
|
|
8743
8770
|
await ensureMiddlewaresCompiled(route.middlewarePaths, rootDir);
|