@api-client/core 0.18.25 → 0.18.27

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 (44) hide show
  1. package/build/src/modeling/Semantics.d.ts +193 -0
  2. package/build/src/modeling/Semantics.d.ts.map +1 -1
  3. package/build/src/modeling/Semantics.js +134 -0
  4. package/build/src/modeling/Semantics.js.map +1 -1
  5. package/build/src/modeling/helpers/Intelisense.d.ts +7 -7
  6. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
  7. package/build/src/modeling/helpers/Intelisense.js.map +1 -1
  8. package/build/src/modeling/templates/meta/blog-publishing-platform.json +1 -1
  9. package/build/src/modeling/templates/meta/financial-services-platform.json +1 -1
  10. package/build/src/modeling/templates/meta/index.d.ts +1 -1
  11. package/build/src/modeling/templates/meta/index.js +1 -1
  12. package/build/src/modeling/templates/meta/index.js.map +1 -1
  13. package/build/src/modeling/templates/meta/iot-smart-home-platform.json +1 -1
  14. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +1 -1
  15. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +249 -63
  16. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +1 -1
  17. package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts.map +1 -1
  18. package/build/src/modeling/templates/verticals/technology-media/blog-domain.js +17 -9
  19. package/build/src/modeling/templates/verticals/technology-media/blog-domain.js.map +1 -1
  20. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts.map +1 -1
  21. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js +2 -0
  22. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js.map +1 -1
  23. package/build/src/modeling/validation/postgresql.d.ts.map +1 -1
  24. package/build/src/modeling/validation/postgresql.js +0 -1
  25. package/build/src/modeling/validation/postgresql.js.map +1 -1
  26. package/build/src/runtime/modeling/Semantics.d.ts +84 -0
  27. package/build/src/runtime/modeling/Semantics.d.ts.map +1 -0
  28. package/build/src/runtime/modeling/Semantics.js +124 -0
  29. package/build/src/runtime/modeling/Semantics.js.map +1 -0
  30. package/build/tsconfig.tsbuildinfo +1 -1
  31. package/data/models/example-generator-api.json +14 -14
  32. package/package.json +1 -1
  33. package/src/modeling/Semantics.ts +262 -0
  34. package/src/modeling/helpers/Intelisense.ts +7 -7
  35. package/src/modeling/templates/meta/blog-publishing-platform.json +1 -1
  36. package/src/modeling/templates/meta/financial-services-platform.json +1 -1
  37. package/src/modeling/templates/meta/iot-smart-home-platform.json +1 -1
  38. package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +286 -65
  39. package/src/modeling/templates/verticals/technology-media/blog-domain.ts +17 -9
  40. package/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.ts +2 -0
  41. package/src/modeling/validation/postgresql.ts +0 -1
  42. package/src/runtime/modeling/Semantics.ts +196 -0
  43. package/tests/unit/modeling/client_ip_address_semantic.spec.ts +71 -0
  44. package/tests/unit/modeling/username_semantic.spec.ts +81 -0
@@ -14,6 +14,13 @@ export declare enum SemanticType {
14
14
  * ensuring it is encrypted and not exposed in API responses.
15
15
  */
16
16
  Password = "Semantic#Password",
17
+ /**
18
+ * Annotates the field as the username for user authentication.
19
+ * This identifies which field should be used for login purposes.
20
+ * Can be applied to dedicated username fields or email fields that serve as usernames.
21
+ * The runtime uses this for authentication, password reset, and user lookup operations.
22
+ */
23
+ Username = "Semantic#Username",
17
24
  /**
18
25
  * Designates a Data Property as the `createdAt` timestamp of an entity.
19
26
  * This is used to track when the entity was first created.
@@ -163,6 +170,12 @@ export declare enum SemanticType {
163
170
  * Annotates a field as derived from other fields.
164
171
  */
165
172
  Derived = "Semantic#Derived",
173
+ /**
174
+ * Annotates a field that should automatically receive the client's IP address.
175
+ * The runtime automatically populates this field with the request's IP address
176
+ * when creating or updating records, providing audit trail and geolocation capabilities.
177
+ */
178
+ ClientIPAddress = "Semantic#ClientIPAddress",
166
179
  /**
167
180
  * Designates an association that links a resource to a "User" entity instance.
168
181
  * This is used to indicate ownership of the resource for access control purposes.
@@ -277,6 +290,61 @@ export declare enum SemanticOperation {
277
290
  */
278
291
  List = "List"
279
292
  }
