routesync 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/dist/cli.js +6 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8451,7 +8451,7 @@ if ($extractModels) {
8451
8451
  foreach ($columns as $col) {
8452
8452
  $parsedColumns[] = [
8453
8453
  'name' => $col['name'],
8454
- 'type' => $col['type_name'],
8454
+ 'type' => $col['type'], // Use 'type' which contains the raw type like enum('a','b') instead of 'type_name'
8455
8455
  'nullable' => $col['nullable']
8456
8456
  ];
8457
8457
  }
@@ -8952,6 +8952,11 @@ var ModelGenerator = class {
8952
8952
  if (type.includes("json")) {
8953
8953
  return "any";
8954
8954
  }
8955
+ const enumMatch = type.match(/^enum\((.*)\)$/);
8956
+ if (enumMatch && enumMatch[1]) {
8957
+ const values = enumMatch[1].split(",").map((v) => v.trim().replace(/^'|'$/g, ""));
8958
+ return values.map((v) => `'${v}'`).join(" | ");
8959
+ }
8955
8960
  return "string";
8956
8961
  }
8957
8962
  static mapCastToTs(castType, defaultType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "routesync",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Laravel routes to typed frontend SDKs.",
5
5
  "main": "./dist/sdk.js",
6
6
  "module": "./dist/sdk.mjs",