@omnifyjp/ts 5.8.14 → 5.8.15

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.
@@ -65,7 +65,16 @@ function generateForSchema(name, schema, reader, config) {
65
65
  }
66
66
  function generateBasePolicyClass(name, schema, reader, config) {
67
67
  const modelName = toPascalCase(name);
68
- const baseNamespace = resolveModularBaseNamespace(config, name, 'Policies', config.policies.baseNamespace);
68
+ // Issue #98 v5.8.15: legacy structure must nest the policy base's
69
+ // `namespace ...;` declaration by group folder so it matches the
70
+ // grouped path on disk. Pre-fix every base emitted
71
+ // `namespace App\\Omnify\\Policies;` (FLAT) while the file lived at
72
+ // `app/Omnify/Policies/<Group>/<Name>Policy.php` — PSR-4 autoload
73
+ // failed at runtime for every grouped policy. Same template fix
74
+ // that v5.8.2 applied to Requests / Resources / Services.
75
+ const baseNamespace = config.structure === 'modular'
76
+ ? resolveModularBaseNamespace(config, name, 'Policies', config.policies.baseNamespace)
77
+ : nestByGroup({ path: '', namespace: config.policies.baseNamespace }, schema.group).namespace;
69
78
  // Issue #98 v5.8.13: policy method signatures (`view(User $user,
70
79
  // <Model> $record): bool`) must type-hint the USER-EDITABLE Model
71
80
  // class. Same root cause + fix as the v5.8.11 service / controller
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnifyjp/ts",
3
- "version": "5.8.14",
3
+ "version": "5.8.15",
4
4
  "description": "TypeScript model type generator from Omnify schemas.json",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",