@memberjunction/codegen-lib 6.2.0-edge.4 → 6.2.0-edge.5

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 (54) hide show
  1. package/README.md +7 -0
  2. package/dist/Angular/angular-codegen.d.ts.map +1 -1
  3. package/dist/Angular/angular-codegen.js +2 -0
  4. package/dist/Angular/angular-codegen.js.map +1 -1
  5. package/dist/Config/config.d.ts +36 -0
  6. package/dist/Config/config.d.ts.map +1 -1
  7. package/dist/Config/config.js +33 -0
  8. package/dist/Config/config.js.map +1 -1
  9. package/dist/Database/codeGenDatabaseProvider.d.ts +118 -2
  10. package/dist/Database/codeGenDatabaseProvider.d.ts.map +1 -1
  11. package/dist/Database/codeGenDatabaseProvider.js +234 -4
  12. package/dist/Database/codeGenDatabaseProvider.js.map +1 -1
  13. package/dist/Database/heal-schema-params.d.ts +7 -0
  14. package/dist/Database/heal-schema-params.d.ts.map +1 -1
  15. package/dist/Database/heal-schema-params.js +5 -0
  16. package/dist/Database/heal-schema-params.js.map +1 -1
  17. package/dist/Database/manage-metadata.d.ts +169 -1
  18. package/dist/Database/manage-metadata.d.ts.map +1 -1
  19. package/dist/Database/manage-metadata.js +399 -9
  20. package/dist/Database/manage-metadata.js.map +1 -1
  21. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts +36 -3
  22. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts.map +1 -1
  23. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js +104 -23
  24. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js.map +1 -1
  25. package/dist/Database/providers/postgresql/__tests__/MetadataSupportObjectsDDL.test.d.ts +2 -0
  26. package/dist/Database/providers/postgresql/__tests__/MetadataSupportObjectsDDL.test.d.ts.map +1 -0
  27. package/dist/Database/providers/postgresql/__tests__/MetadataSupportObjectsDDL.test.js +127 -0
  28. package/dist/Database/providers/postgresql/__tests__/MetadataSupportObjectsDDL.test.js.map +1 -0
  29. package/dist/Database/providers/postgresql/metadataSupportObjects.js +155 -2
  30. package/dist/Database/providers/postgresql/metadataSupportObjects.js.map +1 -1
  31. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts +23 -1
  32. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts.map +1 -1
  33. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js +77 -19
  34. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js.map +1 -1
  35. package/dist/Database/providers/sqlserver/__tests__/VerifiedJoinIndexes.test.d.ts +2 -0
  36. package/dist/Database/providers/sqlserver/__tests__/VerifiedJoinIndexes.test.d.ts.map +1 -0
  37. package/dist/Database/providers/sqlserver/__tests__/VerifiedJoinIndexes.test.js +141 -0
  38. package/dist/Database/providers/sqlserver/__tests__/VerifiedJoinIndexes.test.js.map +1 -0
  39. package/dist/Database/sql_codegen.d.ts +39 -1
  40. package/dist/Database/sql_codegen.d.ts.map +1 -1
  41. package/dist/Database/sql_codegen.js +100 -2
  42. package/dist/Database/sql_codegen.js.map +1 -1
  43. package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts +9 -0
  44. package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts.map +1 -1
  45. package/dist/Manifest/GenerateClassRegistrationsManifest.js +28 -7
  46. package/dist/Manifest/GenerateClassRegistrationsManifest.js.map +1 -1
  47. package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
  48. package/dist/Misc/entity_subclasses_codegen.js +18 -2
  49. package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
  50. package/dist/runCodeGen.d.ts +14 -0
  51. package/dist/runCodeGen.d.ts.map +1 -1
  52. package/dist/runCodeGen.js +21 -1
  53. package/dist/runCodeGen.js.map +1 -1
  54. package/package.json +29 -29
@@ -485,6 +485,17 @@ BEGIN
485
485
  WHERE TRIM(s) <> '';
486
486
  v_has_include := EXISTS (SELECT 1 FROM _ues_included);
487
487
 
488
+ -- [Large Schema Series] vwSQLTablesAndEntities is a function-based scan over pg_catalog
489
+ -- (obj_description/pg_class/pg_namespace per table), so the planner has NO row statistics
490
+ -- for it and estimates every join against it at rows=1 -> a nested loop that re-scans the
491
+ -- catalog per Entity row. This is the same defect that was fixed in
492
+ -- spUpdateExistingEntityFieldsFromSchema and spDeleteUnneededEntityFields (materialise the
493
+ -- introspection view exactly once, then ANALYZE so the reconciliation join hash-joins);
494
+ -- this proc was the one that kept joining the view directly.
495
+ DROP TABLE IF EXISTS _ues_tables;
496
+ CREATE TEMP TABLE _ues_tables AS SELECT * FROM __mj."vwSQLTablesAndEntities";
497
+ ANALYZE _ues_tables;
498
+
488
499
  DROP TABLE IF EXISTS _ues_filtered;
