omni-rest 0.3.1 → 0.3.2
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 +9 -12
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +9 -12
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -720,10 +720,7 @@ function resolveOutputDir(frontendDir, framework, outFlag) {
|
|
|
720
720
|
if (structure.usesSrc) {
|
|
721
721
|
return path3__namespace.resolve(frontendDir, "src");
|
|
722
722
|
}
|
|
723
|
-
|
|
724
|
-
return path3__namespace.resolve(frontendDir, "app");
|
|
725
|
-
}
|
|
726
|
-
return path3__namespace.resolve(frontendDir, "src");
|
|
723
|
+
return frontendDir;
|
|
727
724
|
}
|
|
728
725
|
var BASE_PACKAGES = [
|
|
729
726
|
"@tanstack/react-query",
|
|
@@ -1126,13 +1123,13 @@ function generateTableFile(config, modelConfig) {
|
|
|
1126
1123
|
lines.push(`'use client'`);
|
|
1127
1124
|
lines.push(``);
|
|
1128
1125
|
}
|
|
1129
|
-
lines.push(`import { DataTable } from "../data-table";`);
|
|
1130
|
-
lines.push(`import { ${columnsVar} } from "./${Model}Columns";`);
|
|
1131
1126
|
const hookImports = [useListHook, useDeleteHook];
|
|
1132
1127
|
if (bulkDelete) {
|
|
1133
1128
|
hookImports.push(useBulkDeleteHook);
|
|
1134
1129
|
}
|
|
1135
|
-
lines.push(`import
|
|
1130
|
+
lines.push(`import DataTable from "../data-table";`);
|
|
1131
|
+
lines.push(`import { ${columnsVar} } from "./${Model}Columns";`);
|
|
1132
|
+
lines.push(`import { ${hookImports.join(", ")} } from "../../hooks/use${Model}";`);
|
|
1136
1133
|
lines.push(``);
|
|
1137
1134
|
lines.push(`export function ${Model}Table() {`);
|
|
1138
1135
|
lines.push(` const { data } = ${useListHook}();`);
|
|
@@ -1186,13 +1183,13 @@ function generateFormFile(config, modelConfig) {
|
|
|
1186
1183
|
}
|
|
1187
1184
|
}
|
|
1188
1185
|
lines.push(`import { FormGenerator } from "../form-generator";`);
|
|
1189
|
-
lines.push(`import { ${name}
|
|
1186
|
+
lines.push(`import { ${name}CreateSchema } from "../../schemas.generated";`);
|
|
1190
1187
|
lines.push(
|
|
1191
|
-
`import { useCreate${name}, useUpdate${name} } from "
|
|
1188
|
+
`import { useCreate${name}, useUpdate${name} } from "../../hooks/use${name}";`
|
|
1192
1189
|
);
|
|
1193
1190
|
for (const { relatedModel } of relationalFieldMeta) {
|
|
1194
1191
|
lines.push(
|
|
1195
|
-
`import { use${relatedModel}s } from "
|
|
1192
|
+
`import { use${relatedModel}s } from "../../hooks/use${relatedModel}";`
|
|
1196
1193
|
);
|
|
1197
1194
|
}
|
|
1198
1195
|
lines.push(``);
|
|
@@ -1249,7 +1246,7 @@ function generateFormFile(config, modelConfig) {
|
|
|
1249
1246
|
lines.push(` return (`);
|
|
1250
1247
|
lines.push(` <FormGenerator`);
|
|
1251
1248
|
lines.push(` fields={fields}`);
|
|
1252
|
-
lines.push(` schema={${name}
|
|
1249
|
+
lines.push(` schema={${name}CreateSchema}`);
|
|
1253
1250
|
lines.push(
|
|
1254
1251
|
` onSubmit={(data) => id ? update${name}.mutate({ id, data }) : create${name}.mutate(data)}`
|
|
1255
1252
|
);
|
|
@@ -1260,7 +1257,7 @@ function generateFormFile(config, modelConfig) {
|
|
|
1260
1257
|
lines.push(` return (`);
|
|
1261
1258
|
lines.push(` <FormGenerator`);
|
|
1262
1259
|
lines.push(` fields={fields}`);
|
|
1263
|
-
lines.push(` schema={${name}
|
|
1260
|
+
lines.push(` schema={${name}CreateSchema}`);
|
|
1264
1261
|
lines.push(
|
|
1265
1262
|
` onSubmit={(data) => id ? update${name}.mutate({ id, data }) : create${name}.mutate(data)}`
|
|
1266
1263
|
);
|