@memberjunction/codegen-lib 6.2.0-edge.2 → 6.2.0-edge.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/Angular/angular-codegen.d.ts +15 -0
- package/dist/Angular/angular-codegen.d.ts.map +1 -1
- package/dist/Angular/angular-codegen.js +54 -13
- package/dist/Angular/angular-codegen.js.map +1 -1
- package/dist/Config/config.d.ts +15 -24
- package/dist/Config/config.d.ts.map +1 -1
- package/dist/Config/config.js +2 -5
- package/dist/Config/config.js.map +1 -1
- package/dist/Config/integrity-check-schema.d.ts +22 -0
- package/dist/Config/integrity-check-schema.d.ts.map +1 -0
- package/dist/Config/integrity-check-schema.js +18 -0
- package/dist/Config/integrity-check-schema.js.map +1 -0
- package/dist/Database/json-check-validators.d.ts +98 -0
- package/dist/Database/json-check-validators.d.ts.map +1 -0
- package/dist/Database/json-check-validators.js +196 -0
- package/dist/Database/json-check-validators.js.map +1 -0
- package/dist/Database/manage-metadata.d.ts +27 -0
- package/dist/Database/manage-metadata.d.ts.map +1 -1
- package/dist/Database/manage-metadata.js +88 -1
- package/dist/Database/manage-metadata.js.map +1 -1
- package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts.map +1 -1
- package/dist/Manifest/GenerateClassRegistrationsManifest.js +7 -4
- package/dist/Manifest/GenerateClassRegistrationsManifest.js.map +1 -1
- package/dist/Misc/advanced_generation.d.ts +42 -0
- package/dist/Misc/advanced_generation.d.ts.map +1 -1
- package/dist/Misc/advanced_generation.js +50 -0
- package/dist/Misc/advanced_generation.js.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.d.ts +50 -0
- package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.js +185 -68
- package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
- package/dist/Misc/graphql_server_codegen.d.ts.map +1 -1
- package/dist/Misc/graphql_server_codegen.js +3 -5
- package/dist/Misc/graphql_server_codegen.js.map +1 -1
- package/dist/Misc/json-type-model.d.ts +148 -0
- package/dist/Misc/json-type-model.d.ts.map +1 -0
- package/dist/Misc/json-type-model.js +421 -0
- package/dist/Misc/json-type-model.js.map +1 -0
- package/dist/Misc/json-type-rules.d.ts +90 -0
- package/dist/Misc/json-type-rules.d.ts.map +1 -0
- package/dist/Misc/json-type-rules.js +274 -0
- package/dist/Misc/json-type-rules.js.map +1 -0
- package/dist/Misc/json-type-zod.d.ts +41 -0
- package/dist/Misc/json-type-zod.d.ts.map +1 -0
- package/dist/Misc/json-type-zod.js +390 -0
- package/dist/Misc/json-type-zod.js.map +1 -0
- package/dist/Misc/runCommand.d.ts.map +1 -1
- package/dist/Misc/runCommand.js +13 -5
- package/dist/Misc/runCommand.js.map +1 -1
- package/dist/Misc/system_integrity.d.ts +27 -0
- package/dist/Misc/system_integrity.d.ts.map +1 -1
- package/dist/Misc/system_integrity.js +17 -0
- package/dist/Misc/system_integrity.js.map +1 -1
- package/dist/Misc/validator-text.d.ts +11 -0
- package/dist/Misc/validator-text.d.ts.map +1 -0
- package/dist/Misc/validator-text.js +15 -0
- package/dist/Misc/validator-text.js.map +1 -0
- package/dist/runCodeGen.d.ts.map +1 -1
- package/dist/runCodeGen.js +34 -13
- package/dist/runCodeGen.js.map +1 -1
- package/package.json +29 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_subclasses_codegen.d.ts","sourceRoot":"","sources":["../../src/Misc/entity_subclasses_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,eAAe,EAA4B,UAAU,EAAE,sBAAsB,EAAuC,MAAM,sBAAsB,CAAC;AAO/L,OAAO,EAAE,eAAe,EAAsB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"entity_subclasses_codegen.d.ts","sourceRoot":"","sources":["../../src/Misc/entity_subclasses_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,eAAe,EAA4B,UAAU,EA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iB,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA8EvI;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IAwB1F,oHAAoH;IACpH,OAAO,CAAC,uBAAuB;IAKxB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,eAAe,EAAE,CAAA;KAAE;IAyE3G;;;;;;;;;OASG;IACH,SAAS,CAAC,2BAA2B,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAwB7G,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAsExD;;;;;;OAMG;IACI,sBAAsB,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM;CA0BzF"}
|
|
@@ -6,10 +6,14 @@ import ts from 'typescript';
|
|
|
6
6
|
import { MakeDir, SortBySequenceAndCreatedAt } from '../Misc/util.js';
|
|
7
7
|
import { logError, logStatus, LogWarning } from './status_logging.js';
|
|
8
8
|
import { ManageMetadataBase } from '../Database/manage-metadata.js';
|
|
9
|
+
import { FindUnattachedTagComments, ParseJSONTypeDefinition, RewriteJSONTypeDefinition } from './json-type-model.js';
|
|
10
|
+
import { GenerateJSONTypeZod, JSONSchemaConstName } from './json-type-zod.js';
|
|
11
|
+
import { BuildJSONRuleSet } from './json-type-rules.js';
|
|
9
12
|
import { configInfo, DbPlatform, MjCoreSchema, ResolveEntityImportPackage } from '../Config/config.js';
|
|
10
13
|
import { SQLLogging } from './sql_logging.js';
|
|
11
14
|
import { ResolveCodeGenDatabaseProvider } from '../Database/codeGenDatabaseProvider.js';
|
|
12
15
|
import { CodeGenReporter } from './codegen-reporter.js';
|
|
16
|
+
import { NormalizeGeneratedValidatorText } from './validator-text.js';
|
|
13
17
|
import { v4 as uuidv4 } from 'uuid';
|
|
14
18
|
import { EmitStats } from './emit-stats.js';
|
|
15
19
|
import { BuildSchemaBarrel, GroupEntitiesBySchema, MapLimit, EmitSchemaFile, PruneOrphanedSchemaFiles, ResolveSchemaEmitOptions, SanitizeSchemaFileName, SchemasToEmit, } from './schema-emit.js';
|
|
@@ -246,6 +250,80 @@ ${loadModule}
|
|
|
246
250
|
}
|
|
247
251
|
return { baseClass: 'BaseEntity', importStatement: '' };
|
|
248
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Collects and de-duplicates the JSONTypeDefinitions of this entity into the block of interface
|
|
255
|
+
* declarations emitted above the entity class (a Set, because several fields may share one
|
|
256
|
+
* definition). Each definition is validated through the TypeScript compiler API first; an invalid
|
|
257
|
+
* one is logged and its field is demoted to a plain string getter/setter (`JSONType` is nulled).
|
|
258
|
+
*
|
|
259
|
+
* Type names are prefixed with the entity class name so entities can reuse a JSONType name. An
|
|
260
|
+
* opted-in definition (`@mjValidate`) is prefixed through the AST so words inside its JSDoc tag
|
|
261
|
+
* bodies are never rewritten; every other definition keeps the historical whole-text rewrite, so
|
|
262
|
+
* untagged output is unchanged byte for byte.
|
|
263
|
+
*/
|
|
264
|
+
static CollectJSONTypeBlock(entity, sortedFields, sClassName) {
|
|
265
|
+
const jsonTypeDefinitions = new Set();
|
|
266
|
+
for (const field of sortedFields) {
|
|
267
|
+
if (field.JSONTypeDefinition && field.JSONTypeDefinition.trim().length > 0) {
|
|
268
|
+
const definition = field.JSONTypeDefinition.trim();
|
|
269
|
+
if (field.JSONType && field.JSONType.trim().length > 0) {
|
|
270
|
+
const validation = EntitySubClassGeneratorBase.ValidateJSONTypeDefinition(definition, field.JSONType.trim(), entity.Name, field.Name);
|
|
271
|
+
if (!validation.valid) {
|
|
272
|
+
for (const err of validation.errors) {
|
|
273
|
+
logError(err);
|
|
274
|
+
}
|
|
275
|
+
logError(`[JSONType] Skipping JSONTypeDefinition for ${entity.Name}.${field.Name} due to validation errors. The field will use a plain string getter/setter instead.`);
|
|
276
|
+
field.JSONType = null;
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
jsonTypeDefinitions.add(EntitySubClassGeneratorBase.PrefixJSONTypeDefinition(definition, field.JSONType, sClassName));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return jsonTypeDefinitions.size > 0
|
|
284
|
+
? '\n' + Array.from(jsonTypeDefinitions).join('\n\n') + '\n'
|
|
285
|
+
: '';
|
|
286
|
+
}
|
|
287
|
+
/** Prefixes a definition's type names with the entity class name (see {@link CollectJSONTypeBlock}). */
|
|
288
|
+
static PrefixJSONTypeDefinition(definition, jsonType, sClassName) {
|
|
289
|
+
const model = jsonType && jsonType.trim().length > 0 ? ParseJSONTypeDefinition(definition, jsonType.trim()) : null;
|
|
290
|
+
// AST rewrite whenever ANY declaration opts in, not only the bound root: the same definition can be
|
|
291
|
+
// bound to an opted-in root on one field and an untagged root on another, and both bindings must
|
|
292
|
+
// produce identical text so the block emits the declarations once.
|
|
293
|
+
const anyOptIn = model !== null && Array.from(model.Declarations.values()).some((d) => d.Tags.some((t) => t.Name === 'mjValidate'));
|
|
294
|
+
if (anyOptIn) {
|
|
295
|
+
return RewriteJSONTypeDefinition(definition, sClassName);
|
|
296
|
+
}
|
|
297
|
+
// Historical rewrite: every top-level declared name, `\b`-matched over the whole text.
|
|
298
|
+
let rewrittenDef = definition;
|
|
299
|
+
const sourceFile = ts.createSourceFile('temp.ts', definition, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
300
|
+
ts.forEachChild(sourceFile, (node) => {
|
|
301
|
+
if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) ||
|
|
302
|
+
ts.isEnumDeclaration(node) || ts.isClassDeclaration(node)) && node.name) {
|
|
303
|
+
const originalName = node.name.text;
|
|
304
|
+
const prefixedName = `${sClassName}_${originalName}`;
|
|
305
|
+
rewrittenDef = rewrittenDef.replace(new RegExp('\\b' + originalName + '\\b', 'g'), () => prefixedName);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return rewrittenDef;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* The parsed model of a field's JSONTypeDefinition when — and only when — the field is bound to an
|
|
312
|
+
* opted-in (`@mjValidate`) type whose definition is valid TypeScript. Silent: validity problems are
|
|
313
|
+
* reported once, by {@link CollectJSONTypeBlock}.
|
|
314
|
+
*/
|
|
315
|
+
static GetOptedInJSONModel(field, entityName) {
|
|
316
|
+
const name = field.JSONType?.trim();
|
|
317
|
+
const definition = field.JSONTypeDefinition?.trim();
|
|
318
|
+
if (!name || !definition) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
if (!EntitySubClassGeneratorBase.ValidateJSONTypeDefinition(definition, name, entityName, field.Name).valid) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
const model = ParseJSONTypeDefinition(definition, name);
|
|
325
|
+
return model?.OptedIn ? model : null;
|
|
326
|
+
}
|
|
249
327
|
async GenerateEntitySubClass(pool, entity, includeFileHeader = false, skipDBUpdate = false) {
|
|
250
328
|
if (entity.PrimaryKeys.length === 0) {
|
|
251
329
|
console.warn(`SKIPPING TYPESCRIPT GENERATION: Entity ${entity.Name} has no primary keys in metadata. If using soft primary keys, ensure metadata was refreshed after applySoftPKFKConfig().`);
|
|
@@ -254,6 +332,9 @@ ${loadModule}
|
|
|
254
332
|
const sClassName = `${entity.ClassName}Entity`;
|
|
255
333
|
// Sort fields by Sequence, then by __mj_CreatedAt for consistent ordering
|
|
256
334
|
const sortedFields = SortBySequenceAndCreatedAt(entity.Fields);
|
|
335
|
+
// Validated BEFORE the accessors are emitted: a field whose JSONTypeDefinition does not parse is
|
|
336
|
+
// demoted to a plain string here, so it never gets a typed accessor naming a type that is not emitted.
|
|
337
|
+
const jsonTypeBlock = EntitySubClassGeneratorBase.CollectJSONTypeBlock(entity, sortedFields, sClassName);
|
|
257
338
|
const fields = sortedFields.map((e) => {
|
|
258
339
|
let values = '';
|
|
259
340
|
let valueList = '';
|
|
@@ -314,7 +395,7 @@ ${loadModule}
|
|
|
314
395
|
const setterBody = `this.Set('${e.Name}', value);`;
|
|
315
396
|
let sRet = ` /**
|
|
316
397
|
* * Field Name: ${e.Name}${e.DisplayName && e.DisplayName.length > 0 ? '\n * * Display Name: ' + e.DisplayName : ''}
|
|
317
|
-
* * ${fieldDeprecatedFlag}${fieldDisabledFlag}SQL Data Type: ${e.SQLFullType}${e.RelatedEntity ? '\n * * Related Entity/Foreign Key: ' + e.RelatedEntity + ' (' + e.RelatedEntityBaseView + '.' + e.RelatedEntityFieldName + ')' : ''}${e.DefaultValue && e.DefaultValue.length > 0 ? '\n * * Default Value: ' + e.DefaultValue : ''}${valueList}${jsonTypeComment}${e.Description && e.Description.length > 0 ? '\n * * Description: ' + EntitySubClassGeneratorBase.SanitizeDescription(e.Description) : ''}${isaSourceComment}${conflictNote}
|
|
398
|
+
* * ${fieldDeprecatedFlag}${fieldDisabledFlag}SQL Data Type: ${e.SQLFullType}${e.IsBinaryFieldType ? '\n * * Binary Value: base64-encoded string. Decode with Base64ToBytes() — or Base64ToFloat32Vector() for an embedding — from @memberjunction/global.' : ''}${e.RelatedEntity ? '\n * * Related Entity/Foreign Key: ' + e.RelatedEntity + ' (' + e.RelatedEntityBaseView + '.' + e.RelatedEntityFieldName + ')' : ''}${e.DefaultValue && e.DefaultValue.length > 0 ? '\n * * Default Value: ' + e.DefaultValue : ''}${valueList}${jsonTypeComment}${e.Description && e.Description.length > 0 ? '\n * * Description: ' + EntitySubClassGeneratorBase.SanitizeDescription(e.Description) : ''}${isaSourceComment}${conflictNote}
|
|
318
399
|
*/
|
|
319
400
|
get ${safeName}(): ${typeString} {
|
|
320
401
|
${getterBody}
|
|
@@ -325,33 +406,28 @@ ${loadModule}
|
|
|
325
406
|
${setterBody}
|
|
326
407
|
}`;
|
|
327
408
|
}
|
|
328
|
-
// JSONType: emit additional typed "Object" accessor
|
|
409
|
+
// JSONType: emit additional typed "Object" accessor. Both halves delegate to the framework
|
|
410
|
+
// (BaseEntity.GetJSONFieldObject / SetJSONFieldObject) so the object <-> string logic lives once,
|
|
411
|
+
// in core, and edits made in place (obj.a.b = 1, arr.push(x)) are written back to the field.
|
|
329
412
|
if (hasJSONType && jsonTypeAccessorInfo) {
|
|
330
413
|
const objName = `${safeName}Object`;
|
|
331
|
-
const cachedField = `_${objName}_cached`;
|
|
332
|
-
const lastRawField = `_${objName}_lastRaw`;
|
|
333
414
|
const ft = jsonTypeAccessorInfo.fullTypeString;
|
|
415
|
+
const elementType = jsonTypeAccessorInfo.isArray ? `Array<${jsonTypeAccessorInfo.prefixedTypeName}>` : jsonTypeAccessorInfo.prefixedTypeName;
|
|
334
416
|
sRet += `
|
|
335
417
|
|
|
336
|
-
private ${cachedField}: ${ft} | undefined = undefined;
|
|
337
|
-
private ${lastRawField}: string | null = null;
|
|
338
418
|
/**
|
|
339
|
-
* Typed accessor for ${e.Name} —
|
|
340
|
-
*
|
|
419
|
+
* Typed accessor for ${e.Name} — a live view of the parsed JSON as ${elementType}.
|
|
420
|
+
* Edits made through it, at any depth (\`obj.a.b = 1\`, \`arr.push(x)\`, \`delete obj.k\`), update the
|
|
421
|
+
* underlying ${e.Name} field, so it becomes dirty and Save() persists them. If the raw value changes by
|
|
422
|
+
* any other route (Load, Set, revert) the next read re-parses, and objects obtained earlier are
|
|
423
|
+
* detached: writing through one throws. To clone, structuredClone or postMessage the value use
|
|
424
|
+
* ToPlainJSON() from @memberjunction/core.
|
|
341
425
|
*/
|
|
342
426
|
get ${objName}(): ${ft} {
|
|
343
|
-
|
|
344
|
-
if (raw !== this.${lastRawField}) {
|
|
345
|
-
this.${cachedField} = raw ? JSON.parse(raw) : null;
|
|
346
|
-
this.${lastRawField} = raw;
|
|
347
|
-
}
|
|
348
|
-
return this.${cachedField}!;
|
|
427
|
+
return this.GetJSONFieldObject<${elementType}>('${e.Name}')${e.AllowsNull ? '' : '!'};
|
|
349
428
|
}
|
|
350
429
|
set ${objName}(value: ${ft}) {
|
|
351
|
-
|
|
352
|
-
this.${safeName} = raw;
|
|
353
|
-
this.${cachedField} = value;
|
|
354
|
-
this.${lastRawField} = raw;
|
|
430
|
+
this.SetJSONFieldObject<${elementType}>('${e.Name}', value);
|
|
355
431
|
}`;
|
|
356
432
|
}
|
|
357
433
|
return sRet;
|
|
@@ -462,44 +538,6 @@ ${loadModule}
|
|
|
462
538
|
`\n * @deprecated This entity is deprecated and will be removed in a future version. Using it will result in console warnings.` : '';
|
|
463
539
|
const disabledFlag = status === 'disabled' ?
|
|
464
540
|
`\n * @disabled This entity is disabled and will not be available in the application. Attempting to use it will result in exceptions being thrown` : '';
|
|
465
|
-
// Collect and deduplicate JSONTypeDefinitions for this entity.
|
|
466
|
-
// These are raw TypeScript interface/type definitions (from EntityField.JSONTypeDefinition)
|
|
467
|
-
// that get emitted above the entity class so the typed getters/setters can reference them.
|
|
468
|
-
// A Set is used because multiple fields may share the same definition (e.g., a shared config type).
|
|
469
|
-
// Each definition is validated via the TypeScript compiler API before inclusion.
|
|
470
|
-
const jsonTypeDefinitions = new Set();
|
|
471
|
-
for (const field of sortedFields) {
|
|
472
|
-
if (field.JSONTypeDefinition && field.JSONTypeDefinition.trim().length > 0) {
|
|
473
|
-
const definition = field.JSONTypeDefinition.trim();
|
|
474
|
-
if (field.JSONType && field.JSONType.trim().length > 0) {
|
|
475
|
-
const validation = EntitySubClassGeneratorBase.ValidateJSONTypeDefinition(definition, field.JSONType.trim(), entity.Name, field.Name);
|
|
476
|
-
if (!validation.valid) {
|
|
477
|
-
for (const err of validation.errors) {
|
|
478
|
-
logError(err);
|
|
479
|
-
}
|
|
480
|
-
logError(`[JSONType] Skipping JSONTypeDefinition for ${entity.Name}.${field.Name} due to validation errors. The field will use a plain string getter/setter instead.`);
|
|
481
|
-
field.JSONType = null;
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
// Prefix all type names defined in this definition block with the entity class name
|
|
486
|
-
// to avoid naming conflicts across entities. Uses AST to find all defined type names.
|
|
487
|
-
let rewrittenDef = definition;
|
|
488
|
-
const sourceFile = ts.createSourceFile('temp.ts', definition, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
489
|
-
ts.forEachChild(sourceFile, (node) => {
|
|
490
|
-
if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) ||
|
|
491
|
-
ts.isEnumDeclaration(node) || ts.isClassDeclaration(node)) && node.name) {
|
|
492
|
-
const originalName = node.name.text;
|
|
493
|
-
const prefixedName = `${sClassName}_${originalName}`;
|
|
494
|
-
rewrittenDef = rewrittenDef.replace(new RegExp('\\b' + originalName + '\\b', 'g'), prefixedName);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
jsonTypeDefinitions.add(rewrittenDef);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
const jsonTypeBlock = jsonTypeDefinitions.size > 0
|
|
501
|
-
? '\n' + Array.from(jsonTypeDefinitions).join('\n\n') + '\n'
|
|
502
|
-
: '';
|
|
503
541
|
const relatedRecordCollections = EntitySubClassGeneratorBase.GenerateRelatedRecordCollections(entity);
|
|
504
542
|
const embeddedRecords = EntitySubClassGeneratorBase.GenerateEmbeddedRecords(entity);
|
|
505
543
|
const hierarchyMethods = EntitySubClassGeneratorBase.GenerateHierarchyMethods(entity, sClassName);
|
|
@@ -1093,7 +1131,9 @@ ${fields}
|
|
|
1093
1131
|
const linkedRecordPK = f ? f.ID : entity.ID;
|
|
1094
1132
|
const newGeneratedCodeId = uuidv4();
|
|
1095
1133
|
v.generatedCodeId = newGeneratedCodeId;
|
|
1096
|
-
|
|
1134
|
+
// Every table-level validator links to the entity row, so its guard also names the validator.
|
|
1135
|
+
const nameMatch = f ? '' : ` AND ${qi('Name')} = ${lit(v.functionName)}`;
|
|
1136
|
+
const checkQuery = `SELECT 1 FROM ${generatedCodeTbl} WHERE ${qi('CategoryID')} = ${validatorCodeCategoryID} AND ${qi('LinkedEntityID')} = ${lit(linkedEntityID ?? '')} AND ${qi('LinkedRecordPrimaryKey')} = ${lit(linkedRecordPK)}${nameMatch}`;
|
|
1097
1137
|
const insertSQL = `INSERT INTO ${generatedCodeTbl} (${qi('ID')}, ${qi('CategoryID')}, ${qi('GeneratedByModelID')}, ${qi('GeneratedAt')}, ${qi('Language')}, ${qi('Status')}, ${qi('Source')}, ${qi('Code')}, ${qi('Description')}, ${qi('Name')}, ${qi('LinkedEntityID')}, ${qi('LinkedRecordPrimaryKey')})
|
|
1098
1138
|
VALUES (${lit(newGeneratedCodeId)}, ${validatorCodeCategoryID}, ${lit(v.aiModelID)}, ${utcNow}, ${lit('TypeScript')}, ${lit('Approved')}, ${lit(v.sourceCheckConstraint)}, ${lit(v.functionText)}, ${lit(v.functionDescription)}, ${lit(v.functionName)}, ${lit(linkedEntityID ?? '')}, ${lit(linkedRecordPK)})`;
|
|
1099
1139
|
sSQL += `${provider.conditionalInsertSQL(checkQuery, insertSQL)};\n\n`;
|
|
@@ -1115,6 +1155,46 @@ VALUES (${lit(newGeneratedCodeId)}, ${validatorCodeCategoryID}, ${lit(v.aiModelI
|
|
|
1115
1155
|
return null;
|
|
1116
1156
|
}
|
|
1117
1157
|
}
|
|
1158
|
+
/**
|
|
1159
|
+
* The `Validate()` contributions of an entity's opted-in JSONType fields: one
|
|
1160
|
+
* `this.ValidateJSONField(...)` call per field (structural Zod schema, then the field's `@CHECK`
|
|
1161
|
+
* rules) and one doc line per field. Empty when no field is opted in — the common case, in which
|
|
1162
|
+
* generated output is exactly what it was before JSONType validation existed.
|
|
1163
|
+
*
|
|
1164
|
+
* Fields that are read-only, or that are IS-A parent fields mirrored onto a child, are skipped: the
|
|
1165
|
+
* former cannot be written, and the latter are validated by the parent's own generated `Validate()`.
|
|
1166
|
+
*
|
|
1167
|
+
* SQL `@CHECK` rules are emitted from translations already resolved by CodeGen's metadata phase
|
|
1168
|
+
* (`ManageMetadataBase.GeneratedJSONValidators`); one with no translation is skipped with a warning.
|
|
1169
|
+
*/
|
|
1170
|
+
buildJSONValidation(entity) {
|
|
1171
|
+
const calls = [];
|
|
1172
|
+
const docLines = [];
|
|
1173
|
+
const prefix = `${entity.ClassName}Entity`;
|
|
1174
|
+
const translations = this.collectJSONTranslations();
|
|
1175
|
+
for (const field of SortBySequenceAndCreatedAt(entity.Fields)) {
|
|
1176
|
+
const isISAParentField = field.IsVirtual && field.AllowUpdateAPI && entity.IsChildType;
|
|
1177
|
+
const model = field.ReadOnly || isISAParentField ? null : EntitySubClassGeneratorBase.GetOptedInJSONModel(field, entity.Name);
|
|
1178
|
+
if (!model) {
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
const isArray = field.JSONTypeIsArray === true;
|
|
1182
|
+
const ruleSet = BuildJSONRuleSet(model, prefix, prefix, isArray, translations, entity.Name);
|
|
1183
|
+
ruleSet.Errors.forEach((message) => logError(`[JSONType] ${entity.Name}.${field.Name}: ${message}`));
|
|
1184
|
+
ruleSet.Missing.forEach((rule) => LogWarning(`[JSONType] ${entity.Name}.${field.Name}: SQL @CHECK on ${rule.Path} ('${rule.NormalizedText}') has no generated validator and is not emitted`));
|
|
1185
|
+
const root = JSONSchemaConstName(prefix, model.RootName);
|
|
1186
|
+
const schema = isArray ? `z.array(${root})` : root;
|
|
1187
|
+
const rules = ruleSet.Source ? ruleSet.Source.split('\n').map((l, i) => (i === 0 ? l : ` ${l}`)).join('\n') : 'null';
|
|
1188
|
+
calls.push(` this.ValidateJSONField(${JSON.stringify(field.Name)}, ${schema}, ${rules}, '${model.Severity}', result);`);
|
|
1189
|
+
docLines.push(` * * ${field.Name}: JSON structure${ruleSet.Source ? ' and @CHECK rules' : ''} (@mjValidate${model.Severity === 'Warning' ? ' warn' : ''})`);
|
|
1190
|
+
}
|
|
1191
|
+
return { Calls: calls, DocLines: docLines };
|
|
1192
|
+
}
|
|
1193
|
+
/** Key → translation for every resolved SQL `@CHECK` of the run. Tolerates a manage-metadata that predates them. */
|
|
1194
|
+
collectJSONTranslations() {
|
|
1195
|
+
const resolved = ManageMetadataBase.GeneratedJSONValidators ?? [];
|
|
1196
|
+
return new Map(resolved.map((r) => [r.Key, { Description: r.FunctionDescription, Body: r.FunctionText }]));
|
|
1197
|
+
}
|
|
1118
1198
|
GenerateValidateFunction(entity) {
|
|
1119
1199
|
// go through the ManageMetadataBase.generatedFieldValidators to see if we have anything to generate
|
|
1120
1200
|
const unsortedValidators = ManageMetadataBase.generatedValidators.filter((f) => f.entityName.trim().toLowerCase() === entity.Name.trim().toLowerCase());
|
|
@@ -1150,14 +1230,14 @@ VALUES (${lit(newGeneratedCodeId)}, ${validatorCodeCategoryID}, ${lit(v.aiModelI
|
|
|
1150
1230
|
seenFunctionNames.add(v.functionName);
|
|
1151
1231
|
return true;
|
|
1152
1232
|
});
|
|
1153
|
-
|
|
1233
|
+
const jsonValidation = this.buildJSONValidation(entity);
|
|
1234
|
+
if (validators.length === 0 && jsonValidation.Calls.length === 0) {
|
|
1154
1235
|
return null;
|
|
1155
1236
|
}
|
|
1156
1237
|
else {
|
|
1157
1238
|
const validationFunctions = validators.map((f) => {
|
|
1158
1239
|
// output the function text and the function description in a JSDoc block
|
|
1159
|
-
|
|
1160
|
-
const cleansedText = f.functionText.replace(/\\n/g, '\n').replace(/\\t/g, '\t').replace(/\\"/g, '"');
|
|
1240
|
+
const cleansedText = NormalizeGeneratedValidatorText(f.functionText);
|
|
1161
1241
|
// next up, format the function text to have proper indentation with 4 spaces preceding the start of each line
|
|
1162
1242
|
const formattedText = cleansedText.split('\n').map((l) => ` ${l}`).join('\n');
|
|
1163
1243
|
return ` /**
|
|
@@ -1170,23 +1250,56 @@ ${formattedText}`;
|
|
|
1170
1250
|
}).join('\n\n');
|
|
1171
1251
|
const ret = ` /**
|
|
1172
1252
|
* Validate() method override for ${entity.Name} entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
|
|
1173
|
-
${validators.map((f) => ` * * ${f.fieldName ? f.fieldName : 'Table-Level'}: ${EntitySubClassGeneratorBase.SanitizeDescription(f.functionDescription)}`).join('\n')}
|
|
1253
|
+
${[...validators.map((f) => ` * * ${f.fieldName ? f.fieldName : 'Table-Level'}: ${EntitySubClassGeneratorBase.SanitizeDescription(f.functionDescription)}`), ...jsonValidation.DocLines].join('\n')}
|
|
1174
1254
|
* @public
|
|
1175
1255
|
* @method
|
|
1176
1256
|
* @override
|
|
1177
1257
|
*/
|
|
1178
1258
|
public override Validate(): ValidationResult {
|
|
1179
1259
|
const result = super.Validate();
|
|
1180
|
-
${validators.map((f) => ` this.${f.functionName}(result);`).join('\n')}
|
|
1181
|
-
result.Success = result.Success && (result.Errors.length === 0);
|
|
1260
|
+
${[...validators.map((f) => ` this.${f.functionName}(result);`), ...jsonValidation.Calls].join('\n')}
|
|
1261
|
+
result.Success = result.Success && ${jsonValidation.Calls.length > 0 ? '!result.Errors.some((e) => e.Type === ValidationErrorType.Failure)' : '(result.Errors.length === 0)'};
|
|
1182
1262
|
|
|
1183
1263
|
return result;
|
|
1184
1264
|
}
|
|
1185
|
-
|
|
1186
|
-
${validationFunctions}`;
|
|
1265
|
+
${validationFunctions.length > 0 ? '\n' + validationFunctions : ''}`;
|
|
1187
1266
|
return { code: ret, validators: validators };
|
|
1188
1267
|
}
|
|
1189
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Collects the exported structural Zod consts of a field bound to an opted-in JSONType (nothing for
|
|
1271
|
+
* a field that is not opted in). The consts are used ONLY by the generated `Validate()` and by
|
|
1272
|
+
* consumers that want to `z.infer` / `safeParse` the object shape; the field's own column entry in
|
|
1273
|
+
* `<Entity>Schema` stays `z.any()` because the column's value everywhere (Get, GetAll, LoadFromData,
|
|
1274
|
+
* GraphQL, raw rows) is JSON TEXT, and the typed object view is the `<Field>Object` accessor. `consts`
|
|
1275
|
+
* is keyed by const name, so a declaration reached from several fields or definitions is emitted
|
|
1276
|
+
* once. Constructs Zod cannot express are reported here as warnings and become unchecked sub-trees;
|
|
1277
|
+
* they never fail the run.
|
|
1278
|
+
*/
|
|
1279
|
+
collectStructuralJSONSchema(entity, field, consts) {
|
|
1280
|
+
const model = EntitySubClassGeneratorBase.GetOptedInJSONModel(field, entity.Name);
|
|
1281
|
+
if (!model) {
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
const prefix = `${entity.ClassName}Entity`;
|
|
1285
|
+
const converted = GenerateJSONTypeZod(model, prefix);
|
|
1286
|
+
for (const warning of converted.Warnings) {
|
|
1287
|
+
LogWarning(`[JSONType] ${entity.Name}.${field.Name}: ${warning}`);
|
|
1288
|
+
}
|
|
1289
|
+
for (const orphan of FindUnattachedTagComments(model)) {
|
|
1290
|
+
LogWarning(`[JSONType] ${entity.Name}.${field.Name}: a comment carrying tags is attached to nothing and its tags are ignored — start the comment on its own line, not on the line of the opening '{' (${orphan})`);
|
|
1291
|
+
}
|
|
1292
|
+
for (const [name, source] of converted.Consts) {
|
|
1293
|
+
const existing = consts.get(name);
|
|
1294
|
+
if (existing === undefined) {
|
|
1295
|
+
consts.set(name, source);
|
|
1296
|
+
}
|
|
1297
|
+
else if (existing !== source) {
|
|
1298
|
+
// Same prefixed name, different shape: two definitions on this entity declare the type differently.
|
|
1299
|
+
logError(`[JSONType] ${entity.Name}.${field.Name}: '${name}' is declared differently by another JSONType definition on this entity; the first declaration's schema is used. Give the types distinct names.`);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1190
1303
|
GenerateSchemaAndType(entity) {
|
|
1191
1304
|
let content = '';
|
|
1192
1305
|
if (entity.PrimaryKeys.length === 0) {
|
|
@@ -1195,6 +1308,7 @@ ${validationFunctions}`;
|
|
|
1195
1308
|
else {
|
|
1196
1309
|
// Sort fields by Sequence, then by __mj_CreatedAt for consistent ordering
|
|
1197
1310
|
const sortedFields = SortBySequenceAndCreatedAt(entity.Fields);
|
|
1311
|
+
const jsonSchemaConsts = new Map();
|
|
1198
1312
|
const fields = sortedFields.map((e) => {
|
|
1199
1313
|
let values = '';
|
|
1200
1314
|
let valueList = '';
|
|
@@ -1204,12 +1318,14 @@ ${validationFunctions}`;
|
|
|
1204
1318
|
values = sortedValues.map((v) => `\n * * ${v.Value}${v.Description && v.Description.length > 0 ? ' - ' + v.Description : ''}`).join('');
|
|
1205
1319
|
valueList = `\n * * Value List Type: ${e.ValueListType}\n * * Possible Values ` + values;
|
|
1206
1320
|
}
|
|
1207
|
-
// JSONType fields use z.any() in the Zod schema
|
|
1208
|
-
//
|
|
1321
|
+
// JSONType fields ALWAYS use z.any() in the entity Zod schema (the column value is JSON text).
|
|
1322
|
+
// A type that opted in with @mjValidate additionally gets exported structural schema consts,
|
|
1323
|
+
// converted from the type's AST, that Validate() uses to check the parsed shape.
|
|
1209
1324
|
const hasJSONType = e.JSONType && e.JSONType.trim().length > 0;
|
|
1210
1325
|
let typeString = `${TypeScriptTypeFromSQLType(e.Type).toLowerCase()}()` + (e.AllowsNull ? '.nullable()' : '');
|
|
1211
1326
|
if (hasJSONType) {
|
|
1212
1327
|
typeString = `any()${e.AllowsNull ? '.nullable()' : ''}`;
|
|
1328
|
+
this.collectStructuralJSONSchema(entity, e, jsonSchemaConsts);
|
|
1213
1329
|
}
|
|
1214
1330
|
else if (e.ValueListTypeEnum !== EntityFieldValueListType.None && e.EntityFieldValues && e.EntityFieldValues.length > 0) {
|
|
1215
1331
|
// construct a typeString that is a union of the possible values
|
|
@@ -1235,7 +1351,8 @@ ${validationFunctions}`;
|
|
|
1235
1351
|
return sRet;
|
|
1236
1352
|
}).join('\n');
|
|
1237
1353
|
const schemaName = `${entity.ClassName}Schema`;
|
|
1238
|
-
|
|
1354
|
+
const jsonSchemaBlock = jsonSchemaConsts.size > 0 ? `\n${Array.from(jsonSchemaConsts.values()).join('\n\n')}\n` : '';
|
|
1355
|
+
content = `${jsonSchemaBlock}
|
|
1239
1356
|
/**
|
|
1240
1357
|
* zod schema definition for the entity ${entity.Name}
|
|
1241
1358
|
*/
|