@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
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const modelGenerator_1 = require("../../generators/modelGenerator");
|
|
4
|
+
describe('modelGenerator', () => {
|
|
5
|
+
describe('generateModelFile', () => {
|
|
6
|
+
it('should generate basic model interface', () => {
|
|
7
|
+
const object = {
|
|
8
|
+
name: 'User',
|
|
9
|
+
table: 'users',
|
|
10
|
+
label: 'User',
|
|
11
|
+
properties: {
|
|
12
|
+
id: {
|
|
13
|
+
type: 'Id',
|
|
14
|
+
objectName: 'User',
|
|
15
|
+
propertyName: 'id',
|
|
16
|
+
displayName: 'ID',
|
|
17
|
+
description: null,
|
|
18
|
+
primary: true,
|
|
19
|
+
},
|
|
20
|
+
name: {
|
|
21
|
+
type: 'String',
|
|
22
|
+
objectName: 'User',
|
|
23
|
+
propertyName: 'name',
|
|
24
|
+
displayName: 'Name',
|
|
25
|
+
description: null,
|
|
26
|
+
},
|
|
27
|
+
email: {
|
|
28
|
+
type: 'Email',
|
|
29
|
+
objectName: 'User',
|
|
30
|
+
propertyName: 'email',
|
|
31
|
+
displayName: 'Email',
|
|
32
|
+
description: null,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const output = (0, modelGenerator_1.generateModelFile)('User', object, false);
|
|
37
|
+
expect(output).toContain('// Auto-generated by @famgia/omnify');
|
|
38
|
+
expect(output).toContain('export interface User {');
|
|
39
|
+
expect(output).toContain('id: number; // ID');
|
|
40
|
+
expect(output).toContain('name: string; // Name');
|
|
41
|
+
expect(output).toContain('email: string; // Email');
|
|
42
|
+
});
|
|
43
|
+
it('should handle nullable fields', () => {
|
|
44
|
+
const object = {
|
|
45
|
+
name: 'User',
|
|
46
|
+
table: 'users',
|
|
47
|
+
properties: {
|
|
48
|
+
id: {
|
|
49
|
+
type: 'Id',
|
|
50
|
+
objectName: 'User',
|
|
51
|
+
propertyName: 'id',
|
|
52
|
+
displayName: 'ID',
|
|
53
|
+
description: null,
|
|
54
|
+
},
|
|
55
|
+
bio: {
|
|
56
|
+
type: 'Text',
|
|
57
|
+
nullable: true,
|
|
58
|
+
objectName: 'User',
|
|
59
|
+
propertyName: 'bio',
|
|
60
|
+
displayName: 'Bio',
|
|
61
|
+
description: null,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const output = (0, modelGenerator_1.generateModelFile)('User', object, false);
|
|
66
|
+
expect(output).toContain('bio?: string | null;');
|
|
67
|
+
});
|
|
68
|
+
it('should handle enum fields', () => {
|
|
69
|
+
const object = {
|
|
70
|
+
name: 'User',
|
|
71
|
+
table: 'users',
|
|
72
|
+
properties: {
|
|
73
|
+
id: {
|
|
74
|
+
type: 'Id',
|
|
75
|
+
objectName: 'User',
|
|
76
|
+
propertyName: 'id',
|
|
77
|
+
displayName: 'ID',
|
|
78
|
+
description: null,
|
|
79
|
+
},
|
|
80
|
+
status: {
|
|
81
|
+
type: 'Enum',
|
|
82
|
+
enum: [
|
|
83
|
+
{ value: 'ACTIVE', label: 'Active' },
|
|
84
|
+
{ value: 'INACTIVE', label: 'Inactive' },
|
|
85
|
+
],
|
|
86
|
+
objectName: 'User',
|
|
87
|
+
propertyName: 'status',
|
|
88
|
+
displayName: 'Status',
|
|
89
|
+
description: null,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const output = (0, modelGenerator_1.generateModelFile)('User', object, false);
|
|
94
|
+
expect(output).toContain('status: UserStatus;');
|
|
95
|
+
});
|
|
96
|
+
it('should use PascalCase for enum type names', () => {
|
|
97
|
+
const object = {
|
|
98
|
+
name: 'ApplicationForm',
|
|
99
|
+
table: 'application_forms',
|
|
100
|
+
properties: {
|
|
101
|
+
id: {
|
|
102
|
+
type: 'Id',
|
|
103
|
+
objectName: 'ApplicationForm',
|
|
104
|
+
propertyName: 'id',
|
|
105
|
+
displayName: 'ID',
|
|
106
|
+
description: null,
|
|
107
|
+
},
|
|
108
|
+
entity_type: {
|
|
109
|
+
type: 'Enum',
|
|
110
|
+
enum: [
|
|
111
|
+
{ value: 'CORPORATION', label: 'Corporation' },
|
|
112
|
+
],
|
|
113
|
+
objectName: 'ApplicationForm',
|
|
114
|
+
propertyName: 'entity_type',
|
|
115
|
+
displayName: 'Entity Type',
|
|
116
|
+
description: null,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
const output = (0, modelGenerator_1.generateModelFile)('ApplicationForm', object, false);
|
|
121
|
+
// Should use PascalCase: ApplicationFormEntityType
|
|
122
|
+
expect(output).toContain('entity_type: ApplicationFormEntityType;');
|
|
123
|
+
expect(output).not.toContain('entity_type: ApplicationForm_entity_type;');
|
|
124
|
+
});
|
|
125
|
+
it('should preserve mixed-case in model enum references', () => {
|
|
126
|
+
const object = {
|
|
127
|
+
name: 'MyCustomModel',
|
|
128
|
+
table: 'my_custom_models',
|
|
129
|
+
properties: {
|
|
130
|
+
id: {
|
|
131
|
+
type: 'Id',
|
|
132
|
+
objectName: 'MyCustomModel',
|
|
133
|
+
propertyName: 'id',
|
|
134
|
+
displayName: 'ID',
|
|
135
|
+
description: null,
|
|
136
|
+
},
|
|
137
|
+
status: {
|
|
138
|
+
type: 'Enum',
|
|
139
|
+
enum: [
|
|
140
|
+
{ value: 'ACTIVE', label: 'Active' },
|
|
141
|
+
],
|
|
142
|
+
objectName: 'MyCustomModel',
|
|
143
|
+
propertyName: 'status',
|
|
144
|
+
displayName: 'Status',
|
|
145
|
+
description: null,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
const output = (0, modelGenerator_1.generateModelFile)('MyCustomModel', object, false);
|
|
150
|
+
expect(output).toContain('status: MyCustomModelStatus;');
|
|
151
|
+
});
|
|
152
|
+
it('should generate clean output', () => {
|
|
153
|
+
const object = {
|
|
154
|
+
name: 'TestModel',
|
|
155
|
+
table: 'test_models',
|
|
156
|
+
properties: {
|
|
157
|
+
id: {
|
|
158
|
+
type: 'Id',
|
|
159
|
+
objectName: 'TestModel',
|
|
160
|
+
propertyName: 'id',
|
|
161
|
+
displayName: 'ID',
|
|
162
|
+
description: null,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const output = (0, modelGenerator_1.generateModelFile)('TestModel', object, false);
|
|
167
|
+
expect(output).not.toContain('undefined');
|
|
168
|
+
expect(output).not.toContain('[object Object]');
|
|
169
|
+
});
|
|
170
|
+
it('should generate base models with Base prefix when useBasePrefix is true', () => {
|
|
171
|
+
const object = {
|
|
172
|
+
name: 'User',
|
|
173
|
+
table: 'users',
|
|
174
|
+
properties: {
|
|
175
|
+
id: {
|
|
176
|
+
type: 'Id',
|
|
177
|
+
objectName: 'User',
|
|
178
|
+
propertyName: 'id',
|
|
179
|
+
displayName: 'ID',
|
|
180
|
+
description: null,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
const output = (0, modelGenerator_1.generateModelFile)('User', object, true);
|
|
185
|
+
expect(output).toContain('export interface BaseUser {');
|
|
186
|
+
expect(output).not.toContain('export interface User {');
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
describe('generateAllModels', () => {
|
|
190
|
+
it('should generate all base models with Base prefix', () => {
|
|
191
|
+
const schema = {
|
|
192
|
+
User: {
|
|
193
|
+
objectName: 'User',
|
|
194
|
+
displayName: 'User',
|
|
195
|
+
properties: {
|
|
196
|
+
id: {
|
|
197
|
+
type: 'Id',
|
|
198
|
+
objectName: 'User',
|
|
199
|
+
propertyName: 'id',
|
|
200
|
+
displayName: 'ID',
|
|
201
|
+
description: null,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
Company: {
|
|
206
|
+
objectName: 'Company',
|
|
207
|
+
displayName: 'Company',
|
|
208
|
+
properties: {
|
|
209
|
+
id: {
|
|
210
|
+
type: 'Id',
|
|
211
|
+
objectName: 'Company',
|
|
212
|
+
propertyName: 'id',
|
|
213
|
+
displayName: 'ID',
|
|
214
|
+
description: null,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
const output = (0, modelGenerator_1.generateAllModels)(schema);
|
|
220
|
+
expect(output).toContain('// Auto-generated by @famgia/omnify');
|
|
221
|
+
expect(output).toContain('// These are BASE models - DO NOT EDIT');
|
|
222
|
+
expect(output).toContain('export interface BaseUser {');
|
|
223
|
+
expect(output).toContain('export interface BaseCompany {');
|
|
224
|
+
expect(output).not.toContain('export interface User {');
|
|
225
|
+
expect(output).not.toContain('export interface Company {');
|
|
226
|
+
});
|
|
227
|
+
it('should import enums module', () => {
|
|
228
|
+
const schema = {
|
|
229
|
+
User: {
|
|
230
|
+
objectName: 'User',
|
|
231
|
+
displayName: 'User',
|
|
232
|
+
properties: {},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
const output = (0, modelGenerator_1.generateAllModels)(schema);
|
|
236
|
+
expect(output).toContain("import * as Enums from './enums';");
|
|
237
|
+
});
|
|
238
|
+
it('should import and use extended models for relation types', () => {
|
|
239
|
+
const schema = {
|
|
240
|
+
User: {
|
|
241
|
+
objectName: 'User',
|
|
242
|
+
displayName: 'User',
|
|
243
|
+
properties: {
|
|
244
|
+
id: {
|
|
245
|
+
type: 'Id',
|
|
246
|
+
objectName: 'User',
|
|
247
|
+
propertyName: 'id',
|
|
248
|
+
displayName: 'ID',
|
|
249
|
+
description: null,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
Shop: {
|
|
254
|
+
objectName: 'Shop',
|
|
255
|
+
displayName: 'Shop',
|
|
256
|
+
properties: {
|
|
257
|
+
id: {
|
|
258
|
+
type: 'Id',
|
|
259
|
+
objectName: 'Shop',
|
|
260
|
+
propertyName: 'id',
|
|
261
|
+
displayName: 'ID',
|
|
262
|
+
description: null,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
Company: {
|
|
267
|
+
objectName: 'Company',
|
|
268
|
+
displayName: 'Company',
|
|
269
|
+
properties: {
|
|
270
|
+
created_by: {
|
|
271
|
+
type: 'Association',
|
|
272
|
+
relation: 'ManyToOne',
|
|
273
|
+
target: 'User',
|
|
274
|
+
objectName: 'Company',
|
|
275
|
+
propertyName: 'created_by',
|
|
276
|
+
displayName: 'Created By',
|
|
277
|
+
description: null,
|
|
278
|
+
},
|
|
279
|
+
shops: {
|
|
280
|
+
type: 'Association',
|
|
281
|
+
relation: 'OneToMany',
|
|
282
|
+
target: 'Shop',
|
|
283
|
+
objectName: 'Company',
|
|
284
|
+
propertyName: 'shops',
|
|
285
|
+
displayName: 'Shops',
|
|
286
|
+
description: null,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
const output = (0, modelGenerator_1.generateAllModels)(schema);
|
|
292
|
+
// Should import extended models
|
|
293
|
+
expect(output).toContain("import type { User, Shop, Company } from '../models';");
|
|
294
|
+
// Should use extended model types (User, Shop), not Base prefix
|
|
295
|
+
expect(output).toContain('created_by?: User | null');
|
|
296
|
+
expect(output).toContain('shops?: Shop[]');
|
|
297
|
+
// Should NOT use Base prefix
|
|
298
|
+
expect(output).not.toContain('created_by?: BaseUser | null');
|
|
299
|
+
expect(output).not.toContain('shops?: BaseShop[]');
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
describe('generateExtendedModelFile', () => {
|
|
303
|
+
it('should generate extended model file that extends base model', () => {
|
|
304
|
+
const output = (0, modelGenerator_1.generateExtendedModelFile)('User');
|
|
305
|
+
expect(output).toContain('// Extended model for User');
|
|
306
|
+
expect(output).toContain('// You can customize this file - it will not be overwritten');
|
|
307
|
+
expect(output).toContain("import { BaseUser } from '../types/models';");
|
|
308
|
+
expect(output).toContain('export interface User extends BaseUser {');
|
|
309
|
+
expect(output).toContain('// Add your custom fields here');
|
|
310
|
+
});
|
|
311
|
+
it('should include example usage comments', () => {
|
|
312
|
+
const output = (0, modelGenerator_1.generateExtendedModelFile)('Company');
|
|
313
|
+
expect(output).toContain('// Example:');
|
|
314
|
+
expect(output).toContain('// customField?: string;');
|
|
315
|
+
expect(output).toContain('// export function createCompany');
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
describe('generateModelsIndexFile', () => {
|
|
319
|
+
it('should generate index file that exports all models', () => {
|
|
320
|
+
const objectNames = ['User', 'Company', 'Shop'];
|
|
321
|
+
const output = (0, modelGenerator_1.generateModelsIndexFile)(objectNames);
|
|
322
|
+
expect(output).toContain('// Auto-generated by @famgia/omnify');
|
|
323
|
+
expect(output).toContain("export * from './User';");
|
|
324
|
+
expect(output).toContain("export * from './Company';");
|
|
325
|
+
expect(output).toContain("export * from './Shop';");
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
//# sourceMappingURL=modelGenerator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelGenerator.test.js","sourceRoot":"","sources":["../../../src/__tests__/generators/modelGenerator.test.ts"],"names":[],"mappings":";;AAAA,oEAA2I;AAG3I,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAG;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,MAAM;gBACb,UAAU,EAAE;oBACR,EAAE,EAAE;wBACA,IAAI,EAAE,IAAI;wBACV,UAAU,EAAE,MAAM;wBAClB,YAAY,EAAE,IAAI;wBAClB,WAAW,EAAE,IAAI;wBACjB,WAAW,EAAE,IAAI;wBACjB,OAAO,EAAE,IAAI;qBACJ;oBACb,IAAI,EAAE;wBACF,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,MAAM;wBAClB,YAAY,EAAE,MAAM;wBACpB,WAAW,EAAE,MAAM;wBACnB,WAAW,EAAE,I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BAA0B,CAAC,CAAC;YACrD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC1D,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAChD,MAAM,MAAM,GAAG,IAAA,wCAAuB,EAAC,WAAW,CAAC,CAAC;YAEpD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;YAChE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;YACvD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=pascalCase.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pascalCase.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/pascalCase.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Test for toPascalCase utility function
|
|
3
|
+
// We need to export it from the generators to test it
|
|
4
|
+
describe('toPascalCase utility', () => {
|
|
5
|
+
const toPascalCase = (str) => {
|
|
6
|
+
return str
|
|
7
|
+
.split('_')
|
|
8
|
+
.map(word => {
|
|
9
|
+
if (word !== word.toUpperCase() && word !== word.toLowerCase()) {
|
|
10
|
+
return word;
|
|
11
|
+
}
|
|
12
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
13
|
+
})
|
|
14
|
+
.join('');
|
|
15
|
+
};
|
|
16
|
+
describe('basic cases', () => {
|
|
17
|
+
it('should convert snake_case to PascalCase', () => {
|
|
18
|
+
expect(toPascalCase('user_status')).toBe('UserStatus');
|
|
19
|
+
expect(toPascalCase('account_type')).toBe('AccountType');
|
|
20
|
+
});
|
|
21
|
+
it('should convert single word', () => {
|
|
22
|
+
expect(toPascalCase('status')).toBe('Status');
|
|
23
|
+
expect(toPascalCase('role')).toBe('Role');
|
|
24
|
+
});
|
|
25
|
+
it('should handle UPPER_CASE', () => {
|
|
26
|
+
expect(toPascalCase('USER_STATUS')).toBe('UserStatus');
|
|
27
|
+
expect(toPascalCase('ACCOUNT_TYPE')).toBe('AccountType');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('mixed-case preservation', () => {
|
|
31
|
+
it('should preserve already mixed-case words', () => {
|
|
32
|
+
expect(toPascalCase('ApplicationForm')).toBe('ApplicationForm');
|
|
33
|
+
expect(toPascalCase('MyCustomModel')).toBe('MyCustomModel');
|
|
34
|
+
});
|
|
35
|
+
it('should preserve mixed-case in compound words', () => {
|
|
36
|
+
expect(toPascalCase('ApplicationForm_entity_type')).toBe('ApplicationFormEntityType');
|
|
37
|
+
expect(toPascalCase('MyModel_status')).toBe('MyModelStatus');
|
|
38
|
+
});
|
|
39
|
+
it('should handle combination of mixed and lowercase', () => {
|
|
40
|
+
expect(toPascalCase('ApplicationForm_company_type_position')).toBe('ApplicationFormCompanyTypePosition');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe('edge cases', () => {
|
|
44
|
+
it('should handle empty string', () => {
|
|
45
|
+
expect(toPascalCase('')).toBe('');
|
|
46
|
+
});
|
|
47
|
+
it('should handle single character', () => {
|
|
48
|
+
expect(toPascalCase('a')).toBe('A');
|
|
49
|
+
expect(toPascalCase('A')).toBe('A');
|
|
50
|
+
});
|
|
51
|
+
it('should handle multiple underscores', () => {
|
|
52
|
+
expect(toPascalCase('user__status')).toBe('UserStatus');
|
|
53
|
+
expect(toPascalCase('___test___')).toBe('Test');
|
|
54
|
+
});
|
|
55
|
+
it('should handle trailing/leading underscores', () => {
|
|
56
|
+
expect(toPascalCase('_user_status_')).toBe('UserStatus');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('real-world examples', () => {
|
|
60
|
+
it('should handle ApplicationForm fields', () => {
|
|
61
|
+
expect(toPascalCase('ApplicationForm_entity_type')).toBe('ApplicationFormEntityType');
|
|
62
|
+
expect(toPascalCase('ApplicationForm_company_type')).toBe('ApplicationFormCompanyType');
|
|
63
|
+
expect(toPascalCase('ApplicationForm_account_type')).toBe('ApplicationFormAccountType');
|
|
64
|
+
});
|
|
65
|
+
it('should handle Company fields', () => {
|
|
66
|
+
expect(toPascalCase('Company_entity_type')).toBe('CompanyEntityType');
|
|
67
|
+
expect(toPascalCase('Company_status')).toBe('CompanyStatus');
|
|
68
|
+
});
|
|
69
|
+
it('should handle User fields', () => {
|
|
70
|
+
expect(toPascalCase('User_role')).toBe('UserRole');
|
|
71
|
+
expect(toPascalCase('User_status')).toBe('UserStatus');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=pascalCase.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pascalCase.test.js","sourceRoot":"","sources":["../../../src/__tests__/utils/pascalCase.test.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,sDAAsD;AAEtD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;QACzC,OAAO,GAAG;aACL,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,IAAI,CAAC,EAAE;YACR,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBA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CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,MAAM,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACtF,MAAM,CAAC,YAAY,CAAC,8BAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YACxF,MAAM,CAAC,YAAY,CAAC,8BAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACtE,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACjC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACnD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeMapper.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/typeMapper.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typeMapper_1 = require("../../utils/typeMapper");
|
|
4
|
+
describe('typeMapper', () => {
|
|
5
|
+
describe('mapOmnifyTypeToTypeScript', () => {
|
|
6
|
+
it('should map String types correctly', () => {
|
|
7
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('String')).toBe('string');
|
|
8
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Text')).toBe('string');
|
|
9
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Email')).toBe('string');
|
|
10
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('LongText')).toBe('string');
|
|
11
|
+
});
|
|
12
|
+
it('should map numeric types correctly', () => {
|
|
13
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Int')).toBe('number');
|
|
14
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('BigInt')).toBe('number');
|
|
15
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Float')).toBe('number');
|
|
16
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Id')).toBe('number');
|
|
17
|
+
});
|
|
18
|
+
it('should map Boolean types correctly', () => {
|
|
19
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Boolean')).toBe('boolean');
|
|
20
|
+
});
|
|
21
|
+
it('should map date/time types correctly', () => {
|
|
22
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Date')).toBe('string');
|
|
23
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Timestamp')).toBe('string');
|
|
24
|
+
});
|
|
25
|
+
it('should map JSON types correctly', () => {
|
|
26
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Json')).toBe('Record<string, any>');
|
|
27
|
+
});
|
|
28
|
+
it('should map File types correctly', () => {
|
|
29
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('File')).toBe('string');
|
|
30
|
+
});
|
|
31
|
+
it('should handle nullable types', () => {
|
|
32
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('String', true)).toBe('string | null');
|
|
33
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Int', true)).toBe('number | null');
|
|
34
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('Boolean', true)).toBe('boolean | null');
|
|
35
|
+
});
|
|
36
|
+
it('should return "any" for unknown types', () => {
|
|
37
|
+
expect((0, typeMapper_1.mapOmnifyTypeToTypeScript)('UnknownType')).toBe('any');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=typeMapper.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeMapper.test.js","sourceRoot":"","sources":["../../../src/__tests__/utils/typeMapper.test.ts"],"names":[],"mappings":";;AAAA,uDAAmE;AAEnE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YACzC,MAAM,CAAC,IAAA,sCAAyB,EAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3D,MAAM,CAAC,IAAA,sCAAyB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzD,MAAM,CAAC,IAAA,sCAAyB,EAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1D,MAAM,CAAC,IAAA,sCAAyB,EAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC1C,MAAM,CAAC,IAAA,sCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CA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