489
500
  CREATE TEMP TABLE _ues_filtered AS
490
501
  SELECT
@@ -495,7 +506,7 @@ BEGIN
495
506
  sq."EntityDescription" AS entity_description,
496
507
  sq."SchemaName"::text AS schema_name
497
508
  FROM __mj."Entity" e
498
- INNER JOIN __mj."vwSQLTablesAndEntities" sq ON e."ID" = sq."EntityID"
509
+ INNER JOIN _ues_tables sq ON e."ID" = sq."EntityID"
499
510
  LEFT JOIN unnest(string_to_array(COALESCE(p_ExcludedSchemaNames, ''), ',')) AS ex(v)
500
511
  ON sq."SchemaName"::text = TRIM(ex.v)
501
512
  WHERE e."VirtualEntity" = FALSE
@@ -503,6 +514,10 @@ BEGIN
503
514
  AND (NOT v_has_include OR sq."SchemaName"::text IN (SELECT i.schema_name FROM _ues_included i))
504
515
  AND COALESCE(CASE WHEN e."AutoUpdateDescription" THEN sq."EntityDescription" ELSE e."Description" END, '')
505
516
  <> COALESCE(e."Description", '');
517
+ -- [Large Schema Series] ANALYZE before the UPDATE ... FROM below, for the same reason:
518
+ -- without stats the planner estimates this temp table at rows=1 and nested-loops the
519
+ -- update against __mj."Entity".
520
+ ANALYZE _ues_filtered;
506
521
 
507
522
  UPDATE __mj."Entity" tgt SET
508
523
  "Description" = fr.new_description,
@@ -516,6 +531,7 @@ BEGIN
516
531
  FROM _ues_filtered fr;
517
532
 
518
533
  DROP TABLE IF EXISTS _ues_filtered;
534
+ DROP TABLE IF EXISTS _ues_tables;
519
535
  DROP TABLE IF EXISTS _ues_included;
520
536
  END;
521
537
  $func$;
@@ -529,10 +545,14 @@ $func$;
529
545
  DROP FUNCTION IF EXISTS __mj."spDeleteUnneededEntityFields"(TEXT);
530
546
  DROP FUNCTION IF EXISTS __mj."spDeleteUnneededEntityFields"(TEXT, TEXT);
531
547
  DROP FUNCTION IF EXISTS __mj."spDeleteUnneededEntityFields"(TEXT, TEXT, TEXT);
548
+ DROP FUNCTION IF EXISTS __mj."spDeleteUnneededEntityFields"(TEXT, TEXT, TEXT, TEXT);
532
549
  CREATE OR REPLACE FUNCTION __mj."spDeleteUnneededEntityFields"(
533
550
  p_ExcludedSchemaNames TEXT,
534
551
  p_EntityIDs TEXT DEFAULT NULL,
535
- p_IncludedSchemaNames TEXT DEFAULT NULL
552
+ p_IncludedSchemaNames TEXT DEFAULT NULL,
553
+ -- Comma-delimited field names that must NEVER be pruned, whatever the catalog says.
554
+ -- See the _del_protected note below for why this parameter has to exist.
555
+ p_ProtectedFieldNames TEXT DEFAULT NULL
536
556
  )
