@memberjunction/codegen-lib 6.1.0-edge.5 → 6.1.0-edge.7

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 (103) hide show
  1. package/README.md +20 -0
  2. package/dist/Angular/angular-codegen.d.ts +9 -6
  3. package/dist/Angular/angular-codegen.d.ts.map +1 -1
  4. package/dist/Angular/angular-codegen.js +80 -51
  5. package/dist/Angular/angular-codegen.js.map +1 -1
  6. package/dist/Angular/join-grid-related-entity-component.d.ts.map +1 -1
  7. package/dist/Angular/join-grid-related-entity-component.js +5 -2
  8. package/dist/Angular/join-grid-related-entity-component.js.map +1 -1
  9. package/dist/Angular/related-entity-components.d.ts +11 -0
  10. package/dist/Angular/related-entity-components.d.ts.map +1 -1
  11. package/dist/Angular/related-entity-components.js +23 -0
  12. package/dist/Angular/related-entity-components.js.map +1 -1
  13. package/dist/Angular/timeline-related-entity-component.d.ts.map +1 -1
  14. package/dist/Angular/timeline-related-entity-component.js +3 -2
  15. package/dist/Angular/timeline-related-entity-component.js.map +1 -1
  16. package/dist/Config/config.d.ts +29 -2
  17. package/dist/Config/config.d.ts.map +1 -1
  18. package/dist/Config/config.js +54 -5
  19. package/dist/Config/config.js.map +1 -1
  20. package/dist/Database/codeGenDatabaseProvider.d.ts +64 -1
  21. package/dist/Database/codeGenDatabaseProvider.d.ts.map +1 -1
  22. package/dist/Database/codeGenDatabaseProvider.js +49 -3
  23. package/dist/Database/codeGenDatabaseProvider.js.map +1 -1
  24. package/dist/Database/dbSchema.js +2 -1
  25. package/dist/Database/dbSchema.js.map +1 -1
  26. package/dist/Database/entity-field-change-tracking.d.ts +53 -0
  27. package/dist/Database/entity-field-change-tracking.d.ts.map +1 -0
  28. package/dist/Database/entity-field-change-tracking.js +120 -0
  29. package/dist/Database/entity-field-change-tracking.js.map +1 -0
  30. package/dist/Database/entity-level-tree-cycles.d.ts.map +1 -1
  31. package/dist/Database/entity-level-tree-cycles.js +3 -2
  32. package/dist/Database/entity-level-tree-cycles.js.map +1 -1
  33. package/dist/Database/field-metadata-lock.d.ts +47 -0
  34. package/dist/Database/field-metadata-lock.d.ts.map +1 -0
  35. package/dist/Database/field-metadata-lock.js +159 -0
  36. package/dist/Database/field-metadata-lock.js.map +1 -0
  37. package/dist/Database/manage-metadata.d.ts +133 -51
  38. package/dist/Database/manage-metadata.d.ts.map +1 -1
  39. package/dist/Database/manage-metadata.js +574 -306
  40. package/dist/Database/manage-metadata.js.map +1 -1
  41. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts +10 -2
  42. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts.map +1 -1
  43. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js +113 -42
  44. package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js.map +1 -1
  45. package/dist/Database/providers/postgresql/metadataSupportObjects.js +31 -8
  46. package/dist/Database/providers/postgresql/metadataSupportObjects.js.map +1 -1
  47. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts +47 -2
  48. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts.map +1 -1
  49. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js +176 -30
  50. package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js.map +1 -1
  51. package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.js +15 -2
  52. package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.js.map +1 -1
  53. package/dist/Database/reconcileFieldLevelSecurity.d.ts +22 -0
  54. package/dist/Database/reconcileFieldLevelSecurity.d.ts.map +1 -0
  55. package/dist/Database/reconcileFieldLevelSecurity.js +47 -0
  56. package/dist/Database/reconcileFieldLevelSecurity.js.map +1 -0
  57. package/dist/Database/sql_codegen.d.ts +34 -0
  58. package/dist/Database/sql_codegen.d.ts.map +1 -1
  59. package/dist/Database/sql_codegen.js +152 -14
  60. package/dist/Database/sql_codegen.js.map +1 -1
  61. package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts.map +1 -1
  62. package/dist/Manifest/GenerateClassRegistrationsManifest.js +3 -2
  63. package/dist/Manifest/GenerateClassRegistrationsManifest.js.map +1 -1
  64. package/dist/Misc/action_subclasses_codegen.js +2 -2
  65. package/dist/Misc/action_subclasses_codegen.js.map +1 -1
  66. package/dist/Misc/advanced_generation.d.ts +17 -5
  67. package/dist/Misc/advanced_generation.d.ts.map +1 -1
  68. package/dist/Misc/advanced_generation.js +69 -23
  69. package/dist/Misc/advanced_generation.js.map +1 -1
  70. package/dist/Misc/codegen-reporter.d.ts +2 -0
  71. package/dist/Misc/codegen-reporter.d.ts.map +1 -1
  72. package/dist/Misc/codegen-reporter.js +6 -2
  73. package/dist/Misc/codegen-reporter.js.map +1 -1
  74. package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
  75. package/dist/Misc/entity_subclasses_codegen.js +30 -20
  76. package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
  77. package/dist/Misc/graphql_server_codegen.d.ts +39 -0
  78. package/dist/Misc/graphql_server_codegen.d.ts.map +1 -1
  79. package/dist/Misc/graphql_server_codegen.js +63 -9
  80. package/dist/Misc/graphql_server_codegen.js.map +1 -1
  81. package/dist/Misc/remote_operations_codegen.d.ts +36 -1
  82. package/dist/Misc/remote_operations_codegen.d.ts.map +1 -1
  83. package/dist/Misc/remote_operations_codegen.js +178 -8
  84. package/dist/Misc/remote_operations_codegen.js.map +1 -1
  85. package/dist/Misc/schema-emit.d.ts.map +1 -1
  86. package/dist/Misc/schema-emit.js +2 -1
  87. package/dist/Misc/schema-emit.js.map +1 -1
  88. package/dist/Misc/sql_logging.d.ts +63 -8
  89. package/dist/Misc/sql_logging.d.ts.map +1 -1
  90. package/dist/Misc/sql_logging.js +169 -42
  91. package/dist/Misc/sql_logging.js.map +1 -1
  92. package/dist/Misc/util.d.ts +12 -0
  93. package/dist/Misc/util.d.ts.map +1 -1
  94. package/dist/Misc/util.js +71 -8
  95. package/dist/Misc/util.js.map +1 -1
  96. package/dist/plugins/index.d.ts +3 -0
  97. package/dist/plugins/index.d.ts.map +1 -1
  98. package/dist/plugins/index.js +28 -1
  99. package/dist/plugins/index.js.map +1 -1
  100. package/dist/runCodeGen.d.ts.map +1 -1
  101. package/dist/runCodeGen.js +134 -26
  102. package/dist/runCodeGen.js.map +1 -1
  103. package/package.json +29 -29
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Pure decision function for field metadata updates (Category, GeneratedFormSection,
3
+ * DisplayName, ExtendedType, CodeType).
4
+ *
5
+ * Implements the normative per-column lock table from plan §3.2.
6
+ * All decisions are pure functions of current field state, proposed values, and lock context.
7
+ */
8
+ export function computeFieldMetadataUpdate(field, proposal, ctx, validateExtendedType, sanitizeCodeType) {
9
+ const update = {
10
+ skipped: [],
11
+ };
12
+ // ──────────────────────────────────────────────────────────────────────────
13
+ // 1. Category & GeneratedFormSection
14
+ // ──────────────────────────────────────────────────────────────────────────
15
+ // Override category for system metadata audit fields (__mj_*)
16
+ const rawProposedCategory = field.Name.startsWith('__mj_')
17
+ ? 'System Metadata'
18
+ : proposal.category;
19
+ if (!field.AutoUpdateCategory) {
20
+ update.skipped.push({ column: 'Category', reason: 'flag' });
21
+ }
22
+ else {
23
+ const isCurrentCategoryBlank = !field.Category || field.Category.trim() === '';
24
+ const isAllowedToCategorize = isCurrentCategoryBlank || ctx.isNewEntity;
25
+ if (!isAllowedToCategorize) {
26
+ // Existing non-blank category on an existing entity: locked, never moves even between existing categories
27
+ update.skipped.push({ column: 'Category', reason: 'locked' });
28
+ }
29
+ else {
30
+ if (!rawProposedCategory || rawProposedCategory.trim() === '') {
31
+ update.skipped.push({ column: 'Category', reason: 'blank-proposal' });
32
+ }
33
+ else {
34
+ const trimmedProposed = rawProposedCategory.trim();
35
+ if (trimmedProposed === (field.Category ?? '').trim()) {
36
+ update.skipped.push({ column: 'Category', reason: 'unchanged' });
37
+ }
38
+ else {
39
+ update.Category = trimmedProposed;
40
+ // GeneratedFormSection is only emitted when Category is emitted
41
+ if (field.GeneratedFormSection !== 'Category') {
42
+ update.GeneratedFormSection = 'Category';
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ // ──────────────────────────────────────────────────────────────────────────
49
+ // 2. DisplayName
50
+ // ──────────────────────────────────────────────────────────────────────────
51
+ if (!field.AutoUpdateDisplayName) {
52
+ update.skipped.push({ column: 'DisplayName', reason: 'flag' });
53
+ }
54
+ else {
55
+ const isAllowedDisplayName = ctx.isNewEntity || ctx.isNewField || ctx.descriptionReopened;
56
+ if (!isAllowedDisplayName) {
57
+ update.skipped.push({ column: 'DisplayName', reason: 'locked' });
58
+ }
59
+ else {
60
+ if (!proposal.displayName || proposal.displayName.trim() === '') {
61
+ update.skipped.push({ column: 'DisplayName', reason: 'blank-proposal' });
62
+ }
63
+ else {
64
+ const trimmedProposal = proposal.displayName.trim();
65
+ if (trimmedProposal === (field.DisplayName ?? '').trim()) {
66
+ update.skipped.push({ column: 'DisplayName', reason: 'unchanged' });
67
+ }
68
+ else {
69
+ update.DisplayName = trimmedProposal;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ // ──────────────────────────────────────────────────────────────────────────
75
+ // 3. ExtendedType
76
+ // ──────────────────────────────────────────────────────────────────────────
77
+ if (!field.AutoUpdateExtendedType) {
78
+ update.skipped.push({ column: 'ExtendedType', reason: 'flag' });
79
+ }
80
+ else {
81
+ const isAllowedExtendedType = ctx.isNewEntity || ctx.isNewField || ctx.typeReopened;
82
+ if (!isAllowedExtendedType) {
83
+ update.skipped.push({ column: 'ExtendedType', reason: 'locked' });
84
+ }
85
+ else {
86
+ if (proposal.extendedType === undefined) {
87
+ update.skipped.push({ column: 'ExtendedType', reason: 'blank-proposal' });
88
+ }
89
+ else if (proposal.extendedType === null ||
90
+ proposal.extendedType.trim() === '' ||
91
+ proposal.extendedType.trim().toLowerCase() === 'null') {
92
+ if (field.ExtendedType === null) {
93
+ update.skipped.push({ column: 'ExtendedType', reason: 'unchanged' });
94
+ }
95
+ else {
96
+ update.ExtendedType = null;
97
+ }
98
+ }
99
+ else {
100
+ const valid = validateExtendedType(proposal.extendedType.trim());
101
+ const normalizedValueListType = (field.ValueListType || '').trim().toLowerCase();
102
+ const isValueList = normalizedValueListType !== '' && normalizedValueListType !== 'none';
103
+ if (!valid || (valid === 'Code' && isValueList)) {
104
+ update.skipped.push({ column: 'ExtendedType', reason: 'invalid' });
105
+ }
106
+ else {
107
+ if (valid === field.ExtendedType) {
108
+ update.skipped.push({ column: 'ExtendedType', reason: 'unchanged' });
109
+ }
110
+ else {
111
+ update.ExtendedType = valid;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ // ──────────────────────────────────────────────────────────────────────────
118
+ // 4. CodeType (governed by AutoUpdateExtendedType; D6)
119
+ // ──────────────────────────────────────────────────────────────────────────
120
+ if (!field.AutoUpdateExtendedType) {
121
+ update.skipped.push({ column: 'CodeType', reason: 'flag' });
122
+ }
123
+ else {
124
+ const isAllowedCodeType = ctx.isNewEntity || ctx.isNewField || ctx.typeReopened;
125
+ if (!isAllowedCodeType) {
126
+ update.skipped.push({ column: 'CodeType', reason: 'locked' });
127
+ }
128
+ else {
129
+ // Determine effective extended type after step 3
130
+ const effectiveExtendedType = 'ExtendedType' in update ? update.ExtendedType : field.ExtendedType;
131
+ if (effectiveExtendedType !== 'Code') {
132
+ // CodeType MUST be null when ExtendedType is not Code
133
+ if (field.CodeType === null) {
134
+ update.skipped.push({ column: 'CodeType', reason: 'unchanged' });
135
+ }
136
+ else {
137
+ update.CodeType = null;
138
+ }
139
+ }
140
+ else {
141
+ if (proposal.codeType === undefined) {
142
+ update.skipped.push({ column: 'CodeType', reason: 'blank-proposal' });
143
+ }
144
+ else {
145
+ const sanitized = sanitizeCodeType(proposal.codeType, field.Name);
146
+ const resolvedCodeType = sanitized ?? null;
147
+ if (resolvedCodeType === field.CodeType) {
148
+ update.skipped.push({ column: 'CodeType', reason: 'unchanged' });
149
+ }
150
+ else {
151
+ update.CodeType = resolvedCodeType;
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ return update;
158
+ }
159
+ //# sourceMappingURL=field-metadata-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-metadata-lock.js","sourceRoot":"","sources":["../../src/Database/field-metadata-lock.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0CH,MAAM,UAAU,0BAA0B,CACvC,KAAyB,EACzB,QAA+B,EAC/B,GAAqB,EACrB,oBAAkD,EAClD,gBAAsH;IAEtH,MAAM,MAAM,GAAwB;QACjC,OAAO,EAAE,EAAE;KACb,CAAC;IAEF,6EAA6E;IAC7E,qCAAqC;IACrC,6EAA6E;IAC7E,8DAA8D;IAC9D,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACvD,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAEvB,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACL,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAC/E,MAAM,qBAAqB,GAAG,sBAAsB,IAAI,GAAG,CAAC,WAAW,CAAC;QAExE,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC1B,0GAA0G;YAC1G,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACL,IAAI,CAAC,mBAAmB,IAAI,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAA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GAAG,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;oBAClE,MAAM,gBAAgB,GAAG,SAAS,IAAI,IAAI,CAAC;oBAC3C,IAAI,gBAAgB,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC;wBACvC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;oBACpE,CAAC;yBAAM,CAAC;wBACL,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC;oBACtC,CAAC;gBACJ,CAAC;YACJ,CAAC;QACJ,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AACjB,CAAC"}
@@ -6,6 +6,8 @@ import './providers/sqlserver/SQLServerCodeGenProvider.js';
6
6
  import { EntityFieldExtendedType, EntityFieldInfo, EntityInfo, ExternalDataSourceReadRouter, ExternalSchemaObject, FieldCategoryInfo, Metadata, UserInfo } from "@memberjunction/core";
7
7
  import { SQLUtilityBase } from "./sql.js";
8
8
  import { AdvancedGeneration, SmartFieldIdentificationResult, FormLayoutResult, VirtualEntityDecorationResult } from "../Misc/advanced_generation.js";
9
+ import { FieldChangeReason, EntityFieldSnapshotRow } from './entity-field-change-tracking.js';
10
+ export { TRACKED_FIELD_COLUMNS, FieldChangeReason, DISPLAYNAME_REOPEN_REASONS, TYPE_REOPEN_REASONS, EntityFieldSnapshotRow, EntityFieldChange, diffEntityFieldSnapshots, } from './entity-field-change-tracking.js';
9
11
  export declare class ValidatorResult {
10
12
  entityName: string;
11
13
  fieldName?: string;
@@ -249,6 +251,17 @@ export declare class ManageMetadataBase {
249
251
  * SQL Server: 1/0, PostgreSQL: true/false
250
252
  */
251
253
  protected boolLit(value: boolean): string;
254
+ /**
255
+ * Returns an explicitly-typed UUID literal for the platform.
256
+ * SQL Server: CAST('...' AS uniqueidentifier), PostgreSQL: CAST('...' AS uuid)
257
+ *
258
+ * Needed wherever a UUID literal appears in the SELECT list of an `INSERT ... SELECT`. A bare
259
+ * quoted literal is fine in `INSERT ... VALUES`, where both platforms coerce it to the target
260
+ * column's type — but in the projection of a SELECT, PostgreSQL can resolve an untyped literal
261
+ * to `text` and then refuse to assign it to a `uuid` column. `CAST(x AS y)` is ANSI and settles
262
+ * it on both, with the type name coming from the dialect rather than a platform branch here.
263
+ */
264
+ protected uuidLit(value: string): string;
252
265
  /**
253
266
  * Quotes mixed-case identifiers in a SQL string for the current platform.
254
267
  * Delegates to the database provider's quoteSQLForExecution method.
@@ -263,19 +276,17 @@ export declare class ManageMetadataBase {
263
276
  */
264
277
  protected runQueryWithParams(pool: CodeGenConnection, sql: string, params: Record<string, unknown>): Promise<CodeGenQueryResult>;
265
278
  /**
266
- * Returns a sequence value safe to use for an EntityField INSERT under the given
267
- * EntityID, defaulting to `candidate` when it doesn't collide. Otherwise returns
268
- * `MAX(Sequence) + 1` for that entity.
279
+ * The `Sequence` expression for every EntityField INSERT CodeGen emits:
280
+ * `(SELECT COALESCE(MAX(Sequence), 0) + 1 FROM EntityField WHERE EntityID = '<id>')`.
269
281
  *
270
- * Why this exists: several insert paths (virtual-entity field sync, IS-A parent
271
- * field sync, schema-derived field creation) compute a deterministic sequence
272
- * up-front, but a partial prior run can leave rows at that exact ordinal under
273
- * the target EntityID. SS hides the collision because retried runs typically
274
- * succeed before failing; PG raises UQ_EntityField_EntityID_Sequence (~4 errors
275
- * per advanced-generation run). The values are temporary anyway —
276
- * spUpdateExistingEntityFieldsFromSchema renumbers them on the next pass.
282
+ * Evaluated at APPLY time, never a literal. The value is disposable — the run's own
283
+ * spUpdateExistingEntityFieldsFromSchema pass and R__RefreshMetadata renumber every field from
284
+ * the schema — but it must be unique on ANY database in ANY order, because the INSERT is
285
+ * appended verbatim to a migration and Flyway runs every versioned migration before the
286
+ * repeatable renumber. Each INSERT re-evaluates MAX after the one before it, so a batch that
287
+ * executes sequentially in emission order rises in that order (#3670, #4202).
277
288
  */
278
- protected nextAvailableEntityFieldSequence(pool: CodeGenConnection, entityId: string, candidate: number): Promise<number>;
289
+ protected applyTimeEntityFieldSequenceSQL(entityID: string): string;
279
290
  /**
280
291
  * Wraps a SELECT query with a row limit.
281
292
  * SQL Server: SELECT TOP N ... , PostgreSQL: SELECT ... LIMIT N
@@ -324,11 +335,39 @@ export declare class ManageMetadataBase {
324
335
  * Globally scoped list of entities that have been created during the metadata management process.
325
336
  */
326
337
  static get newEntityList(): string[];
338
+ static set newEntityList(value: string[]);
327
339
  private static _modifiedEntityList;
328
340
  /**
329
341
  * Globally scoped list of entities that have been modified during the metadata management process.
330
342
  */
331
343
  static get modifiedEntityList(): string[];
344
+ static set modifiedEntityList(value: string[]);
345
+ private static _newFieldSet;
346
+ private static _changedFields;
347
+ private static _changedFieldReport;
348
+ private static fieldKey;
349
+ static registerNewField(entityID: string, name: string): void;
350
+ static registerFieldChange(entityID: string, name: string, reasons: Iterable<FieldChangeReason>): void;
351
+ static isFieldNew(entityID: string, name: string): boolean;
352
+ static fieldChangeReasons(entityID: string, name: string): ReadonlySet<FieldChangeReason>;
353
+ static isDisplayNameReopened(entityID: string, name: string): boolean;
354
+ static isTypeReopened(entityID: string, name: string): boolean;
355
+ static get newFieldCount(): number;
356
+ static get changedFieldCount(): number;
357
+ static get changedFieldReport(): ReadonlyArray<{
358
+ entityName: string;
359
+ fieldName: string;
360
+ reasons: FieldChangeReason[];
361
+ }>;
362
+ static clearFieldTracking(): void;
363
+ /**
364
+ * Takes a snapshot of EntityField rows from vwEntityFields for diffing.
365
+ * Only queries columns in TRACKED_FIELD_COLUMNS (Sequence is excluded).
366
+ */
367
+ protected snapshotEntityFields(pool: CodeGenConnection, entityIDs?: string[]): Promise<Map<string, EntityFieldSnapshotRow>>;
368
+ protected findFieldByName<T extends {
369
+ Name: string;
370
+ }>(fields: T[], name: string | null | undefined): T | undefined;
332
371
  private static _deletedEntitySchemaList;
333
372
  /**
334
373
  * Schemas that lost an entity during this run.
@@ -376,7 +415,7 @@ export declare class ManageMetadataBase {
376
415
  * Cached per process to avoid repeated I/O within a CodeGen run; the in-process (RSU) path calls
377
416
  * {@link invalidateSoftPKFKConfigCache} at the start of each run so a rewritten file is picked up.
378
417
  */
379
- private static getSoftPKFKConfig;
418
+ static getSoftPKFKConfig(): Record<string, unknown> | null;
380
419
  /**
381
420
  * Extracts a flat array of table configs from the config file, handling both formats:
382
421
  * 1. Schema-as-key (template format): { "dbo": [{ "TableName": "Orders", ... }] }
@@ -649,8 +688,8 @@ export declare class ManageMetadataBase {
649
688
  * INTEGRITY CHECK — in a well-formed entity every base (non-virtual) field sequences BEFORE the
650
689
  * virtual/related fields, so the EntityField order matches the base view's `SELECT [base].*, <joins>`
651
690
  * column output. The positional save-capture in the data providers (e.g. SQLServerDataProvider's
652
- * @ResultTable) relies on that alignment. CodeGen assigns newly-discovered columns a temporary
653
- * `maxSequence + 100000` offset that updateExistingEntityFieldsFromSchema is supposed to renumber; if
691
+ * @ResultTable) relies on that alignment. CodeGen inserts newly-discovered columns at an apply-time
692
+ * `MAX(Sequence) + ordinal` placeholder that updateExistingEntityFieldsFromSchema is supposed to renumber; if
654
693
  * a base column is left sequenced AFTER a virtual field, the save-capture would mis-route values by
655
694
  * position. The providers now compensate (saves stay correct), but the metadata is still wrong — so we
656
695
  * scan for it after every metadata pass and log a prominent warning to drive the root cause out over time.
@@ -838,7 +877,7 @@ export declare class ManageMetadataBase {
838
877
  */
839
878
  protected applyLLMFieldDescriptions(pool: CodeGenConnection, entity: EntityInfo, fieldDescriptions: VirtualEntityDecorationResult['fieldDescriptions'], schema: string): Promise<boolean>;
840
879
  /**
841
- * Valid values for EntityField.ExtendedType, plus common LLM aliases mapped to valid values.
880
+ * Valid values for EntityField.ExtendedType. Domain lives on {@link EntityFieldInfo.ExtendedTypes}.
842
881
  */
843
882
  private static readonly VALID_EXTENDED_TYPES;
844
883
  private static readonly EXTENDED_TYPE_ALIASES;
@@ -1061,7 +1100,7 @@ export declare class ManageMetadataBase {
1061
1100
  *
1062
1101
  * @returns {string} - The SQL statement to retrieve pending entity fields.
1063
1102
  */
1064
- protected getPendingEntityFieldsSELECTSQL(entityIDs?: string[]): string;
1103
+ protected getPendingEntityFieldsSELECTSQL(entityIDs?: string[], excludeSchemas?: string[]): string;
1065
1104
  /**
1066
1105
  * This method builds a SQL Statement that will insert a row into the EntityField table with information about a new field.
1067
1106
  * @param n - the new field
@@ -1077,25 +1116,8 @@ export declare class ManageMetadataBase {
1077
1116
  * @param sqlDefaultValue
1078
1117
  * @returns
1079
1118
  */
1080
- /**
1081
- * Park existing EntityField.Sequence values out of the 1..N catalog range so a
1082
- * following INSERT can use the real BaseView column_id without colliding on
1083
- * UQ_EntityField_EntityID_Sequence. The +100000 band is unique-safe; the
1084
- * subsequent spUpdateExistingEntityFieldsFromSchema rewrite brings every row
1085
- * (parked and new) back to live catalog order.
1086
- *
1087
- * Parks ONLY when nothing on the entity is parked yet, which is what makes a second
1088
- * emission for the same entity in the same run a no-op. `Sequence < 100000` alone does
1089
- * not achieve that: after the first park the rows below the band are precisely the ones
1090
- * the first pass just INSERTED at their catalog ordinals, so a second park lifts THOSE
1091
- * into the band — onto the row the first park moved from the same ordinal, and the
1092
- * migration dies on UQ_EntityField_EntityID_Sequence with a duplicate at 100000+ordinal.
1093
- * Reachable whenever an entity gains fields in both CodeGen passes: pass 1 for the real
1094
- * columns, pass 2 for the denormalized name column a new foreign key introduces.
1095
- */
1096
- protected parkEntityFieldSequencesSQL(entityID: string): string;
1097
1119
  protected parseDefaultValue(sqlDefaultValue: string): string;
1098
- protected createNewEntityFieldsFromSchema(pool: CodeGenConnection, entityIDs?: string[]): Promise<boolean>;
1120
+ protected createNewEntityFieldsFromSchema(pool: CodeGenConnection, entityIDs?: string[], excludeSchemas?: string[]): Promise<boolean>;
1099
1121
  /**
1100
1122
  * This method handles updating entity field related name field maps which is basically the process of finding the related entity field that is the "name" field for the related entity.
1101
1123
  * @param ds
@@ -1249,6 +1271,24 @@ export declare class ManageMetadataBase {
1249
1271
  * Shared by both table-backed entity creation and virtual entity creation.
1250
1272
  */
1251
1273
  protected addEntityToApplicationForSchema(pool: CodeGenConnection, entityId: string, entityName: string, schemaName: string, currentUser: UserInfo): Promise<void>;
1274
+ /**
1275
+ * INSERT for one `EntityPermission` row, skipped when a row already exists for that
1276
+ * (EntityID, RoleID, Type).
1277
+ *
1278
+ * The guard is not defensive tidiness — `EntityPermission` carries a UNIQUE constraint on those
1279
+ * three columns (`UQ_EntityPermission_EntityID_RoleID_Type`), so an unguarded INSERT is a failed
1280
+ * CodeGen run rather than a duplicate row. All three call sites are "grant the configured default
1281
+ * permissions", which is naturally re-entrant: an entity re-detected as new, or a second CodeGen
1282
+ * pass over the same entity, reaches them again. Before the constraint existed this silently
1283
+ * accumulated duplicates — a live database showed one (entity, role) pair with rows created three
1284
+ * years apart, and pairs whose verb flags disagreed.
1285
+ *
1286
+ * `Type` is written explicitly rather than left to the column default so the row being inserted
1287
+ * and the row being tested for are keyed identically; a default that changed later would
1288
+ * otherwise put them out of step. Expressed as INSERT ... SELECT ... WHERE NOT EXISTS, which is
1289
+ * valid on both SQL Server and PostgreSQL, so no provider branch is needed.
1290
+ */
1291
+ protected buildEntityPermissionInsertSQL(entityId: string, roleId: string, canRead: boolean, canCreate: boolean, canUpdate: boolean, canDelete: boolean): string;
1252
1292
  /**
1253
1293
  * Adds default permissions for a newly created entity based on config settings.
1254
1294
  * Shared by both table-backed entity creation and virtual entity creation.
@@ -1316,7 +1356,10 @@ export declare class ManageMetadataBase {
1316
1356
  */
1317
1357
  protected entityHasRowLevelSecurity(entity: EntityInfo): boolean;
1318
1358
  /** Pure form of the role-RLS layer (see {@link entityHasRowLevelSecurity}). IO-free so it can be reused
1319
- * verbatim by the runtime refresher's equivalent gate. */
1359
+ * verbatim by the runtime refresher's equivalent gate. Deliberately WIDER than the runtime's own reader
1360
+ * (`EntityInfo.GetUserRowLevelSecurityInfo` collects a filter only from an Allow row whose `CanRead` is
1361
+ * set, since #4358): a leftover filter beside a cleared flag still counts as "protected" here, which errs
1362
+ * conservative for a leak gate. */
1320
1363
  static EntityHasRoleReadRLS(entity: EntityInfo): boolean;
1321
1364
  /**
1322
1365
  * Per-run cache of the entity NAMES (trimmed + lowercased) that an API-KEY row filter
@@ -1475,7 +1518,11 @@ export declare class ManageMetadataBase {
1475
1518
  AutoUpdateAllowUserSearchAPI?: boolean;
1476
1519
  FullTextSearchEnabled?: boolean;
1477
1520
  AutoUpdateFullTextSearch?: boolean;
1478
- }, fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult): Promise<void>;
1521
+ }, fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, ctx?: {
1522
+ isNewEntity: boolean;
1523
+ newFieldNames: ReadonlySet<string>;
1524
+ typeReopenedNames: ReadonlySet<string>;
1525
+ }): Promise<void>;
1479
1526
  /**
1480
1527
  * Apply the code-level search guardrails to the LLM result, mutating
1481
1528
  * `result` in place so every downstream applier reads the normalized
@@ -1530,7 +1577,9 @@ export declare class ManageMetadataBase {
1530
1577
  * `AutoUpdateIsNameField=0` are never touched in either direction — the user owns
1531
1578
  * them, and `EntityInfo.NameField`'s literal-`Name` preference arbitrates at runtime.
1532
1579
  */
1533
- protected applyNameFieldUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult): void;
1580
+ protected applyNameFieldUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, entity?: {
1581
+ Name?: string;
1582
+ }): void;
1534
1583
  /**
1535
1584
  * Picks the single IsNameField winner for an entity per the rules documented on
1536
1585
  * {@link applyNameFieldUpdates}: stable current winner → deterministic repair
@@ -1602,7 +1651,17 @@ export declare class ManageMetadataBase {
1602
1651
  /**
1603
1652
  * Generate SQL UPDATEs for DefaultInView on the identified default view fields
1604
1653
  */
1605
- protected applyDefaultInViewUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult): void;
1654
+ protected applyDefaultInViewUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, entityOrCtx?: {
1655
+ Name?: string;
1656
+ } | {
1657
+ isNewEntity: boolean;
1658
+ newFieldNames: ReadonlySet<string>;
1659
+ typeReopenedNames: ReadonlySet<string>;
1660
+ }, maybeCtx?: {
1661
+ isNewEntity: boolean;
1662
+ newFieldNames: ReadonlySet<string>;
1663
+ typeReopenedNames: ReadonlySet<string>;
1664
+ }): void;
1606
1665
  /**
1607
1666
  * Generate SQL UPDATEs for IncludeInUserSearchAPI on the identified searchable fields.
1608
1667
  *
@@ -1615,7 +1674,12 @@ export declare class ManageMetadataBase {
1615
1674
  * every search.
1616
1675
  */
1617
1676
  protected applySearchableFieldUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, entity?: {
1677
+ Name?: string;
1618
1678
  FullTextSearchEnabled?: boolean;
1679
+ }, ctx?: {
1680
+ isNewEntity: boolean;
1681
+ newFieldNames: ReadonlySet<string>;
1682
+ typeReopenedNames: ReadonlySet<string>;
1619
1683
  }): void;
1620
1684
  /**
1621
1685
  * Returns true if the field is a sensible target for LIKE-based user search.
@@ -1626,7 +1690,17 @@ export declare class ManageMetadataBase {
1626
1690
  /**
1627
1691
  * Generate SQL UPDATEs for UserSearchPredicateAPI on each searchable field
1628
1692
  */
1629
- protected applySearchPredicateUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult): void;
1693
+ protected applySearchPredicateUpdates(sqlStatements: string[], fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, entityOrCtx?: {
1694
+ Name?: string;
1695
+ } | {
1696
+ isNewEntity: boolean;
1697
+ newFieldNames: ReadonlySet<string>;
1698
+ typeReopenedNames: ReadonlySet<string>;
1699
+ }, maybeCtx?: {
1700
+ isNewEntity: boolean;
1701
+ newFieldNames: ReadonlySet<string>;
1702
+ typeReopenedNames: ReadonlySet<string>;
1703
+ }): void;
1630
1704
  /**
1631
1705
  * Generate SQL UPDATEs for entity-level AllowUserSearchAPI.
1632
1706
  *
@@ -1655,9 +1729,14 @@ export declare class ManageMetadataBase {
1655
1729
  */
1656
1730
  protected applyFullTextSearchUpdates(sqlStatements: string[], entity: {
1657
1731
  ID: string;
1732
+ Name?: string;
1658
1733
  FullTextSearchEnabled?: boolean;
1659
1734
  AutoUpdateFullTextSearch?: boolean;
1660
- }, fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult): void;
1735
+ }, fields: Array<Record<string, unknown>>, result: SmartFieldIdentificationResult, ctx?: {
1736
+ isNewEntity: boolean;
1737
+ newFieldNames: ReadonlySet<string>;
1738
+ typeReopenedNames: ReadonlySet<string>;
1739
+ }): void;
1661
1740
  /**
1662
1741
  * Apply form layout generation results to set category on entity fields.
1663
1742
  * Delegates to shared methods for category assignment, icon, and category info persistence.
@@ -1673,20 +1752,19 @@ export declare class ManageMetadataBase {
1673
1752
  Category: string | null;
1674
1753
  AutoUpdateCategory: boolean;
1675
1754
  AutoUpdateDisplayName: boolean;
1755
+ AutoUpdateExtendedType: boolean;
1676
1756
  GeneratedFormSection: string;
1677
1757
  DisplayName: string;
1678
1758
  ExtendedType: string;
1679
1759
  CodeType: string;
1760
+ ValueListType?: string | null;
1680
1761
  }>, result: FormLayoutResult, isNewEntity?: boolean): Promise<void>;
1681
1762
  /**
1682
- * Detect if an entity has geo-capable fields based on LLM-assigned ExtendedType values.
1763
+ * Detect if an entity has geo-capable fields based on persisted ExtendedType values in the database.
1683
1764
  * If any field has a Geo* ExtendedType, set Entity.SupportsGeoCoding = 1.
1684
1765
  * Respects the AutoUpdateSupportsGeoCoding flag — if 0, the value is locked.
1685
1766
  */
1686
- protected detectAndSetGeoCodingSupport(pool: CodeGenConnection, entity: EntityInfo, fieldCategories: Array<{
1687
- fieldName: string;
1688
- extendedType: EntityFieldExtendedType | null;
1689
- }>): Promise<void>;
1767
+ protected detectAndSetGeoCodingSupport(pool: CodeGenConnection, entity: EntityInfo): Promise<void>;
1690
1768
  /**
1691
1769
  * Builds a set of existing category names from entity fields.
1692
1770
  * Used to enforce category stability (prevent renaming).
@@ -1714,10 +1792,12 @@ export declare class ManageMetadataBase {
1714
1792
  Category: string | null;
1715
1793
  AutoUpdateCategory: boolean;
1716
1794
  AutoUpdateDisplayName: boolean;
1795
+ AutoUpdateExtendedType: boolean;
1717
1796
  GeneratedFormSection: string;
1718
1797
  DisplayName: string;
1719
- ExtendedType: string;
1720
- CodeType: string;
1798
+ ExtendedType: string | null;
1799
+ CodeType: string | null;
1800
+ ValueListType?: string | null;
1721
1801
  }>, fieldCategories: Array<{
1722
1802
  fieldName: string;
1723
1803
  category: string;
@@ -1725,15 +1805,17 @@ export declare class ManageMetadataBase {
1725
1805
  extendedType?: string | null;
1726
1806
  codeType?: string | null;
1727
1807
  reason?: string;
1728
- }>, existingCategories: Set<string>): Promise<void>;
1808
+ }>, existingCategories: Set<string>, ctx: {
1809
+ isNewEntity: boolean;
1810
+ }): Promise<void>;
1729
1811
  /**
1730
1812
  * Sets the entity icon if the entity doesn't already have one.
1731
1813
  */
1732
- protected applyEntityIcon(pool: CodeGenConnection, entityId: string, entityIcon: string): Promise<void>;
1814
+ protected applyEntityIcon(pool: CodeGenConnection, entityId: string, entityIcon: string, entityName?: string): Promise<void>;
1733
1815
  /**
1734
1816
  * Upserts FieldCategoryInfo (new format) and FieldCategoryIcons (legacy format) in EntitySetting.
1735
1817
  */
1736
- protected applyCategoryInfoSettings(pool: CodeGenConnection, entityId: string, categoryInfo: Record<string, FieldCategoryInfo>): Promise<void>;
1818
+ protected applyCategoryInfoSettings(pool: CodeGenConnection, entityId: string, categoryInfo: Record<string, FieldCategoryInfo>, _entityName?: string): Promise<void>;
1737
1819
  /**
1738
1820
  * Applies entity importance analysis to MJApplicationEntity records.
1739
1821
  * Only called for NEW entities to set DefaultForNewUser.
@@ -1743,7 +1825,7 @@ export declare class ManageMetadataBase {
1743
1825
  entityCategory: string;
1744
1826
  confidence: string;
1745
1827
  reasoning: string;
1746
- }): Promise<void>;
1828
+ }, entityName?: string): Promise<void>;
1747
1829
  /**
1748
1830
  * Executes the given SQL query using the given ConnectionPool object.
1749
1831
  * If the appendToLogFile parameter is true, the query will also be appended to the log file.