293
+ /**
294
+ * Defines the execution mode for a semantic.
295
+ */
296
+ export declare enum SemanticExecutionMode {
297
+ /**
298
+ * Execute synchronously as part of the main operation
299
+ */
300
+ Synchronous = "Synchronous",
301
+ /**
302
+ * Execute asynchronously after the main operation
303
+ */
304
+ Asynchronous = "Asynchronous",
305
+ /**
306
+ * Execute in background/queue (fire and forget)
307
+ */
308
+ Background = "Background"
309
+ }
310
+ /**
311
+ * Defines validation strategies for semantics.
312
+ */
313
+ export declare enum SemanticValidationStrategy {
314
+ /**
315
+ * Fail the operation if semantic validation fails
316
+ */
317
+ Strict = "Strict",
318
+ /**
319
+ * Log warnings but continue operation
320
+ */
321
+ Warning = "Warning",
322
+ /**
323
+ * Skip validation entirely
324
+ */
325
+ Skip = "Skip"
326
+ }
327
+ /**
328
+ * Defines caching strategies for computed semantics.
329
+ */
330
+ export declare enum SemanticCacheStrategy {
331
+ /**
332
+ * No caching - always compute
333
+ */
334
+ None = "None",
335
+ /**
336
+ * Cache until dependent fields change
337
+ */
338
+ Dependency = "Dependency",
339
+ /**
340
+ * Cache with TTL expiration
341
+ */
342
+ TimeToLive = "TimeToLive",
343
+ /**
344
+ * Cache until manually invalidated
345
+ */
346
+ Manual = "Manual"
347
+ }
280
348
  /**
281
349
  * Configuration for when and how a semantic should execute at runtime.
282
350
  */
