@api-client/core 0.15.0 → 0.16.0

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 (126) hide show
  1. package/TESTING_READY.md +114 -0
  2. package/TESTING_SETUP.md +198 -0
  3. package/build/src/modeling/Semantics.d.ts +126 -2
  4. package/build/src/modeling/Semantics.d.ts.map +1 -1
  5. package/build/src/modeling/Semantics.js +281 -13
  6. package/build/src/modeling/Semantics.js.map +1 -1
  7. package/build/src/modeling/definitions/Calculated.d.ts +54 -0
  8. package/build/src/modeling/definitions/Calculated.d.ts.map +1 -0
  9. package/build/src/modeling/definitions/Calculated.js +31 -0
  10. package/build/src/modeling/definitions/Calculated.js.map +1 -0
  11. package/build/src/modeling/definitions/Categories.d.ts +60 -0
  12. package/build/src/modeling/definitions/Categories.d.ts.map +1 -0
  13. package/build/src/modeling/definitions/Categories.js +33 -0
  14. package/build/src/modeling/definitions/Categories.js.map +1 -0
  15. package/build/src/modeling/definitions/Derived.d.ts +54 -0
  16. package/build/src/modeling/definitions/Derived.d.ts.map +1 -0
  17. package/build/src/modeling/definitions/Derived.js +31 -0
  18. package/build/src/modeling/definitions/Derived.js.map +1 -0
  19. package/build/src/modeling/definitions/Description.d.ts +36 -0
  20. package/build/src/modeling/definitions/Description.d.ts.map +1 -0
  21. package/build/src/modeling/definitions/Description.js +28 -0
  22. package/build/src/modeling/definitions/Description.js.map +1 -0
  23. package/build/src/modeling/definitions/Email.d.ts +66 -0
  24. package/build/src/modeling/definitions/Email.d.ts.map +1 -0
  25. package/build/src/modeling/definitions/Email.js +33 -0
  26. package/build/src/modeling/definitions/Email.js.map +1 -0
  27. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts +212 -0
  28. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts.map +1 -0
  29. package/build/src/modeling/definitions/GeospatialCoordinates.js +129 -0
  30. package/build/src/modeling/definitions/GeospatialCoordinates.js.map +1 -0
  31. package/build/src/modeling/definitions/HTML.d.ts +88 -0
  32. package/build/src/modeling/definitions/HTML.d.ts.map +1 -0
  33. package/build/src/modeling/definitions/HTML.js +42 -0
  34. package/build/src/modeling/definitions/HTML.js.map +1 -0
  35. package/build/src/modeling/definitions/Markdown.d.ts +84 -0
  36. package/build/src/modeling/definitions/Markdown.d.ts.map +1 -0
  37. package/build/src/modeling/definitions/Markdown.js +41 -0
  38. package/build/src/modeling/definitions/Markdown.js.map +1 -0
  39. package/build/src/modeling/definitions/Password.d.ts +112 -0
  40. package/build/src/modeling/definitions/Password.d.ts.map +1 -0
  41. package/build/src/modeling/definitions/Password.js +57 -0
  42. package/build/src/modeling/definitions/Password.js.map +1 -0
  43. package/build/src/modeling/definitions/Phone.d.ts +83 -0
  44. package/build/src/modeling/definitions/Phone.d.ts.map +1 -0
  45. package/build/src/modeling/definitions/Phone.js +39 -0
  46. package/build/src/modeling/definitions/Phone.js.map +1 -0
  47. package/build/src/modeling/definitions/Price.d.ts +102 -0
  48. package/build/src/modeling/definitions/Price.d.ts.map +1 -0
  49. package/build/src/modeling/definitions/Price.js +99 -0
  50. package/build/src/modeling/definitions/Price.js.map +1 -0
  51. package/build/src/modeling/definitions/PublicUniqueName.d.ts +69 -0
  52. package/build/src/modeling/definitions/PublicUniqueName.d.ts.map +1 -0
  53. package/build/src/modeling/definitions/PublicUniqueName.js +34 -0
  54. package/build/src/modeling/definitions/PublicUniqueName.js.map +1 -0
  55. package/build/src/modeling/definitions/SKU.d.ts +127 -0
  56. package/build/src/modeling/definitions/SKU.d.ts.map +1 -0
  57. package/build/src/modeling/definitions/SKU.js +142 -0
  58. package/build/src/modeling/definitions/SKU.js.map +1 -0
  59. package/build/src/modeling/definitions/Status.d.ts +150 -0
  60. package/build/src/modeling/definitions/Status.d.ts.map +1 -0
  61. package/build/src/modeling/definitions/Status.js +60 -0
  62. package/build/src/modeling/definitions/Status.js.map +1 -0
  63. package/build/src/modeling/definitions/Summary.d.ts +53 -0
  64. package/build/src/modeling/definitions/Summary.d.ts.map +1 -0
  65. package/build/src/modeling/definitions/Summary.js +50 -0
  66. package/build/src/modeling/definitions/Summary.js.map +1 -0
  67. package/build/src/modeling/definitions/Tags.d.ts +52 -0
  68. package/build/src/modeling/definitions/Tags.d.ts.map +1 -0
  69. package/build/src/modeling/definitions/Tags.js +32 -0
  70. package/build/src/modeling/definitions/Tags.js.map +1 -0
  71. package/build/src/modeling/definitions/URL.d.ts +68 -0
  72. package/build/src/modeling/definitions/URL.d.ts.map +1 -0
  73. package/build/src/modeling/definitions/URL.js +37 -0
  74. package/build/src/modeling/definitions/URL.js.map +1 -0
  75. package/build/src/modeling/validation/semantic_validation.d.ts +4 -0
  76. package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -1
  77. package/build/src/modeling/validation/semantic_validation.js +32 -1
  78. package/build/src/modeling/validation/semantic_validation.js.map +1 -1
  79. package/build/tsconfig.tsbuildinfo +1 -1
  80. package/data/models/example-generator-api.json +9 -9
  81. package/package.json +1 -1
  82. package/src/modeling/Semantics.ts +297 -14
  83. package/src/modeling/definitions/Calculated.ts +76 -0
  84. package/src/modeling/definitions/Categories.ts +84 -0
  85. package/src/modeling/definitions/Derived.ts +76 -0
  86. package/src/modeling/definitions/Description.ts +55 -0
  87. package/src/modeling/definitions/Email.ts +90 -0
  88. package/src/modeling/definitions/GeospatialCoordinates.ts +274 -0
  89. package/src/modeling/definitions/HTML.ts +121 -0
  90. package/src/modeling/definitions/Markdown.ts +116 -0
  91. package/src/modeling/definitions/Password.ts +156 -0
  92. package/src/modeling/definitions/Phone.ts +116 -0
  93. package/src/modeling/definitions/Price.examples.md +158 -0
  94. package/src/modeling/definitions/Price.ts +180 -0
  95. package/src/modeling/definitions/PublicUniqueName.ts +98 -0
  96. package/src/modeling/definitions/SKU.examples.md +230 -0
  97. package/src/modeling/definitions/SKU.ts +254 -0
  98. package/src/modeling/definitions/Status.ts +227 -0
  99. package/src/modeling/definitions/Summary.ts +73 -0
  100. package/src/modeling/definitions/Tags.ts +75 -0
  101. package/src/modeling/definitions/URL.ts +96 -0
  102. package/src/modeling/validation/semantic_validation.ts +35 -1
  103. package/tests/example-test-setup.ts +133 -0
  104. package/tests/template-node.spec.ts +75 -0
  105. package/tests/test-utils.ts +293 -0
  106. package/tests/unit/modeling/definitions/calculated.spec.ts +33 -0
  107. package/tests/unit/modeling/definitions/categories.spec.ts +38 -0
  108. package/tests/unit/modeling/definitions/derived.spec.ts +34 -0
  109. package/tests/unit/modeling/definitions/description.spec.ts +38 -0
  110. package/tests/unit/modeling/definitions/email.spec.ts +38 -0
  111. package/tests/unit/modeling/definitions/geospatial-coordinates.spec.ts +41 -0
  112. package/tests/unit/modeling/definitions/html.spec.ts +38 -0
  113. package/tests/unit/modeling/definitions/markdown.spec.ts +38 -0
  114. package/tests/unit/modeling/definitions/password.spec.ts +347 -0
  115. package/tests/unit/modeling/definitions/phone.spec.ts +38 -0
  116. package/tests/unit/modeling/definitions/price.spec.ts +465 -0
  117. package/tests/unit/modeling/definitions/public-unique-name.spec.ts +38 -0
  118. package/tests/unit/modeling/definitions/sku.spec.ts +240 -0
  119. package/tests/unit/modeling/definitions/status.spec.ts +37 -0
  120. package/tests/unit/modeling/definitions/summary.spec.ts +36 -0
  121. package/tests/unit/modeling/definitions/tags.spec.ts +38 -0
  122. package/tests/unit/modeling/definitions/url.spec.ts +38 -0
  123. package/tests/unit/modeling/domain_property.spec.ts +106 -0
  124. package/tests/unit/modeling/domain_validation.spec.ts +5 -5
  125. package/tests/unit/modeling/semantic-configs.spec.ts +569 -0
  126. package/tests/unit/modeling/semantics.spec.ts +52 -0