537
557
  RETURNS TABLE(
538
558
  "ID" UUID,
@@ -584,6 +604,23 @@ BEGIN
584
604
  -- NOTE (parity): the ENTITY-level prune (vwEntitiesWithMissingBaseTables + the ExternalDataSourceID
585
605
  -- guard in manage-metadata) is likewise inert on PG until that same migration also recreates
586
606
  -- vwEntitiesWithMissingBaseTables as SELECT e.* (mirroring SQL Server migration V202607031201).
607
+ -- PROTECTED FIELD NAMES. The orphan join below is "an EntityField with no column in
608
+ -- vwSQLColumnsAndEntityFields", and that view resolves columns VIEW-FIRST
609
+ -- (COALESCE(e.view_object_id, e.object_id)). So for any entity that has a base view, the
610
+ -- prune's real question is "is this column in the BASE VIEW?" — not "is it in the base table?".
611
+ -- That makes the prune and a deliberate base-view column exclusion directly incompatible:
612
+ -- exclude a physical column from the view and the very next CodeGen run deletes its EntityField
613
+ -- row, taking the sync writes that go through it with it, silently. A field named here is held
614
+ -- back from the prune so an exclusion cannot destroy metadata.
615
+ --
616
+ -- It is a NAME list, not an id list, because the caller's exclusions are declared by name and
617
+ -- apply across entities. Matched case-insensitively for the same reason.
618
+ DROP TABLE IF EXISTS _del_protected;
619
+ CREATE TEMP TABLE _del_protected AS
620
+ SELECT LOWER(TRIM(s)) AS field_name
621
+ FROM unnest(string_to_array(COALESCE(p_ProtectedFieldNames, ''), ',')) AS s
622
+ WHERE TRIM(s) <> '';
623
+
587
624
  DROP TABLE IF EXISTS _del_ext_entities;
588
625
  CREATE TEMP TABLE _del_ext_entities (entity_id UUID);
589
626
  IF EXISTS (
@@ -605,6 +642,7 @@ BEGIN
605
642
  WHERE e."VirtualEntity" = FALSE
606
643
  AND ef."EntityID" NOT IN (SELECT entity_id FROM _del_ext_entities) -- exclude external-data-source entities (see note above)
607
644
  AND ex.v IS NULL
645
+ AND LOWER(TRIM(ef."Name"::text)) NOT IN (SELECT pr.field_name FROM _del_protected pr) -- see _del_protected
608
646
  AND (NOT v_has_include OR e."SchemaName"::text IN (SELECT i.schema_name FROM _del_included i))
609
647
  AND (NOT v_is_scoped OR ef."EntityID" IN (SELECT s.entity_id FROM _del_scope s));
610
648
  -- [Large Schema Series] ANALYZE so the planner has real cardinalities for the
@@ -640,6 +678,8 @@ BEGIN
640
678
  DELETE FROM __mj."EntityField" delf
641
679
  WHERE delf."ID" IN (SELECT d.field_id FROM _del_deleted d);
642
680
 
681
+ DROP TABLE IF EXISTS _del_protected;
682
+
643
683
  RETURN QUERY
644
684
  SELECT d.field_id, d.entity_id, d.entity_name, d.field_name FROM _del_deleted d;
645
685
 
@@ -852,5 +892,118 @@ BEGIN
852
892
  AND NOT a.attisdropped;
853
893
  END;
854
894
  $spgetpk$ LANGUAGE plpgsql;
895
+
896
+ -- ----------------------------------------------------------------------------
897
+ -- 9. spRecompileAllViews — the PostgreSQL counterpart of the SQL Server proc
898
+ -- R__RefreshMetadata calls first.
899
+ --
900
+ -- WHAT SQL SERVER DOES AND WHY PG CANNOT. SQL Server caches a view's column
901
+ -- list at create time and sp_refreshview re-resolves it in place, so
902
+ -- spRecompileAllViews can walk the catalog in dependency order and heal
903
+ -- every stale SELECT * view without knowing any view's source. PostgreSQL
904
+ -- freezes a view's targetlist at creation too, but has NO in-place refresh:
905
+ -- CREATE OR REPLACE VIEW may only APPEND columns and must keep the existing
906
+ -- ones identical, and pg_get_viewdef returns the already-expanded
907
+ -- definition — so replaying it re-freezes exactly the same stale list. The
908
+ -- only repair is DROP + CREATE from the ORIGINAL source, which lives in
909
+ -- CodeGen, not in the database.
910
+ --
911
+ -- SO THIS FUNCTION DETECTS, AND SAYS SO. The harm CodeGen's SQL Server side
912
+ -- prevents is not "a view is stale" — it is that a stale view is SILENT until
913
+ -- something reads it and fails with column "X" does not exist, taking
914
+ -- BaseEngine loads and mj sync push down with it. On the migrate-only
915
+ -- deploy path (mj migrate with no mj codegen) nothing on PostgreSQL said
916
+ -- anything at all. This reports every base view whose column list has drifted
917
+ -- from its base table, RAISEs a WARNING per view so a migrate log carries it,
918
+ -- and returns the rows so a caller can act.
919
+ --
920
+ -- THE REPAIR IS mj codegen (or mj codegen with forceRegeneration for a
921
+ -- broad drift): CodeGen holds each view's source and regenerates it.
922
+ --
923
+ -- Scope/parameters mirror the other R__RefreshMetadata routines: exclude
924
+ -- always wins, a NULL/empty include list means every remaining schema.
925
+ -- Virtual entities are skipped (no physical base table to compare against).
926
+ -- ----------------------------------------------------------------------------
927
+ DROP FUNCTION IF EXISTS __mj."spRecompileAllViews"();
928
+ DROP FUNCTION IF EXISTS __mj."spRecompileAllViews"(TEXT);
929
+ DROP FUNCTION IF EXISTS __mj."spRecompileAllViews"(TEXT, TEXT);
930
+ CREATE OR REPLACE FUNCTION __mj."spRecompileAllViews"(
931
+ p_ExcludedSchemaNames TEXT DEFAULT 'sys,information_schema',
932
+ p_IncludedSchemaNames TEXT DEFAULT NULL
933
+ )
934
+ RETURNS TABLE(
935
+ "SchemaName" TEXT,
936
+ "ViewName" TEXT,
937
+ "EntityName" TEXT,
938
+ "MissingColumns" TEXT
939
+ )
940
+ LANGUAGE plpgsql AS $rav$
941
+ DECLARE
942
+ v_has_include BOOLEAN := FALSE;
943
+ v_row RECORD;
944
+ BEGIN
945
+ DROP TABLE IF EXISTS _rav_included;
946
+ CREATE TEMP TABLE _rav_included AS
947
+ SELECT TRIM(s) AS schema_name
948
+ FROM unnest(string_to_array(COALESCE(p_IncludedSchemaNames, ''), ',')) AS s
949
+ WHERE TRIM(s) <> '';
950
+ v_has_include := EXISTS (SELECT 1 FROM _rav_included);
951
+
952
+ DROP TABLE IF EXISTS _rav_drift;
953
+ CREATE TEMP TABLE _rav_drift AS
954
+ WITH scoped AS (
955
+ SELECT
956
+ e."ID" AS entity_id,
957
+ e."Name"::text AS entity_name,
958
+ e."SchemaName"::text AS schema_name,
959
+ e."BaseTable"::text AS base_table,
960
+ e."BaseView"::text AS base_view
961
+ FROM __mj."vwEntities" e
962
+ LEFT JOIN unnest(string_to_array(COALESCE(p_ExcludedSchemaNames, ''), ',')) AS ex(v)
963
+ ON e."SchemaName"::text = TRIM(ex.v)
964
+ WHERE e."VirtualEntity" = FALSE
965
+ AND ex.v IS NULL
966
+ AND COALESCE(e."BaseView", '') <> ''
967
+ AND (NOT v_has_include OR e."SchemaName"::text IN (SELECT i.schema_name FROM _rav_included i))
968
+ ),
969
+ resolved AS (
970
+ SELECT
971
+ sc.*,
972
+ bt.oid AS base_table_oid,
973
+ vw.oid AS view_oid
974
+ FROM scoped sc
975
+ JOIN pg_catalog.pg_namespace ns ON ns.nspname = sc.schema_name
976
+ JOIN pg_catalog.pg_class bt ON bt.relnamespace = ns.oid AND bt.relname = sc.base_table AND bt.relkind IN ('r', 'p', 'f')
977
+ JOIN pg_catalog.pg_class vw ON vw.relnamespace = ns.oid AND vw.relname = sc.base_view AND vw.relkind IN ('v', 'm')
978
+ )
979
+ SELECT
980
+ r.schema_name,
981
+ r.base_view AS view_name,
982
+ r.entity_name,
983
+ string_agg(bt_a.attname::text, ', ' ORDER BY bt_a.attnum) AS missing_columns
984
+ FROM resolved r
985
+ JOIN pg_catalog.pg_attribute bt_a
986
+ ON bt_a.attrelid = r.base_table_oid AND bt_a.attnum > 0 AND NOT bt_a.attisdropped
987
+ WHERE NOT EXISTS (
988
+ SELECT 1 FROM pg_catalog.pg_attribute v_a
989
+ WHERE v_a.attrelid = r.view_oid AND v_a.attnum > 0 AND NOT v_a.attisdropped
990
+ AND v_a.attname = bt_a.attname
991
+ )
992
+ GROUP BY r.schema_name, r.base_view, r.entity_name;
993
+
994
+ FOR v_row IN SELECT * FROM _rav_drift ORDER BY schema_name, view_name LOOP
995
+ RAISE WARNING 'spRecompileAllViews: base view %.% (entity %) is missing base-table column(s): %. PostgreSQL cannot refresh a view in place, so run mj codegen to regenerate it from source.',
996
+ v_row.schema_name, v_row.view_name, v_row.entity_name, v_row.missing_columns;
997
+ END LOOP;
998
+
999
+ RETURN QUERY
1000
+ SELECT d.schema_name, d.view_name, d.entity_name, d.missing_columns
1001
+ FROM _rav_drift d
1002
+ ORDER BY d.schema_name, d.view_name;
1003
+
1004
+ DROP TABLE IF EXISTS _rav_drift;
1005
+ DROP TABLE IF EXISTS _rav_included;
1006
+ END;
1007
+ $rav$;
855
1008
  `;
856
1009
  //# sourceMappingURL=metadataSupportObjects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadataSupportObjects.js","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/metadataSupportObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,8BAA8B,CAAC,YAAoB;IAC/D,OAAO,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACzE,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,8BAA8B,CAAC,Y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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAk9BtD,CAAC"}
@@ -97,12 +97,24 @@ export declare class SQLServerCodeGenProvider extends CodeGenDatabaseProvider {
97
97
  * Includes GRANT EXECUTE permissions for authorized roles.
98
98
  */
99
99
  generateCRUDCreate(entity: EntityInfo): string;
100
+ /**
101
+ * Builds the post-insert / post-update `SELECT` statement returned by a CRUD stored procedure.
102
+ *
103
+ * - When `entity.SaveReturnMode` is `'full'` (default), queries `SELECT *` (or `SELECT TOP 0 *`)
104
+ * from `[schema].[BaseView]` so calculated and joined columns are returned.
105
+ * - When `entity.SaveReturnMode` is `'datestamps_only'`, queries only the primary key column(s)
106
+ * plus `__mj_CreatedAt` and `__mj_UpdatedAt` (via {@link EntityInfo.DatestampReturnFields})
107
+ * directly from `[schema].[BaseTable]`, avoiding the post-write `BaseView` joins and large
108
+ * payload columns while still returning DB-generated key and timestamp values.
109
+ */
110
+ protected buildCRUDReturnSelect(entity: EntityInfo, whereClause: string, topZero?: boolean): string;
100
111
  /**
101
112
  * Generates the `spUpdate` stored procedure for a SQL Server entity. Performs a standard
102
113
  * `UPDATE ... SET ... WHERE PK = @PK` and uses `@@ROWCOUNT` to detect whether the row
103
114
  * was found: if no rows were updated (e.g., stale PK or concurrent delete), returns an
104
115
  * empty result set with the base view's column structure (`SELECT TOP 0 ... WHERE 1=0`);
105
- * otherwise returns the updated record from the base view. Also generates the
116
+ * otherwise returns the updated record from the base view (or PK + datestamp columns from
117
+ * the base table when `entity.SaveReturnMode === 'datestamps_only'`). Also generates the
106
118
  * `__mj_UpdatedAt` timestamp trigger if the entity has that column.
107
119
  */
108
120
  generateCRUDUpdate(entity: EntityInfo): string;
@@ -156,6 +168,14 @@ export declare class SQLServerCodeGenProvider extends CodeGenDatabaseProvider {
156
168
  *
157
169
  * @returns The generated SQL and the resolved function name for permission grants.
158
170
  */
171
+ /**
172
+ * SQL Server charges full-text search through the fulltext population service rather than a
173
+ * trigger: `CREATE FULLTEXT INDEX` puts the table under continuous change tracking, so every
174
+ * INSERT/UPDATE/DELETE that touches an indexed column queues crawl work, and the index itself
175
+ * occupies catalog storage. The generated script also DROPs and RECREATEs the index, which means
176
+ * a full re-crawl of the table each time this entity's SQL is applied.
177
+ */
178
+ FullTextSearchCostDisclosure(entity: EntityInfo, searchFields: EntityFieldInfo[]): string | null;
159
179
  generateFullTextSearch(entity: EntityInfo, searchFields: EntityFieldInfo[], primaryKeyIndexName: string): FullTextSearchResult;
160
180
  /**
161
181
  * Generates a SQL Server inline table-valued function that resolves the root ancestor ID
@@ -339,6 +359,8 @@ export declare class SQLServerCodeGenProvider extends CodeGenDatabaseProvider {
339
359
  */
340
360
  getCompositeUniqueConstraintCheckSQL(schema: string, tableName: string, columnName: string): string;
341
361
  /** @inheritdoc */
362
+ GetUniqueIndexMembershipSQL(schema: string, tableName: string, columnName: string): string | null;
363
+ /** @inheritdoc */
342
364
  getForeignKeyIndexExistsSQL(schema: string, tableName: string, indexName: string): string;
343
365
  /**
344
366
  * Builds a SQL Server `EXEC` statement for invoking a stored procedure. When `paramNames`
@@ -1 +1 @@
1
- {"version":3,"file":"SQLServerCodeGenProvider.d.ts","sourceRoot":"","sources":["../../../../src/Database/providers/sqlserver/SQLServerCodeGenProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAA0C,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EACH,uBAAuB,EACvB,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAA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AY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM;IAMxG;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAuBpC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAsFnC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAQjC,kBAAkB;IAClB,+BAA+B,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM;IAQjE,kBAAkB;IAClB,sCAAsC,IAAI,MAAM;IAIhD,kBAAkB;IAClB,gCAAgC,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAM/D;;;;;;;OAOG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA4BnE"}
@@ -5,9 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { EntityInfo, CodeNameFromString, ResolveStartupMode } from '@memberjunction/core';
8
- import { CodeGenDatabaseProvider, } from '../../codeGenDatabaseProvider.js';
8
+ import { CodeGenDatabaseProvider, ExcludedBaseViewFieldNames, } from '../../codeGenDatabaseProvider.js';
9
9
  import { SQLServerDialect } from '@memberjunction/sql-dialect';
10
- import { ordinalCompare, RegisterClass } from '@memberjunction/global';
10
+ import { EscapeSQLString, ordinalCompare, RegisterClass } from '@memberjunction/global';
11
11
  import { SortBySequenceAndCreatedAt } from '../../../Misc/util.js';
12
12
  import { configInfo, dbDatabase, MjCoreSchema } from '../../../Config/config.js';
13
13
  import { MSSQLConnection, GetSqlConfig } from '../../../Config/db-connection.js';
@@ -123,6 +123,9 @@ let SQLServerCodeGenProvider = class SQLServerCodeGenProvider extends CodeGenDat
123
123
  const whereClause = entity.DeleteType === 'Soft'
124
124
  ? `WHERE\n ${alias}.[${EntityInfo.DeletedAtFieldName}] IS NULL\n`
125
125
  : '';
126
+ // `alias.*` unless this entity has a configured base-view column exclusion, in which case the
127
+ // base-table columns are enumerated instead. See baseTableSelectList / ExcludedBaseViewFieldNames.
128
+ const baseTableSelect = this.baseTableSelectList(entity, alias, ExcludedBaseViewFieldNames(entity.Name, configInfo?.baseViewExcludedFields ?? []));
126
129
  return `
127
130
  ------------------------------------------------------------
128
131
  ----- BASE VIEW FOR ENTITY: ${entity.Name}
@@ -137,7 +140,7 @@ GO
137
140
  CREATE VIEW [${entity.SchemaName}].[${viewName}]
138
141
  AS
139
142
  SELECT
140
- ${alias}.*${context.parentFieldsSelect}${context.relatedFieldsSelect.length > 0 ? ',' : ''}${context.relatedFieldsSelect}${context.rootFieldsSelect}
143
+ ${baseTableSelect}${context.parentFieldsSelect}${context.relatedFieldsSelect.length > 0 ? ',' : ''}${context.relatedFieldsSelect}${context.rootFieldsSelect}
141
144
  FROM
142
145
  [${entity.SchemaName}].[${entity.BaseTable}] AS ${alias}${context.parentJoins ? '\n' + context.parentJoins : ''}${context.relatedFieldsJoins ? '\n' + context.relatedFieldsJoins : ''}${context.rootJoins}
143
146
  ${whereClause}GO`;
@@ -245,7 +248,7 @@ ${this.trimStatementTerminator(selectSQL)}`;
245
248
  additionalFieldList = callerSuppliedKeys.map(k => `[${k.Name}]`).join(',\n ');
246
249
  additionalValueList = callerSuppliedKeys.map(k => `@${k.CodeName}`).join(',\n ');
247
250
  const callerSuppliedKeyPredicates = callerSuppliedKeys.map(k => ` AND [${k.Name}] = @${k.CodeName}`).join('');
248
- selectInsertedRecord = `SELECT * FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE [${identityKey.Name}] = SCOPE_IDENTITY()${callerSuppliedKeyPredicates}`;
251
+ selectInsertedRecord = this.buildCRUDReturnSelect(entity, `[${identityKey.Name}] = SCOPE_IDENTITY()${callerSuppliedKeyPredicates}`);
249
252
  }
250
253
  else if (firstKey.Type.toLowerCase().trim() === 'uniqueidentifier' && entity.PrimaryKeys.length === 1) {
251
254
  const hasDefaultValue = firstKey.DefaultValue && firstKey.DefaultValue.trim().length > 0;
@@ -289,7 +292,7 @@ ${this.trimStatementTerminator(selectSQL)}`;
289
292
  additionalFieldList = '';
290
293
  additionalValueList = '';
291
294
  outputCode = '';
292
- selectInsertedRecord = `SELECT * FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE [${firstKey.Name}] = (SELECT [${firstKey.Name}] FROM @InsertedRow)`;
295
+ selectInsertedRecord = this.buildCRUDReturnSelect(entity, `[${firstKey.Name}] = (SELECT [${firstKey.Name}] FROM @InsertedRow)`);
293
296
  }
294
297
  else {
295
298
  // UUID without DB default: generate via ISNULL(@PK, NEWID()).
@@ -299,7 +302,7 @@ ${this.trimStatementTerminator(selectSQL)}`;
299
302
  additionalFieldList = '[' + firstKey.Name + ']';
300
303
  additionalValueList = '@ActualID';
301
304
  outputCode = '';
302
- selectInsertedRecord = `SELECT * FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE [${firstKey.Name}] = @ActualID`;
305
+ selectInsertedRecord = this.buildCRUDReturnSelect(entity, `[${firstKey.Name}] = @ActualID`);
303
306
  }
304
307
  }
