@api-client/core 0.20.2 → 0.20.4
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/build/src/modeling/Semantics.d.ts +0 -252
- package/build/src/modeling/Semantics.d.ts.map +1 -1
- package/build/src/modeling/Semantics.js +0 -356
- package/build/src/modeling/Semantics.js.map +1 -1
- package/build/src/modeling/ai/tools/Semantic.tools.d.ts +0 -3
- package/build/src/modeling/ai/tools/Semantic.tools.d.ts.map +1 -1
- package/build/src/modeling/types.d.ts +50 -0
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/modeling/Semantics.ts +40 -520
- package/src/modeling/types.ts +52 -0
- package/tests/unit/modeling/client_ip_address_semantic.spec.ts +0 -22
- package/tests/unit/modeling/semantics.spec.ts +0 -65
- package/tests/unit/modeling/username_semantic.spec.ts +0 -32
- package/build/src/runtime/modeling/Semantics.d.ts +0 -84
- package/build/src/runtime/modeling/Semantics.d.ts.map +0 -1
- package/build/src/runtime/modeling/Semantics.js +0 -124
- package/build/src/runtime/modeling/Semantics.js.map +0 -1
- package/src/runtime/modeling/Semantics.ts +0 -196
- package/tests/unit/modeling/semantic_runtime.spec.ts +0 -113
|
@@ -300,104 +300,6 @@ export var SemanticCategory;
|
|
|
300
300
|
*/
|
|
301
301
|
SemanticCategory["Computed"] = "Computed Values";
|
|
302
302
|
})(SemanticCategory || (SemanticCategory = {}));
|
|
303
|
-
/**
|
|
304
|
-
* Defines when a semantic should execute in relation to database operations.
|
|
305
|
-
*/
|
|
306
|
-
export var SemanticTiming;
|
|
307
|
-
(function (SemanticTiming) {
|
|
308
|
-
/**
|
|
309
|
-
* Execute before the database operation (validation, preprocessing)
|
|
310
|
-
*/
|
|
311
|
-
SemanticTiming["Before"] = "Before";
|
|
312
|
-
/**
|
|
313
|
-
* Execute after the database operation (cleanup, notifications, derived values)
|
|
314
|
-
*/
|
|
315
|
-
SemanticTiming["After"] = "After";
|
|
316
|
-
/**
|
|
317
|
-
* Execute both before and after the operation
|
|
318
|
-
*/
|
|
319
|
-
SemanticTiming["Both"] = "Both";
|
|
320
|
-
/**
|
|
321
|
-
* No automatic execution (manual/on-demand only)
|
|
322
|
-
*/
|
|
323
|
-
SemanticTiming["None"] = "None";
|
|
324
|
-
})(SemanticTiming || (SemanticTiming = {}));
|
|
325
|
-
/**
|
|
326
|
-
* Defines which database operations can trigger a semantic.
|
|
327
|
-
*/
|
|
328
|
-
export var SemanticOperation;
|
|
329
|
-
(function (SemanticOperation) {
|
|
330
|
-
SemanticOperation["Create"] = "Create";
|
|
331
|
-
SemanticOperation["Read"] = "Read";
|
|
332
|
-
SemanticOperation["Update"] = "Update";
|
|
333
|
-
SemanticOperation["Delete"] = "Delete";
|
|
334
|
-
/**
|
|
335
|
-
* Special operation for list operations
|
|
336
|
-
*/
|
|
337
|
-
SemanticOperation["List"] = "List";
|
|
338
|
-
/**
|
|
339
|
-
* Special operation for search operations
|
|
340
|
-
*/
|
|
341
|
-
SemanticOperation["Search"] = "Search";
|
|
342
|
-
})(SemanticOperation || (SemanticOperation = {}));
|
|
343
|
-
/**
|
|
344
|
-
* Defines the execution mode for a semantic.
|
|
345
|
-
*/
|
|
346
|
-
export var SemanticExecutionMode;
|
|
347
|
-
(function (SemanticExecutionMode) {
|
|
348
|
-
/**
|
|
349
|
-
* Execute synchronously as part of the main operation
|
|
350
|
-
*/
|
|
351
|
-
SemanticExecutionMode["Synchronous"] = "Synchronous";
|
|
352
|
-
/**
|
|
353
|
-
* Execute asynchronously after the main operation
|
|
354
|
-
*/
|
|
355
|
-
SemanticExecutionMode["Asynchronous"] = "Asynchronous";
|
|
356
|
-
/**
|
|
357
|
-
* Execute in background/queue (fire and forget)
|
|
358
|
-
*/
|
|
359
|
-
SemanticExecutionMode["Background"] = "Background";
|
|
360
|
-
})(SemanticExecutionMode || (SemanticExecutionMode = {}));
|
|
361
|
-
/**
|
|
362
|
-
* Defines validation strategies for semantics.
|
|
363
|
-
*/
|
|
364
|
-
export var SemanticValidationStrategy;
|
|
365
|
-
(function (SemanticValidationStrategy) {
|
|
366
|
-
/**
|
|
367
|
-
* Fail the operation if semantic validation fails
|
|
368
|
-
*/
|
|
369
|
-
SemanticValidationStrategy["Strict"] = "Strict";
|
|
370
|
-
/**
|
|
371
|
-
* Log warnings but continue operation
|
|
372
|
-
*/
|
|
373
|
-
SemanticValidationStrategy["Warning"] = "Warning";
|
|
374
|
-
/**
|
|
375
|
-
* Skip validation entirely
|
|
376
|
-
*/
|
|
377
|
-
SemanticValidationStrategy["Skip"] = "Skip";
|
|
378
|
-
})(SemanticValidationStrategy || (SemanticValidationStrategy = {}));
|
|
379
|
-
/**
|
|
380
|
-
* Defines caching strategies for computed semantics.
|
|
381
|
-
*/
|
|
382
|
-
export var SemanticCacheStrategy;
|
|
383
|
-
(function (SemanticCacheStrategy) {
|
|
384
|
-
/**
|
|
385
|
-
* No caching - always compute
|
|
386
|
-
*/
|
|
387
|
-
SemanticCacheStrategy["None"] = "None";
|
|
388
|
-
/**
|
|
389
|
-
* Cache until dependent fields change
|
|
390
|
-
*/
|
|
391
|
-
SemanticCacheStrategy["Dependency"] = "Dependency";
|
|
392
|
-
/**
|
|
393
|
-
* Cache with TTL expiration
|
|
394
|
-
*/
|
|
395
|
-
SemanticCacheStrategy["TimeToLive"] = "TimeToLive";
|
|
396
|
-
/**
|
|
397
|
-
* Cache until manually invalidated
|
|
398
|
-
*/
|
|
399
|
-
SemanticCacheStrategy["Manual"] = "Manual";
|
|
400
|
-
})(SemanticCacheStrategy || (SemanticCacheStrategy = {}));
|
|
401
303
|
/**
|
|
402
304
|
* A type guard to check if a semantic is an EntitySemantic.
|
|
403
305
|
*/
|
|
@@ -425,10 +327,6 @@ export const DataSemantics = {
|
|
|
425
327
|
description: 'System users and accounts',
|
|
426
328
|
category: SemanticCategory.Identity,
|
|
427
329
|
hasConfig: false,
|
|
428
|
-
runtime: {
|
|
429
|
-
timing: SemanticTiming.None,
|
|
430
|
-
operations: [],
|
|
431
|
-
},
|
|
432
330
|
},
|
|
433
331
|
[SemanticType.Password]: {
|
|
434
332
|
id: SemanticType.Password,
|
|
@@ -438,19 +336,6 @@ export const DataSemantics = {
|
|
|
438
336
|
category: SemanticCategory.Identity,
|
|
439
337
|
applicableDataTypes: ['string'],
|
|
440
338
|
hasConfig: true,
|
|
441
|
-
runtime: {
|
|
442
|
-
timing: SemanticTiming.Before,
|
|
443
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
444
|
-
priority: 10, // High priority for security
|
|
445
|
-
canDisable: false, // Security semantics cannot be disabled
|
|
446
|
-
timeoutMs: 2000, // Allow time for hashing
|
|
447
|
-
conditions: [
|
|
448
|
-
{
|
|
449
|
-
expression: 'entity[semantics.Password] != null && entity[semantics.Password].length > 0',
|
|
450
|
-
description: 'Only process when password field has a value',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
},
|
|
454
339
|
},
|
|
455
340
|
[SemanticType.Username]: {
|
|
456
341
|
id: SemanticType.Username,
|
|
@@ -460,13 +345,6 @@ export const DataSemantics = {
|
|
|
460
345
|
category: SemanticCategory.Identity,
|
|
461
346
|
applicableDataTypes: ['string'],
|
|
462
347
|
hasConfig: false,
|
|
463
|
-
runtime: {
|
|
464
|
-
timing: SemanticTiming.Before,
|
|
465
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read],
|
|
466
|
-
priority: 15, // High priority for authentication
|
|
467
|
-
canDisable: false, // Security semantics cannot be disabled
|
|
468
|
-
timeoutMs: 100, // Fast operation
|
|
469
|
-
},
|
|
470
348
|
},
|
|
471
349
|
[SemanticType.UserRole]: {
|
|
472
350
|
id: SemanticType.UserRole,
|
|
@@ -476,17 +354,6 @@ export const DataSemantics = {
|
|
|
476
354
|
category: SemanticCategory.Identity,
|
|
477
355
|
applicableDataTypes: ['string'],
|
|
478
356
|
hasConfig: false,
|
|
479
|
-
runtime: {
|
|
480
|
-
timing: SemanticTiming.Before,
|
|
481
|
-
operations: [
|
|
482
|
-
SemanticOperation.Create,
|
|
483
|
-
SemanticOperation.Read,
|
|
484
|
-
SemanticOperation.Update,
|
|
485
|
-
SemanticOperation.Delete,
|
|
486
|
-
SemanticOperation.List,
|
|
487
|
-
],
|
|
488
|
-
priority: 20,
|
|
489
|
-
},
|
|
490
357
|
},
|
|
491
358
|
[SemanticType.ResourceOwnerIdentifier]: {
|
|
492
359
|
id: SemanticType.ResourceOwnerIdentifier,
|
|
@@ -495,18 +362,6 @@ export const DataSemantics = {
|
|
|
495
362
|
description: 'Links record to owner user',
|
|
496
363
|
category: SemanticCategory.Identity,
|
|
497
364
|
hasConfig: false,
|
|
498
|
-
runtime: {
|
|
499
|
-
timing: SemanticTiming.Before,
|
|
500
|
-
operations: [
|
|
501
|
-
SemanticOperation.Create,
|
|
502
|
-
SemanticOperation.Read,
|
|
503
|
-
SemanticOperation.Update,
|
|
504
|
-
SemanticOperation.Delete,
|
|
505
|
-
SemanticOperation.List,
|
|
506
|
-
],
|
|
507
|
-
priority: 5, // Very high priority for access control
|
|
508
|
-
canDisable: false,
|
|
509
|
-
},
|
|
510
365
|
},
|
|
511
366
|
//
|
|
512
367
|
// Timestamps & Versioning
|
|
@@ -519,18 +374,6 @@ export const DataSemantics = {
|
|
|
519
374
|
category: SemanticCategory.Lifecycle,
|
|
520
375
|
applicableDataTypes: ['datetime'],
|
|
521
376
|
hasConfig: false,
|
|
522
|
-
runtime: {
|
|
523
|
-
timing: SemanticTiming.Before,
|
|
524
|
-
operations: [SemanticOperation.Create],
|
|
525
|
-
priority: 90,
|
|
526
|
-
timeoutMs: 100, // Very fast operation
|
|
527
|
-
conditions: [
|
|
528
|
-
{
|
|
529
|
-
expression: 'entity[semantics.CreatedTimestamp] == null',
|
|
530
|
-
description: 'Only set timestamp if not already provided',
|
|
531
|
-
},
|
|
532
|
-
],
|
|
533
|
-
},
|
|
534
377
|
},
|
|
535
378
|
[SemanticType.UpdatedTimestamp]: {
|
|
536
379
|
id: SemanticType.UpdatedTimestamp,
|
|
@@ -540,11 +383,6 @@ export const DataSemantics = {
|
|
|
540
383
|
category: SemanticCategory.Lifecycle,
|
|
541
384
|
applicableDataTypes: ['datetime'],
|
|
542
385
|
hasConfig: false,
|
|
543
|
-
runtime: {
|
|
544
|
-
timing: SemanticTiming.Before,
|
|
545
|
-
operations: [SemanticOperation.Update],
|
|
546
|
-
priority: 90,
|
|
547
|
-
},
|
|
548
386
|
},
|
|
549
387
|
[SemanticType.DeletedTimestamp]: {
|
|
550
388
|
id: SemanticType.DeletedTimestamp,
|
|
@@ -554,11 +392,6 @@ export const DataSemantics = {
|
|
|
554
392
|
category: SemanticCategory.Lifecycle,
|
|
555
393
|
applicableDataTypes: ['datetime'],
|
|
556
394
|
hasConfig: false,
|
|
557
|
-
runtime: {
|
|
558
|
-
timing: SemanticTiming.Before,
|
|
559
|
-
operations: [SemanticOperation.Delete],
|
|
560
|
-
priority: 80,
|
|
561
|
-
},
|
|
562
395
|
},
|
|
563
396
|
[SemanticType.DeletedFlag]: {
|
|
564
397
|
id: SemanticType.DeletedFlag,
|
|
@@ -568,11 +401,6 @@ export const DataSemantics = {
|
|
|
568
401
|
category: SemanticCategory.Lifecycle,
|
|
569
402
|
applicableDataTypes: ['boolean'],
|
|
570
403
|
hasConfig: false,
|
|
571
|
-
runtime: {
|
|
572
|
-
timing: SemanticTiming.Before,
|
|
573
|
-
operations: [SemanticOperation.Delete, SemanticOperation.Read, SemanticOperation.List],
|
|
574
|
-
priority: 80,
|
|
575
|
-
},
|
|
576
404
|
},
|
|
577
405
|
//
|
|
578
406
|
// Contact & Address
|
|
@@ -588,10 +416,6 @@ export const DataSemantics = {
|
|
|
588
416
|
// - validationProvider (enum): Options like None, GoogleMaps, or Loqate. This determines if the API returns an error for non-existent addresses.
|
|
589
417
|
// - strictness (enum): Lax (accept anything) vs. Strict (reject if not deliverable).
|
|
590
418
|
hasConfig: false,
|
|
591
|
-
runtime: {
|
|
592
|
-
timing: SemanticTiming.None,
|
|
593
|
-
operations: [],
|
|
594
|
-
},
|
|
595
419
|
},
|
|
596
420
|
[SemanticType.StreetAddress]: {
|
|
597
421
|
id: SemanticType.StreetAddress,
|
|
@@ -601,10 +425,6 @@ export const DataSemantics = {
|
|
|
601
425
|
category: SemanticCategory.Contact,
|
|
602
426
|
applicableDataTypes: ['string'],
|
|
603
427
|
hasConfig: false,
|
|
604
|
-
runtime: {
|
|
605
|
-
timing: SemanticTiming.None,
|
|
606
|
-
operations: [],
|
|
607
|
-
},
|
|
608
428
|
},
|
|
609
429
|
[SemanticType.StreetAddressSupplemental]: {
|
|
610
430
|
id: SemanticType.StreetAddressSupplemental,
|
|
@@ -614,10 +434,6 @@ export const DataSemantics = {
|
|
|
614
434
|
category: SemanticCategory.Contact,
|
|
615
435
|
applicableDataTypes: ['string'],
|
|
616
436
|
hasConfig: false,
|
|
617
|
-
runtime: {
|
|
618
|
-
timing: SemanticTiming.None,
|
|
619
|
-
operations: [],
|
|
620
|
-
},
|
|
621
437
|
},
|
|
622
438
|
[SemanticType.City]: {
|
|
623
439
|
id: SemanticType.City,
|
|
@@ -627,10 +443,6 @@ export const DataSemantics = {
|
|
|
627
443
|
category: SemanticCategory.Contact,
|
|
628
444
|
applicableDataTypes: ['string'],
|
|
629
445
|
hasConfig: false,
|
|
630
|
-
runtime: {
|
|
631
|
-
timing: SemanticTiming.None,
|
|
632
|
-
operations: [],
|
|
633
|
-
},
|
|
634
446
|
},
|
|
635
447
|
[SemanticType.PostalCode]: {
|
|
636
448
|
id: SemanticType.PostalCode,
|
|
@@ -640,10 +452,6 @@ export const DataSemantics = {
|
|
|
640
452
|
category: SemanticCategory.Contact,
|
|
641
453
|
applicableDataTypes: ['string'],
|
|
642
454
|
hasConfig: true,
|
|
643
|
-
runtime: {
|
|
644
|
-
timing: SemanticTiming.None,
|
|
645
|
-
operations: [],
|
|
646
|
-
},
|
|
647
455
|
},
|
|
648
456
|
[SemanticType.Country]: {
|
|
649
457
|
id: SemanticType.Country,
|
|
@@ -653,10 +461,6 @@ export const DataSemantics = {
|
|
|
653
461
|
category: SemanticCategory.Contact,
|
|
654
462
|
applicableDataTypes: ['string'],
|
|
655
463
|
hasConfig: true,
|
|
656
|
-
runtime: {
|
|
657
|
-
timing: SemanticTiming.None,
|
|
658
|
-
operations: [],
|
|
659
|
-
},
|
|
660
464
|
},
|
|
661
465
|
[SemanticType.Region]: {
|
|
662
466
|
id: SemanticType.Region,
|
|
@@ -666,10 +470,6 @@ export const DataSemantics = {
|
|
|
666
470
|
category: SemanticCategory.Contact,
|
|
667
471
|
applicableDataTypes: ['string'],
|
|
668
472
|
hasConfig: false,
|
|
669
|
-
runtime: {
|
|
670
|
-
timing: SemanticTiming.None,
|
|
671
|
-
operations: [],
|
|
672
|
-
},
|
|
673
473
|
},
|
|
674
474
|
[SemanticType.Version]: {
|
|
675
475
|
id: SemanticType.Version,
|
|
@@ -679,11 +479,6 @@ export const DataSemantics = {
|
|
|
679
479
|
category: SemanticCategory.Lifecycle,
|
|
680
480
|
applicableDataTypes: ['number'],
|
|
681
481
|
hasConfig: false,
|
|
682
|
-
runtime: {
|
|
683
|
-
timing: SemanticTiming.Before,
|
|
684
|
-
operations: [SemanticOperation.Update],
|
|
685
|
-
priority: 85,
|
|
686
|
-
},
|
|
687
482
|
},
|
|
688
483
|
//
|
|
689
484
|
// Content & Media
|
|
@@ -696,10 +491,6 @@ export const DataSemantics = {
|
|
|
696
491
|
category: SemanticCategory.Content,
|
|
697
492
|
applicableDataTypes: ['string'],
|
|
698
493
|
hasConfig: false,
|
|
699
|
-
runtime: {
|
|
700
|
-
timing: SemanticTiming.None,
|
|
701
|
-
operations: [],
|
|
702
|
-
},
|
|
703
494
|
},
|
|
704
495
|
[SemanticType.Name]: {
|
|
705
496
|
id: SemanticType.Name,
|
|
@@ -709,10 +500,6 @@ export const DataSemantics = {
|
|
|
709
500
|
category: SemanticCategory.Content,
|
|
710
501
|
applicableDataTypes: ['string'],
|
|
711
502
|
hasConfig: false,
|
|
712
|
-
runtime: {
|
|
713
|
-
timing: SemanticTiming.None,
|
|
714
|
-
operations: [],
|
|
715
|
-
},
|
|
716
503
|
},
|
|
717
504
|
[SemanticType.Description]: {
|
|
718
505
|
id: SemanticType.Description,
|
|
@@ -722,10 +509,6 @@ export const DataSemantics = {
|
|
|
722
509
|
category: SemanticCategory.Content,
|
|
723
510
|
applicableDataTypes: ['string'],
|
|
724
511
|
hasConfig: false,
|
|
725
|
-
runtime: {
|
|
726
|
-
timing: SemanticTiming.None,
|
|
727
|
-
operations: [],
|
|
728
|
-
},
|
|
729
512
|
},
|
|
730
513
|
[SemanticType.Summary]: {
|
|
731
514
|
id: SemanticType.Summary,
|
|
@@ -735,10 +518,6 @@ export const DataSemantics = {
|
|
|
735
518
|
category: SemanticCategory.Content,
|
|
736
519
|
applicableDataTypes: ['string'],
|
|
737
520
|
hasConfig: false,
|
|
738
|
-
runtime: {
|
|
739
|
-
timing: SemanticTiming.None,
|
|
740
|
-
operations: [],
|
|
741
|
-
},
|
|
742
521
|
},
|
|
743
522
|
[SemanticType.Markdown]: {
|
|
744
523
|
id: SemanticType.Markdown,
|
|
@@ -748,11 +527,6 @@ export const DataSemantics = {
|
|
|
748
527
|
category: SemanticCategory.Content,
|
|
749
528
|
applicableDataTypes: ['string'],
|
|
750
529
|
hasConfig: true,
|
|
751
|
-
runtime: {
|
|
752
|
-
timing: SemanticTiming.Before,
|
|
753
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
754
|
-
priority: 50, // Process before storage
|
|
755
|
-
},
|
|
756
530
|
},
|
|
757
531
|
[SemanticType.HTML]: {
|
|
758
532
|
id: SemanticType.HTML,
|
|
@@ -762,11 +536,6 @@ export const DataSemantics = {
|
|
|
762
536
|
category: SemanticCategory.Content,
|
|
763
537
|
applicableDataTypes: ['string'],
|
|
764
538
|
hasConfig: true,
|
|
765
|
-
runtime: {
|
|
766
|
-
timing: SemanticTiming.Before,
|
|
767
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
768
|
-
priority: 50, // Process before storage for sanitization
|
|
769
|
-
},
|
|
770
539
|
},
|
|
771
540
|
[SemanticType.ImageURL]: {
|
|
772
541
|
id: SemanticType.ImageURL,
|
|
@@ -776,11 +545,6 @@ export const DataSemantics = {
|
|
|
776
545
|
category: SemanticCategory.Content,
|
|
777
546
|
applicableDataTypes: ['string'],
|
|
778
547
|
hasConfig: false,
|
|
779
|
-
runtime: {
|
|
780
|
-
timing: SemanticTiming.Before,
|
|
781
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
782
|
-
priority: 60, // Validate URLs before storage
|
|
783
|
-
},
|
|
784
548
|
},
|
|
785
549
|
[SemanticType.FileURL]: {
|
|
786
550
|
id: SemanticType.FileURL,
|
|
@@ -790,11 +554,6 @@ export const DataSemantics = {
|
|
|
790
554
|
category: SemanticCategory.Content,
|
|
791
555
|
applicableDataTypes: ['string'],
|
|
792
556
|
hasConfig: false,
|
|
793
|
-
runtime: {
|
|
794
|
-
timing: SemanticTiming.Before,
|
|
795
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
796
|
-
priority: 60, // Validate URLs before storage
|
|
797
|
-
},
|
|
798
557
|
},
|
|
799
558
|
//
|
|
800
559
|
// Business Data
|
|
@@ -807,11 +566,6 @@ export const DataSemantics = {
|
|
|
807
566
|
category: SemanticCategory.Business,
|
|
808
567
|
applicableDataTypes: ['string'],
|
|
809
568
|
hasConfig: true,
|
|
810
|
-
runtime: {
|
|
811
|
-
timing: SemanticTiming.Both,
|
|
812
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read, SemanticOperation.List],
|
|
813
|
-
priority: 30, // Validate state transitions before, filter by state after
|
|
814
|
-
},
|
|
815
569
|
},
|
|
816
570
|
[SemanticType.Currency]: {
|
|
817
571
|
id: SemanticType.Currency,
|
|
@@ -821,11 +575,6 @@ export const DataSemantics = {
|
|
|
821
575
|
category: SemanticCategory.Business,
|
|
822
576
|
applicableDataTypes: ['number', 'string'],
|
|
823
577
|
hasConfig: true,
|
|
824
|
-
runtime: {
|
|
825
|
-
timing: SemanticTiming.Before,
|
|
826
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
827
|
-
priority: 70, // Validate currency format and precision
|
|
828
|
-
},
|
|
829
578
|
},
|
|
830
579
|
[SemanticType.SKU]: {
|
|
831
580
|
id: SemanticType.SKU,
|
|
@@ -835,11 +584,6 @@ export const DataSemantics = {
|
|
|
835
584
|
category: SemanticCategory.Business,
|
|
836
585
|
applicableDataTypes: ['string'],
|
|
837
586
|
hasConfig: true,
|
|
838
|
-
runtime: {
|
|
839
|
-
timing: SemanticTiming.Before,
|
|
840
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
841
|
-
priority: 25, // High priority for uniqueness validation
|
|
842
|
-
},
|
|
843
587
|
},
|
|
844
588
|
//
|
|
845
589
|
// Contact Information
|
|
@@ -852,11 +596,6 @@ export const DataSemantics = {
|
|
|
852
596
|
category: SemanticCategory.Contact,
|
|
853
597
|
applicableDataTypes: ['string'],
|
|
854
598
|
hasConfig: true,
|
|
855
|
-
runtime: {
|
|
856
|
-
timing: SemanticTiming.Before,
|
|
857
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
858
|
-
priority: 40, // Validate email format
|
|
859
|
-
},
|
|
860
599
|
},
|
|
861
600
|
[SemanticType.Phone]: {
|
|
862
601
|
id: SemanticType.Phone,
|
|
@@ -866,11 +605,6 @@ export const DataSemantics = {
|
|
|
866
605
|
category: SemanticCategory.Contact,
|
|
867
606
|
applicableDataTypes: ['string'],
|
|
868
607
|
hasConfig: true,
|
|
869
|
-
runtime: {
|
|
870
|
-
timing: SemanticTiming.Before,
|
|
871
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
872
|
-
priority: 40, // Validate phone format
|
|
873
|
-
},
|
|
874
608
|
},
|
|
875
609
|
[SemanticType.URL]: {
|
|
876
610
|
id: SemanticType.URL,
|
|
@@ -880,11 +614,6 @@ export const DataSemantics = {
|
|
|
880
614
|
category: SemanticCategory.Contact,
|
|
881
615
|
applicableDataTypes: ['string'],
|
|
882
616
|
hasConfig: true,
|
|
883
|
-
runtime: {
|
|
884
|
-
timing: SemanticTiming.Before,
|
|
885
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
886
|
-
priority: 40, // Validate URL format
|
|
887
|
-
},
|
|
888
617
|
},
|
|
889
618
|
[SemanticType.ClientIPAddress]: {
|
|
890
619
|
id: SemanticType.ClientIPAddress,
|
|
@@ -894,18 +623,6 @@ export const DataSemantics = {
|
|
|
894
623
|
category: SemanticCategory.Contact,
|
|
895
624
|
applicableDataTypes: ['string'],
|
|
896
625
|
hasConfig: false,
|
|
897
|
-
runtime: {
|
|
898
|
-
timing: SemanticTiming.Before,
|
|
899
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
900
|
-
priority: 95, // Low priority, populate after other validations
|
|
901
|
-
timeoutMs: 100, // Very fast operation
|
|
902
|
-
conditions: [
|
|
903
|
-
{
|
|
904
|
-
expression: 'entity[semantics.ClientIPAddress] == null',
|
|
905
|
-
description: 'Only set IP address if not already provided',
|
|
906
|
-
},
|
|
907
|
-
],
|
|
908
|
-
},
|
|
909
626
|
},
|
|
910
627
|
//
|
|
911
628
|
// Classification & Organization
|
|
@@ -918,23 +635,6 @@ export const DataSemantics = {
|
|
|
918
635
|
category: SemanticCategory.Organization,
|
|
919
636
|
applicableDataTypes: ['string'],
|
|
920
637
|
hasConfig: true,
|
|
921
|
-
runtime: {
|
|
922
|
-
timing: SemanticTiming.Before,
|
|
923
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
924
|
-
priority: 30, // Generate slug from title, validate uniqueness
|
|
925
|
-
timeoutMs: 1000,
|
|
926
|
-
conditions: [
|
|
927
|
-
{
|
|
928
|
-
expression: 'entity[semantics.PublicUniqueName] == null || entity[semantics.PublicUniqueName].length == 0',
|
|
929
|
-
description: 'Only generate slug if not already provided',
|
|
930
|
-
},
|
|
931
|
-
// Let's not guess which field is marked as slug source in the `PublicUniqueName` configuration.
|
|
932
|
-
// {
|
|
933
|
-
// expression: 'entity[semantics.Title] != null && entity[semantics.Title].length > 0',
|
|
934
|
-
// description: 'Only generate slug if title field exists and has content',
|
|
935
|
-
// },
|
|
936
|
-
],
|
|
937
|
-
},
|
|
938
638
|
},
|
|
939
639
|
[SemanticType.Tags]: {
|
|
940
640
|
id: SemanticType.Tags,
|
|
@@ -943,11 +643,6 @@ export const DataSemantics = {
|
|
|
943
643
|
description: 'Enable tagging functionality',
|
|
944
644
|
category: SemanticCategory.Organization,
|
|
945
645
|
hasConfig: true,
|
|
946
|
-
runtime: {
|
|
947
|
-
timing: SemanticTiming.After,
|
|
948
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Delete],
|
|
949
|
-
priority: 200, // Process after main operation
|
|
950
|
-
},
|
|
951
646
|
},
|
|
952
647
|
[SemanticType.Categories]: {
|
|
953
648
|
id: SemanticType.Categories,
|
|
@@ -956,11 +651,6 @@ export const DataSemantics = {
|
|
|
956
651
|
description: 'Enable categorization functionality',
|
|
957
652
|
category: SemanticCategory.Organization,
|
|
958
653
|
hasConfig: true,
|
|
959
|
-
runtime: {
|
|
960
|
-
timing: SemanticTiming.After,
|
|
961
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Delete],
|
|
962
|
-
priority: 200, // Process after main operation
|
|
963
|
-
},
|
|
964
654
|
},
|
|
965
655
|
//
|
|
966
656
|
// Location & Geography
|
|
@@ -973,11 +663,6 @@ export const DataSemantics = {
|
|
|
973
663
|
category: SemanticCategory.Location,
|
|
974
664
|
applicableDataTypes: ['string'],
|
|
975
665
|
hasConfig: true,
|
|
976
|
-
runtime: {
|
|
977
|
-
timing: SemanticTiming.Both,
|
|
978
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read, SemanticOperation.List],
|
|
979
|
-
priority: 60, // Validate coordinates before, enable spatial queries after
|
|
980
|
-
},
|
|
981
666
|
},
|
|
982
667
|
//
|
|
983
668
|
// Computed Values
|
|
@@ -991,11 +676,6 @@ export const DataSemantics = {
|
|
|
991
676
|
category: SemanticCategory.Computed,
|
|
992
677
|
applicableDataTypes: ['string', 'number', 'boolean', 'date', 'datetime', 'time', 'binary'],
|
|
993
678
|
hasConfig: true,
|
|
994
|
-
runtime: {
|
|
995
|
-
timing: SemanticTiming.Both,
|
|
996
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read],
|
|
997
|
-
priority: 150, // Calculate after other validations, recalculate on read if needed
|
|
998
|
-
},
|
|
999
679
|
},
|
|
1000
680
|
[SemanticType.Derived]: {
|
|
1001
681
|
id: SemanticType.Derived,
|
|
@@ -1005,44 +685,8 @@ export const DataSemantics = {
|
|
|
1005
685
|
category: SemanticCategory.Computed,
|
|
1006
686
|
applicableDataTypes: ['string'],
|
|
1007
687
|
hasConfig: true,
|
|
1008
|
-
runtime: {
|
|
1009
|
-
timing: SemanticTiming.After,
|
|
1010
|
-
operations: [SemanticOperation.Create, SemanticOperation.Update],
|
|
1011
|
-
priority: 180, // Derive after all other processing
|
|
1012
|
-
},
|
|
1013
688
|
},
|
|
1014
689
|
};
|
|
1015
|
-
/**
|
|
1016
|
-
* Get all semantics that should run for a specific operation and timing
|
|
1017
|
-
*/
|
|
1018
|
-
export function getSemanticsForOperation(semantics, operation, timing) {
|
|
1019
|
-
return semantics
|
|
1020
|
-
.filter((semantic) => {
|
|
1021
|
-
const definition = DataSemantics[semantic.id];
|
|
1022
|
-
if (!definition?.runtime) {
|
|
1023
|
-
return false;
|
|
1024
|
-
}
|
|
1025
|
-
const { timing: semanticTiming, operations } = definition.runtime;
|
|
1026
|
-
// Check if timing matches
|
|
1027
|
-
const timingMatches = semanticTiming === timing || semanticTiming === SemanticTiming.Both;
|
|
1028
|
-
// Check if operation is included
|
|
1029
|
-
const operationMatches = operations.includes(operation);
|
|
1030
|
-
return timingMatches && operationMatches;
|
|
1031
|
-
})
|
|
1032
|
-
.sort((a, b) => {
|
|
1033
|
-
// Sort by priority (lower number = higher priority)
|
|
1034
|
-
const priorityA = DataSemantics[a.id]?.runtime?.priority ?? 100;
|
|
1035
|
-
const priorityB = DataSemantics[b.id]?.runtime?.priority ?? 100;
|
|
1036
|
-
return priorityA - priorityB;
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Check if a specific semantic can be disabled at runtime
|
|
1041
|
-
*/
|
|
1042
|
-
export function canSemanticBeDisabled(semanticType) {
|
|
1043
|
-
const definition = DataSemantics[semanticType];
|
|
1044
|
-
return definition?.runtime?.canDisable !== false; // Default to true if not specified
|
|
1045
|
-
}
|
|
1046
690
|
/**
|
|
1047
691
|
* Helper function to get all semantics grouped by category.
|
|
1048
692
|
* Useful for organizing semantics in UI dropdowns and forms.
|