@@ -0,0 +1,68 @@
1
+ import type { AppliedDataSemantic } from '../Semantics.js';
2
+ import { SemanticType } from '../Semantics.js';
3
+ /**
4
+ * Configuration options for the URL semantic.
5
+ * Controls validation, allowed protocols, and formatting.
6
+ */
7
+ export interface URLConfig {
8
+ /**
9
+ * List of allowed protocols (e.g., ['http', 'https']).
10
+ */
11
+ allowedProtocols?: string[];
12
+ /**
13
+ * Whether to require HTTPS protocol (default: false).
14
+ */
15
+ requireHttps?: boolean;
16
+ /**
17
+ * Whether to allow query parameters in the URL.
18
+ */
19
+ allowQueryParams?: boolean;
20
+ /**
21
+ * Whether to allow URL fragments (e.g., #section).
22
+ */
23
+ allowFragments?: boolean;
24
+ /**
25
+ * Whether to allow internationalized domain names.
26
+ */
27
+ allowInternational?: boolean;
28
+ /**
29
+ * Whether to allow IP addresses as hostnames.
30
+ */
31
+ allowIP?: boolean;
32
+ /**
33
+ * Whether to allow port numbers in the URL.
34
+ */
35
+ allowPort?: boolean;
36
+ /**
37
+ * Whether to allow authentication info (user:pass@host).
38
+ */
39
+ allowAuthentication?: boolean;
40
+ /**
41
+ * Custom metadata for the URL field.
42
+ */
43
+ metadata?: Record<string, unknown>;
44
+ /**
45
+ * Index signature to allow additional properties.
46
+ */
47
+ [key: string]: unknown;
48
+ }
49
+ /**
50
+ * Type-safe configuration for URL semantic.
51
+ */
52
+ export interface AppliedURLSemantic extends AppliedDataSemantic {
53
+ id: SemanticType.URL;
54
+ config?: URLConfig;
55
+ }
56
+ /**
57
+ * Type guard to check if a semantic is a URL semantic.
58
+ */
59
+ export declare const isURLSemantic: (semantic: AppliedDataSemantic) => semantic is AppliedURLSemantic;
60
+ /**
61
+ * Helper function to create a URL semantic with configuration.
62
+ */
63
+ export declare const createURLSemantic: (config?: URLConfig) => AppliedURLSemantic;
64
+ /**
65
+ * Default configuration for URL semantic.
66
+ */
67
+ export declare const DEFAULT_URL_CONFIG: URLConfig;
68
+ //# sourceMappingURL=URL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"URL.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/URL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,EAAE,EAAE,YAAY,CAAC,GAAG,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,kBAEzE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAQ,SAAc,KAAG,kBAa1D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAShC,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { SemanticType } from '../Semantics.js';
2
+ /**
3
+ * Type guard to check if a semantic is a URL semantic.
4
+ */
5
+ export const isURLSemantic = (semantic) => {
6
+ return semantic.id === SemanticType.URL;
7
+ };
8
+ /**
9
+ * Helper function to create a URL semantic with configuration.
10
+ */
11
+ export const createURLSemantic = (config = {}) => {
12
+ const mergedConfig = {
13
+ ...DEFAULT_URL_CONFIG,
14
+ ...config,
15
+ };
16
+ if (config.metadata) {
17
+ mergedConfig.metadata = { ...config.metadata };
18
+ }
19
+ return {
20
+ id: SemanticType.URL,
21
+ config: mergedConfig,
22
+ };
23
+ };
24
+ /**
25
+ * Default configuration for URL semantic.
26
+ */
27
+ export const DEFAULT_URL_CONFIG = {
28
+ allowedProtocols: ['http', 'https'],
29
+ requireHttps: false,
30
+ allowQueryParams: true,
31
+ allowFragments: true,
32
+ allowInternational: true,
33
+ allowIP: true,
34
+ allowPort: true,
35
+ allowAuthentication: false,
36
+ };
37
+ //# sourceMappingURL=URL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"URL.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/URL.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAyD9C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA6B,EAAkC,EAAE;IAC7F,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,GAAG,CAAA;AACzC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAE,EAAsB,EAAE;IAC9E,MAAM,YAAY,GAAG;QACnB,GAAG,kBAAkB;QACrB,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,GAAG;QACpB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,gBAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACnC,YAAY,EAAE,KAAK;IACnB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,mBAAmB,EAAE,KAAK;CAC3B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the URL semantic.\n * Controls validation, allowed protocols, and formatting.\n */\nexport interface URLConfig {\n /**\n * List of allowed protocols (e.g., ['http', 'https']).\n */\n allowedProtocols?: string[]\n /**\n * Whether to require HTTPS protocol (default: false).\n */\n requireHttps?: boolean\n /**\n * Whether to allow query parameters in the URL.\n */\n allowQueryParams?: boolean\n /**\n * Whether to allow URL fragments (e.g., #section).\n */\n allowFragments?: boolean\n /**\n * Whether to allow internationalized domain names.\n */\n allowInternational?: boolean\n /**\n * Whether to allow IP addresses as hostnames.\n */\n allowIP?: boolean\n /**\n * Whether to allow port numbers in the URL.\n */\n allowPort?: boolean\n /**\n * Whether to allow authentication info (user:pass@host).\n */\n allowAuthentication?: boolean\n /**\n * Custom metadata for the URL field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for URL semantic.\n */\nexport interface AppliedURLSemantic extends AppliedDataSemantic {\n id: SemanticType.URL\n config?: URLConfig\n}\n\n/**\n * Type guard to check if a semantic is a URL semantic.\n */\nexport const isURLSemantic = (semantic: AppliedDataSemantic): semantic is AppliedURLSemantic => {\n return semantic.id === SemanticType.URL\n}\n\n/**\n * Helper function to create a URL semantic with configuration.\n */\nexport const createURLSemantic = (config: URLConfig = {}): AppliedURLSemantic => {\n const mergedConfig = {\n ...DEFAULT_URL_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.URL,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for URL semantic.\n */\nexport const DEFAULT_URL_CONFIG: URLConfig = {\n allowedProtocols: ['http', 'https'],\n requireHttps: false,\n allowQueryParams: true,\n allowFragments: true,\n allowInternational: true,\n allowIP: true,\n allowPort: true,\n allowAuthentication: false,\n}\n"]}
@@ -27,5 +27,9 @@ export declare class SemanticValidation {
27
27
  * This includes either DeletedTimestamp or DeletedFlag.
28
28
  */
29
29
  private validateSoftDeleteSemantics;
30
+ /**
31
+ * Validates if property semantics are applied to properties with compatible data types.
32
+ */
33
+ private validatePropertySemanticsDataTypes;
30
34
  }
