@famgia/omnify-old 0.12.9
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/CHANGELOG.md +129 -0
- package/README.md +136 -0
- package/dist/__tests__/generators/contextGenerator.test.d.ts +2 -0
- package/dist/__tests__/generators/contextGenerator.test.d.ts.map +1 -0
- package/dist/__tests__/generators/contextGenerator.test.js +109 -0
- package/dist/__tests__/generators/contextGenerator.test.js.map +1 -0
- package/dist/__tests__/generators/enumGenerator.test.d.ts +2 -0
- package/dist/__tests__/generators/enumGenerator.test.d.ts.map +1 -0
- package/dist/__tests__/generators/enumGenerator.test.js +151 -0
- package/dist/__tests__/generators/enumGenerator.test.js.map +1 -0
- package/dist/__tests__/generators/modelGenerator.test.d.ts +2 -0
- package/dist/__tests__/generators/modelGenerator.test.d.ts.map +1 -0
- package/dist/__tests__/generators/modelGenerator.test.js +329 -0
- package/dist/__tests__/generators/modelGenerator.test.js.map +1 -0
- package/dist/__tests__/utils/pascalCase.test.d.ts +1 -0
- package/dist/__tests__/utils/pascalCase.test.d.ts.map +1 -0
- package/dist/__tests__/utils/pascalCase.test.js +75 -0
- package/dist/__tests__/utils/pascalCase.test.js.map +1 -0
- package/dist/__tests__/utils/typeMapper.test.d.ts +2 -0
- package/dist/__tests__/utils/typeMapper.test.d.ts.map +1 -0
- package/dist/__tests__/utils/typeMapper.test.js +41 -0
- package/dist/__tests__/utils/typeMapper.test.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +248 -0
- package/dist/cli.js.map +1 -0
- package/dist/generators/commonTypesGenerator.d.ts +5 -0
- package/dist/generators/commonTypesGenerator.d.ts.map +1 -0
- package/dist/generators/commonTypesGenerator.js +37 -0
- package/dist/generators/commonTypesGenerator.js.map +1 -0
- package/dist/generators/contextGenerator.d.ts +3 -0
- package/dist/generators/contextGenerator.d.ts.map +1 -0
- package/dist/generators/contextGenerator.js +248 -0
- package/dist/generators/contextGenerator.js.map +1 -0
- package/dist/generators/enumGenerator.d.ts +13 -0
- package/dist/generators/enumGenerator.d.ts.map +1 -0
- package/dist/generators/enumGenerator.js +83 -0
- package/dist/generators/enumGenerator.js.map +1 -0
- package/dist/generators/hooksGenerator.d.ts +4 -0
- package/dist/generators/hooksGenerator.d.ts.map +1 -0
- package/dist/generators/hooksGenerator.js +265 -0
- package/dist/generators/hooksGenerator.js.map +1 -0
- package/dist/generators/modelGenerator.d.ts +13 -0
- package/dist/generators/modelGenerator.d.ts.map +1 -0
- package/dist/generators/modelGenerator.js +262 -0
- package/dist/generators/modelGenerator.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/hooks/useFormSubmit.d.ts +36 -0
- package/dist/runtime/hooks/useFormSubmit.d.ts.map +1 -0
- package/dist/runtime/hooks/useFormSubmit.js +86 -0
- package/dist/runtime/hooks/useFormSubmit.js.map +1 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +21 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/lib/axios.d.ts +7 -0
- package/dist/runtime/lib/axios.d.ts.map +1 -0
- package/dist/runtime/lib/axios.js +54 -0
- package/dist/runtime/lib/axios.js.map +1 -0
- package/dist/runtime/lib/validation.d.ts +50 -0
- package/dist/runtime/lib/validation.d.ts.map +1 -0
- package/dist/runtime/lib/validation.js +85 -0
- package/dist/runtime/lib/validation.js.map +1 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/typeMapper.d.ts +10 -0
- package/dist/utils/typeMapper.d.ts.map +1 -0
- package/dist/utils/typeMapper.js +119 -0
- package/dist/utils/typeMapper.js.map +1 -0
- package/package.json +74 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.4.0] - 2025-11-09
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Base Models + Extended Models pattern**: Base models are now auto-generated with `Base` prefix and should not be edited
|
|
9
|
+
- **Extended models directory**: `models/` directory with customizable model files that extend base models
|
|
10
|
+
- Extended model files are generated once and never overwritten, allowing full customization
|
|
11
|
+
- `generateExtendedModelFile()` function to create customizable model templates
|
|
12
|
+
- `generateModelsIndexFile()` to export all extended models
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Base models now use `Base` prefix (e.g., `BaseUser`, `BaseCompany`)
|
|
16
|
+
- Frontend code should import from `models/` instead of `types/models`
|
|
17
|
+
- Main `index.ts` now exports from `models/` directory
|
|
18
|
+
|
|
19
|
+
### Structure
|
|
20
|
+
```
|
|
21
|
+
omnify/
|
|
22
|
+
├── types/
|
|
23
|
+
│ ├── models.ts # BaseUser, BaseCompany, etc (auto-generated, DO NOT EDIT)
|
|
24
|
+
│ └── enums.ts
|
|
25
|
+
├── models/
|
|
26
|
+
│ ├── User.ts # extends BaseUser (SAFE TO CUSTOMIZE)
|
|
27
|
+
│ ├── Company.ts # extends BaseCompany (SAFE TO CUSTOMIZE)
|
|
28
|
+
│ └── index.ts # exports all
|
|
29
|
+
└── contexts/
|
|
30
|
+
└── EnumsContext.tsx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example
|
|
34
|
+
```typescript
|
|
35
|
+
// Auto-generated base model (DO NOT EDIT)
|
|
36
|
+
// types/models.ts
|
|
37
|
+
export interface BaseUser {
|
|
38
|
+
id: number;
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Customizable extended model (SAFE TO EDIT)
|
|
43
|
+
// models/User.ts
|
|
44
|
+
import { BaseUser } from '../types/models';
|
|
45
|
+
|
|
46
|
+
export interface User extends BaseUser {
|
|
47
|
+
// Add your custom fields here
|
|
48
|
+
fullName?: string;
|
|
49
|
+
avatarUrl?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Use in your app
|
|
53
|
+
import { User } from '@/omnify';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## [0.3.0] - 2025-11-09
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
- **Type-safe enum keys**: Exported `EnumKey` type for better TypeScript autocomplete and type checking
|
|
60
|
+
- JSDoc comments for all helper methods (`getLabel`, `getValue`, `getOptions`) with usage examples
|
|
61
|
+
- Exported `EnumsContextType` interface for better type inference
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- All helper methods now use `EnumKey` type instead of `keyof EnumOptions` for cleaner API
|
|
65
|
+
- Improved IntelliSense support - now you get autocomplete for enum keys like `'account_type'`, `'company_type'`, etc.
|
|
66
|
+
|
|
67
|
+
## [0.2.3] - 2025-11-09
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
- Fixed `npm pkg fix` warning about bin script path
|
|
71
|
+
|
|
72
|
+
## [0.2.2] - 2025-11-09
|
|
73
|
+
|
|
74
|
+
### Changed
|
|
75
|
+
- Merged `enums.ts` and `enumOptions.ts` into single `enums.ts` file
|
|
76
|
+
- Updated `types/index.ts` to only export `enums` and `models`
|
|
77
|
+
|
|
78
|
+
## [0.2.1] - 2025-11-09
|
|
79
|
+
|
|
80
|
+
### Added
|
|
81
|
+
- Comprehensive test suite using Jest
|
|
82
|
+
- Test coverage for all generators and utilities
|
|
83
|
+
- PascalCase naming for enum types (e.g., `ApplicationFormEntityType` instead of `ApplicationForm_entity_type`)
|
|
84
|
+
- Mixed-case word preservation in PascalCase conversion
|
|
85
|
+
|
|
86
|
+
### Changed
|
|
87
|
+
- Enum type names now use PascalCase for better TypeScript conventions
|
|
88
|
+
- Improved code quality with test coverage
|
|
89
|
+
|
|
90
|
+
## [0.2.0] - 2025-11-09
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
- Helper methods in `EnumsContext.tsx`:
|
|
94
|
+
- `getLabel(enumKey, value)` - convert value to label
|
|
95
|
+
- `getValue(enumKey, label)` - convert label to value
|
|
96
|
+
- `getOptions(enumKey)` - get options for Select components
|
|
97
|
+
- Prefectures support in enum context (all 47 Japanese prefectures)
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
- Updated package name to `@famgia/omnify`
|
|
101
|
+
- Improved documentation in README
|
|
102
|
+
|
|
103
|
+
## [0.1.3] - 2025-11-09
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
- Fixed model generation to handle composite types correctly
|
|
107
|
+
- Added support for ManyToOne, OneToMany, OneToOne, ManyToMany relations
|
|
108
|
+
- Fixed duplicate fields in generated models
|
|
109
|
+
|
|
110
|
+
## [0.1.2] - 2025-11-09
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
- Fixed npm registry indexing issue
|
|
114
|
+
- Package now available on npm
|
|
115
|
+
|
|
116
|
+
## [0.1.1] - 2025-11-09
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
- Fixed npm publish issues
|
|
120
|
+
|
|
121
|
+
## [0.1.0] - 2025-11-09
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
- Initial release
|
|
125
|
+
- Generate TypeScript models from `schema-lock.json`
|
|
126
|
+
- Generate enum types and options
|
|
127
|
+
- Generate React Context for enums
|
|
128
|
+
- CLI tool `omnify-build` with watch mode
|
|
129
|
+
- Auto-detect `schema-lock.json` from common paths
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @famgia/omnify
|
|
2
|
+
|
|
3
|
+
Complete Laravel + React solution: Schema-to-TypeScript generation + Runtime helpers for forms
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 🎯 Build-time (Code Generation)
|
|
8
|
+
- ✅ Convert Omnify `schema-lock.json` to TypeScript types
|
|
9
|
+
- ✅ Generate enum types and options
|
|
10
|
+
- ✅ Generate model interfaces with relations
|
|
11
|
+
- ✅ Generate Enums Context Provider with type-safe helpers
|
|
12
|
+
- ✅ Watch mode for auto-regeneration
|
|
13
|
+
|
|
14
|
+
### 🚀 Runtime (React Helpers)
|
|
15
|
+
- ✅ `useFormSubmit` - Auto Laravel validation error mapping
|
|
16
|
+
- ✅ `createLaravelAxios` - Pre-configured axios for Laravel
|
|
17
|
+
- ✅ `getCsrfCookie` - CSRF token helper
|
|
18
|
+
- ✅ Full TypeScript support
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @famgia/omnify
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### 1. Generate Types (Build-time)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# In frontend project
|
|
32
|
+
npx omnify-build --output src/omnify
|
|
33
|
+
|
|
34
|
+
# Watch mode
|
|
35
|
+
npx omnify-build --output src/omnify --watch
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Use Generated Types & Enums
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { User, Company } from '@/omnify/models';
|
|
42
|
+
import { useEnums } from '@/omnify';
|
|
43
|
+
|
|
44
|
+
function MyForm() {
|
|
45
|
+
const { getOptions, getPrefecturesAsNumbers } = useEnums();
|
|
46
|
+
|
|
47
|
+
const accountTypeOptions = getOptions('ApplicationForm', 'account_type');
|
|
48
|
+
const prefectureOptions = getPrefecturesAsNumbers();
|
|
49
|
+
|
|
50
|
+
return <Select options={accountTypeOptions} />;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Use Runtime Helpers
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { useFormSubmit, getCsrfCookie } from '@famgia/omnify';
|
|
58
|
+
import { Form, Button } from 'antd';
|
|
59
|
+
|
|
60
|
+
function MyForm() {
|
|
61
|
+
const [form] = Form.useForm();
|
|
62
|
+
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
63
|
+
|
|
64
|
+
const { handleSubmit, loading } = useFormSubmit({
|
|
65
|
+
form,
|
|
66
|
+
submitFn: createUser,
|
|
67
|
+
getCsrfToken: () => getCsrfCookie(apiUrl!),
|
|
68
|
+
onSuccess: (response) => {
|
|
69
|
+
message.success('Success!');
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Form form={form} onFinish={handleSubmit}>
|
|
75
|
+
<Form.Item name="email">
|
|
76
|
+
<Input />
|
|
77
|
+
</Form.Item>
|
|
78
|
+
<Button type="primary" htmlType="submit" loading={loading}>
|
|
79
|
+
Submit
|
|
80
|
+
</Button>
|
|
81
|
+
</Form>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
### `useFormSubmit<TResponse>(options)`
|
|
89
|
+
|
|
90
|
+
Hook for form submission with automatic Laravel validation error mapping.
|
|
91
|
+
|
|
92
|
+
**Options:**
|
|
93
|
+
- `form: FormInstance` - Ant Design form instance
|
|
94
|
+
- `submitFn: (values) => Promise<TResponse>` - API call function
|
|
95
|
+
- `getCsrfToken?: () => Promise<void>` - CSRF token getter
|
|
96
|
+
- `onSuccess?: (response, values) => void` - Success callback
|
|
97
|
+
- `onError?: (error, values) => void` - Custom error handler
|
|
98
|
+
- `errorMessages?: { 500?, 401?, 403?, default? }` - Custom error messages
|
|
99
|
+
|
|
100
|
+
**Returns:**
|
|
101
|
+
- `handleSubmit: (values) => Promise<void>` - Submit handler
|
|
102
|
+
- `loading: boolean` - Loading state
|
|
103
|
+
- `setLoading: (loading) => void` - Set loading manually
|
|
104
|
+
|
|
105
|
+
### `createLaravelAxios(baseURL)`
|
|
106
|
+
|
|
107
|
+
Create pre-configured axios instance for Laravel API.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { createLaravelAxios } from '@famgia/omnify';
|
|
111
|
+
|
|
112
|
+
const axios = createLaravelAxios('https://api.example.com');
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `getCsrfCookie(baseURL)`
|
|
116
|
+
|
|
117
|
+
Get CSRF cookie for Laravel Sanctum.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { getCsrfCookie } from '@famgia/omnify';
|
|
121
|
+
|
|
122
|
+
await getCsrfCookie('https://api.example.com');
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Benefits
|
|
126
|
+
|
|
127
|
+
- 🚀 Reduce 100+ lines of boilerplate per form
|
|
128
|
+
- 🛡️ Type-safe enums and models
|
|
129
|
+
- 🔄 Auto-sync with backend schema
|
|
130
|
+
- 📝 Consistent error handling
|
|
131
|
+
- ⚡ Build-time code generation
|
|
132
|
+
- 🎯 Runtime helpers for common tasks
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextGenerator.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/generators/contextGenerator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const contextGenerator_1 = require("../../generators/contextGenerator");
|
|
4
|
+
describe('contextGenerator', () => {
|
|
5
|
+
describe('generateEnumContextFile', () => {
|
|
6
|
+
const mockEnums = [
|
|
7
|
+
{
|
|
8
|
+
objectName: 'User',
|
|
9
|
+
propertyName: 'status',
|
|
10
|
+
values: [
|
|
11
|
+
{ value: 'ACTIVE', label: 'Active' },
|
|
12
|
+
{ value: 'INACTIVE', label: 'Inactive' },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
objectName: 'User',
|
|
17
|
+
propertyName: 'role',
|
|
18
|
+
values: [
|
|
19
|
+
{ value: 'ADMIN', label: 'Administrator' },
|
|
20
|
+
{ value: 'USER', label: 'User' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
it('should generate context with nested EnumOptions interface', () => {
|
|
25
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
26
|
+
expect(output).toContain("'use client';");
|
|
27
|
+
expect(output).toContain('// Auto-generated by @famgia/omnify');
|
|
28
|
+
expect(output).toContain('export interface EnumOptions {');
|
|
29
|
+
expect(output).toContain('User: {');
|
|
30
|
+
expect(output).toContain('status: Record<string, string>;');
|
|
31
|
+
expect(output).toContain('role: Record<string, string>;');
|
|
32
|
+
});
|
|
33
|
+
it('should generate EnumObjectName type for IDE autocomplete', () => {
|
|
34
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
35
|
+
expect(output).toContain('// Type-safe keys for IDE autocomplete');
|
|
36
|
+
expect(output).toContain("export type EnumObjectName = 'User';");
|
|
37
|
+
expect(output).toContain("export type UserEnumProperty = 'status' | 'role';");
|
|
38
|
+
});
|
|
39
|
+
it('should generate nested STATIC_ENUMS object', () => {
|
|
40
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
41
|
+
expect(output).toContain('const STATIC_ENUMS: EnumOptions = {');
|
|
42
|
+
expect(output).toContain('User: {');
|
|
43
|
+
expect(output).toContain('status: {');
|
|
44
|
+
expect(output).toContain("ACTIVE: 'Active'");
|
|
45
|
+
expect(output).toContain("INACTIVE: 'Inactive'");
|
|
46
|
+
expect(output).toContain('role: {');
|
|
47
|
+
expect(output).toContain("ADMIN: 'Administrator'");
|
|
48
|
+
expect(output).toContain("USER: 'User'");
|
|
49
|
+
});
|
|
50
|
+
it('should include all 47 prefectures in separate const', () => {
|
|
51
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
52
|
+
expect(output).toContain('const PREFECTURES: Record<string, string> = {');
|
|
53
|
+
expect(output).toContain("'1': '北海道'");
|
|
54
|
+
expect(output).toContain("'13': '東京都'");
|
|
55
|
+
expect(output).toContain("'47': '沖縄県'");
|
|
56
|
+
});
|
|
57
|
+
it('should generate EnumsContextType with helper methods', () => {
|
|
58
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
59
|
+
expect(output).toContain('export interface EnumsContextType {');
|
|
60
|
+
expect(output).toContain('enums: EnumOptions | null;');
|
|
61
|
+
expect(output).toContain('loading: boolean;');
|
|
62
|
+
expect(output).toContain('error: Error | null;');
|
|
63
|
+
expect(output).toContain('getLabel: <T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>, value: string | number) => string | undefined;');
|
|
64
|
+
expect(output).toContain('getValue: <T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>, label: string) => string | undefined;');
|
|
65
|
+
expect(output).toContain('getOptions: <T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>) => { value: string; label: string }[];');
|
|
66
|
+
expect(output).toContain('getPrefectures: () => { value: string; label: string }[];');
|
|
67
|
+
expect(output).toContain('getPrefecturesAsNumbers: () => { value: number; label: string }[];');
|
|
68
|
+
});
|
|
69
|
+
it('should generate EnumsProvider component', () => {
|
|
70
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
71
|
+
expect(output).toContain('export function EnumsProvider({ children }: { children: ReactNode })');
|
|
72
|
+
expect(output).toContain('const [enums] = useState<EnumOptions>(STATIC_ENUMS);');
|
|
73
|
+
expect(output).toContain('<EnumsContext.Provider');
|
|
74
|
+
});
|
|
75
|
+
it('should generate getLabel helper method with 2-param signature', () => {
|
|
76
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
77
|
+
expect(output).toContain('const getLabel = useCallback(<T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>, value: string | number): string | undefined => {');
|
|
78
|
+
expect(output).toContain('}, [enums]);');
|
|
79
|
+
expect(output).toContain('if (!enums) return undefined;');
|
|
80
|
+
expect(output).toContain('const enumData = enums[objectName]?.[propertyName] as Record<string, string> | undefined;');
|
|
81
|
+
});
|
|
82
|
+
it('should generate getValue helper method with 2-param signature', () => {
|
|
83
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
84
|
+
expect(output).toContain('const getValue = useCallback(<T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>, label: string): string | undefined => {');
|
|
85
|
+
expect(output).toContain('}, [enums]);');
|
|
86
|
+
expect(output).toContain('return Object.entries(enumData).find(([_, l]) => l === label)?.[0];');
|
|
87
|
+
});
|
|
88
|
+
it('should generate getOptions helper method with 2-param signature', () => {
|
|
89
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
90
|
+
expect(output).toContain('const getOptions = useCallback(<T extends EnumObjectName>(objectName: T, propertyName: EnumPropertyName<T>): { value: string; label: string }[] => {');
|
|
91
|
+
expect(output).toContain('}, []);');
|
|
92
|
+
expect(output).toContain('return (STATIC_OPTIONS as any)[objectName]?.[propertyName] || [];');
|
|
93
|
+
expect(output).toContain('const STATIC_OPTIONS:');
|
|
94
|
+
});
|
|
95
|
+
it('should generate useEnums hook', () => {
|
|
96
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)(mockEnums);
|
|
97
|
+
expect(output).toContain('export function useEnums(): EnumsContextType {');
|
|
98
|
+
expect(output).toContain('const context = useContext(EnumsContext);');
|
|
99
|
+
expect(output).toContain("throw new Error('useEnums must be used within an EnumsProvider');");
|
|
100
|
+
});
|
|
101
|
+
it('should handle empty enums array', () => {
|
|
102
|
+
const output = (0, contextGenerator_1.generateEnumContextFile)([]);
|
|
103
|
+
expect(output).toContain('export interface EnumOptions {');
|
|
104
|
+
expect(output).toContain('const PREFECTURES: Record<string, string> = {');
|
|
105
|
+
expect(output).toContain('const STATIC_ENUMS: EnumOptions = {');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=contextGenerator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextGenerator.test.js","sourceRoot":"","sources":["../../../src/__tests__/generators/contextGenerator.test.ts"],"names":[],"mappings":";;AAAA,wEAA4E;AAG5E,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACrC,MAAM,SAAS,GAAe;YAC1B;gBACI,UAAU,EAAE,MAAM;gBAClB,YAAY,EAAE,QAAQ;gBACtB,MAAM,EAAE;oBACJ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;iBAC3C;aACJ;YACD;gBACI,UAAU,EAAE,MAAM;gBAClB,YAAY,EAAE,MAAM;gBACpB,MAAM,EAAE;oBACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE;oBAC1C,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACnC;aACJ;SACJ,CAAC;QAEF,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;YACjE,MAAM,MAAM,GAAG,IAAA,0CAAuB,EAAC,SAAS,CAAC,CAAC;YAElD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;YAChE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;YAC5D,MAAM,CAAC,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CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACrC,MAAM,MAAM,GAAG,IAAA,0CAAuB,EAAC,SAAS,CAAC,CAAC;YAElD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gDAAgD,CAAC,CAAC;YAC3E,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,mEAAmE,CAAC,CAAC;QAClG,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;YACvC,MAAM,MAAM,GAAG,IAAA,0CAAuB,EAAC,EAAE,CAAC,CAAC;YAE3C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,+CAA+C,CAAC,CAAC;YAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumGenerator.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/generators/enumGenerator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const enumGenerator_1 = require("../../generators/enumGenerator");
|
|
4
|
+
describe('enumGenerator', () => {
|
|
5
|
+
const mockSchema = {
|
|
6
|
+
User: {
|
|
7
|
+
name: 'User',
|
|
8
|
+
table: 'users',
|
|
9
|
+
properties: {
|
|
10
|
+
id: {
|
|
11
|
+
type: 'Id',
|
|
12
|
+
objectName: 'User',
|
|
13
|
+
propertyName: 'id',
|
|
14
|
+
displayName: 'ID',
|
|
15
|
+
description: null,
|
|
16
|
+
primary: true,
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
type: 'Enum',
|
|
20
|
+
enum: [
|
|
21
|
+
{ value: 'ACTIVE', label: 'Active' },
|
|
22
|
+
{ value: 'INACTIVE', label: 'Inactive' },
|
|
23
|
+
],
|
|
24
|
+
objectName: 'User',
|
|
25
|
+
propertyName: 'status',
|
|
26
|
+
displayName: 'Status',
|
|
27
|
+
description: null,
|
|
28
|
+
},
|
|
29
|
+
role: {
|
|
30
|
+
type: 'Enum',
|
|
31
|
+
enum: [
|
|
32
|
+
{ value: 'ADMIN', label: 'Administrator' },
|
|
33
|
+
{ value: 'USER', label: 'User' },
|
|
34
|
+
],
|
|
35
|
+
objectName: 'User',
|
|
36
|
+
propertyName: 'role',
|
|
37
|
+
displayName: 'Role',
|
|
38
|
+
description: null,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
describe('extractEnums', () => {
|
|
44
|
+
it('should extract all enums from schema', () => {
|
|
45
|
+
const enums = (0, enumGenerator_1.extractEnums)(mockSchema);
|
|
46
|
+
expect(enums).toHaveLength(2);
|
|
47
|
+
expect(enums[0].objectName).toBe('User');
|
|
48
|
+
expect(enums[0].propertyName).toBe('status');
|
|
49
|
+
expect(enums[0].values).toHaveLength(2);
|
|
50
|
+
expect(enums[1].propertyName).toBe('role');
|
|
51
|
+
});
|
|
52
|
+
it('should handle schema with no enums', () => {
|
|
53
|
+
const schemaWithoutEnums = {
|
|
54
|
+
User: {
|
|
55
|
+
name: 'User',
|
|
56
|
+
table: 'users',
|
|
57
|
+
properties: {
|
|
58
|
+
id: {
|
|
59
|
+
type: 'Id',
|
|
60
|
+
objectName: 'User',
|
|
61
|
+
propertyName: 'id',
|
|
62
|
+
displayName: 'ID',
|
|
63
|
+
description: null,
|
|
64
|
+
},
|
|
65
|
+
name: {
|
|
66
|
+
type: 'String',
|
|
67
|
+
objectName: 'User',
|
|
68
|
+
propertyName: 'name',
|
|
69
|
+
displayName: 'Name',
|
|
70
|
+
description: null,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const enums = (0, enumGenerator_1.extractEnums)(schemaWithoutEnums);
|
|
76
|
+
expect(enums).toHaveLength(0);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe('generateEnumsFile', () => {
|
|
80
|
+
it('should generate enums file with types and options', () => {
|
|
81
|
+
const enums = (0, enumGenerator_1.extractEnums)(mockSchema);
|
|
82
|
+
const output = (0, enumGenerator_1.generateEnumsFile)(enums);
|
|
83
|
+
expect(output).toContain('// Auto-generated by @omnifyjp/omnify');
|
|
84
|
+
// Check enum types (PascalCase)
|
|
85
|
+
expect(output).toContain('export type UserStatus');
|
|
86
|
+
expect(output).toContain("| 'ACTIVE'");
|
|
87
|
+
expect(output).toContain("| 'INACTIVE'");
|
|
88
|
+
expect(output).toContain('export type UserRole');
|
|
89
|
+
expect(output).toContain("| 'ADMIN'");
|
|
90
|
+
expect(output).toContain("| 'USER'");
|
|
91
|
+
// Check enum options with full keys
|
|
92
|
+
expect(output).toContain('export const User_statusOptions = {');
|
|
93
|
+
expect(output).toContain("ACTIVE: 'Active'");
|
|
94
|
+
expect(output).toContain("INACTIVE: 'Inactive'");
|
|
95
|
+
expect(output).toContain('export const User_roleOptions = {');
|
|
96
|
+
expect(output).toContain("ADMIN: 'Administrator'");
|
|
97
|
+
expect(output).toContain("USER: 'User'");
|
|
98
|
+
});
|
|
99
|
+
it('should preserve mixed-case words in PascalCase conversion', () => {
|
|
100
|
+
const mixedCaseSchema = {
|
|
101
|
+
ApplicationForm: {
|
|
102
|
+
name: 'ApplicationForm',
|
|
103
|
+
table: 'application_forms',
|
|
104
|
+
properties: {
|
|
105
|
+
id: {
|
|
106
|
+
type: 'Id',
|
|
107
|
+
objectName: 'ApplicationForm',
|
|
108
|
+
propertyName: 'id',
|
|
109
|
+
displayName: 'ID',
|
|
110
|
+
description: null,
|
|
111
|
+
},
|
|
112
|
+
entity_type: {
|
|
113
|
+
type: 'Enum',
|
|
114
|
+
enum: [
|
|
115
|
+
{ value: 'CORPORATION', label: 'Corporation' },
|
|
116
|
+
],
|
|
117
|
+
objectName: 'ApplicationForm',
|
|
118
|
+
propertyName: 'entity_type',
|
|
119
|
+
displayName: 'Entity Type',
|
|
120
|
+
description: null,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const enums = (0, enumGenerator_1.extractEnums)(mixedCaseSchema);
|
|
126
|
+
const output = (0, enumGenerator_1.generateEnumsFile)(enums);
|
|
127
|
+
// Should preserve "ApplicationForm" not convert to "Applicationform"
|
|
128
|
+
expect(output).toContain('export type ApplicationFormEntityType');
|
|
129
|
+
expect(output).not.toContain('ApplicationformEntityType');
|
|
130
|
+
});
|
|
131
|
+
it('should have clear section separators', () => {
|
|
132
|
+
const enums = (0, enumGenerator_1.extractEnums)(mockSchema);
|
|
133
|
+
const output = (0, enumGenerator_1.generateEnumsFile)(enums);
|
|
134
|
+
expect(output).toContain('// ============================================');
|
|
135
|
+
expect(output).toContain('// Enum Types');
|
|
136
|
+
expect(output).toContain('// Enum Options (Value -> Label mappings)');
|
|
137
|
+
});
|
|
138
|
+
it('should use "as const" for enum options', () => {
|
|
139
|
+
const enums = (0, enumGenerator_1.extractEnums)(mockSchema);
|
|
140
|
+
const output = (0, enumGenerator_1.generateEnumsFile)(enums);
|
|
141
|
+
expect(output).toContain('} as const;');
|
|
142
|
+
});
|
|
143
|
+
it('should generate empty file for no enums', () => {
|
|
144
|
+
const output = (0, enumGenerator_1.generateEnumsFile)([]);
|
|
145
|
+
expect(output).toContain('// Auto-generated by @omnifyjp/omnify');
|
|
146
|
+
expect(output).not.toContain('export type');
|
|
147
|
+
expect(output).not.toContain('export const');
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=enumGenerator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumGenerator.test.js","sourceRoot":"","sources":["../../../src/__tests__/generators/enumGenerator.test.ts"],"names":[],"mappings":";;AAAA,kEAAiF;AAGjF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,MAAM,UAAU,GAAG;QACf,IAAI,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,UAAU,EAAE;gBACR,EAAE,EAAE;oBACA,IAAI,EAAE,IAAI;oBACV,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,IAAI;oBAClB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE,IAAI;oBACjB,OAAO,EAAE,IAAI;iBACJ;gBACb,MAAM,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACF,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;wBACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;qBAC3C;oBACD,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,QAAQ;oBACtB,WAAW,EAAE,QAAQ;oBACrB,WAAW,EAAE,IAAI;iBACR;gBACb,IAAI,EAAE;oBACF,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACF,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE;wBAC1C,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;qBACnC;oBACD,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,MAAM;oBACpB,WAAW,EAAE,MAAM;oBACnB,WAAW,EAAE,IAAI;iBACR;aAChB;SACJ;KACG,CAAC;IAET,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,MAAM,KAAK,GAAG,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