@api-client/core 0.20.2 → 0.20.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.
@@ -316,255 +316,6 @@ export enum SemanticCategory {
316
316
  Computed = 'Computed Values',
317
317
  }
318
318
 
319
- /**
320
- * Defines when a semantic should execute in relation to database operations.
321
- */
322
- export enum SemanticTiming {
323
- /**
324
- * Execute before the database operation (validation, preprocessing)
325
- */
326
- Before = 'Before',
327
- /**
328
- * Execute after the database operation (cleanup, notifications, derived values)
329
- */
330
- After = 'After',
331
- /**
332
- * Execute both before and after the operation
333
- */
334
- Both = 'Both',
335
- /**
336
- * No automatic execution (manual/on-demand only)
337
- */
338
- None = 'None',
339
- }
340
-
341
- /**
342
- * Defines which database operations can trigger a semantic.
343
- */
344
- export enum SemanticOperation {
345
- Create = 'Create',
346
- Read = 'Read',
347
- Update = 'Update',
348
- Delete = 'Delete',
349
- /**
350
- * Special operation for list operations
351
- */
352
- List = 'List',
353
- /**
354
- * Special operation for search operations
355
- */
356
- Search = 'Search',
357
- }
358
-
359
- /**
360
- * Defines the execution mode for a semantic.
361
- */
362
- export enum SemanticExecutionMode {
363
- /**
364
- * Execute synchronously as part of the main operation
365
- */
366
- Synchronous = 'Synchronous',
367
- /**
368
- * Execute asynchronously after the main operation
369
- */
370
- Asynchronous = 'Asynchronous',
371
- /**
372
- * Execute in background/queue (fire and forget)
373
- */
374
- Background = 'Background',
375
- }
376
-
377
- /**
378
- * Defines validation strategies for semantics.
379
- */
380
- export enum SemanticValidationStrategy {
381
- /**
382
- * Fail the operation if semantic validation fails
383
- */
384
- Strict = 'Strict',
385
- /**
386
- * Log warnings but continue operation
387
- */
388
- Warning = 'Warning',
389
- /**
390
- * Skip validation entirely
391
- */
392
- Skip = 'Skip',
393
- }
394
-
395
- /**
396
- * Defines caching strategies for computed semantics.
397
- */
398
- export enum SemanticCacheStrategy {
399
- /**
400
- * No caching - always compute
401
- */
402
- None = 'None',
403
- /**
404
- * Cache until dependent fields change
405
- */
406
- Dependency = 'Dependency',
407
- /**
408
- * Cache with TTL expiration
409
- */
410
- TimeToLive = 'TimeToLive',
411
- /**
412
- * Cache until manually invalidated
413
- */
414
- Manual = 'Manual',
415
- }
416
-
417
- /**
418
- * Configuration for when and how a semantic should execute at runtime.
419
- */
420
- export interface SemanticRuntimeConfig {
421
- /**
422
- * When the semantic should execute relative to the database operation.
423
- */
424
- timing: SemanticTiming
425
- /**
426
- * Which database operations should trigger this semantic.
427
- */
428
- operations: SemanticOperation[]
429
- /**
430
- * Priority order for execution when multiple semantics apply.
431
- * Lower numbers execute first. Default is 100.
432
- */
433
- priority?: number
434
- /**
435
- * Whether this semantic can be disabled at the entity/property level.
436
- */
437
- canDisable?: boolean
438
- /**
439
- * How the semantic should execute (sync/async/background).
440
- * Default is Synchronous.
441
- * @default Synchronous
442
- */
443
- executionMode?: SemanticExecutionMode
444
- /**
445
- * Validation strategy when semantic processing fails.
446
- * Default is Strict.
447
- * @default Strict
448
- */
449
- validationStrategy?: SemanticValidationStrategy
450
- /**
451
- * Maximum execution time in milliseconds before timeout.
452
- * Default is 5000ms for sync, 30000ms for async.
453
- * @default 5000 for sync, 30000 for async
454
- */
455
- timeoutMs?: number
456
- /**
457
- * Number of retry attempts on failure.
458
- * Default is 0 (no retries).
459
- * @default 0
460
- */
461
- retryAttempts?: number
462
- /**
463
- * Dependencies on other semantics that must execute first.
464
- * Uses semantic IDs.
465
- */
466
- dependencies?: SemanticType[]
467
- /**
468
- * Fields that this semantic depends on for computation.
469
- * Used for cache invalidation and optimization.
470
- */
471
- dependentFields?: string[]
472
- /**
473
- * Caching strategy for computed/derived values.
474
- */
475
- cacheStrategy?: SemanticCacheStrategy
476
- /**
477
- * Cache TTL in seconds (only used with TimeToLive strategy).
478
- */
479
- cacheTtlSeconds?: number
480
- /**
481
- * Whether this semantic should run in transactions.
482
- * Default is true.
483
- */
484
- transactional?: boolean
485
- /**
486
- * Rate limiting configuration for expensive operations.
487
- */
488
- rateLimit?: SemanticRateLimit
489
- /**
490
- * Conditional execution based on data or context.
491
- */
492
- conditions?: SemanticCondition[]
493
- /**
494
- * Audit and logging configuration.
495
- */
496
- audit?: SemanticAudit
497
- }
498
-
499
- export interface SemanticRateLimit {
500
- /**
501
- * Maximum executions per time window.
502
- */
503
- maxExecutions: number
504
- /**
505
- * Time window in seconds.
506
- */
507
- windowSeconds: number
508
- /**
509
- * Strategy when rate limit is exceeded.
510
- */
511
- strategy: 'queue' | 'drop' | 'error'
512
- }
513
-
514
- export interface SemanticCondition {
515
- /**
516
- * JEXL expression that must evaluate to true for execution.
517
- * Has access to entity data, user context, and semantic field references.
518
- *
519
- * Available context variables:
520
- * - `entity`: The entity data being processed
521
- * - `user`: Current user context (if authenticated)
522
- * - `operation`: The current operation (Create, Update, etc.)
523
- * - `semantics`: Object with semantic field accessors
524
- *
525
- * Semantic field references use dot notation:
526
- * - `semantics.CreatedTimestamp` - field with CreatedTimestamp semantic
527
- * - `semantics.Password` - field with Password semantic
528
- * - `semantics.User` - entity with User semantic (for associations)
529
- *
530
- * @example
531
- * // Only set timestamp if not already provided
532
- * "semantics.CreatedTimestamp == null"
533
- *
534
- * @example
535
- * // Only apply to authenticated users
536
- * "user != null && user.authenticated == true"
537
- *
538
- * @example
539
- * // Only hash password if it's a plain text (not already hashed)
540
- * "entity[semantics.Password] != null && !entity[semantics.Password].startsWith('$')"
541
- *
542
- * @example
543
- * // Only generate slug if title exists
544
- * "entity[semantics.Title] != null && entity[semantics.Title].length > 0"
545
- */
546
- expression: string
547
- /**
548
- * Description of when this semantic should run.
549
- */
550
- description: string
551
- }
552
-
553
- export interface SemanticAudit {
554
- /**
555
- * Whether to log semantic execution.
556
- */
557
- logExecution: boolean
558
- /**
559
- * Whether to log input/output data.
560
- */
561
- logData: boolean
562
- /**
563
- * Retention period for audit logs in days.
564
- */
565
- retentionDays: number
566
- }
567
-
568
319
  /**
569
320
  * A base interface for all Data Semantics, containing common properties.
570
321
  * A semantic is an annotation applied to a Data Entity, Property, or Association
@@ -597,10 +348,6 @@ interface BaseDataSemantic {
597
348
  * This is used to determine if the semantic requires additional setup or configuration.
598
349
  */