31
35
  //# sourceMappingURL=semantic_validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"semantic_validation.d.ts","sourceRoot":"","sources":["../../../../src/modeling/validation/semantic_validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;GAGG;AACH,qBAAa,kBAAkB;IACjB,SAAS,CAAC,MAAM,EAAE,UAAU;gBAAlB,MAAM,EAAE,UAAU;IAExC;;;OAGG;IACH,QAAQ,IAAI,gBAAgB,EAAE;IAkB9B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA4ClC;;;OAGG;IACH,OAAO,CAAC,2BAA2B;CA4BpC"}
1
+ {"version":3,"file":"semantic_validation.d.ts","sourceRoot":"","sources":["../../../../src/modeling/validation/semantic_validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;GAGG;AACH,qBAAa,kBAAkB;IACjB,SAAS,CAAC,MAAM,EAAE,UAAU;gBAAlB,MAAM,EAAE,UAAU;IAExC;;;OAGG;IACH,QAAQ,IAAI,gBAAgB,EAAE;IAsB9B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA4ClC;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IA6BnC;;OAEG;IACH,OAAO,CAAC,kCAAkC;CA0B3C"}
@@ -1,5 +1,5 @@
1
1
  import { DomainEntityKind } from '../../models/kinds.js';
2
- import { SemanticType } from '../Semantics.js';
2
+ import { DataSemantics, isPropertySemantic, SemanticType } from '../Semantics.js';
3
3
  /**
4
4
  * SemanticValidation is a class that performs validation on semantics in a data domain.
5
5
  * It checks for required and recommended semantics in entities, properties, and associations.
@@ -24,6 +24,9 @@ export class SemanticValidation {
24
24
  // Check for soft delete semantics
25
25
  const softDeleteSemantics = this.validateSoftDeleteSemantics();
26
26
  results.push(...softDeleteSemantics);
27
+ // Validate property semantics data types
28
+ const propertySemanticsDataTypes = this.validatePropertySemanticsDataTypes();
29
+ results.push(...propertySemanticsDataTypes);
27
30
  return results;
28
31
  }
29
32
  /**
@@ -122,5 +125,33 @@ export class SemanticValidation {
122
125
  }
123
126
  return results;
124
127
  }
128
+ /**
129
+ * Validates if property semantics are applied to properties with compatible data types.
130
+ */
131
+ validatePropertySemanticsDataTypes() {
132
+ const results = [];
133
+ for (const entity of this.domain.listEntities()) {
134
+ for (const property of entity.listProperties()) {
135
+ for (const appliedSemantic of property.semantics) {
136
+ const semanticDefinition = DataSemantics[appliedSemantic.id];
137
+ if (isPropertySemantic(semanticDefinition) && semanticDefinition.applicableDataTypes) {
138
+ if (!semanticDefinition.applicableDataTypes.includes(property.type)) {
139
+ results.push({
140
+ field: 'semantics',
141
+ rule: 'type_mismatch',
142
+ message: `The "${property.info.getLabel()}" property has the "${semanticDefinition.displayName}" semantic applied, but its type "${property.type}" is not compatible.`,
143
+ help: `The "${semanticDefinition.displayName}" semantic can only be applied to properties of type(s): ${semanticDefinition.applicableDataTypes.join(', ')}.`,
144
+ severity: 'error',
145
+ key: property.key,
146
+ kind: property.kind,
147
+ parent: entity.key,
148
+ });
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+ return results;
155
+ }
125
156
  }
126
157
  //# sourceMappingURL=semantic_validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semantic_validation.js","sourceRoot":"","sources":["../../../../src/modeling/validation/semantic_validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACP;IAAtB,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE5C;;;OAGG;IACH,QAAQ;QACN,MAAM,OAAO,GAAuB,EAAE,CAAA;QAEtC,iCAAiC;QACjC,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAC/C,OAAO,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAA;QAE9B,gCAAgC;QAChC,MAAM,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAA;QAC5D,OAAO,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAA;QAEnC,kCAAkC;QAClC,MAAM,mBAAmB,GAAG,IAAI,CAAC,2BAA2B,EAAE,CAAA;QAC9D,OAAO,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAA;QAEpC,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;OAGG;IACK,kBAAkB;QACxB,MAAM,OAAO,GAAuB,EAAE,CAAA;QACtC,IAAI,aAAa,GAAG,KAAK,CAAA;QAEzB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YAChD,IAAI,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,aAAa,GAAG,IAAI,CAAA;gBACpB,MAAK;YACP,CAAC;QACH,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,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,CAAC,IAAI,CAAC,QAAQ,EAAE,sDAAsD;oBAC7F,IAAI,EAAE,oGAAoG;oBAC1G,QAAQ,EAAE,MAAM;oBAChB,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;OAGG;IACK,2BAA2B;QACjC,MAAM,OAAO,GAAuB,EAAE,CAAA;QAEtC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YAChD,IAAI,aAAa,GAAG,KAAK,CAAA;YAEzB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC/C,IAAI,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC1G,aAAa,GAAG,IAAI,CAAA;oBACpB,MAAK;gBACP,CAAC;YACH,CAAC;YAED,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC;oBACX,KAAK,EAAE,WAAW;oBAClB,IAAI,EAAE,aAAa;oBACnB,OAAO,EAAE,QAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,8CAA8C;oBACrF,IAAI,EAAE,gGAAgG;oBACtG,QAAQ,EAAE,MAAM;oBAChB,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF","sourcesContent":["import { DomainEntityKind } from '../../models/kinds.js'\nimport type { DataDomain } from '../DataDomain.js'\nimport { SemanticType } from '../Semantics.js'\nimport type { DomainValidation } from './rules.js'\n\n/**\n * SemanticValidation is a class that performs validation on semantics in a data domain.\n * It checks for required and recommended semantics in entities, properties, and associations.\n */\nexport class SemanticValidation {\n constructor(protected domain: DataDomain) {}\n\n /**\n * Performs all the semantic validation rules on the domain.\n * @returns The list of validation messages.\n */\n validate(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n // Check for User entity semantic\n const hasUserEntity = this.validateUserEntity()\n results.push(...hasUserEntity)\n\n // Check for timestamp semantics\n const timestampSemantics = this.validateTimestampSemantics()\n results.push(...timestampSemantics)\n\n // Check for soft delete semantics\n const softDeleteSemantics = this.validateSoftDeleteSemantics()\n results.push(...softDeleteSemantics)\n\n return results\n }\n\n /**\n * Validates if there is at least one entity with the User semantic.\n * This is a recommended semantic for authentication purposes.\n */\n private validateUserEntity(): DomainValidation[] {\n const results: DomainValidation[] = []\n let hasUserEntity = false\n\n for (const entity of this.domain.listEntities()) {\n if (entity.hasSemantic(SemanticType.User)) {\n hasUserEntity = true\n break\n }\n }\n\n if (!hasUserEntity) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: 'No entity with User taxonomy found in the domain.',\n help: 'It is recommended to have at least one entity with the User taxonomy for authentication purposes.',\n severity: 'warning',\n key: 'user_semantic',\n kind: DomainEntityKind,\n })\n }\n\n return results\n }\n\n /**\n * Validates if entities have the recommended timestamp semantics.\n * This includes CreatedTimestamp and UpdatedTimestamp.\n */\n private validateTimestampSemantics(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n for (const entity of this.domain.listEntities()) {\n let hasCreatedTimestamp = false\n let hasUpdatedTimestamp = false\n\n for (const property of entity.listProperties()) {\n if (property.hasSemantic(SemanticType.CreatedTimestamp)) {\n hasCreatedTimestamp = true\n }\n if (property.hasSemantic(SemanticType.UpdatedTimestamp)) {\n hasUpdatedTimestamp = true\n }\n }\n\n if (!hasCreatedTimestamp) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have a CreatedTimestamp taxonomy.`,\n help: 'It is recommended to have a CreatedTimestamp property to track when the entity was created.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n\n if (!hasUpdatedTimestamp) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have an UpdatedTimestamp taxonomy.`,\n help: 'It is recommended to have an UpdatedTimestamp property to track when the entity was last modified.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n }\n\n return results\n }\n\n /**\n * Validates if entities have the recommended soft delete semantics.\n * This includes either DeletedTimestamp or DeletedFlag.\n */\n private validateSoftDeleteSemantics(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n for (const entity of this.domain.listEntities()) {\n let hasSoftDelete = false\n\n for (const property of entity.listProperties()) {\n if (property.hasSemantic(SemanticType.DeletedTimestamp) || property.hasSemantic(SemanticType.DeletedFlag)) {\n hasSoftDelete = true\n break\n }\n }\n\n if (!hasSoftDelete) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have soft delete taxonomy.`,\n help: 'It is recommended to have either a DeletedTimestamp or DeletedFlag property for soft deletion.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n }\n\n return results\n }\n}\n"]}
1
+ {"version":3,"file":"semantic_validation.js","sourceRoot":"","sources":["../../../../src/modeling/validation/semantic_validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGjF;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACP;IAAtB,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE5C;;;OAGG;IACH,QAAQ;QACN,MAAM,OAAO,GAAuB,EAAE,CAAA;QAEtC,iCAAiC;QACjC,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAC/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AI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;4BACpE,OAAO,CAAC,IAAI,CAAC;gCACX,KAAK,EAAE,WAAW;gCAClB,IAAI,EAAE,eAAe;gCACrB,OAAO,EAAE,QAAQ,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,uBAAuB,kBAAkB,CAAC,WAAW,qCAAqC,QAAQ,CAAC,IAAI,sBAAsB;gCACtK,IAAI,EAAE,QAAQ,kBAAkB,CAAC,WAAW,4DAA4D,kBAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gCAC5J,QAAQ,EAAE,OAAO;gCACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;gCACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;gCACnB,MAAM,EAAE,MAAM,CAAC,GAAG;6BACnB,CAAC,CAAA;wBACJ,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF","sourcesContent":["import { DomainEntityKind } from '../../models/kinds.js'\nimport type { DataDomain } from '../DataDomain.js'\nimport { DataSemantics, isPropertySemantic, SemanticType } from '../Semantics.js'\nimport type { DomainValidation } from './rules.js'\n\n/**\n * SemanticValidation is a class that performs validation on semantics in a data domain.\n * It checks for required and recommended semantics in entities, properties, and associations.\n */\nexport class SemanticValidation {\n constructor(protected domain: DataDomain) {}\n\n /**\n * Performs all the semantic validation rules on the domain.\n * @returns The list of validation messages.\n */\n validate(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n // Check for User entity semantic\n const hasUserEntity = this.validateUserEntity()\n results.push(...hasUserEntity)\n\n // Check for timestamp semantics\n const timestampSemantics = this.validateTimestampSemantics()\n results.push(...timestampSemantics)\n\n // Check for soft delete semantics\n const softDeleteSemantics = this.validateSoftDeleteSemantics()\n results.push(...softDeleteSemantics)\n\n // Validate property semantics data types\n const propertySemanticsDataTypes = this.validatePropertySemanticsDataTypes()\n results.push(...propertySemanticsDataTypes)\n\n return results\n }\n\n /**\n * Validates if there is at least one entity with the User semantic.\n * This is a recommended semantic for authentication purposes.\n */\n private validateUserEntity(): DomainValidation[] {\n const results: DomainValidation[] = []\n let hasUserEntity = false\n\n for (const entity of this.domain.listEntities()) {\n if (entity.hasSemantic(SemanticType.User)) {\n hasUserEntity = true\n break\n }\n }\n\n if (!hasUserEntity) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: 'No entity with User taxonomy found in the domain.',\n help: 'It is recommended to have at least one entity with the User taxonomy for authentication purposes.',\n severity: 'warning',\n key: 'user_semantic',\n kind: DomainEntityKind,\n })\n }\n\n return results\n }\n\n /**\n * Validates if entities have the recommended timestamp semantics.\n * This includes CreatedTimestamp and UpdatedTimestamp.\n */\n private validateTimestampSemantics(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n for (const entity of this.domain.listEntities()) {\n let hasCreatedTimestamp = false\n let hasUpdatedTimestamp = false\n\n for (const property of entity.listProperties()) {\n if (property.hasSemantic(SemanticType.CreatedTimestamp)) {\n hasCreatedTimestamp = true\n }\n if (property.hasSemantic(SemanticType.UpdatedTimestamp)) {\n hasUpdatedTimestamp = true\n }\n }\n\n if (!hasCreatedTimestamp) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have a CreatedTimestamp taxonomy.`,\n help: 'It is recommended to have a CreatedTimestamp property to track when the entity was created.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n\n if (!hasUpdatedTimestamp) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have an UpdatedTimestamp taxonomy.`,\n help: 'It is recommended to have an UpdatedTimestamp property to track when the entity was last modified.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n }\n\n return results\n }\n\n /**\n * Validates if entities have the recommended soft delete semantics.\n * This includes either DeletedTimestamp or DeletedFlag.\n */\n private validateSoftDeleteSemantics(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n for (const entity of this.domain.listEntities()) {\n let hasSoftDelete = false\n\n for (const property of entity.listProperties()) {\n if (property.hasSemantic(SemanticType.DeletedTimestamp) || property.hasSemantic(SemanticType.DeletedFlag)) {\n hasSoftDelete = true\n break\n }\n }\n\n if (!hasSoftDelete) {\n results.push({\n field: 'semantics',\n rule: 'recommended',\n message: `The \"${entity.info.getLabel()}\" entity does not have soft delete taxonomy.`,\n help: 'It is recommended to have either a DeletedTimestamp or DeletedFlag property for soft deletion.',\n severity: 'info',\n key: entity.key,\n kind: entity.kind,\n })\n }\n }\n\n return results\n }\n\n /**\n * Validates if property semantics are applied to properties with compatible data types.\n */\n private validatePropertySemanticsDataTypes(): DomainValidation[] {\n const results: DomainValidation[] = []\n\n for (const entity of this.domain.listEntities()) {\n for (const property of entity.listProperties()) {\n for (const appliedSemantic of property.semantics) {\n const semanticDefinition = DataSemantics[appliedSemantic.id]\n if (isPropertySemantic(semanticDefinition) && semanticDefinition.applicableDataTypes) {\n if (!semanticDefinition.applicableDataTypes.includes(property.type)) {\n results.push({\n field: 'semantics',\n rule: 'type_mismatch',\n message: `The \"${property.info.getLabel()}\" property has the \"${semanticDefinition.displayName}\" semantic applied, but its type \"${property.type}\" is not compatible.`,\n help: `The \"${semanticDefinition.displayName}\" semantic can only be applied to properties of type(s): ${semanticDefinition.applicableDataTypes.join(', ')}.`,\n severity: 'error',\n key: property.key,\n kind: property.kind,\n parent: entity.key,\n })\n }\n }\n }\n }\n }\n return results\n }\n}\n"]}