@@ -298,6 +366,131 @@ export interface SemanticRuntimeConfig {
298
366
  * Whether this semantic can be disabled at the entity/property level.
299
367
  */
300
368
  canDisable?: boolean;
369
+ /**
370
+ * How the semantic should execute (sync/async/background).
371
+ * Default is Synchronous.
372
+ * @default Synchronous
373
+ */
374
+ executionMode?: SemanticExecutionMode;
375
+ /**
376
+ * Validation strategy when semantic processing fails.
377
+ * Default is Strict.
378
+ * @default Strict
379
+ */
380
+ validationStrategy?: SemanticValidationStrategy;
381
+ /**
382
+ * Maximum execution time in milliseconds before timeout.
383
+ * Default is 5000ms for sync, 30000ms for async.
384
+ * @default 5000 for sync, 30000 for async
385
+ */
386
+ timeoutMs?: number;
387
+ /**
388
+ * Number of retry attempts on failure.
389
+ * Default is 0 (no retries).
390
+ * @default 0
391
+ */
392
+ retryAttempts?: number;
393
+ /**
394
+ * Dependencies on other semantics that must execute first.
395
+ * Uses semantic IDs.
396
+ */
397
+ dependencies?: SemanticType[];
398
+ /**
399
+ * Fields that this semantic depends on for computation.
400
+ * Used for cache invalidation and optimization.
401
+ */
402
+ dependentFields?: string[];
403
+ /**
404
+ * Caching strategy for computed/derived values.
405
+ */
406
+ cacheStrategy?: SemanticCacheStrategy;
407
+ /**
408
+ * Cache TTL in seconds (only used with TimeToLive strategy).
409
+ */
410
+ cacheTtlSeconds?: number;
411
+ /**
412
+ * Whether this semantic should run in transactions.
413
+ * Default is true.
414
+ */
415
+ transactional?: boolean;
416
+ /**
417
+ * Rate limiting configuration for expensive operations.
418
+ */
419
+ rateLimit?: SemanticRateLimit;
420
+ /**
421
+ * Conditional execution based on data or context.
422
+ */
423
+ conditions?: SemanticCondition[];
424
+ /**
425
+ * Audit and logging configuration.
426
+ */
427
+ audit?: SemanticAudit;
428
+ }
429
+ export interface SemanticRateLimit {
430
+ /**
431
+ * Maximum executions per time window.
432
+ */
433
+ maxExecutions: number;
434
+ /**
435
+ * Time window in seconds.
436
+ */
437
+ windowSeconds: number;
438
+ /**
439
+ * Strategy when rate limit is exceeded.
440
+ */
441
+ strategy: 'queue' | 'drop' | 'error';
442
+ }
443
+ export interface SemanticCondition {
444
+ /**
445
+ * JEXL expression that must evaluate to true for execution.
446
+ * Has access to entity data, user context, and semantic field references.
447
+ *
448
+ * Available context variables:
449
+ * - `entity`: The entity data being processed
450
+ * - `user`: Current user context (if authenticated)
451
+ * - `operation`: The current operation (Create, Update, etc.)
452
+ * - `semantics`: Object with semantic field accessors
453
+ *
454
+ * Semantic field references use dot notation:
455
+ * - `semantics.CreatedTimestamp` - field with CreatedTimestamp semantic
456
+ * - `semantics.Password` - field with Password semantic
457
+ * - `semantics.User` - entity with User semantic (for associations)
458
+ *
459
+ * @example
460
+ * // Only set timestamp if not already provided
461
+ * "semantics.CreatedTimestamp == null"
462
+ *
463
+ * @example
464
+ * // Only apply to authenticated users
465
+ * "user != null && user.authenticated == true"
466
+ *
467
+ * @example
468
+ * // Only hash password if it's a plain text (not already hashed)
469
+ * "entity[semantics.Password] != null && !entity[semantics.Password].startsWith('$')"
470
+ *
471
+ * @example
472
+ * // Only generate slug if title exists
473
+ * "entity[semantics.Title] != null && entity[semantics.Title].length > 0"
474
+ */
475
+ expression: string;
476
+ /**
477
+ * Description of when this semantic should run.
478
+ */
479
+ description: string;
480
+ }
481
+ export interface SemanticAudit {
482
+ /**
483
+ * Whether to log semantic execution.
484
+ */
485
+ logExecution: boolean;
486
+ /**
487
+ * Whether to log input/output data.
488
+ */
489
+ logData: boolean;
490
+ /**
491
+ * Retention period for audit logs in days.
492
+ */
493
+ retentionDays: number;
301
494
  }
302
495
  /**
303
496
  * A base interface for all Data Semantics, containing common properties.
@@ -1 +1 @@
1
- {"version":3,"file":"Semantics.d.ts","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;;GAGG;AACH,oBAAY,YAAY;IAKtB;;OAEG;IACH,IAAI,kBAAkB;IAMtB;;;;OAIG;IACH,QAAQ,sBAAsB;IAC9B;;;OAGG;IACH,gBAAgB,8BAA8B;IAC9C;;;OAGG;IACH,gBAAgB,8BAA8B;IAC9C;;;;;OAKG;IACH,gBAAgB,8BAA8B;IAC9C;;;;OAIG;IACH,WAAW,yBAAyB;IACpC;;;;;;;OAOG;IACH,gBAAgB,8BAA8B;IAC9C;;;;OAIG;IACH,KAAK,mBAAmB;IACxB;;;;;;OAMG;IACH,QAAQ,sBAAsB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AGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,YAAY,CAsf5D,CAAA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,mBAAmB,EAAE,EAChC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,cAAc,GACrB,mBAAmB,EAAE,CAwBvB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAGzE;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,gBAAgB,EAAE,YAAY,EAAE,CAAC,CAAA;AAClF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,cAAc,EAAE,CAAC,CAAA;AAC/G,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,QAAQ,GAAG,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,CAAC,CAAA;AACnH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,WAAW,GAC/B,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,EAAE,CAAC,CAAA;AA+BlD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,UAAU,gBAAgB,KAAG,YAAY,EAEnF,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,EAAE,YAAY,CAAA;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC"}
@@ -20,6 +20,13 @@ export var SemanticType;
20
20
  * ensuring it is encrypted and not exposed in API responses.
21
21
  */
