@memberjunction/codegen-lib 5.4.1 → 5.6.0

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.
Files changed (75) hide show
  1. package/README.md +65 -2
  2. package/dist/Angular/angular-codegen.d.ts.map +1 -1
  3. package/dist/Angular/angular-codegen.js +26 -12
  4. package/dist/Angular/angular-codegen.js.map +1 -1
  5. package/dist/Angular/related-entity-components.js +2 -2
  6. package/dist/Angular/related-entity-components.js.map +1 -1
  7. package/dist/Config/config.d.ts +10 -0
  8. package/dist/Config/config.d.ts.map +1 -1
  9. package/dist/Config/config.js +10 -0
  10. package/dist/Config/config.js.map +1 -1
  11. package/dist/Database/codeGenDatabaseProvider.d.ts +544 -0
  12. package/dist/Database/codeGenDatabaseProvider.d.ts.map +1 -0
  13. package/dist/Database/codeGenDatabaseProvider.js +29 -0
  14. package/dist/Database/codeGenDatabaseProvider.js.map +1 -0
  15. package/dist/Database/manage-metadata.d.ts +165 -60
  16. package/dist/Database/manage-metadata.d.ts.map +1 -1
  17. package/dist/Database/manage-metadata.js +592 -483
  18. package/dist/Database/manage-metadata.js.map +1 -1
  19. package/dist/Database/providers/postgresql/PostgreSQLCodeGenConnection.d.ts +53 -0
  20. package/dist/Database/providers/postgresql/PostgreSQLCodeGenConnection.d.ts.map +1 -0
  21. package/dist/Database/providers/postgresql/PostgreSQLCodeGenConnection.js +112 -0
  22. package/dist/Database/providers/postgresql/PostgreSQLCodeGenConnection.js.map +1 -0
  23. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts +344 -0
  24. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts.map +1 -0
  25. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js +1567 -0
  26. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js.map +1 -0
  27. package/dist/Database/providers/sqlserver/SQLServerCodeGenConnection.d.ts +42 -0
  28. package/dist/Database/providers/sqlserver/SQLServerCodeGenConnection.d.ts.map +1 -0
  29. package/dist/Database/providers/sqlserver/SQLServerCodeGenConnection.js +84 -0
  30. package/dist/Database/providers/sqlserver/SQLServerCodeGenConnection.js.map +1 -0
  31. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts +372 -0
  32. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts.map +1 -0
  33. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js +1483 -0
  34. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js.map +1 -0
  35. package/dist/Database/reorder-columns.d.ts +2 -2
  36. package/dist/Database/reorder-columns.d.ts.map +1 -1
  37. package/dist/Database/reorder-columns.js +9 -9
  38. package/dist/Database/reorder-columns.js.map +1 -1
  39. package/dist/Database/sql.d.ts +10 -5
  40. package/dist/Database/sql.d.ts.map +1 -1
  41. package/dist/Database/sql.js +44 -228
  42. package/dist/Database/sql.js.map +1 -1
  43. package/dist/Database/sql_codegen.d.ts +31 -29
  44. package/dist/Database/sql_codegen.d.ts.map +1 -1
  45. package/dist/Database/sql_codegen.js +209 -842
  46. package/dist/Database/sql_codegen.js.map +1 -1
  47. package/dist/Misc/action_subclasses_codegen.js +3 -2
  48. package/dist/Misc/action_subclasses_codegen.js.map +1 -1
  49. package/dist/Misc/entity_subclasses_codegen.d.ts +4 -4
  50. package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
  51. package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
  52. package/dist/Misc/graphql_server_codegen.d.ts +6 -1
  53. package/dist/Misc/graphql_server_codegen.d.ts.map +1 -1
  54. package/dist/Misc/graphql_server_codegen.js +33 -35
  55. package/dist/Misc/graphql_server_codegen.js.map +1 -1
  56. package/dist/Misc/sql_logging.d.ts +2 -2
  57. package/dist/Misc/sql_logging.d.ts.map +1 -1
  58. package/dist/Misc/sql_logging.js +1 -1
  59. package/dist/Misc/sql_logging.js.map +1 -1
  60. package/dist/Misc/system_integrity.d.ts +6 -6
  61. package/dist/Misc/system_integrity.d.ts.map +1 -1
  62. package/dist/Misc/system_integrity.js +33 -8
  63. package/dist/Misc/system_integrity.js.map +1 -1
  64. package/dist/Misc/temp_batch_file.d.ts.map +1 -1
  65. package/dist/Misc/temp_batch_file.js +4 -1
  66. package/dist/Misc/temp_batch_file.js.map +1 -1
  67. package/dist/index.d.ts +5 -0
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +5 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/runCodeGen.d.ts +30 -75
  72. package/dist/runCodeGen.d.ts.map +1 -1
  73. package/dist/runCodeGen.js +123 -215
  74. package/dist/runCodeGen.js.map +1 -1
  75. package/package.json +18 -15
@@ -3,96 +3,51 @@
3
3
  * Coordinates all aspects of code generation including database schema analysis,
4
4
  * metadata management, SQL generation, TypeScript entities, Angular components,
5
5
  * GraphQL resolvers, and more.
6
+ *
7
+ * Supports both SQL Server and PostgreSQL database platforms via the dbType configuration.
6
8
  */
7
- import { SQLServerDataProvider } from '@memberjunction/sqlserver-dataprovider';
9
+ import { CodeGenConnection } from './Database/codeGenDatabaseProvider.js';
10
+ import { IMetadataProvider, UserInfo } from '@memberjunction/core';
8
11
  import '@memberjunction/server-bootstrap-lite/mj-class-registrations';