305
308
  else {
@@ -318,14 +321,8 @@ ${this.trimStatementTerminator(selectSQL)}`;
318
321
  }
319
322
  additionalFieldList = pkColumns.join(',\n ');
320
323
  additionalValueList = pkValues.join(',\n ');
321
- selectInsertedRecord = `SELECT * FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE `;
322
- let isFirst = true;
323
- for (const k of entity.PrimaryKeys) {
324
- if (!isFirst)
325
- selectInsertedRecord += ' AND ';
326
- selectInsertedRecord += `[${k.Name}] = @${k.CodeName}`;
327
- isFirst = false;
328
- }
324
+ const pkWhereClause = entity.PrimaryKeys.map(k => `[${k.Name}] = @${k.CodeName}`).join(' AND ');
325
+ selectInsertedRecord = this.buildCRUDReturnSelect(entity, pkWhereClause);
329
326
  }
330
327
  // Build the INSERT column and value lists. For the non-hasDefaultValue branches,
331
328
  // additionalFieldList holds PK columns (without leading commas) and
@@ -382,12 +379,31 @@ END
382
379
  GO${permissions}
383
380
  `;
384
381
  }
382
+ /**
383
+ * Builds the post-insert / post-update `SELECT` statement returned by a CRUD stored procedure.
384
+ *
385
+ * - When `entity.SaveReturnMode` is `'full'` (default), queries `SELECT *` (or `SELECT TOP 0 *`)
386
+ * from `[schema].[BaseView]` so calculated and joined columns are returned.
387
+ * - When `entity.SaveReturnMode` is `'datestamps_only'`, queries only the primary key column(s)
388
+ * plus `__mj_CreatedAt` and `__mj_UpdatedAt` (via {@link EntityInfo.DatestampReturnFields})
389
+ * directly from `[schema].[BaseTable]`, avoiding the post-write `BaseView` joins and large
390
+ * payload columns while still returning DB-generated key and timestamp values.
391
+ */
392
+ buildCRUDReturnSelect(entity, whereClause, topZero = false) {
393
+ const topPrefix = topZero ? 'TOP 0 ' : '';
394
+ if (entity.SaveReturnMode === 'datestamps_only') {
395
+ const cols = entity.DatestampReturnFields.map(f => `[${f.Name}]`).join(', ');
396
+ return `SELECT ${topPrefix}${cols} FROM [${entity.SchemaName}].[${entity.BaseTable}] WHERE ${whereClause}`;
397
+ }
398
+ return `SELECT ${topPrefix}* FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE ${whereClause}`;
399
+ }
385
400
  /**
386
401
  * Generates the `spUpdate` stored procedure for a SQL Server entity. Performs a standard
387
402
  * `UPDATE ... SET ... WHERE PK = @PK` and uses `@@ROWCOUNT` to detect whether the row
388
403
  * was found: if no rows were updated (e.g., stale PK or concurrent delete), returns an
389
404
  * empty result set with the base view's column structure (`SELECT TOP 0 ... WHERE 1=0`);
390
- * otherwise returns the updated record from the base view. Also generates the
405
+ * otherwise returns the updated record from the base view (or PK + datestamp columns from
406
+ * the base table when `entity.SaveReturnMode === 'datestamps_only'`). Also generates the
391
407
  * `__mj_UpdatedAt` timestamp trigger if the entity has that column.
392
408
  */
