@omnifyjp/ts 5.5.0 → 5.6.1

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.
@@ -39,15 +39,35 @@ export declare function resolveSharedBasePath(config: PhpConfig, category: BaseC
39
39
  */
40
40
  export declare function resolveSharedBaseNamespace(config: PhpConfig, category: BaseCategory, legacyNamespace: string): string;
41
41
  /**
42
- * Resolve global Omnify enum file path. Used for system enums that aren't tied
43
- * to a single user-defined schema (e.g. FileStatusEnum belongs to the Omnify
44
- * file-attachment subsystem). In modular mode these live under their own
45
- * top-level folder so they're easy to find. In legacy mode the original
46
- * `legacyPath` is preserved for backward compat.
42
+ * Resolve global Omnify enum file path. ALWAYS uses
43
+ * `config.globalEnums.path` regardless of structure mode enums are
44
+ * conceptually independent of the model tree they describe and belong
45
+ * in their own dedicated folder for discoverability. The `legacyPath`
46
+ * argument is kept for callsite compatibility but ignored.
47
+ *
48
+ * Default: `app/Omnify/Enums/`. Override via `codegen.laravel.enums.path`
49
+ * in `omnify.yaml` (e.g. set to `app/Models/Omnify` to restore the
50
+ * pre-v5.6 legacy behavior of co-locating enums with models).
51
+ *
52
+ * History: pre-v5.6, legacy structure dumped enums into the model dir
53
+ * (`app/Models/Omnify/<Name>Enum.php`), mixing them with the user
54
+ * models — confusing for code reviewers and inconsistent with modular
55
+ * mode. Fixed via dedicated dir always.
56
+ */
57
+ export declare function resolveGlobalEnumPath(config: PhpConfig, fileName: string, _legacyPath: string): string;
58
+ /**
59
+ * Resolve global Omnify enum namespace. ALWAYS uses
60
+ * `config.globalEnums.namespace`. The `legacyNamespace` argument is
61
+ * kept for callsite compatibility but ignored.
62
+ *
63
+ * Default: `App\Omnify\Enums`. Override via
64
+ * `codegen.laravel.enums.namespace` to match a custom path.
65
+ *
66
+ * History: pre-v5.6, legacy structure used the model namespace
67
+ * (`App\Models\Omnify`), forcing every model file to import enums via
68
+ * the model dir. Fixed via dedicated namespace always.
47
69
  */
48
- export declare function resolveGlobalEnumPath(config: PhpConfig, fileName: string, legacyPath: string): string;
49
- /** Resolve global Omnify enum namespace. Modular: {globalEnums.namespace}. Legacy: passthrough. */
50
- export declare function resolveGlobalEnumNamespace(config: PhpConfig, legacyNamespace: string): string;
70
+ export declare function resolveGlobalEnumNamespace(config: PhpConfig, _legacyNamespace: string): string;
51
71
  /** Resolve global Omnify trait file path (HasFiles, HasLocalizedDisplayName, ...). */
52
72
  export declare function resolveGlobalTraitPath(config: PhpConfig, fileName: string, legacyPath: string): string;
53
73
  /** Resolve global Omnify trait namespace. */
package/dist/php/types.js CHANGED
@@ -54,24 +54,38 @@ export function resolveSharedBaseNamespace(config, category, legacyNamespace) {
54
54
  return legacyNamespace;
55
55
  }
56
56
  /**
57
- * Resolve global Omnify enum file path. Used for system enums that aren't tied
58
- * to a single user-defined schema (e.g. FileStatusEnum belongs to the Omnify
59
- * file-attachment subsystem). In modular mode these live under their own
60
- * top-level folder so they're easy to find. In legacy mode the original
61
- * `legacyPath` is preserved for backward compat.
57
+ * Resolve global Omnify enum file path. ALWAYS uses
58
+ * `config.globalEnums.path` regardless of structure mode enums are
59
+ * conceptually independent of the model tree they describe and belong
60
+ * in their own dedicated folder for discoverability. The `legacyPath`
61
+ * argument is kept for callsite compatibility but ignored.
62
+ *
63
+ * Default: `app/Omnify/Enums/`. Override via `codegen.laravel.enums.path`
64
+ * in `omnify.yaml` (e.g. set to `app/Models/Omnify` to restore the
65
+ * pre-v5.6 legacy behavior of co-locating enums with models).
66
+ *
67
+ * History: pre-v5.6, legacy structure dumped enums into the model dir
68
+ * (`app/Models/Omnify/<Name>Enum.php`), mixing them with the user
69
+ * models — confusing for code reviewers and inconsistent with modular
70
+ * mode. Fixed via dedicated dir always.
62
71
  */
63
- export function resolveGlobalEnumPath(config, fileName, legacyPath) {
64
- if (config.structure === 'modular') {
65
- return `${config.globalEnums.path}/${fileName}`;
66
- }
67
- return `${legacyPath}/${fileName}`;
72
+ export function resolveGlobalEnumPath(config, fileName, _legacyPath) {
73
+ return `${config.globalEnums.path}/${fileName}`;
68
74
  }
69
- /** Resolve global Omnify enum namespace. Modular: {globalEnums.namespace}. Legacy: passthrough. */
70
- export function resolveGlobalEnumNamespace(config, legacyNamespace) {
71
- if (config.structure === 'modular') {
72
- return config.globalEnums.namespace;
73
- }
74
- return legacyNamespace;
75
+ /**
76
+ * Resolve global Omnify enum namespace. ALWAYS uses
77
+ * `config.globalEnums.namespace`. The `legacyNamespace` argument is
78
+ * kept for callsite compatibility but ignored.
79
+ *
80
+ * Default: `App\Omnify\Enums`. Override via
81
+ * `codegen.laravel.enums.namespace` to match a custom path.
82
+ *
83
+ * History: pre-v5.6, legacy structure used the model namespace
84
+ * (`App\Models\Omnify`), forcing every model file to import enums via
85
+ * the model dir. Fixed via dedicated namespace always.
86
+ */
87
+ export function resolveGlobalEnumNamespace(config, _legacyNamespace) {
88
+ return config.globalEnums.namespace;
75
89
  }
76
90
  /** Resolve global Omnify trait file path (HasFiles, HasLocalizedDisplayName, ...). */
77
91
  export function resolveGlobalTraitPath(config, fileName, legacyPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnifyjp/ts",
3
- "version": "5.5.0",
3
+ "version": "5.6.1",
4
4
  "description": "TypeScript model type generator from Omnify schemas.json",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",