22
22
  SemanticType["Password"] = "Semantic#Password";
23
+ /**
24
+ * Annotates the field as the username for user authentication.
25
+ * This identifies which field should be used for login purposes.
26
+ * Can be applied to dedicated username fields or email fields that serve as usernames.
27
+ * The runtime uses this for authentication, password reset, and user lookup operations.
28
+ */
29
+ SemanticType["Username"] = "Semantic#Username";
23
30
  /**
24
31
  * Designates a Data Property as the `createdAt` timestamp of an entity.
25
32
  * This is used to track when the entity was first created.
@@ -169,6 +176,12 @@ export var SemanticType;
169
176
  * Annotates a field as derived from other fields.
170
177
  */
171
178
  SemanticType["Derived"] = "Semantic#Derived";
179
+ /**
180
+ * Annotates a field that should automatically receive the client's IP address.
181
+ * The runtime automatically populates this field with the request's IP address
182
+ * when creating or updating records, providing audit trail and geolocation capabilities.
183
+ */
184
+ SemanticType["ClientIPAddress"] = "Semantic#ClientIPAddress";
172
185
  //
173
186
  // Association-Level Semantics
174
187
  //
@@ -290,6 +303,64 @@ export var SemanticOperation;
290
303
  */
291
304
  SemanticOperation["List"] = "List";
292
305
  })(SemanticOperation || (SemanticOperation = {}));
306
+ /**
307
+ * Defines the execution mode for a semantic.
308
+ */
309
+ export var SemanticExecutionMode;
310
+ (function (SemanticExecutionMode) {
311
+ /**
312
+ * Execute synchronously as part of the main operation
313
+ */
314
+ SemanticExecutionMode["Synchronous"] = "Synchronous";
315
+ /**
316
+ * Execute asynchronously after the main operation
317
+ */
318
+ SemanticExecutionMode["Asynchronous"] = "Asynchronous";
319
+ /**
320
+ * Execute in background/queue (fire and forget)
321
+ */
322
+ SemanticExecutionMode["Background"] = "Background";
323
+ })(SemanticExecutionMode || (SemanticExecutionMode = {}));
324
+ /**
325
+ * Defines validation strategies for semantics.
326
+ */
327
+ export var SemanticValidationStrategy;
328
+ (function (SemanticValidationStrategy) {
329
+ /**
330
+ * Fail the operation if semantic validation fails
331
+ */
332
+ SemanticValidationStrategy["Strict"] = "Strict";
333
+ /**
334
+ * Log warnings but continue operation
335
+ */
336
+ SemanticValidationStrategy["Warning"] = "Warning";
337
+ /**
338
+ * Skip validation entirely
339
+ */
340
+ SemanticValidationStrategy["Skip"] = "Skip";
341
+ })(SemanticValidationStrategy || (SemanticValidationStrategy = {}));
342
+ /**
343
+ * Defines caching strategies for computed semantics.
344
+ */
345
+ export var SemanticCacheStrategy;
346
+ (function (SemanticCacheStrategy) {
347
+ /**
348
+ * No caching - always compute
349
+ */
350
+ SemanticCacheStrategy["None"] = "None";
351
+ /**
352
+ * Cache until dependent fields change
353
+ */
354
+ SemanticCacheStrategy["Dependency"] = "Dependency";
355
+ /**
356
+ * Cache with TTL expiration
357
+ */
358
+ SemanticCacheStrategy["TimeToLive"] = "TimeToLive";
359
+ /**
360
+ * Cache until manually invalidated
361
+ */
362
+ SemanticCacheStrategy["Manual"] = "Manual";
363
+ })(SemanticCacheStrategy || (SemanticCacheStrategy = {}));
293
364
  /**
294
365
  * A type guard to check if a semantic is an EntitySemantic.
295
366
  */
