@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
@@ -0,0 +1,53 @@
1
+ /**
2
+ * PostgreSQL implementation of the CodeGenConnection interface.
3
+ * Wraps pg.Pool to provide a database-agnostic connection
4
+ * for CodeGen orchestration code.
5
+ */
6
+ import pg from 'pg';
7
+ import { CodeGenConnection, CodeGenQueryResult, CodeGenTransaction } from '../../codeGenDatabaseProvider.js';
8
+ /**
9
+ * PostgreSQL implementation of CodeGenConnection.
10
+ * Wraps a pg.Pool and adapts it to the generic interface.
11
+ *
12
+ * Parameter handling:
13
+ * - SQL Server uses `@ParamName` for parameter placeholders
14
+ * - PostgreSQL uses ``, ``, etc. for positional parameters
15
+ * - This implementation translates `@ParamName` references to positional `` parameters
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import pg from 'pg';
20
+ * const pool = new pg.Pool({ connectionString: '...', });
21
+ * const conn = new PostgreSQLCodeGenConnection(pool);
22
+ *
23
+ * // Simple query
24
+ * const result = await conn.query("SELECT id, name FROM entities");
25
+ *
26
+ * // Parameterized query (uses @-prefix notation, auto-translated to $N)
27
+ * const result2 = await conn.queryWithParams(
28
+ * "SELECT id FROM entities WHERE name = @Name",
29
+ * { Name: 'Users' }
30
+ * );
31
+ * ```
32
+ */
33
+ export declare class PostgreSQLCodeGenConnection implements CodeGenConnection {
34
+ private _pool;
35
+ constructor(pool: pg.Pool);
36
+ /**
37
+ * Provides access to the underlying pg.Pool for cases where
38
+ * PostgreSQL-specific functionality is needed.
39
+ */
40
+ get Pool(): pg.Pool;
41
+ query(sql: string): Promise<CodeGenQueryResult>;
42
+ queryWithParams(sql: string, params: Record<string, unknown>): Promise<CodeGenQueryResult>;
43
+ executeStoredProcedure(name: string, params: Record<string, unknown>): Promise<CodeGenQueryResult>;
44
+ beginTransaction(): Promise<CodeGenTransaction>;
45
+ /**
46
+ * Translates @-prefixed parameter names to PostgreSQL positional $N parameters.
47
+ * @param sql SQL string with @ParamName placeholders
48
+ * @param params Named parameters
49
+ * @returns Object with translated SQL text and ordered values array
50
+ */
51
+ private translateParams;
52
+ }
53
+ //# sourceMappingURL=PostgreSQLCodeGenConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgreSQLCodeGenConnection.d.ts","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/PostgreSQLCodeGenConnection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACrB,MAAM,+BAA+B,CAAC;AA4BvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,2BAA4B,YAAW,iBAAiB;IACjE,OAAO,CAAC,KAAK,CAAU;gBAEX,IAAI,EAAE,EAAE,CAAC,IAAI;IAIzB;;;OAGG;IACH,IAAW,IAAI,IAAI,EAAE,CAAC,IAAI,CAEzB;IAEK,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAS/C,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM1F,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWlG,gBAAgB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAMrD;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CAqB1B"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * PostgreSQL transaction implementation wrapping pg.PoolClient.
3
+ */
4
+ class PostgreSQLCodeGenTransaction {
5
+ constructor(client) {
6
+ this._client = client;
7
+ }
8
+ async query(sql) {
9
+ const result = await this._client.query(sql);
10
+ return { recordset: result.rows };
11
+ }
12
+ async commit() {
13
+ await this._client.query('COMMIT');
14
+ this._client.release();
15
+ }
16
+ async rollback() {
17
+ await this._client.query('ROLLBACK');
18
+ this._client.release();
19
+ }
20
+ }
21
+ /**
22
+ * PostgreSQL implementation of CodeGenConnection.
23
+ * Wraps a pg.Pool and adapts it to the generic interface.
24
+ *
25
+ * Parameter handling:
26
+ * - SQL Server uses `@ParamName` for parameter placeholders
27
+ * - PostgreSQL uses ``, ``, etc. for positional parameters
28
+ * - This implementation translates `@ParamName` references to positional `` parameters
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * import pg from 'pg';
33
+ * const pool = new pg.Pool({ connectionString: '...', });
34
+ * const conn = new PostgreSQLCodeGenConnection(pool);
35
+ *
36
+ * // Simple query
37
+ * const result = await conn.query("SELECT id, name FROM entities");
38
+ *
39
+ * // Parameterized query (uses @-prefix notation, auto-translated to $N)
40
+ * const result2 = await conn.queryWithParams(
41
+ * "SELECT id FROM entities WHERE name = @Name",
42
+ * { Name: 'Users' }
43
+ * );
44
+ * ```
45
+ */
46
+ export class PostgreSQLCodeGenConnection {
47
+ constructor(pool) {
48
+ this._pool = pool;
49
+ }
50
+ /**
51
+ * Provides access to the underlying pg.Pool for cases where
52
+ * PostgreSQL-specific functionality is needed.
53
+ */
54
+ get Pool() {
55
+ return this._pool;
56
+ }
57
+ async query(sql) {
58
+ try {
59
+ const result = await this._pool.query(sql);
60
+ return { recordset: result.rows };
61
+ }
62
+ catch (e) {
63
+ throw e;
64
+ }
65
+ }
66
+ async queryWithParams(sql, params) {
67
+ const { text, values } = this.translateParams(sql, params);
68
+ const result = await this._pool.query(text, values);
69
+ return { recordset: result.rows };
70
+ }
71
+ async executeStoredProcedure(name, params) {
72
+ // PostgreSQL uses functions instead of stored procedures.
73
+ // Build a SELECT * FROM function_name(, , ...) call.
74
+ const keys = Object.keys(params);
75
+ const placeholders = keys.map((_, i) => `$${i + 1}`).join(', ');
76
+ const values = keys.map(k => params[k]);
77
+ const sqlText = `SELECT * FROM ${name}(${placeholders})`;
78
+ const result = await this._pool.query(sqlText, values);
79
+ return { recordset: result.rows };
80
+ }
81
+ async beginTransaction() {
82
+ const client = await this._pool.connect();
83
+ await client.query('BEGIN');
84
+ return new PostgreSQLCodeGenTransaction(client);
85
+ }
86
+ /**
87
+ * Translates @-prefixed parameter names to PostgreSQL positional $N parameters.
88
+ * @param sql SQL string with @ParamName placeholders
89
+ * @param params Named parameters
90
+ * @returns Object with translated SQL text and ordered values array
91
+ */
92
+ translateParams(sql, params) {
93
+ const keys = Object.keys(params);
94
+ const values = [];
95
+ let paramIndex = 0;
96
+ // Replace each @ParamName with $N in order of appearance
97
+ // Use word boundary to avoid replacing @ParamName inside longer identifiers
98
+ let text = sql;
99
+ for (const key of keys) {
100
+ const regex = new RegExp(`@${key}\\b`, 'g');
101
+ if (regex.test(text)) {
102
+ paramIndex++;
103
+ values.push(params[key]);
104
+ // Reset regex lastIndex since test() advances it
105
+ regex.lastIndex = 0;
106
+ text = text.replace(regex, `$${paramIndex}`);
107
+ }
108
+ }
109
+ return { text, values };
110
+ }
111
+ }
112
+ //# sourceMappingURL=PostgreSQLCodeGenConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgreSQLCodeGenConnection.js","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/PostgreSQLCodeGenConnection.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,4BAA4B;IAG9B,YAAY,MAA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4E;QAC5E,IAAI,IAAI,GAAG,GAAG,CAAC;QACf,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,UAAU,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBACzB,iDAAiD;gBACjD,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;gBACpB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC;YACjD,CAAC;QACL,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;CACJ"}
@@ -0,0 +1,344 @@
1
+ import { EntityInfo, EntityFieldInfo } from '@memberjunction/core';
2
+ import { CodeGenDatabaseProvider, CRUDType, BaseViewGenerationContext, CascadeDeleteContext, FullTextSearchResult } from '../../codeGenDatabaseProvider.js';
3
+ import { DatabasePlatform, SQLDialect } from '@memberjunction/sql-dialect';
4
+ /**
5
+ * PostgreSQL implementation of the CodeGen database provider.
6
+ * Generates PostgreSQL-native DDL for views, CRUD functions, triggers, indexes,
7
+ * full-text search, permissions, and other database objects.
8
+ */
9
+ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
10
+ /** @inheritdoc */
11
+ get Dialect(): SQLDialect;
12
+ /** @inheritdoc */
13
+ get PlatformKey(): DatabasePlatform;
14
+ /**
15
+ * Generates a PostgreSQL `DROP ... IF EXISTS ... CASCADE` statement as a guard before
16
+ * creating or replacing a database object. For triggers, PostgreSQL relies on
17
+ * `CREATE OR REPLACE` on the trigger function, so a comment is emitted instead.
18
+ */
19
+ generateDropGuard(objectType: 'VIEW' | 'PROCEDURE' | 'FUNCTION' | 'TRIGGER', schema: string, name: string): string;
20
+ /**
21
+ * Generates a PostgreSQL `CREATE OR REPLACE VIEW` statement for an entity's base view.
22
+ * Includes all base table columns, parent/related field joins, and root field lateral
23
+ * joins. Applies a soft-delete `WHERE` filter when the entity uses soft deletes.
24
+ */
25
+ generateBaseView(context: BaseViewGenerationContext): string;
26
+ /**
27
+ * Generates a PostgreSQL `CREATE OR REPLACE FUNCTION` for inserting a new record.
28
+ * The function accepts typed parameters for each writable field, performs an `INSERT`
29
+ * into the base table, and returns the newly created row from the base view via
30
+ * `RETURN QUERY SELECT`. Handles auto-increment PKs (using `RETURNING ... INTO`),
31
+ * UUID PKs (with `COALESCE` to gen_random_uuid()), and composite PKs. Also emits
32
+ * `GRANT EXECUTE` permissions for authorized roles.
33
+ */
34
+ generateCRUDCreate(entity: EntityInfo): string;
35
+ /**
36
+ * Generates a PostgreSQL `CREATE OR REPLACE FUNCTION` for updating an existing record.
37
+ * The function accepts typed parameters for all updatable fields plus primary key(s),
38
+ * performs an `UPDATE ... SET ... WHERE PK = param`, checks `ROW_COUNT` to detect
39
+ * missing rows, and returns the updated record from the base view via `RETURN QUERY
40
+ * SELECT`. Also generates the `__mj_UpdatedAt` timestamp trigger for the entity
41
+ * and emits `GRANT EXECUTE` permissions.
42
+ */
43
+ generateCRUDUpdate(entity: EntityInfo): string;
44
+ /**
45
+ * Generates a PostgreSQL `CREATE OR REPLACE FUNCTION` for deleting a record.
46
+ * Supports both hard deletes (`DELETE FROM`) and soft deletes (`UPDATE ... SET
47
+ * __mj_DeletedAt`). Prepends any cascade SQL for dependent records, uses
48
+ * `#variable_conflict use_column` to avoid PL/pgSQL naming conflicts, and returns
49
+ * the affected primary key(s) or NULLs if no row was found. Emits `GRANT EXECUTE`
50
+ * permissions for authorized roles.
51
+ */
52
+ generateCRUDDelete(entity: EntityInfo, cascadeSQL: string): string;
53
+ /**
54
+ * Generates a PL/pgSQL trigger function and a `BEFORE UPDATE` trigger that
55
+ * automatically sets the `__mj_UpdatedAt` column to the current UTC time on every
56
+ * row update. Uses `CREATE OR REPLACE FUNCTION` for the trigger function and
57
+ * `DROP TRIGGER IF EXISTS` + `CREATE TRIGGER` for idempotent trigger creation.
58
+ * Returns an empty string if the entity has no `__mj_UpdatedAt` field.
59
+ */
60
+ generateTimestampTrigger(entity: EntityInfo): string;
61
+ /**
62
+ * Generates `CREATE INDEX IF NOT EXISTS` statements for each foreign key column
63
+ * on the entity's base table. Index names follow the `idx_auto_mj_fkey_<table>_<column>`
64
+ * convention and are truncated to 63 characters (PostgreSQL's maximum identifier length).
65
+ * Skips primary key columns and virtual fields.
66
+ */
67
+ generateForeignKeyIndexes(entity: EntityInfo): string[];
68
+ /**
69
+ * Generates a complete PostgreSQL full-text search infrastructure for an entity.
70
+ * This includes:
71
+ * 1. A `tsvector` column (`__mj_fts_vector`) added via conditional `ALTER TABLE`
72
+ * 2. A PL/pgSQL trigger function that concatenates search fields into a `tsvector`
73
+ * 3. A `BEFORE INSERT OR UPDATE` trigger to keep the vector column in sync
74
+ * 4. A GIN index on the `tsvector` column for fast lookups
75
+ * 5. A SQL `STABLE` search function that joins the base view with a `plainto_tsquery` match
76
+ * 6. A backfill `UPDATE` to populate existing rows where the vector is NULL
77
+ *
78
+ * @returns A {@link FullTextSearchResult} with the generated SQL and the search function name.
79
+ */
80
+ generateFullTextSearch(entity: EntityInfo, searchFields: EntityFieldInfo[], _primaryKeyIndexName: string): FullTextSearchResult;
81
+ /**
82
+ * Generates a PostgreSQL SQL `STABLE` function that walks a self-referencing hierarchy
83
+ * (e.g., ParentCategoryID) using a recursive CTE to find the root ancestor record.
84
+ * The CTE starts from `COALESCE(p_parent_id, p_record_id)` as the anchor and follows
85
+ * the parent FK upward, capped at 100 levels to prevent infinite loops. Returns the
86
+ * root record's primary key value.
87
+ */
88
+ generateRootIDFunction(entity: EntityInfo, field: EntityFieldInfo): string;
89
+ /** @inheritdoc */
90
+ generateRootFieldSelect(_entity: EntityInfo, field: EntityFieldInfo, alias: string): string;
91
+ /**
92
+ * Generates a `LEFT JOIN LATERAL` clause that invokes the root ID function for a
93
+ * self-referencing field. PostgreSQL uses `LATERAL` joins (rather than SQL Server's
94
+ * `OUTER APPLY`) to call scalar functions inline within a view definition.
95
+ */
96
+ generateRootFieldJoin(entity: EntityInfo, field: EntityFieldInfo, alias: string): string;
97
+ /** @inheritdoc */
98
+ generateViewPermissions(entity: EntityInfo): string;
99
+ /**
100
+ * Generates `GRANT EXECUTE ON FUNCTION` statements for the given CRUD function,
101
+ * granting access to each role that has the corresponding permission (Create, Update,
102
+ * or Delete) on the entity.
103
+ */
104
+ generateCRUDPermissions(entity: EntityInfo, routineName: string, type: CRUDType): string;
105
+ /** @inheritdoc */
106
+ generateFullTextSearchPermissions(entity: EntityInfo, functionName: string): string;
107
+ /** @inheritdoc */
108
+ generateSingleCascadeOperation(context: CascadeDeleteContext): string;
109
+ /**
110
+ * Generates a PL/pgSQL `DO $$` block that conditionally adds `__mj_CreatedAt` and
111
+ * `__mj_UpdatedAt` columns to a table using `TIMESTAMPTZ` type with a UTC default.
112
+ * Uses `information_schema` checks to skip columns that already exist.
113
+ */
114
+ generateTimestampColumns(schema: string, tableName: string): string;
115
+ /**
116
+ * Builds the parameter declaration list for a PostgreSQL CRUD function signature.
117
+ * Each parameter is prefixed with `p_` and uses the PostgreSQL-mapped type. For
118
+ * CREATE functions, parameters with default values or primary keys get `DEFAULT NULL`
119
+ * to allow optional arguments, and PostgreSQL's requirement that all subsequent
120
+ * parameters also have defaults once the first default appears is respected.
121
+ */
122
+ generateCRUDParamString(entityFields: EntityFieldInfo[], isUpdate: boolean): string;
123
+ /**
124
+ * Builds either the column name list or the value expression list for an INSERT
125
+ * statement, depending on whether {@link prefix} is empty (column names) or set
126
+ * (parameter values with `p_` prefix). Handles special date fields
127
+ * (`__mj_CreatedAt`, `__mj_UpdatedAt`) by substituting `NOW() AT TIME ZONE 'UTC'`
128
+ * and applies default-value COALESCE wrappers for fields with non-null defaults.
129
+ */
130
+ generateInsertFieldString(entity: EntityInfo, entityFields: EntityFieldInfo[], prefix: string, excludePrimaryKey?: boolean): string;
131
+ /** @inheritdoc */
132
+ generateUpdateFieldString(entityFields: EntityFieldInfo[]): string;
133
+ /** @inheritdoc */
134
+ getCRUDRoutineName(entity: EntityInfo, type: CRUDType): string;
135
+ /** @inheritdoc */
136
+ generateSQLFileHeader(entity: EntityInfo, itemName: string): string;
137
+ /** @inheritdoc */
138
+ generateAllEntitiesSQLFileHeader(): string;
139
+ /**
140
+ * Maps a SQL default value expression to its PostgreSQL equivalent. Translates
141
+ * SQL Server built-in functions (e.g., `NEWID()` to `gen_random_uuid()`,
142
+ * `GETUTCDATE()` to `NOW() AT TIME ZONE 'UTC'`), strips outer parentheses and
143
+ * surrounding single quotes, and re-applies quoting based on the {@link needsQuotes}
144
+ * flag. Returns `'NULL'` for empty or whitespace-only input.
145
+ */
146
+ formatDefaultValue(defaultValue: string, needsQuotes: boolean): string;
147
+ /**
148
+ * Builds a set of PL/pgSQL components for working with an entity's primary key(s)
149
+ * in cascade operations: variable declarations, SELECT field list, FETCH INTO
150
+ * variable list, and named routine parameter assignments. Used by cascade delete
151
+ * and update-to-NULL generators to construct cursor-based loops.
152
+ */
153
+ buildPrimaryKeyComponents(entity: EntityInfo, prefix?: string): {
154
+ varDeclarations: string;
155
+ selectFields: string;
156
+ fetchInto: string;
157
+ routineParams: string;
158
+ };
159
+ /** @inheritdoc */
160
+ callRoutineSQL(schema: string, routineName: string, params: string[], _paramNames?: string[]): string;
161
+ /** @inheritdoc */
162
+ conditionalInsertSQL(checkQuery: string, insertSQL: string): string;
163
+ /** @inheritdoc */
164
+ wrapInsertWithConflictGuard(_conflictCheckSQL: string): {
165
+ prefix: string;
166
+ suffix: string;
167
+ };
168
+ /** @inheritdoc */
169
+ addColumnSQL(schema: string, tableName: string, columnName: string, dataType: string, nullable: boolean, defaultExpression?: string): string;
170
+ /** @inheritdoc */
171
+ alterColumnTypeAndNullabilitySQL(schema: string, tableName: string, columnName: string, dataType: string, nullable: boolean): string;
172
+ /** @inheritdoc */
173
+ addDefaultConstraintSQL(schema: string, tableName: string, columnName: string, defaultExpression: string): string;
174
+ /**
175
+ * Generates a PL/pgSQL `DO $$` block that drops both a named CHECK constraint (if one
176
+ * exists on the column, found via `pg_catalog.pg_constraint`) and the column's default
177
+ * value. Uses dynamic SQL (`EXECUTE format(...)`) to drop the constraint by name,
178
+ * then unconditionally runs `ALTER COLUMN ... DROP DEFAULT`.
179
+ */
180
+ dropDefaultConstraintSQL(schema: string, tableName: string, columnName: string): string;
181
+ /** @inheritdoc */
182
+ dropObjectSQL(objectType: 'VIEW' | 'PROCEDURE' | 'FUNCTION', schema: string, name: string): string;
183
+ /** @inheritdoc */
184
+ getViewExistsSQL(): string;
185
+ /** @inheritdoc */
186
+ getViewColumnsSQL(schema: string, viewName: string): string;
187
+ /** @inheritdoc */
188
+ get TimestampType(): string;
189
+ /**
190
+ * Compares two PostgreSQL data type strings for equivalence, accounting for common
191
+ * aliases. For example, `'timestamptz'` and `'timestamp with time zone'` are
192
+ * considered equal. Returns `true` if the types match directly or via alias lookup.
193
+ */
194
+ compareDataTypes(reported: string, expected: string): boolean;
195
+ /** @inheritdoc */
196
+ getSystemSchemasToExclude(): string[];
197
+ /**
198
+ * PostgreSQL does not require view refresh after creation. Unlike SQL Server's
199
+ * `sp_refreshview`, PostgreSQL views automatically reflect column changes, so
200
+ * this always returns `false`.
201
+ */
202
+ get NeedsViewRefresh(): boolean;
203
+ /** @inheritdoc */
204
+ generateViewRefreshSQL(_schema: string, _viewName: string): string;
205
+ /** @inheritdoc */
206
+ generateViewTestQuerySQL(schema: string, viewName: string): string;
207
+ /**
208
+ * PostgreSQL requires a nullability fix for virtual (computed) fields in views.
209
+ * View columns derived from expressions may report incorrect nullability in
210
+ * `information_schema.columns`, so CodeGen must correct these after view creation.
211
+ */
212
+ get NeedsVirtualFieldNullabilityFix(): boolean;
213
+ /**
214
+ * SQL keywords that should NOT be quoted even when they match PascalCase patterns.
215
+ */
216
+ private static readonly _SQL_KEYWORDS;
217
+ /**
218
+ * Quotes mixed-case identifiers in a SQL string for PostgreSQL compatibility.
219
+ * Uses a tokenizer approach to skip string literals, already-quoted identifiers,
220
+ * dollar-quoted blocks, and SQL keywords. Any remaining PascalCase word gets
221
+ * double-quoted to preserve case.
222
+ */
223
+ quoteSQLForExecution(sql: string): string;
224
+ /**
225
+ * Parses a PostgreSQL column default value by stripping PG-specific type cast syntax
226
+ * (e.g., `'2024-01-01'::timestamp` becomes `'2024-01-01'`). Returns `null` for
227
+ * auto-increment sequences (`nextval(...)`) and for null/undefined input, indicating
228
+ * no meaningful default.
229
+ */
230
+ parseColumnDefaultValue(sqlDefaultValue: string): string | null;
231
+ /** @inheritdoc */
232
+ getPendingEntityFieldsSQL(mjCoreSchema: string): string;
233
+ /** @inheritdoc */
234
+ getCheckConstraintsSchemaFilter(_excludeSchemas: string[]): string;
235
+ /** @inheritdoc */
236
+ getEntitiesWithMissingBaseTablesFilter(): string;
237
+ /** @inheritdoc */
238
+ getFixVirtualFieldNullabilitySQL(mjCoreSchema: string): string;
239
+ /**
240
+ * Executes a SQL file against the PostgreSQL database using the `psql` CLI tool.
241
+ * Reads connection parameters from environment variables (`PG_HOST`, `PG_PORT`,
242
+ * `PG_DATABASE`, `PG_USERNAME`, `PG_PASSWORD`) with fallback to `configInfo` values.
243
+ * Resolves the file path to an absolute path before passing it to psql.
244
+ */
245
+ executeSQLFileViaShell(filePath: string): Promise<boolean>;
246
+ /**
247
+ * Converts a PascalCase or camelCase string to snake_case.
248
+ * Handles consecutive uppercase letters (e.g., "ID" → "id", "HTMLParser" → "html_parser").
249
+ */
250
+ private toSnakeCase;
251
+ /**
252
+ * Maps a SQL Server type string to its PostgreSQL equivalent.
253
+ */
254
+ private mapSQLType;
255
+ /** Gets the base view name for an entity */
256
+ private getBaseViewName;
257
+ /** Builds the WHERE clause for soft-delete filtering */
258
+ private buildSoftDeleteWhereClause;
259
+ /** Assembles the SELECT parts for a base view */
260
+ private buildBaseViewSelectParts;
261
+ /** Assembles the FROM/JOIN parts for a base view */
262
+ private buildBaseViewFromParts;
263
+ /** Determines whether a field should be included in CRUD parameters */
264
+ private shouldIncludeFieldInParams;
265
+ /** Determines whether a field should be skipped for INSERT */
266
+ private shouldSkipFieldForInsert;
267
+ /** Gets the INSERT value for a special date field */
268
+ private getSpecialDateInsertValue;
269
+ /** Gets the parameter insert value, handling defaults */
270
+ private getParameterInsertValue;
271
+ /** Builds a WHERE clause using primary key fields with a parameter prefix */
272
+ private buildPrimaryKeyWhereClause;
273
+ /** Builds the INSERT strategy for CREATE function based on PK type */
274
+ private buildCreateInsertStrategy;
275
+ /** Builds the DELETE body and return type based on entity delete type */
276
+ private buildDeleteStrategy;
277
+ /** Generates cascade update-to-NULL SQL for nullable FK */
278
+ private generateCascadeUpdateToNull;
279
+ /** Generates cascade cursor-based DELETE SQL for non-nullable FK */
280
+ private generateCascadeCursorDelete;
281
+ /** Collects unique role SQL names from permissions that have a role name */
282
+ private collectPermissionRoles;
283
+ /** @inheritdoc */
284
+ getViewDefinitionSQL(schema: string, viewName: string): string;
285
+ /**
286
+ * Generates a query against `pg_index`, `pg_class`, and `pg_namespace` to retrieve
287
+ * the index name for a table's primary key constraint. Used by CodeGen to reference
288
+ * the PK index in full-text search and other operations.
289
+ */
290
+ getPrimaryKeyIndexNameSQL(schema: string, tableName: string): string;
291
+ /**
292
+ * Generates a query against `pg_index`, `pg_class`, `pg_namespace`, and `pg_attribute`
293
+ * to check whether a column participates in a multi-column unique constraint. Returns
294
+ * rows only when the unique index contains more than one column and includes the
295
+ * specified column.
296
+ */
297
+ getCompositeUniqueConstraintCheckSQL(schema: string, tableName: string, columnName: string): string;
298
+ /** @inheritdoc */
299
+ getForeignKeyIndexExistsSQL(schema: string, tableName: string, indexName: string): string;
300
+ /** Skips a single-quoted string literal, handling escaped quotes ('') */
301
+ private skipSingleQuotedString;
302
+ /** Skips a dollar-quoted block ($$ ... $$ or $tag$ ... $tag$) */
303
+ private skipDollarQuotedBlock;
304
+ /** Skips an already double-quoted identifier */
305
+ private skipDoubleQuotedIdentifier;
306
+ /** Skips a square-bracketed identifier (SQL Server style) */
307
+ private skipBracketedIdentifier;
308
+ /** Skips an @-prefixed parameter */
309
+ private skipAtParameter;
310
+ /** Processes a word token - quotes it if it's a PascalCase identifier, not a keyword */
311
+ private processWord;
312
+ /**
313
+ * Builds the full pending entity fields query for PostgreSQL.
314
+ * Uses CTEs for FK, PK, and UK caches, then joins against entity metadata
315
+ * to find fields that exist in the database but not in MJ metadata.
316
+ */
317
+ private buildPendingEntityFieldsQuery;
318
+ /**
319
+ * Builds the CASE expression for AllowUpdateAPI in the pending entity fields query.
320
+ */
321
+ private buildAllowUpdateAPICase;
322
+ /**
323
+ * Builds the UPDATE SQL to fix virtual field nullability.
324
+ * Updates AllowsNull for virtual fields based on the FK column's nullability.
325
+ */
326
+ private buildFixVirtualFieldNullabilityUpdateSQL;
327
+ /**
328
+ * Executes a SQL file using the psql CLI.
329
+ */
330
+ private executePsqlCommand;
331
+ /**
332
+ * Spawns a psql child process and returns its output.
333
+ */
334
+ private spawnPsql;
335
+ /**
336
+ * Logs psql stdout/stderr output, filtering out informational NOTICE messages.
337
+ */
338
+ private logPsqlOutput;
339
+ /**
340
+ * Logs psql execution errors with password masking.
341
+ */
342
+ private logPsqlError;
343
+ }
344
+ //# sourceMappingURL=PostgreSQLCodeGenProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgreSQLCodeGenProvider.d.ts","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/PostgreSQLCodeGenProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAwB,MAAM,sBAAsB,CAAC;AAEzF,OAAO,EACH,uBAAuB,EACvB,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAqB,gBAAgB,EAAE,UA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