routesync 1.0.11 → 1.0.13
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.js +6 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8620,7 +8620,7 @@ var SDKGenerator = class _SDKGenerator {
|
|
|
8620
8620
|
if (options.zod) {
|
|
8621
8621
|
for (const [group, routes] of Object.entries(grouped)) {
|
|
8622
8622
|
for (const route of routes) {
|
|
8623
|
-
if (route.
|
|
8623
|
+
if (route.schema?.rules) {
|
|
8624
8624
|
usesZod = true;
|
|
8625
8625
|
zodRoutes.add(`${group}.${route.actionName}`);
|
|
8626
8626
|
}
|
|
@@ -8643,8 +8643,8 @@ var SDKGenerator = class _SDKGenerator {
|
|
|
8643
8643
|
lines.push(` method: '${route.method}',`);
|
|
8644
8644
|
lines.push(` path: '${route.runtimePath}',`);
|
|
8645
8645
|
if (route.auth) lines.push(` auth: true,`);
|
|
8646
|
-
if (options.zod && route.
|
|
8647
|
-
const zodSchema = _SDKGenerator.translateRulesToZod(route.
|
|
8646
|
+
if (options.zod && route.schema?.rules) {
|
|
8647
|
+
const zodSchema = _SDKGenerator.translateRulesToZod(route.schema.rules);
|
|
8648
8648
|
lines.push(` schema: {`);
|
|
8649
8649
|
lines.push(` body: ${zodSchema}`);
|
|
8650
8650
|
lines.push(` },`);
|
|
@@ -8866,6 +8866,9 @@ var NextActionGenerator = class {
|
|
|
8866
8866
|
const actionName = `${groupName}${toTypeName(route.actionName)}`;
|
|
8867
8867
|
lines.push(`export async function ${actionName}Action(payload?: Record<string, unknown>) {`);
|
|
8868
8868
|
const args = [];
|
|
8869
|
+
if (route.path.includes(":")) {
|
|
8870
|
+
args.push(`params: payload as any`);
|
|
8871
|
+
}
|
|
8869
8872
|
if (route.method === "GET") {
|
|
8870
8873
|
args.push(`query: payload`);
|
|
8871
8874
|
} else {
|