393
409
  generateCRUDUpdate(entity) {
@@ -397,13 +413,18 @@ GO${permissions}
397
413
  const hasUpdatedAtField = entity.Fields.find(f => f.Name.toLowerCase().trim() === EntityInfo.UpdatedAtFieldName.trim().toLowerCase()) !== undefined;
398
414
  const updatedAtTrigger = hasUpdatedAtField ? this.generateTimestampTrigger(entity) : '';
399
415
  const updateFields = this.generateUpdateFieldString(entity.Fields);
400
- const selectUpdatedRecord = `SELECT
416
+ const pkWhereClause = entity.PrimaryKeys.map(k => `[${k.Name}] = @${k.CodeName}`).join(' AND ');
417
+ const isDatestampsOnly = entity.SaveReturnMode === 'datestamps_only';
418
+ const selectUpdatedRecord = isDatestampsOnly
419
+ ? this.buildCRUDReturnSelect(entity, pkWhereClause)
420
+ : `SELECT
401
421
  *
402
422
  FROM
403
423
  [${entity.SchemaName}].[${entity.BaseView}]
404
424
  WHERE
405
- ${entity.PrimaryKeys.map(k => `[${k.Name}] = @${k.CodeName}`).join(' AND ')}
425
+ ${pkWhereClause}
406
426
  `;
427
+ const selectEmptyRecord = this.buildCRUDReturnSelect(entity, '1=0', true);
407
428
  // PK-only entities (e.g. junction tables with only PK + __mj timestamp columns)
408
429
  // have no updatable fields. Generate a no-op SP that just returns the existing row
409
430
  // rather than emitting an invalid UPDATE with an empty SET clause.
@@ -414,12 +435,12 @@ GO${permissions}
414
435
  SET
415
436
  ${updateFields}
416
437
  WHERE
417
- ${entity.PrimaryKeys.map(k => `[${k.Name}] = @${k.CodeName}`).join(' AND ')}
438
+ ${pkWhereClause}
418
439
 
419
440
  -- Check if the update was successful
420
441
  IF @@ROWCOUNT = 0
421
442
  -- Nothing was updated, return no rows, but column structure from base view intact, semantically correct this way.
422
- SELECT TOP 0 * FROM [${entity.SchemaName}].[${entity.BaseView}] WHERE 1=0
443
+ ${selectEmptyRecord}
423
444
  ELSE
424
445
  -- Return the updated record so the caller can see the updated values and any calculated fields
425
446
  ${selectUpdatedRecord}`
@@ -618,6 +639,24 @@ CREATE INDEX ${indexName} ON [${entity.SchemaName}].[${entity.BaseTable}] (${col
618
639
  *
619
640
  * @returns The generated SQL and the resolved function name for permission grants.
620
641
  */
642
+ /**
643
+ * SQL Server charges full-text search through the fulltext population service rather than a
644
+ * trigger: `CREATE FULLTEXT INDEX` puts the table under continuous change tracking, so every
645
+ * INSERT/UPDATE/DELETE that touches an indexed column queues crawl work, and the index itself
646
+ * occupies catalog storage. The generated script also DROPs and RECREATEs the index, which means
647
+ * a full re-crawl of the table each time this entity's SQL is applied.
648
+ */
649
+ FullTextSearchCostDisclosure(entity, searchFields) {
650
+ if (!entity.FullTextIndexGenerated) {
651
+ return null;
652
+ }
653
+ const fields = searchFields.map((f) => f.Name).join(', ');
654
+ return `Full-text search on ${entity.SchemaName}.${entity.BaseTable} adds a PERMANENT cost: the `
655
+ + `fulltext index over (${fields}) puts the table under change tracking, so every write to an `
656
+ + `indexed column queues population work, and this script DROPs and RECREATEs the index — a full `
657
+ + `re-crawl of the table on every apply. Clearing the entity's full-text flags later does not drop `
658
+ + `the index or the catalog.`;
659
+ }
621
660
  generateFullTextSearch(entity, searchFields, primaryKeyIndexName) {
622
661
  let sql = '';
623
662
  const catalogName = entity.FullTextCatalog && entity.FullTextCatalog.length > 0
@@ -1491,6 +1530,25 @@ WHERE s.name IN (${inList})`;
1491
1530
  AND ic2.index_id = i.index_id) > 1`;
1492
1531
  }
1493
1532
  /** @inheritdoc */
1533
+ GetUniqueIndexMembershipSQL(schema, tableName, columnName) {
1534
+ return `SELECT ic.is_included_column AS IsIncludedColumn,
1535
+ (SELECT COUNT(*)
1536
+ FROM sys.index_columns k
1537
+ WHERE k.object_id = i.object_id
1538
+ AND k.index_id = i.index_id
1539
+ AND k.is_included_column = 0) AS KeyColumnCount
1540
+ FROM sys.indexes i
1541
+ INNER JOIN sys.tables t ON t.object_id = i.object_id
1542
+ INNER JOIN sys.schemas s ON s.schema_id = t.schema_id
1543
+ INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id
1544
+ INNER JOIN sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id
1545
+ WHERE i.is_unique = 1
1546
+ AND i.is_primary_key = 0
1547
+ AND s.name = '${EscapeSQLString(schema)}'
1548
+ AND t.name = '${EscapeSQLString(tableName)}'
1549
+ AND c.name = '${EscapeSQLString(columnName)}'`;
1550
+ }
1551
+ /** @inheritdoc */
1494
1552
  getForeignKeyIndexExistsSQL(schema, tableName, indexName) {
1495
1553
  return `SELECT 1
1496
1554
  FROM sys.indexes