599
350
  hasConfig: boolean
600
- /**
601
- * Runtime execution configuration for this semantic.
602
- */
603
- runtime: SemanticRuntimeConfig
604
351
  }
605
352
 
606
353
  /**
@@ -668,10 +415,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
668
415
  description: 'System users and accounts',
669
416
  category: SemanticCategory.Identity,
670
417
  hasConfig: false,
671
- runtime: {
672
- timing: SemanticTiming.None,
673
- operations: [],
674
- },
675
418
  },
676
419
  [SemanticType.Password]: {
677
420
  id: SemanticType.Password,
@@ -681,19 +424,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
681
424
  category: SemanticCategory.Identity,
682
425
  applicableDataTypes: ['string'],
683
426
  hasConfig: true,
684
- runtime: {
685
- timing: SemanticTiming.Before,
686
- operations: [SemanticOperation.Create, SemanticOperation.Update],
687
- priority: 10, // High priority for security
688
- canDisable: false, // Security semantics cannot be disabled
689
- timeoutMs: 2000, // Allow time for hashing
690
- conditions: [
691
- {
692
- expression: 'entity[semantics.Password] != null && entity[semantics.Password].length > 0',
693
- description: 'Only process when password field has a value',
694
- },
695
- ],
696
- },
697
427
  },
698
428
  [SemanticType.Username]: {
699
429
  id: SemanticType.Username,
@@ -703,13 +433,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
703
433
  category: SemanticCategory.Identity,
704
434
  applicableDataTypes: ['string'],
705
435
  hasConfig: false,
706
- runtime: {
707
- timing: SemanticTiming.Before,
708
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read],
709
- priority: 15, // High priority for authentication
710
- canDisable: false, // Security semantics cannot be disabled
711
- timeoutMs: 100, // Fast operation
712
- },
713
436
  },
714
437
  [SemanticType.UserRole]: {
715
438
  id: SemanticType.UserRole,
@@ -719,17 +442,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
719
442
  category: SemanticCategory.Identity,
720
443
  applicableDataTypes: ['string'],
721
444
  hasConfig: false,
722
- runtime: {
723
- timing: SemanticTiming.Before,
724
- operations: [
725
- SemanticOperation.Create,
726
- SemanticOperation.Read,
727
- SemanticOperation.Update,
728
- SemanticOperation.Delete,
729
- SemanticOperation.List,
730
- ],
731
- priority: 20,
732
- },
733
445
  },
734
446
  [SemanticType.ResourceOwnerIdentifier]: {
735
447
  id: SemanticType.ResourceOwnerIdentifier,
@@ -738,18 +450,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
738
450
  description: 'Links record to owner user',
739
451
  category: SemanticCategory.Identity,
740
452
  hasConfig: false,
741
- runtime: {
742
- timing: SemanticTiming.Before,
743
- operations: [
744
- SemanticOperation.Create,
745
- SemanticOperation.Read,
746
- SemanticOperation.Update,
747
- SemanticOperation.Delete,
748
- SemanticOperation.List,
749
- ],
750
- priority: 5, // Very high priority for access control
751
- canDisable: false,
752
- },
753
453
  },
754
454
 
755
455
  //
@@ -764,18 +464,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
764
464
  category: SemanticCategory.Lifecycle,
765
465
  applicableDataTypes: ['datetime'],
766
466
  hasConfig: false,
767
- runtime: {
768
- timing: SemanticTiming.Before,
769
- operations: [SemanticOperation.Create],
770
- priority: 90,
771
- timeoutMs: 100, // Very fast operation
772
- conditions: [
773
- {
774
- expression: 'entity[semantics.CreatedTimestamp] == null',
775
- description: 'Only set timestamp if not already provided',
776
- },
777
- ],
778
- },
779
467
  },
780
468
  [SemanticType.UpdatedTimestamp]: {
781
469
  id: SemanticType.UpdatedTimestamp,
@@ -785,11 +473,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
785
473
  category: SemanticCategory.Lifecycle,
786
474
  applicableDataTypes: ['datetime'],
787
475
  hasConfig: false,
788
- runtime: {
789
- timing: SemanticTiming.Before,
790
- operations: [SemanticOperation.Update],
791
- priority: 90,
792
- },
793
476
  },
794
477
  [SemanticType.DeletedTimestamp]: {
795
478
  id: SemanticType.DeletedTimestamp,
@@ -799,11 +482,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
799
482
  category: SemanticCategory.Lifecycle,
800
483
  applicableDataTypes: ['datetime'],
801
484
  hasConfig: false,
802
- runtime: {
803
- timing: SemanticTiming.Before,
804
- operations: [SemanticOperation.Delete],
805
- priority: 80,
806
- },
807
485
  },
808
486
  [SemanticType.DeletedFlag]: {
809
487
  id: SemanticType.DeletedFlag,
@@ -813,11 +491,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
813
491
  category: SemanticCategory.Lifecycle,
814
492
  applicableDataTypes: ['boolean'],
815
493
  hasConfig: false,
816
- runtime: {
817
- timing: SemanticTiming.Before,
818
- operations: [SemanticOperation.Delete, SemanticOperation.Read, SemanticOperation.List],
819
- priority: 80,
820
- },
821
494
  },
822
495
 
823
496
  //
@@ -835,10 +508,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
835
508
  // - validationProvider (enum): Options like None, GoogleMaps, or Loqate. This determines if the API returns an error for non-existent addresses.
836
509
  // - strictness (enum): Lax (accept anything) vs. Strict (reject if not deliverable).
837
510
  hasConfig: false,
838
- runtime: {
839
- timing: SemanticTiming.None,
840
- operations: [],
841
- },
842
511
  },
843
512
  [SemanticType.StreetAddress]: {
844
513
  id: SemanticType.StreetAddress,
@@ -848,10 +517,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
848
517
  category: SemanticCategory.Contact,
849
518
  applicableDataTypes: ['string'],
850
519
  hasConfig: false,
851
- runtime: {
852
- timing: SemanticTiming.None,
853
- operations: [],
854
- },
855
520
  },
856
521
  [SemanticType.StreetAddressSupplemental]: {
857
522
  id: SemanticType.StreetAddressSupplemental,
@@ -861,10 +526,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
861
526
  category: SemanticCategory.Contact,
862
527
  applicableDataTypes: ['string'],
863
528
  hasConfig: false,
864
- runtime: {
865
- timing: SemanticTiming.None,
866
- operations: [],
867
- },
868
529
  },
869
530
  [SemanticType.City]: {
870
531
  id: SemanticType.City,
@@ -874,10 +535,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
874
535
  category: SemanticCategory.Contact,
875
536
  applicableDataTypes: ['string'],
876
537
  hasConfig: false,
877
- runtime: {
878
- timing: SemanticTiming.None,
879
- operations: [],
880
- },
881
538
  },
882
539
  [SemanticType.PostalCode]: {
883
540
  id: SemanticType.PostalCode,
@@ -887,10 +544,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
887
544
  category: SemanticCategory.Contact,
888
545
  applicableDataTypes: ['string'],
889
546
  hasConfig: true,
890
- runtime: {
891
- timing: SemanticTiming.None,
892
- operations: [],
893
- },
894
547
  },
895
548
  [SemanticType.Country]: {
896
549
  id: SemanticType.Country,
@@ -900,10 +553,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
900
553
  category: SemanticCategory.Contact,
901
554
  applicableDataTypes: ['string'],
902
555
  hasConfig: true,
903
- runtime: {
904
- timing: SemanticTiming.None,
905
- operations: [],
906
- },
907
556
  },
908
557
  [SemanticType.Region]: {
909
558
  id: SemanticType.Region,
@@ -913,10 +562,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
913
562
  category: SemanticCategory.Contact,
914
563
  applicableDataTypes: ['string'],
915
564
  hasConfig: false,
916
- runtime: {
917
- timing: SemanticTiming.None,
918
- operations: [],
919
- },
920
565
  },
921
566
 
922
567
  [SemanticType.Version]: {
@@ -927,11 +572,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
927
572
  category: SemanticCategory.Lifecycle,
928
573
  applicableDataTypes: ['number'],
929
574
  hasConfig: false,
930
- runtime: {
931
- timing: SemanticTiming.Before,
932
- operations: [SemanticOperation.Update],
933
- priority: 85,
934
- },
935
575
  },
936
576
 
937
577
  //
@@ -946,10 +586,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
946
586
  category: SemanticCategory.Content,
947
587
  applicableDataTypes: ['string'],
948
588
  hasConfig: false,
949
- runtime: {
950
- timing: SemanticTiming.None,
951
- operations: [],
952
- },
953
589
  },
954
590
  [SemanticType.Name]: {
955
591
  id: SemanticType.Name,
@@ -959,10 +595,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
959
595
  category: SemanticCategory.Content,
960
596
  applicableDataTypes: ['string'],
961
597
  hasConfig: false,
962
- runtime: {
963
- timing: SemanticTiming.None,
964
- operations: [],
965
- },
966
598
  },
967
599
  [SemanticType.Description]: {
968
600
  id: SemanticType.Description,
@@ -972,10 +604,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
972
604
  category: SemanticCategory.Content,
973
605
  applicableDataTypes: ['string'],
974
606
  hasConfig: false,
975
- runtime: {
976
- timing: SemanticTiming.None,
977
- operations: [],
978
- },
979
607
  },
980
608
  [SemanticType.Summary]: {
981
609
  id: SemanticType.Summary,
@@ -985,10 +613,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
985
613
  category: SemanticCategory.Content,
986
614
  applicableDataTypes: ['string'],
987
615
  hasConfig: false,
988
- runtime: {
989
- timing: SemanticTiming.None,
990
- operations: [],
991
- },
992
616
  },
993
617
  [SemanticType.Markdown]: {
994
618
  id: SemanticType.Markdown,
@@ -998,11 +622,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
998
622
  category: SemanticCategory.Content,
999
623
  applicableDataTypes: ['string'],
1000
624
  hasConfig: true,
1001
- runtime: {
1002
- timing: SemanticTiming.Before,
1003
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1004
- priority: 50, // Process before storage
1005
- },
1006
625
  },
1007
626
  [SemanticType.HTML]: {
1008
627
  id: SemanticType.HTML,
@@ -1012,11 +631,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1012
631
  category: SemanticCategory.Content,
1013
632
  applicableDataTypes: ['string'],
1014
633
  hasConfig: true,
1015
- runtime: {
1016
- timing: SemanticTiming.Before,
1017
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1018
- priority: 50, // Process before storage for sanitization
1019
- },
1020
634
  },
1021
635
  [SemanticType.ImageURL]: {
1022
636
  id: SemanticType.ImageURL,
@@ -1026,11 +640,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1026
640
  category: SemanticCategory.Content,
1027
641
  applicableDataTypes: ['string'],
1028
642
  hasConfig: false,
1029
- runtime: {
1030
- timing: SemanticTiming.Before,
1031
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1032
- priority: 60, // Validate URLs before storage
1033
- },
1034
643
  },
1035
644
  [SemanticType.FileURL]: {
1036
645
  id: SemanticType.FileURL,
@@ -1040,11 +649,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1040
649
  category: SemanticCategory.Content,
1041
650
  applicableDataTypes: ['string'],
1042
651
  hasConfig: false,
1043
- runtime: {
1044
- timing: SemanticTiming.Before,
1045
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1046
- priority: 60, // Validate URLs before storage
1047
- },
1048
652
  },
1049
653
 
1050
654
  //
@@ -1059,11 +663,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1059
663
  category: SemanticCategory.Business,
1060
664
  applicableDataTypes: ['string'],
1061
665
  hasConfig: true,
1062
- runtime: {
1063
- timing: SemanticTiming.Both,
1064
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read, SemanticOperation.List],
1065
- priority: 30, // Validate state transitions before, filter by state after
1066
- },
1067
666
  },
1068
667
  [SemanticType.Currency]: {
1069
668
  id: SemanticType.Currency,
@@ -1073,11 +672,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1073
672
  category: SemanticCategory.Business,
1074
673
  applicableDataTypes: ['number', 'string'],
1075
674
  hasConfig: true,
1076
- runtime: {
1077
- timing: SemanticTiming.Before,
1078
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1079
- priority: 70, // Validate currency format and precision
1080
- },
1081
675
  },
1082
676
  [SemanticType.SKU]: {
1083
677
  id: SemanticType.SKU,
@@ -1087,11 +681,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1087
681
  category: SemanticCategory.Business,
1088
682
  applicableDataTypes: ['string'],
1089
683
  hasConfig: true,
1090
- runtime: {
1091
- timing: SemanticTiming.Before,
1092
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1093
- priority: 25, // High priority for uniqueness validation
1094
- },
1095
684
  },
1096
685
 
1097
686
  //
@@ -1106,11 +695,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1106
695
  category: SemanticCategory.Contact,
1107
696
  applicableDataTypes: ['string'],
1108
697
  hasConfig: true,
1109
- runtime: {
1110
- timing: SemanticTiming.Before,
1111
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1112
- priority: 40, // Validate email format
1113
- },
1114
698
  },
1115
699
  [SemanticType.Phone]: {
1116
700
  id: SemanticType.Phone,
@@ -1120,11 +704,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1120
704
  category: SemanticCategory.Contact,
1121
705
  applicableDataTypes: ['string'],
1122
706
  hasConfig: true,
1123
- runtime: {
1124
- timing: SemanticTiming.Before,
1125
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1126
- priority: 40, // Validate phone format
1127
- },
1128
707
  },
1129
708
  [SemanticType.URL]: {
1130
709
  id: SemanticType.URL,
@@ -1134,11 +713,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1134
713
  category: SemanticCategory.Contact,
1135
714
  applicableDataTypes: ['string'],
1136
715
  hasConfig: true,
1137
- runtime: {
1138
- timing: SemanticTiming.Before,
1139
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1140
- priority: 40, // Validate URL format
1141
- },
1142
716
  },
1143
717
  [SemanticType.ClientIPAddress]: {
1144
718
  id: SemanticType.ClientIPAddress,
@@ -1148,18 +722,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1148
722
  category: SemanticCategory.Contact,
1149
723
  applicableDataTypes: ['string'],
1150
724
  hasConfig: false,
1151
- runtime: {
1152
- timing: SemanticTiming.Before,
1153
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1154
- priority: 95, // Low priority, populate after other validations
1155
- timeoutMs: 100, // Very fast operation
1156
- conditions: [
1157
- {
1158
- expression: 'entity[semantics.ClientIPAddress] == null',
1159
- description: 'Only set IP address if not already provided',
1160
- },
1161
- ],
1162
- },
1163
725
  },
1164
726
 
1165
727
  //
@@ -1174,23 +736,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1174
736
  category: SemanticCategory.Organization,
1175
737
  applicableDataTypes: ['string'],
1176
738
  hasConfig: true,
1177
- runtime: {
1178
- timing: SemanticTiming.Before,
1179
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1180
- priority: 30, // Generate slug from title, validate uniqueness
1181
- timeoutMs: 1000,
1182
- conditions: [
1183
- {
1184
- expression: 'entity[semantics.PublicUniqueName] == null || entity[semantics.PublicUniqueName].length == 0',
1185
- description: 'Only generate slug if not already provided',
1186
- },
1187
- // Let's not guess which field is marked as slug source in the `PublicUniqueName` configuration.
1188
- // {
1189
- // expression: 'entity[semantics.Title] != null && entity[semantics.Title].length > 0',
1190
- // description: 'Only generate slug if title field exists and has content',
1191
- // },
1192
- ],
1193
- },
1194
739
  },
1195
740
  [SemanticType.Tags]: {
1196
741
  id: SemanticType.Tags,
@@ -1199,11 +744,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1199
744
  description: 'Enable tagging functionality',
1200
745
  category: SemanticCategory.Organization,
1201
746
  hasConfig: true,
1202
- runtime: {
1203
- timing: SemanticTiming.After,
1204
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Delete],
1205
- priority: 200, // Process after main operation
1206
- },
1207
747
  },
1208
748
  [SemanticType.Categories]: {
1209
749
  id: SemanticType.Categories,
@@ -1212,11 +752,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1212
752
  description: 'Enable categorization functionality',
1213
753
  category: SemanticCategory.Organization,
1214
754
  hasConfig: true,
1215
- runtime: {
1216
- timing: SemanticTiming.After,
1217
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Delete],
1218
- priority: 200, // Process after main operation
1219
- },
1220
755
  },
1221
756
 
1222
757
  //
@@ -1231,11 +766,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1231
766
  category: SemanticCategory.Location,
1232
767
  applicableDataTypes: ['string'],
1233
768
  hasConfig: true,
1234
- runtime: {
1235
- timing: SemanticTiming.Both,
1236
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read, SemanticOperation.List],
1237
- priority: 60, // Validate coordinates before, enable spatial queries after
1238
- },
1239
769
  },
1240
770
 
1241
771
  //
@@ -1251,11 +781,6 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1251
781
  category: SemanticCategory.Computed,
1252
782
  applicableDataTypes: ['string', 'number', 'boolean', 'date', 'datetime', 'time', 'binary'],
1253
783
  hasConfig: true,
1254
- runtime: {
1255
- timing: SemanticTiming.Both,
1256
- operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read],
1257
- priority: 150, // Calculate after other validations, recalculate on read if needed
1258
- },
1259
784
  },
1260
785
  [SemanticType.Derived]: {
1261
786
  id: SemanticType.Derived,
@@ -1265,54 +790,49 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
1265
790
  category: SemanticCategory.Computed,
1266
791
  applicableDataTypes: ['string'],
1267
792
  hasConfig: true,
1268
- runtime: {
1269
- timing: SemanticTiming.After,
1270
- operations: [SemanticOperation.Create, SemanticOperation.Update],
1271
- priority: 180, // Derive after all other processing
1272
- },
1273
793
  },
1274
794
  }
1275
795
 
1276
- /**
1277
- * Get all semantics that should run for a specific operation and timing
1278
- */
1279
- export function getSemanticsForOperation(
1280
- semantics: AppliedDataSemantic[],
1281
- operation: SemanticOperation,
1282
- timing: SemanticTiming
1283
- ): AppliedDataSemantic[] {
1284
- return semantics
1285
- .filter((semantic) => {
1286
- const definition = DataSemantics[semantic.id]
1287
- if (!definition?.runtime) {
1288
- return false
1289
- }
1290
-
1291
- const { timing: semanticTiming, operations } = definition.runtime
1292
-
1293
- // Check if timing matches
1294
- const timingMatches = semanticTiming === timing || semanticTiming === SemanticTiming.Both
1295
-
1296
- // Check if operation is included
1297
- const operationMatches = operations.includes(operation)
1298
-
1299
- return timingMatches && operationMatches
1300
- })
1301
- .sort((a, b) => {
1302
- // Sort by priority (lower number = higher priority)
1303
- const priorityA = DataSemantics[a.id]?.runtime?.priority ?? 100
1304
- const priorityB = DataSemantics[b.id]?.runtime?.priority ?? 100
1305
- return priorityA - priorityB
1306
- })
1307
- }
1308
-
1309
- /**
1310
- * Check if a specific semantic can be disabled at runtime
1311
- */
1312
- export function canSemanticBeDisabled(semanticType: SemanticType): boolean {
1313
- const definition = DataSemantics[semanticType]
1314
- return definition?.runtime?.canDisable !== false // Default to true if not specified
1315
- }
796
+ // /**
797
+ // * Get all semantics that should run for a specific operation and timing
798
+ // */
799
+ // export function getSemanticsForOperation(
800
+ // semantics: AppliedDataSemantic[],
801
+ // operation: SemanticOperation,
802
+ // timing: SemanticTiming
803
+ // ): AppliedDataSemantic[] {
804
+ // return semantics
805
+ // .filter((semantic) => {
806
+ // const definition = DataSemantics[semantic.id]
807
+ // if (!definition?.runtime) {
808
+ // return false
809
+ // }
810
+
811
+ // const { timing: semanticTiming, operations } = definition.runtime
812
+
813
+ // // Check if timing matches
814
+ // const timingMatches = semanticTiming === timing || semanticTiming === SemanticTiming.Both
815
+
816
+ // // Check if operation is included
817
+ // const operationMatches = operations.includes(operation)
818
+
819
+ // return timingMatches && operationMatches
820
+ // })
821
+ // .sort((a, b) => {
822
+ // // Sort by priority (lower number = higher priority)
823
+ // const priorityA = DataSemantics[a.id]?.runtime?.priority ?? 100
824
+ // const priorityB = DataSemantics[b.id]?.runtime?.priority ?? 100
825
+ // return priorityA - priorityB
826
+ // })
827
+ // }
828
+
829
+ // /**
830
+ // * Check if a specific semantic can be disabled at runtime
831
+ // */
832
+ // export function canSemanticBeDisabled(semanticType: SemanticType): boolean {
833
+ // const definition = DataSemantics[semanticType]
834
+ // return definition?.runtime?.canDisable !== false // Default to true if not specified
835
+ // }
1316
836
 
1317
837
  export function getSemanticsByCategory(): Record<SemanticCategory, DataSemantic[]>
1318
838
  export function getSemanticsByCategory(scope: SemanticScope.Entity): Record<SemanticCategory, EntitySemantic[]>