12
+ /**
13
+ * Result from setupDataSource() providing both the data provider
14
+ * and a CodeGenConnection for database operations.
15
+ */
16
+ interface DataSourceResult {
17
+ /** The configured data provider (SQL Server or PostgreSQL) */
18
+ provider: IMetadataProvider;
19
+ /** Database-agnostic connection for CodeGen operations */
20
+ connection: CodeGenConnection;
21
+ /** The current user loaded from the user cache */
22
+ currentUser: UserInfo;
23
+ /** Connection info string for display */
24
+ connectionInfo: string;
25
+ }
9
26
  /**
10
27
  * Main orchestrator class for the MemberJunction code generation process.
11
- *
12
- * This class coordinates a comprehensive code generation pipeline that transforms
13
- * database schemas into a complete, type-safe, full-stack application. The process includes:
14
- *
15
- * **Pipeline Steps:**
16
- * 1. **Database Setup** - Initialize connections and metadata
17
- * 2. **Metadata Management** - Analyze schema changes and update metadata
18
- * 3. **SQL Generation** - Create views, procedures, and indexes
19
- * 4. **TypeScript Entities** - Generate entity classes with validation
20
- * 5. **Angular Components** - Create forms and UI components
21
- * 6. **GraphQL Resolvers** - Generate API endpoints
22
- * 7. **Action Classes** - Create business logic containers
23
- * 8. **Documentation** - Generate schema JSON for AI/documentation
24
- * 9. **Post-processing** - Run commands and integrity checks
25
- *
26
- * **Customization:**
27
- * You can sub-class this class and override specific methods to customize
28
- * the code generation process for your specific needs.
29
- *
30
- * @example
31
- * ```typescript
32
- * const codeGen = new RunCodeGenBase();
33
- * await codeGen.Run(); // Full generation
34
- * await codeGen.Run(true); // Skip database operations
35
- * ```
36
28
  */
37
29
  export declare class RunCodeGenBase {
38
30
  /**
39
- * Sets up the SQL Server data source and initializes the MemberJunction core metadata.
40
- * This method establishes the database connection pool and configures the data provider
41
- * that will be used throughout the code generation process.
42
- *
43
- * Override this method to customize the data source setup process for different
44
- * database providers or connection configurations.
45
- *
46
- * @returns Promise resolving to the configured SQLServerDataProvider instance
47
- * @throws Error if connection setup fails
31
+ * Sets up the data source based on the configured database type (SQL Server or PostgreSQL).
32
+ * Initializes the appropriate data provider, connection, and user cache.
48
33
  */
49
- setupDataSource(): Promise<SQLServerDataProvider>;
34
+ setupDataSource(): Promise<DataSourceResult>;
35
+ /**
36
+ * Sets up SQL Server data source (original behavior).
37
+ */
38
+ protected setupSQLServerDataSource(): Promise<DataSourceResult>;
39
+ /**
40
+ * Sets up PostgreSQL data source.
41
+ */
42
+ protected setupPostgreSQLDataSource(): Promise<DataSourceResult>;
50
43
  /**
51
44
  * Main entry point for the complete code generation process.
52
- *
53
- * Orchestrates the entire pipeline from database schema analysis to final code output.
54
- * The process is highly configurable through the configuration file and can be
55
- * partially skipped for faster iteration during development.
56
- *
57
- * **Process Flow:**
58
- * 1. Initialize data sources and user context
59
- * 2. Execute pre-generation commands and scripts
60
- * 3. Manage metadata and schema changes
61
- * 4. Generate SQL objects (views, procedures, indexes)
62
- * 5. Generate TypeScript entity classes
63
- * 6. Generate Angular UI components
64
- * 7. Generate GraphQL API resolvers
65
- * 8. Generate Action business logic classes
66
- * 9. Create documentation JSON
67
- * 10. Run integrity checks
68
- * 11. Execute post-generation commands
69
- *
70
- * @param skipDatabaseGeneration If true, skips all database-related operations
71
- * (metadata management, SQL generation). Useful for faster UI-only regeneration.
72
- * @throws Error if any critical step fails
73
- * @returns Promise that resolves when generation is complete
74
45
  */
75
46
  Run(skipDatabaseGeneration?: boolean): Promise<void>;
76
47
  }
77
48
  /**
78
49
  * Convenience function to run the MemberJunction code generation process.
79
- * Creates a new instance of RunCodeGenBase and executes the full generation pipeline.
80
- *
81
- * This is the recommended way to trigger code generation from external scripts
82
- * or applications.
83
- *
84
- * @param skipDatabaseGeneration Whether to skip database-related operations
85
- * @returns Promise that resolves when generation is complete
86
- * @throws Error if generation fails
87
- *
88
- * @example
89
- * ```typescript
90
- * // Full generation
91
- * await runMemberJunctionCodeGeneration();
92
- *
93
- * // Skip database operations for faster UI generation
94
- * await runMemberJunctionCodeGeneration(true);
95
- * ```
96
50
  */
97
51
  export declare function runMemberJunctionCodeGeneration(skipDatabaseGeneration?: boolean): Promise<void>;
52
+ export {};
98
53
  //# sourceMappingURL=runCodeGen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runCodeGen.d.ts","sourceRoot":"","sources":["../src/runCodeGen.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,qBAAqB,EAAmC,MAAM,wCAAwC,CAAC;AAmBhH,OAAO,8DAA8D,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,cAAc;IACzB;;;;;;;;;;OAUG;IACU,eAAe,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAsB9D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,GAAG,CAAC,sBAAsB,GAAE,OAAe;CAoWzD;AAED;;;;;;;;;;;;;;;;;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