@@ -335,6 +406,29 @@ export const DataSemantics = {
335
406
  operations: [SemanticOperation.Create, SemanticOperation.Update],
336
407
  priority: 10, // High priority for security
337
408
  canDisable: false, // Security semantics cannot be disabled
409
+ timeoutMs: 2000, // Allow time for hashing
410
+ conditions: [
411
+ {
412
+ expression: 'entity[semantics.Password] != null && entity[semantics.Password].length > 0',
413
+ description: 'Only process when password field has a value',
414
+ },
415
+ ],
416
+ },
417
+ },
418
+ [SemanticType.Username]: {
419
+ id: SemanticType.Username,
420
+ displayName: 'Username',
421
+ scope: SemanticScope.Property,
422
+ description: 'User authentication identifier',
423
+ category: SemanticCategory.Identity,
424
+ applicableDataTypes: ['string'],
425
+ hasConfig: false,
426
+ runtime: {
427
+ timing: SemanticTiming.Before,
428
+ operations: [SemanticOperation.Create, SemanticOperation.Update, SemanticOperation.Read],
429
+ priority: 15, // High priority for authentication
430
+ canDisable: false, // Security semantics cannot be disabled
431
+ timeoutMs: 100, // Fast operation
338
432
  },
339
433
  },
340
434
  [SemanticType.UserRole]: {
@@ -392,6 +486,13 @@ export const DataSemantics = {
392
486
  timing: SemanticTiming.Before,
393
487
  operations: [SemanticOperation.Create],
394
488
  priority: 90,
489
+ timeoutMs: 100, // Very fast operation
490
+ conditions: [
491
+ {
492
+ expression: 'entity[semantics.CreatedTimestamp] == null',
493
+ description: 'Only set timestamp if not already provided',
494
+ },
495
+ ],
395
496
  },
396
497
  },
397
498
  [SemanticType.UpdatedTimestamp]: {
@@ -638,6 +739,27 @@ export const DataSemantics = {
638
739
  priority: 40, // Validate URL format
639
740
  },
640
741
  },
742
+ [SemanticType.ClientIPAddress]: {
743
+ id: SemanticType.ClientIPAddress,
744
+ displayName: 'Client IP Address',
745
+ scope: SemanticScope.Property,
746
+ description: 'Automatically populated client IP address',
747
+ category: SemanticCategory.Contact,
748
+ applicableDataTypes: ['string'],
749
+ hasConfig: false,
750
+ runtime: {
751
+ timing: SemanticTiming.Before,
752
+ operations: [SemanticOperation.Create, SemanticOperation.Update],
753
+ priority: 95, // Low priority, populate after other validations
754
+ timeoutMs: 100, // Very fast operation
755
+ conditions: [
756
+ {
757
+ expression: 'entity[semantics.ClientIPAddress] == null',
758
+ description: 'Only set IP address if not already provided',
759
+ },
760
+ ],
761
+ },
762
+ },
641
763
  //
642
764
  // Classification & Organization
643
765
  //
@@ -653,6 +775,18 @@ export const DataSemantics = {
653
775
  timing: SemanticTiming.Before,
654
776
  operations: [SemanticOperation.Create, SemanticOperation.Update],
655
777
  priority: 30, // Generate slug from title, validate uniqueness
778
+ timeoutMs: 1000,
779
+ conditions: [
780
+ {
781
+ expression: 'entity[semantics.PublicUniqueName] == null || entity[semantics.PublicUniqueName].length == 0',
782
+ description: 'Only generate slug if not already provided',
783
+ },
784
+ // Let's not guess which field is marked as slug source in the `PublicUniqueName` configuration.
785
+ // {
786
+ // expression: 'entity[semantics.Title] != null && entity[semantics.Title].length > 0',
787
+ // description: 'Only generate slug if title field exists and has content',
788
+ // },
789
+ ],
656
790
  },
657
791
  },
658
792
  [SemanticType.Tags]: {