@famgia/omnify-laravel 0.0.26 → 0.0.28

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/dist/index.d.cts CHANGED
@@ -234,4 +234,87 @@ declare function generateDropTableMigration(schemaName: string, options?: Migrat
234
234
  */
235
235
  declare function generateMigrationsFromChanges(changes: readonly SchemaChange[], options?: MigrationOptions): MigrationFile[];
236
236
 
237
- export { type ColumnMethod, type ColumnModifier, type ForeignKeyDefinition, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generatePrimaryKeyColumn, generateSoftDeleteColumn, generateTimestampColumns, getMigrationPath, propertyToColumnMethod, schemaToBlueprint, toColumnName, toTableName };
237
+ /**
238
+ * Laravel Model Generator
239
+ *
240
+ * Generates Eloquent model classes from Omnify schemas.
241
+ * Creates base models (auto-generated) and user models (created once).
242
+ */
243
+
244
+ /**
245
+ * Options for model generation.
246
+ */
247
+ interface ModelGeneratorOptions {
248
+ /**
249
+ * Base model namespace.
250
+ * @default 'App\\Models\\OmnifyBase'
251
+ */
252
+ baseModelNamespace?: string;
253
+ /**
254
+ * User model namespace.
255
+ * @default 'App\\Models'
256
+ */
257
+ modelNamespace?: string;
258
+ /**
259
+ * Base model class name.
260
+ * @default 'BaseModel'
261
+ */
262
+ baseModelClassName?: string;
263
+ /**
264
+ * Output path for base models.
265
+ * @default 'app/Models/OmnifyBase'
266
+ */
267
+ baseModelPath?: string;
268
+ /**
269
+ * Output path for user models.
270
+ * @default 'app/Models'
271
+ */
272
+ modelPath?: string;
273
+ }
274
+ /**
275
+ * Generated model output.
276
+ */
277
+ interface GeneratedModel {
278
+ /** File path relative to project root */
279
+ path: string;
280
+ /** PHP content */
281
+ content: string;
282
+ /** Model type */
283
+ type: 'base-model' | 'entity-base' | 'entity' | 'service-provider' | 'provider-registration' | 'trait' | 'locales';
284
+ /** Whether to overwrite existing file */
285
+ overwrite: boolean;
286
+ /** Schema name */
287
+ schemaName: string;
288
+ }
289
+ /**
290
+ * Provider registration result.
291
+ */
292
+ interface ProviderRegistrationResult {
293
+ /** Path to the provider registration file */
294
+ path: string;
295
+ /** Modified content */
296
+ content: string;
297
+ /** Laravel version type */
298
+ laravelVersion: 'laravel11+' | 'laravel10-';
299
+ /** Whether registration was already present */
300
+ alreadyRegistered: boolean;
301
+ }
302
+ /**
303
+ * Generate all models for the given schemas.
304
+ */
305
+ declare function generateModels(schemas: SchemaCollection, options?: ModelGeneratorOptions): GeneratedModel[];
306
+ /**
307
+ * Get the output path for a model.
308
+ */
309
+ declare function getModelPath(model: GeneratedModel): string;
310
+ /**
311
+ * Generate provider registration for Laravel.
312
+ * Handles both Laravel 11+ (bootstrap/providers.php) and Laravel 10- (config/app.php).
313
+ *
314
+ * @param existingContent - Existing file content (null if file doesn't exist)
315
+ * @param laravelVersion - Laravel version type
316
+ * @returns Registration result or null if already registered
317
+ */
318
+ declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-'): ProviderRegistrationResult | null;
319
+
320
+ export { type ColumnMethod, type ColumnModifier, type ForeignKeyDefinition, type GeneratedModel, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type ModelGeneratorOptions, type ProviderRegistrationResult, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generateModels, generatePrimaryKeyColumn, generateProviderRegistration, generateSoftDeleteColumn, generateTimestampColumns, getMigrationPath, getModelPath, propertyToColumnMethod, schemaToBlueprint, toColumnName, toTableName };
package/dist/index.d.ts CHANGED
@@ -234,4 +234,87 @@ declare function generateDropTableMigration(schemaName: string, options?: Migrat
234
234
  */
235
235
  declare function generateMigrationsFromChanges(changes: readonly SchemaChange[], options?: MigrationOptions): MigrationFile[];
236
236
 
237
- export { type ColumnMethod, type ColumnModifier, type ForeignKeyDefinition, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generatePrimaryKeyColumn, generateSoftDeleteColumn, generateTimestampColumns, getMigrationPath, propertyToColumnMethod, schemaToBlueprint, toColumnName, toTableName };
237
+ /**
238
+ * Laravel Model Generator
239
+ *
240
+ * Generates Eloquent model classes from Omnify schemas.
241
+ * Creates base models (auto-generated) and user models (created once).
242
+ */
243
+
244
+ /**
245
+ * Options for model generation.
246
+ */
247
+ interface ModelGeneratorOptions {
248
+ /**
249
+ * Base model namespace.
250
+ * @default 'App\\Models\\OmnifyBase'
251
+ */
252
+ baseModelNamespace?: string;
253
+ /**
254
+ * User model namespace.
255
+ * @default 'App\\Models'
256
+ */
257
+ modelNamespace?: string;
258
+ /**
259
+ * Base model class name.
260
+ * @default 'BaseModel'
261
+ */
262
+ baseModelClassName?: string;
263
+ /**
264
+ * Output path for base models.
265
+ * @default 'app/Models/OmnifyBase'
266
+ */
267
+ baseModelPath?: string;
268
+ /**
269
+ * Output path for user models.
270
+ * @default 'app/Models'
271
+ */
272
+ modelPath?: string;
273
+ }
274
+ /**
275
+ * Generated model output.
276
+ */
277
+ interface GeneratedModel {
278
+ /** File path relative to project root */
279
+ path: string;
280
+ /** PHP content */
281
+ content: string;
282
+ /** Model type */
283
+ type: 'base-model' | 'entity-base' | 'entity' | 'service-provider' | 'provider-registration' | 'trait' | 'locales';
284
+ /** Whether to overwrite existing file */
285
+ overwrite: boolean;
286
+ /** Schema name */
287
+ schemaName: string;
288
+ }
289
+ /**
290
+ * Provider registration result.
291
+ */
292
+ interface ProviderRegistrationResult {
293
+ /** Path to the provider registration file */
294
+ path: string;
295
+ /** Modified content */
296
+ content: string;
297
+ /** Laravel version type */
298
+ laravelVersion: 'laravel11+' | 'laravel10-';
299
+ /** Whether registration was already present */
300
+ alreadyRegistered: boolean;
301
+ }
302
+ /**
303
+ * Generate all models for the given schemas.
304
+ */
305
+ declare function generateModels(schemas: SchemaCollection, options?: ModelGeneratorOptions): GeneratedModel[];
306
+ /**
307
+ * Get the output path for a model.
308
+ */
309
+ declare function getModelPath(model: GeneratedModel): string;
310
+ /**
311
+ * Generate provider registration for Laravel.
312
+ * Handles both Laravel 11+ (bootstrap/providers.php) and Laravel 10- (config/app.php).
313
+ *
314
+ * @param existingContent - Existing file content (null if file doesn't exist)
315
+ * @param laravelVersion - Laravel version type
316
+ * @returns Registration result or null if already registered
317
+ */
318
+ declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-'): ProviderRegistrationResult | null;
319
+
320
+ export { type ColumnMethod, type ColumnModifier, type ForeignKeyDefinition, type GeneratedModel, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type ModelGeneratorOptions, type ProviderRegistrationResult, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generateModels, generatePrimaryKeyColumn, generateProviderRegistration, generateSoftDeleteColumn, generateTimestampColumns, getMigrationPath, getModelPath, propertyToColumnMethod, schemaToBlueprint, toColumnName, toTableName };
package/dist/index.js CHANGED
@@ -10,16 +10,19 @@ import {
10
10
  generateMigrationFromSchema,
11
11
  generateMigrations,
12
12
  generateMigrationsFromChanges,
13
+ generateModels,
13
14
  generatePrimaryKeyColumn,
15
+ generateProviderRegistration,
14
16
  generateSoftDeleteColumn,
15
17
  generateTimestampColumns,
16
18
  getMigrationPath,
19
+ getModelPath,
17
20
  laravelPlugin,
18
21
  propertyToColumnMethod,
19
22
  schemaToBlueprint,
20
23
  toColumnName,
21
24
  toTableName
22
- } from "./chunk-ILSNN7UV.js";
25
+ } from "./chunk-4LHIH7NX.js";
23
26
  export {
24
27
  formatColumnMethod,
25
28
  formatForeignKey,
@@ -32,10 +35,13 @@ export {
32
35
  generateMigrationFromSchema,
33
36
  generateMigrations,
34
37
  generateMigrationsFromChanges,
38
+ generateModels,
35
39
  generatePrimaryKeyColumn,
40
+ generateProviderRegistration,
36
41
  generateSoftDeleteColumn,
37
42
  generateTimestampColumns,
38
43
  getMigrationPath,
44
+ getModelPath,
39
45
  laravelPlugin,
40
46
  propertyToColumnMethod,
41
47
  schemaToBlueprint,
package/dist/plugin.cjs CHANGED
@@ -1192,6 +1192,7 @@ function getCastType(propDef) {
1192
1192
  return "array";
1193
1193
  case "Date":
1194
1194
  return "date";
1195
+ case "DateTime":
1195
1196
  case "Timestamp":
1196
1197
  return "datetime";
1197
1198
  case "Password":
@@ -1221,6 +1222,7 @@ function getPhpDocType(propDef, schemas) {
1221
1222
  case "Boolean":
1222
1223
  return "bool" + (nullable ? "|null" : "");
1223
1224
  case "Date":
1225
+ case "DateTime":
1224
1226
  case "Time":
1225
1227
  case "Timestamp":
1226
1228
  return "\\Carbon\\Carbon" + (nullable ? "|null" : "");