@intellegens/cornerstone-client 0.0.9999-alpha-9 → 0.0.9999-alpha-10

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 (227) hide show
  1. package/demo/index.ts +29 -0
  2. package/demo/public_html/favicon.ico +0 -0
  3. package/demo/public_html/index.html +106 -0
  4. package/demo/public_html/websettings.json +3 -0
  5. package/jest.config.js +29 -0
  6. package/package.json +1 -1
  7. package/src/adapters/CollectionViewAdapter/index.ts +390 -0
  8. package/src/adapters/index.ts +1 -0
  9. package/src/data/api/dto/PropertyPathDto.ts +4 -0
  10. package/src/data/api/dto/ReadOptionsDto.ts +8 -0
  11. package/src/data/api/dto/ReadResultDto.ts +13 -0
  12. package/src/data/api/dto/ReadResultMetadataDto.ts +8 -0
  13. package/src/data/api/dto/crud/CrudMetadataDto.ts +4 -0
  14. package/src/data/api/dto/crud/index.ts +1 -0
  15. package/src/data/api/dto/index.ts +4 -0
  16. package/src/data/api/dto/read/ReadMetadataDto.ts +8 -0
  17. package/src/data/api/dto/read/ReadSelectedDefinitionDto.ts +21 -0
  18. package/src/data/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.ts +25 -0
  19. package/src/data/api/dto/read/ReadSelectedNestedCriteriaDto.ts +20 -0
  20. package/src/data/api/dto/read/ReadSelectedOrderingDefinitionDto.ts +8 -0
  21. package/src/data/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.ts +16 -0
  22. package/src/data/api/dto/read/ReadSelectedPaginationDefinitionDto.ts +13 -0
  23. package/src/data/api/dto/read/ReadSelectedSearchDefinitionDto.ts +43 -0
  24. package/src/data/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.ts +186 -0
  25. package/src/data/api/dto/read/index.ts +9 -0
  26. package/src/data/api/dto/response/ApiErrorDto.ts +21 -0
  27. package/src/data/api/dto/response/ApiErrorResponseDto.ts +13 -0
  28. package/src/data/api/dto/response/ApiResponseDto.ts +7 -0
  29. package/src/data/api/dto/response/ApiSuccessResponseDto.ts +13 -0
  30. package/src/data/api/dto/response/MetadataDto.ts +24 -0
  31. package/src/data/api/dto/response/index.ts +5 -0
  32. package/src/data/api/enum/index.ts +2 -0
  33. package/src/data/api/enum/read/ReadSelectedCollectionOperator.ts +17 -0
  34. package/src/data/api/enum/read/ReadSelectedComparisonOperator.ts +96 -0
  35. package/src/data/api/enum/read/ReadSelectedLogicalOperator.ts +16 -0
  36. package/src/data/api/enum/read/ReadSelectedOrderingDirection.ts +13 -0
  37. package/src/data/api/enum/read/ReadSelectedPropertyType.ts +86 -0
  38. package/src/data/api/enum/read/index.ts +5 -0
  39. package/src/data/api/enum/response/ErrorCode.ts +13 -0
  40. package/src/data/api/enum/response/index.ts +1 -0
  41. package/src/data/api/index.ts +3 -0
  42. package/src/data/api/interface/IConcurrencySafe.ts +9 -0
  43. package/src/data/api/interface/IIdentifiable.ts +12 -0
  44. package/src/data/api/interface/IIdentifiableSecondary.ts +9 -0
  45. package/src/data/api/interface/index.ts +3 -0
  46. package/src/data/auth/dto/ClaimDto.ts +4 -0
  47. package/src/data/auth/dto/RegisterRequestDto.ts +4 -0
  48. package/src/data/auth/dto/RoleDto.ts +6 -0
  49. package/src/data/auth/dto/SignInRequestDto.ts +4 -0
  50. package/src/data/auth/dto/TokensDto.ts +4 -0
  51. package/src/data/auth/dto/UserDto.ts +18 -0
  52. package/src/data/auth/dto/UserInfoDto.ts +15 -0
  53. package/src/data/auth/dto/index.ts +4 -0
  54. package/src/data/auth/index.ts +2 -0
  55. package/src/data/auth/policy.ts +63 -0
  56. package/src/data/index.ts +2 -0
  57. package/src/index.ts +4 -0
  58. package/src/services/api/ApiCrudControllerClient/index.ts +129 -0
  59. package/src/services/api/ApiInitializationService/index.ts +254 -0
  60. package/src/services/api/ApiReadControllerClient/index.ts +137 -0
  61. package/src/services/api/HttpService/FetchHttpService.ts +34 -0
  62. package/src/services/api/HttpService/HttpRequestConfig.ts +10 -0
  63. package/src/services/api/HttpService/HttpResponse.ts +14 -0
  64. package/src/services/api/HttpService/IHttpService.ts +17 -0
  65. package/src/services/api/HttpService/README.md +106 -0
  66. package/src/services/api/HttpService/index.ts +12 -0
  67. package/src/services/api/UserManagementControllerClient/index.ts +160 -0
  68. package/src/services/api/index.ts +5 -0
  69. package/src/services/auth/client/AuthService/index.ts +187 -0
  70. package/src/services/auth/client/AuthorizationManagementControllerClient/index.ts +165 -0
  71. package/src/services/auth/client/index.ts +2 -0
  72. package/src/services/auth/index.ts +1 -0
  73. package/src/services/index.ts +2 -0
  74. package/src/utils/authorization/index.ts +47 -0
  75. package/src/utils/index.ts +2 -0
  76. package/src/utils/result/index.ts +25 -0
  77. package/src/utils/search/index.ts +150 -0
  78. package/tests/ApiClients.test.ts +284 -0
  79. package/tests/CollectionViewAdapter.test.ts +392 -0
  80. package/tests/HttpService.test.ts +303 -0
  81. package/tests/setup.ts +76 -0
  82. package/tsconfig.json +19 -0
  83. package/LICENSE.md +0 -7
  84. /package/{adapters → dist/adapters}/CollectionViewAdapter/index.d.ts +0 -0
  85. /package/{adapters → dist/adapters}/CollectionViewAdapter/index.js +0 -0
  86. /package/{adapters → dist/adapters}/index.d.ts +0 -0
  87. /package/{adapters → dist/adapters}/index.js +0 -0
  88. /package/{data → dist/data}/api/dto/PropertyPathDto.d.ts +0 -0
  89. /package/{data → dist/data}/api/dto/PropertyPathDto.js +0 -0
  90. /package/{data → dist/data}/api/dto/ReadOptionsDto.d.ts +0 -0
  91. /package/{data → dist/data}/api/dto/ReadOptionsDto.js +0 -0
  92. /package/{data → dist/data}/api/dto/ReadResultDto.d.ts +0 -0
  93. /package/{data → dist/data}/api/dto/ReadResultDto.js +0 -0
  94. /package/{data → dist/data}/api/dto/ReadResultMetadataDto.d.ts +0 -0
  95. /package/{data → dist/data}/api/dto/ReadResultMetadataDto.js +0 -0
  96. /package/{data → dist/data}/api/dto/crud/CrudMetadataDto.d.ts +0 -0
  97. /package/{data → dist/data}/api/dto/crud/CrudMetadataDto.js +0 -0
  98. /package/{data → dist/data}/api/dto/crud/index.d.ts +0 -0
  99. /package/{data → dist/data}/api/dto/crud/index.js +0 -0
  100. /package/{data → dist/data}/api/dto/index.d.ts +0 -0
  101. /package/{data → dist/data}/api/dto/index.js +0 -0
  102. /package/{data → dist/data}/api/dto/read/ReadMetadataDto.d.ts +0 -0
  103. /package/{data → dist/data}/api/dto/read/ReadMetadataDto.js +0 -0
  104. /package/{data → dist/data}/api/dto/read/ReadSelectedDefinitionDto.d.ts +0 -0
  105. /package/{data → dist/data}/api/dto/read/ReadSelectedDefinitionDto.js +0 -0
  106. /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.d.ts +0 -0
  107. /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.js +0 -0
  108. /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCriteriaDto.d.ts +0 -0
  109. /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCriteriaDto.js +0 -0
  110. /package/{data → dist/data}/api/dto/read/ReadSelectedOrderingDefinitionDto.d.ts +0 -0
  111. /package/{data → dist/data}/api/dto/read/ReadSelectedOrderingDefinitionDto.js +0 -0
  112. /package/{data → dist/data}/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.d.ts +0 -0
  113. /package/{data → dist/data}/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.js +0 -0
  114. /package/{data → dist/data}/api/dto/read/ReadSelectedPaginationDefinitionDto.d.ts +0 -0
  115. /package/{data → dist/data}/api/dto/read/ReadSelectedPaginationDefinitionDto.js +0 -0
  116. /package/{data → dist/data}/api/dto/read/ReadSelectedSearchDefinitionDto.d.ts +0 -0
  117. /package/{data → dist/data}/api/dto/read/ReadSelectedSearchDefinitionDto.js +0 -0
  118. /package/{data → dist/data}/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.d.ts +0 -0
  119. /package/{data → dist/data}/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.js +0 -0
  120. /package/{data → dist/data}/api/dto/read/index.d.ts +0 -0
  121. /package/{data → dist/data}/api/dto/read/index.js +0 -0
  122. /package/{data → dist/data}/api/dto/response/ApiErrorDto.d.ts +0 -0
  123. /package/{data → dist/data}/api/dto/response/ApiErrorDto.js +0 -0
  124. /package/{data → dist/data}/api/dto/response/ApiErrorResponseDto.d.ts +0 -0
  125. /package/{data → dist/data}/api/dto/response/ApiErrorResponseDto.js +0 -0
  126. /package/{data → dist/data}/api/dto/response/ApiResponseDto.d.ts +0 -0
  127. /package/{data → dist/data}/api/dto/response/ApiResponseDto.js +0 -0
  128. /package/{data → dist/data}/api/dto/response/ApiSuccessResponseDto.d.ts +0 -0
  129. /package/{data → dist/data}/api/dto/response/ApiSuccessResponseDto.js +0 -0
  130. /package/{data → dist/data}/api/dto/response/EmptyMetadataDto.d.ts +0 -0
  131. /package/{data → dist/data}/api/dto/response/EmptyMetadataDto.js +0 -0
  132. /package/{data → dist/data}/api/dto/response/MetadataDto.d.ts +0 -0
  133. /package/{data → dist/data}/api/dto/response/MetadataDto.js +0 -0
  134. /package/{data → dist/data}/api/dto/response/index.d.ts +0 -0
  135. /package/{data → dist/data}/api/dto/response/index.js +0 -0
  136. /package/{data → dist/data}/api/enum/index.d.ts +0 -0
  137. /package/{data → dist/data}/api/enum/index.js +0 -0
  138. /package/{data → dist/data}/api/enum/read/ReadSelectedCollectionOperator.d.ts +0 -0
  139. /package/{data → dist/data}/api/enum/read/ReadSelectedCollectionOperator.js +0 -0
  140. /package/{data → dist/data}/api/enum/read/ReadSelectedComparisonOperator.d.ts +0 -0
  141. /package/{data → dist/data}/api/enum/read/ReadSelectedComparisonOperator.js +0 -0
  142. /package/{data → dist/data}/api/enum/read/ReadSelectedLogicalOperator.d.ts +0 -0
  143. /package/{data → dist/data}/api/enum/read/ReadSelectedLogicalOperator.js +0 -0
  144. /package/{data → dist/data}/api/enum/read/ReadSelectedOrderingDirection.d.ts +0 -0
  145. /package/{data → dist/data}/api/enum/read/ReadSelectedOrderingDirection.js +0 -0
  146. /package/{data → dist/data}/api/enum/read/ReadSelectedPropertyType.d.ts +0 -0
  147. /package/{data → dist/data}/api/enum/read/ReadSelectedPropertyType.js +0 -0
  148. /package/{data → dist/data}/api/enum/read/index.d.ts +0 -0
  149. /package/{data → dist/data}/api/enum/read/index.js +0 -0
  150. /package/{data → dist/data}/api/enum/response/ApiErrorCodes.d.ts +0 -0
  151. /package/{data → dist/data}/api/enum/response/ApiErrorCodes.js +0 -0
  152. /package/{data → dist/data}/api/enum/response/ErrorCode.d.ts +0 -0
  153. /package/{data → dist/data}/api/enum/response/ErrorCode.js +0 -0
  154. /package/{data → dist/data}/api/enum/response/index.d.ts +0 -0
  155. /package/{data → dist/data}/api/enum/response/index.js +0 -0
  156. /package/{data → dist/data}/api/index.d.ts +0 -0
  157. /package/{data → dist/data}/api/index.js +0 -0
  158. /package/{data → dist/data}/api/interface/IConcurrencySafe.d.ts +0 -0
  159. /package/{data → dist/data}/api/interface/IConcurrencySafe.js +0 -0
  160. /package/{data → dist/data}/api/interface/IIdentifiable.d.ts +0 -0
  161. /package/{data → dist/data}/api/interface/IIdentifiable.js +0 -0
  162. /package/{data → dist/data}/api/interface/IIdentifiableSecondary.d.ts +0 -0
  163. /package/{data → dist/data}/api/interface/IIdentifiableSecondary.js +0 -0
  164. /package/{data → dist/data}/api/interface/index.d.ts +0 -0
  165. /package/{data → dist/data}/api/interface/index.js +0 -0
  166. /package/{data → dist/data}/auth/dto/ClaimDto.d.ts +0 -0
  167. /package/{data → dist/data}/auth/dto/ClaimDto.js +0 -0
  168. /package/{data → dist/data}/auth/dto/RegisterRequestDto.d.ts +0 -0
  169. /package/{data → dist/data}/auth/dto/RegisterRequestDto.js +0 -0
  170. /package/{data → dist/data}/auth/dto/RoleDto.d.ts +0 -0
  171. /package/{data → dist/data}/auth/dto/RoleDto.js +0 -0
  172. /package/{data → dist/data}/auth/dto/SignInRequestDto.d.ts +0 -0
  173. /package/{data → dist/data}/auth/dto/SignInRequestDto.js +0 -0
  174. /package/{data → dist/data}/auth/dto/TokensDto.d.ts +0 -0
  175. /package/{data → dist/data}/auth/dto/TokensDto.js +0 -0
  176. /package/{data → dist/data}/auth/dto/UserDto.d.ts +0 -0
  177. /package/{data → dist/data}/auth/dto/UserDto.js +0 -0
  178. /package/{data → dist/data}/auth/dto/UserInfoDto.d.ts +0 -0
  179. /package/{data → dist/data}/auth/dto/UserInfoDto.js +0 -0
  180. /package/{data → dist/data}/auth/dto/index.d.ts +0 -0
  181. /package/{data → dist/data}/auth/dto/index.js +0 -0
  182. /package/{data → dist/data}/auth/index.d.ts +0 -0
  183. /package/{data → dist/data}/auth/index.js +0 -0
  184. /package/{data → dist/data}/auth/policy.d.ts +0 -0
  185. /package/{data → dist/data}/auth/policy.js +0 -0
  186. /package/{data → dist/data}/index.d.ts +0 -0
  187. /package/{data → dist/data}/index.js +0 -0
  188. /package/{index.d.ts → dist/index.d.ts} +0 -0
  189. /package/{index.js → dist/index.js} +0 -0
  190. /package/{services → dist/services}/api/ApiCrudControllerClient/index.d.ts +0 -0
  191. /package/{services → dist/services}/api/ApiCrudControllerClient/index.js +0 -0
  192. /package/{services → dist/services}/api/ApiInitializationService/index.d.ts +0 -0
  193. /package/{services → dist/services}/api/ApiInitializationService/index.js +0 -0
  194. /package/{services → dist/services}/api/ApiReadControllerClient/index.d.ts +0 -0
  195. /package/{services → dist/services}/api/ApiReadControllerClient/index.js +0 -0
  196. /package/{services → dist/services}/api/HttpService/FetchHttpService.d.ts +0 -0
  197. /package/{services → dist/services}/api/HttpService/FetchHttpService.js +0 -0
  198. /package/{services → dist/services}/api/HttpService/HttpRequestConfig.d.ts +0 -0
  199. /package/{services → dist/services}/api/HttpService/HttpRequestConfig.js +0 -0
  200. /package/{services → dist/services}/api/HttpService/HttpResponse.d.ts +0 -0
  201. /package/{services → dist/services}/api/HttpService/HttpResponse.js +0 -0
  202. /package/{services → dist/services}/api/HttpService/IHttpService.d.ts +0 -0
  203. /package/{services → dist/services}/api/HttpService/IHttpService.js +0 -0
  204. /package/{services → dist/services}/api/HttpService/index.d.ts +0 -0
  205. /package/{services → dist/services}/api/HttpService/index.js +0 -0
  206. /package/{services → dist/services}/api/UserManagementControllerClient/index.d.ts +0 -0
  207. /package/{services → dist/services}/api/UserManagementControllerClient/index.js +0 -0
  208. /package/{services → dist/services}/api/index.d.ts +0 -0
  209. /package/{services → dist/services}/api/index.js +0 -0
  210. /package/{services → dist/services}/auth/client/AuthService/index.d.ts +0 -0
  211. /package/{services → dist/services}/auth/client/AuthService/index.js +0 -0
  212. /package/{services → dist/services}/auth/client/AuthorizationManagementControllerClient/index.d.ts +0 -0
  213. /package/{services → dist/services}/auth/client/AuthorizationManagementControllerClient/index.js +0 -0
  214. /package/{services → dist/services}/auth/client/index.d.ts +0 -0
  215. /package/{services → dist/services}/auth/client/index.js +0 -0
  216. /package/{services → dist/services}/auth/index.d.ts +0 -0
  217. /package/{services → dist/services}/auth/index.js +0 -0
  218. /package/{services → dist/services}/index.d.ts +0 -0
  219. /package/{services → dist/services}/index.js +0 -0
  220. /package/{utils → dist/utils}/authorization/index.d.ts +0 -0
  221. /package/{utils → dist/utils}/authorization/index.js +0 -0
  222. /package/{utils → dist/utils}/index.d.ts +0 -0
  223. /package/{utils → dist/utils}/index.js +0 -0
  224. /package/{utils → dist/utils}/result/index.d.ts +0 -0
  225. /package/{utils → dist/utils}/result/index.js +0 -0
  226. /package/{utils → dist/utils}/search/index.d.ts +0 -0
  227. /package/{utils → dist/utils}/search/index.js +0 -0
@@ -0,0 +1,25 @@
1
+ import { ReadSelectedCollectionOperator, ReadSelectedSearchDefinitionDto } from '@data';
2
+
3
+ /**
4
+ * Defines criteria for searching within a collection navigation property using quantifiers (Any/All).
5
+ *
6
+ * This DTO allows navigation into a collection property and applying search criteria
7
+ * with a quantifier to determine if any or all elements match.
8
+ */
9
+ export type ReadSelectedNestedCollectionCriteriaDto<T, TPropertyName extends keyof T> = {
10
+ /**
11
+ * The name of the collection navigation property to navigate into.
12
+ */
13
+ propertyName: TPropertyName;
14
+
15
+ /**
16
+ * The quantifier operator determining whether any or all elements must match.
17
+ */
18
+ collectionOperator: ReadSelectedCollectionOperator;
19
+
20
+ /**
21
+ * The search criteria to apply to elements in the collection.
22
+ * Type should be ReadSelectedSearchDefinitionDto of the collection element type.
23
+ */
24
+ criteria: ReadSelectedSearchDefinitionDto<unknown>;
25
+ };
@@ -0,0 +1,20 @@
1
+ import {ReadSelectedSearchDefinitionDto} from '@data';
2
+
3
+ /**
4
+ * Defines criteria for searching within a nested object property.
5
+ *
6
+ * This DTO allows navigation into a nested object property and applying search criteria
7
+ * to that nested object. The property name must refer to a navigation property (not a collection).
8
+ */
9
+ export type ReadSelectedNestedCriteriaDto<T, TPropertyName extends keyof T> = {
10
+ /**
11
+ * The name of the navigation property to navigate into.
12
+ */
13
+ propertyName: TPropertyName;
14
+
15
+ /**
16
+ * The search criteria to apply to the nested object.
17
+ * Type should be ReadSelectedSearchDefinitionDto of the nested object type.
18
+ */
19
+ criteria: ReadSelectedSearchDefinitionDto<unknown>;
20
+ };
@@ -0,0 +1,8 @@
1
+ import { ReadSelectedOrderingPropertyDefinitionDto } from '@data';
2
+
3
+ /**
4
+ * Represents the ordering definition for a controller.
5
+ */
6
+ export type ReadSelectedOrderingDefinitionDto = {
7
+ order: ReadSelectedOrderingPropertyDefinitionDto[];
8
+ };
@@ -0,0 +1,16 @@
1
+ import { PropertyPathDto, ReadSelectedOrderingDirection } from '@data';
2
+
3
+ /**
4
+ * Defines the ordering property for a controller.
5
+ */
6
+ export type ReadSelectedOrderingPropertyDefinitionDto = {
7
+ /**
8
+ * Gets or sets the property path.
9
+ */
10
+ propertyPath: PropertyPathDto;
11
+
12
+ /**
13
+ * Gets or sets the ordering direction.
14
+ */
15
+ direction: ReadSelectedOrderingDirection;
16
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Defines the pagination parameters for a controller.
3
+ */
4
+ export type ReadSelectedPaginationDefinitionDto = {
5
+ /**
6
+ * Pagination offset
7
+ */
8
+ skip: number;
9
+ /**
10
+ * Pagination limit
11
+ */
12
+ limit: number;
13
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ ReadSelectedLogicalOperator,
3
+ ReadSelectedNestedCollectionCriteriaDto,
4
+ ReadSelectedNestedCriteriaDto,
5
+ ReadSelectedSearchPropertyDefinitionDto,
6
+ } from '@data';
7
+
8
+ /**
9
+ * Defines the search criteria for a controller using a recursive structure.
10
+ *
11
+ * This DTO supports complex search queries with:
12
+ * - Logical operators (AND/OR) to combine multiple criteria
13
+ * - Direct property value comparisons via `propertyCriteria`
14
+ * - Nested searches via `searches` for recursive query composition
15
+ * - Navigation into nested objects via `nestedCriteria`
16
+ * - Collection quantifier queries (Any/All) via `nestedCollectionCriteria`
17
+ */
18
+ export type ReadSelectedSearchDefinitionDto<T> = {
19
+ /**
20
+ * The logical operator to combine all criteria at this level.
21
+ */
22
+ logicalOperator: ReadSelectedLogicalOperator;
23
+
24
+ /**
25
+ * Recursive nested search definitions combined with the logical operator.
26
+ */
27
+ searches?: ReadSelectedSearchDefinitionDto<T>[];
28
+
29
+ /**
30
+ * Direct property value comparison criteria.
31
+ */
32
+ propertyCriteria?: ReadSelectedSearchPropertyDefinitionDto<T, keyof T>[];
33
+
34
+ /**
35
+ * Criteria for searching within nested object properties.
36
+ */
37
+ nestedCriteria?: ReadSelectedNestedCriteriaDto<T, keyof T>[];
38
+
39
+ /**
40
+ * Criteria for searching within collection properties using Any/All quantifiers.
41
+ */
42
+ nestedCollectionCriteria?: ReadSelectedNestedCollectionCriteriaDto<T, keyof T>[];
43
+ };
@@ -0,0 +1,186 @@
1
+ import {ReadSelectedComparisonOperator, ReadSelectedPropertyType} from '@data';
2
+
3
+ /**
4
+ * Defines a direct property value comparison criteria for searching.
5
+ *
6
+ * This DTO represents a leaf-level search criterion that compares a single property
7
+ * against a value using a comparison operator. For nested property searches, use
8
+ * `ReadSelectedNestedCriteriaDto` or `ReadSelectedNestedCollectionCriteriaDto`.
9
+ */
10
+ export type ReadSelectedSearchPropertyDefinitionDto<T, TPropertyName extends keyof T> =
11
+ Partial_ReadSelectedSearchPropertyDefinition_IndependentProperties<T, TPropertyName>
12
+ &
13
+ Partial_ReadSelectedSearchPropertyDefinition_TypedValueProperty
14
+ &
15
+ Partial_ReadSelectedSearchPropertyDefinition_TypedComparisonOperators;
16
+
17
+ /**
18
+ * Defines independent properties
19
+ */
20
+ type Partial_ReadSelectedSearchPropertyDefinition_IndependentProperties<T, TPropertyName extends keyof T> = {
21
+ /**
22
+ * The name of the property to compare.
23
+ *
24
+ * This must be a direct property on the target type, not a nested property path.
25
+ * Use nested criteria DTOs for navigation.
26
+ */
27
+ propertyName: TPropertyName;
28
+ /**
29
+ * The comparison operator to use for the search.
30
+ */
31
+ comparisonOperator: ReadSelectedComparisonOperator;
32
+ /**
33
+ * The type of the property value being searched.
34
+ */
35
+ valueType: ReadSelectedPropertyType;
36
+ /**
37
+ * The value to compare against.
38
+ */
39
+ value: unknown;
40
+ };
41
+
42
+ /**
43
+ * Defines the dependence between the .valueType and the type of the .value properties
44
+ */
45
+ type Partial_ReadSelectedSearchPropertyDefinition_TypedValueProperty =
46
+ // Boolean
47
+ | {
48
+ /**
49
+ * The type of the property value being searched.
50
+ */
51
+ valueType: ReadSelectedPropertyType.Bool;
52
+ /**
53
+ * The value to use for the search.
54
+ */
55
+ value: boolean;
56
+ }
57
+ // Number
58
+ | {
59
+ /**
60
+ * The type of the property value being searched.
61
+ */
62
+ valueType:
63
+ | ReadSelectedPropertyType.Int
64
+ | ReadSelectedPropertyType.Short
65
+ | ReadSelectedPropertyType.Long
66
+ | ReadSelectedPropertyType.Decimal
67
+ | ReadSelectedPropertyType.Double
68
+ | ReadSelectedPropertyType.Float;
69
+ /**
70
+ * The value to use for the search.
71
+ */
72
+ value: number;
73
+ }
74
+ // String
75
+ | {
76
+ /**
77
+ * The type of the property value being searched.
78
+ */
79
+ valueType: ReadSelectedPropertyType.String;
80
+ /**
81
+ * The value to use for the search.
82
+ */
83
+ value: string;
84
+ }
85
+ // Temporal
86
+ | {
87
+ /**
88
+ * The type of the property value being searched.
89
+ */
90
+ valueType:
91
+ | ReadSelectedPropertyType.DateTime
92
+ | ReadSelectedPropertyType.DateTimeOffset
93
+ | ReadSelectedPropertyType.TimeSpan
94
+ | ReadSelectedPropertyType.DateOnly
95
+ | ReadSelectedPropertyType.TimeOnly;
96
+ /**
97
+ * The value to use for the search.
98
+ */
99
+ value: string;
100
+ };
101
+
102
+ /**
103
+ * Defines the dependence between the .valueType and the type of the .comparisonOperator properties
104
+ */
105
+ type Partial_ReadSelectedSearchPropertyDefinition_TypedComparisonOperators =
106
+ // Boolean
107
+ | {
108
+ /**
109
+ * The type of the property value being searched.
110
+ */
111
+ valueType: ReadSelectedPropertyType.Bool;
112
+
113
+ /**
114
+ * The comparison operator to use for the search.
115
+ */
116
+ comparisonOperator: ReadSelectedComparisonOperator.Equal | ReadSelectedComparisonOperator.NotEqual;
117
+ }
118
+ // Number
119
+ | {
120
+ /**
121
+ * The type of the property value being searched.
122
+ */
123
+ valueType:
124
+ | ReadSelectedPropertyType.Int
125
+ | ReadSelectedPropertyType.Short
126
+ | ReadSelectedPropertyType.Long
127
+ | ReadSelectedPropertyType.Decimal
128
+ | ReadSelectedPropertyType.Double
129
+ | ReadSelectedPropertyType.Float;
130
+
131
+ /**
132
+ * The comparison operator to use for the search.
133
+ */
134
+ comparisonOperator:
135
+ | ReadSelectedComparisonOperator.Equal
136
+ | ReadSelectedComparisonOperator.NotEqual
137
+ | ReadSelectedComparisonOperator.LessThan
138
+ | ReadSelectedComparisonOperator.LessOrEqual
139
+ | ReadSelectedComparisonOperator.GreaterThan
140
+ | ReadSelectedComparisonOperator.GreaterOrEqual;
141
+ }
142
+ // String
143
+ | {
144
+ /**
145
+ * The type of the property value being searched.
146
+ */
147
+ valueType: ReadSelectedPropertyType.String;
148
+
149
+ /**
150
+ * The comparison operator to use for the search.
151
+ */
152
+ comparisonOperator:
153
+ | ReadSelectedComparisonOperator.Equal
154
+ | ReadSelectedComparisonOperator.NotEqual
155
+ | ReadSelectedComparisonOperator.Contains
156
+ | ReadSelectedComparisonOperator.StartsWith
157
+ | ReadSelectedComparisonOperator.EndsWith
158
+ | ReadSelectedComparisonOperator.IContains
159
+ | ReadSelectedComparisonOperator.IStartsWith
160
+ | ReadSelectedComparisonOperator.IEndsWith
161
+ | ReadSelectedComparisonOperator.IEqual
162
+ | ReadSelectedComparisonOperator.INotEqual;
163
+ }
164
+ // Temporal
165
+ | {
166
+ /**
167
+ * The type of the property value being searched.
168
+ */
169
+ valueType:
170
+ | ReadSelectedPropertyType.DateTime
171
+ | ReadSelectedPropertyType.DateTimeOffset
172
+ | ReadSelectedPropertyType.TimeSpan
173
+ | ReadSelectedPropertyType.DateOnly
174
+ | ReadSelectedPropertyType.TimeOnly;
175
+
176
+ /**
177
+ * The comparison operator to use for the search.
178
+ */
179
+ comparisonOperator:
180
+ | ReadSelectedComparisonOperator.Equal
181
+ | ReadSelectedComparisonOperator.NotEqual
182
+ | ReadSelectedComparisonOperator.LessThan
183
+ | ReadSelectedComparisonOperator.LessOrEqual
184
+ | ReadSelectedComparisonOperator.GreaterThan
185
+ | ReadSelectedComparisonOperator.GreaterOrEqual;
186
+ };
@@ -0,0 +1,9 @@
1
+ export * from './ReadMetadataDto';
2
+ export * from './ReadSelectedSearchPropertyDefinitionDto';
3
+ export * from './ReadSelectedNestedCriteriaDto';
4
+ export * from './ReadSelectedNestedCollectionCriteriaDto';
5
+ export * from './ReadSelectedOrderingDefinitionDto';
6
+ export * from './ReadSelectedOrderingPropertyDefinitionDto';
7
+ export * from './ReadSelectedPaginationDefinitionDto';
8
+ export * from './ReadSelectedDefinitionDto';
9
+ export * from './ReadSelectedSearchDefinitionDto';
@@ -0,0 +1,21 @@
1
+ import {EmptyMetadataDto, ErrorCode, ValidationFailedMetadataDto} from '@data';
2
+
3
+ /**
4
+ * Default, empty metadata.
5
+ */
6
+ export type ApiErrorDto<TMetadata extends ApiErrorMetadataDto = ApiErrorMetadataDto> = {
7
+ message: string;
8
+ details?: string;
9
+ traceId?: string;
10
+ timestamp?: string;
11
+ } & TMetadata;
12
+
13
+ export type ApiErrorMetadataDto =
14
+ | {
15
+ code: ErrorCode.ValidationFailed;
16
+ metadata: ValidationFailedMetadataDto;
17
+ }
18
+ | {
19
+ code: Omit<number, ErrorCode.ValidationFailed>;
20
+ metadata: EmptyMetadataDto;
21
+ };
@@ -0,0 +1,13 @@
1
+ import {ApiErrorDto, ApiErrorMetadataDto} from '@data';
2
+
3
+ /**
4
+ * Represents an API response containing an error and empty metadata.
5
+ */
6
+ export type ApiErrorResponseDto<TErrorMetadata extends ApiErrorMetadataDto = ApiErrorMetadataDto> = {
7
+ ok: false;
8
+
9
+ /**
10
+ * The error object containing information about the error
11
+ */
12
+ error: ApiErrorDto<TErrorMetadata>;
13
+ };
@@ -0,0 +1,7 @@
1
+ import {ApiErrorMetadataDto, ApiErrorResponseDto, ApiSuccessResponseDto} from '@/data';
2
+ import {Result} from '@utils/result';
3
+
4
+ export type ApiResponseDto<T, TMetadata extends object, TErrorMetadata extends ApiErrorMetadataDto = ApiErrorMetadataDto> = Result<
5
+ ApiSuccessResponseDto<T, TMetadata>,
6
+ ApiErrorResponseDto<TErrorMetadata>
7
+ >;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Represents a successful API response containing a result and metadata.
3
+ *
4
+ * @template T The type of result
5
+ * @template TMetadata The type of metadata
6
+ * @property {T} result - The result returned
7
+ * @property {TMetadata} metadata - Metadata about the result
8
+ */
9
+ export type ApiSuccessResponseDto<T, TMetadata> = {
10
+ ok: true;
11
+ result: T;
12
+ metadata: TMetadata;
13
+ };
@@ -0,0 +1,24 @@
1
+ declare const __brand: unique symbol;
2
+
3
+ /**
4
+ * Utility type for creating branded types that are nominally different but structurally identical.
5
+ * This enables compile-time type safety for values that would otherwise have the same runtime structure.
6
+ *
7
+ * @template T - The brand identifier string literal type
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * type UserId = Brand<'userId'>;
12
+ * type OrderId = Brand<'orderId'>;
13
+ *
14
+ * const userId: UserId = { [__brand]: 'userId' } as UserId;
15
+ * const orderId: OrderId = userId; // Type error! Different brands
16
+ * ```
17
+ */
18
+ export type Brand<T extends string> = { [__brand]: T };
19
+
20
+ /**
21
+ * Default, empty metadata.
22
+ */
23
+ export type EmptyMetadataDto = Brand<'emptyMetadata'>;
24
+ export type ValidationFailedMetadataDto = Brand<'validationFailedMetadata'>;
@@ -0,0 +1,5 @@
1
+ export * from './ApiResponseDto';
2
+ export * from './ApiSuccessResponseDto';
3
+ export * from './ApiErrorDto';
4
+ export * from './MetadataDto';
5
+ export * from './ApiErrorResponseDto';
@@ -0,0 +1,2 @@
1
+ export * from './response';
2
+ export * from './read';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Represents the collection quantifier operators that can be used when searching collection properties.
3
+ *
4
+ * The `Any` operator matches if at least one element in the collection satisfies the criteria.
5
+ * The `All` operator matches if all elements in the collection satisfy the criteria.
6
+ */
7
+ export enum ReadSelectedCollectionOperator {
8
+ /**
9
+ * Matches if at least one element in the collection satisfies the criteria.
10
+ */
11
+ Any = 0,
12
+
13
+ /**
14
+ * Matches if all elements in the collection satisfy the criteria.
15
+ */
16
+ All = 1,
17
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Represents the basic comparison operators that can be used in a controller.
3
+ */
4
+ export enum ReadSelectedComparisonOperator {
5
+ //#region Any type
6
+
7
+ /**
8
+ * Represents the equal comparison operator.
9
+ */
10
+ Equal = 0,
11
+
12
+ /**
13
+ * Represents the not equal comparison operator.
14
+ */
15
+ NotEqual = 1,
16
+
17
+ /**
18
+ * Represents the is null comparison operator.
19
+ */
20
+ IsNull = 2,
21
+
22
+ /**
23
+ * Represents the is not null comparison operator.
24
+ */
25
+ IsNotNull = 3,
26
+
27
+ //#endregion
28
+
29
+ //#region Number
30
+
31
+ /**
32
+ * Represents the less than comparison operator.
33
+ */
34
+ LessThan = 100,
35
+
36
+ /**
37
+ * Represents the less than or equal comparison operator.
38
+ */
39
+ LessOrEqual = 101,
40
+
41
+ /**
42
+ * Represents the greater than comparison operator.
43
+ */
44
+ GreaterThan = 102,
45
+
46
+ /**
47
+ * Represents the greater than or equal comparison operator.
48
+ */
49
+ GreaterOrEqual = 103,
50
+
51
+ //#endregion
52
+
53
+ //#region String
54
+
55
+ /**
56
+ * Represents the contains comparison operator.
57
+ */
58
+ Contains = 200,
59
+
60
+ /**
61
+ * Represents the starts with comparison operator.
62
+ */
63
+ StartsWith = 201,
64
+
65
+ /**
66
+ * Represents the ends with comparison operator.
67
+ */
68
+ EndsWith = 202,
69
+
70
+ /**
71
+ * Represents the contains comparison operator (case-insensitive).
72
+ */
73
+ IContains = 203,
74
+
75
+ /**
76
+ * Represents the starts with comparison operator (case-insensitive).
77
+ */
78
+ IStartsWith = 204,
79
+
80
+ /**
81
+ * Represents the ends with comparison operator (case-insensitive).
82
+ */
83
+ IEndsWith = 205,
84
+
85
+ /**
86
+ * Represents the equal comparison operator (case-insensitive).
87
+ */
88
+ IEqual = 206,
89
+
90
+ /**
91
+ * Represents the not equal comparison operator (case-insensitive).
92
+ */
93
+ INotEqual = 207,
94
+
95
+ //#endregion
96
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Represents the logical operators that can be used in a controller.
3
+ * - The `And` operator combines multiple conditions, requiring all of them to be true.
4
+ * - The `Or` operator combines multiple conditions, requiring at least one of them to be true.
5
+ */
6
+ export enum ReadSelectedLogicalOperator {
7
+ /**
8
+ * Represents the logical AND operator.
9
+ */
10
+ And = 0,
11
+
12
+ /**
13
+ * Represents the logical OR operator.
14
+ */
15
+ Or = 1,
16
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Represents options for ordering directions
3
+ */
4
+ export enum ReadSelectedOrderingDirection {
5
+ /**
6
+ * Ascending ordering
7
+ */
8
+ Ascending = 0,
9
+ /**
10
+ * Descending ordering
11
+ */
12
+ Descending = 1,
13
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Represents the basic property types that can be used in a controller.
3
+ * - The ReadSelectedPropertyType enum defines the basic property types that can be used in a fetch controller. These types include boolean, integer, long, and string.
4
+ */
5
+ export enum ReadSelectedPropertyType {
6
+ //#region Boolean
7
+
8
+ /**
9
+ * Represents a boolean property type.
10
+ */
11
+ Bool = 0,
12
+
13
+ //#endregion
14
+
15
+ //#region Number
16
+
17
+ /**
18
+ * Represents an integer property type.
19
+ */
20
+ Int = 100,
21
+
22
+ /**
23
+ * Represents a short property type.
24
+ */
25
+ Short = 101,
26
+
27
+ /**
28
+ * Represents a long property type.
29
+ */
30
+ Long = 102,
31
+
32
+ /**
33
+ * Represents a decimal property type.
34
+ */
35
+ Decimal = 103,
36
+
37
+ /**
38
+ * Represents a double property type.
39
+ */
40
+ Double = 104,
41
+
42
+ /**
43
+ * Represents a float property type.
44
+ */
45
+ Float = 105,
46
+
47
+ //#endregion
48
+
49
+ //#region string
50
+
51
+ /**
52
+ * Represents a string property type.
53
+ */
54
+ String = 200,
55
+
56
+ //#endregion
57
+
58
+ //#region Time
59
+
60
+ /**
61
+ * Represents a DateTime property type.
62
+ */
63
+ DateTime = 300,
64
+
65
+ /**
66
+ * Represents a DateTimeOffset property type.
67
+ */
68
+ DateTimeOffset = 301,
69
+
70
+ /**
71
+ * Represents a TimeSpan property type.
72
+ */
73
+ TimeSpan = 302,
74
+
75
+ /**
76
+ * Represents a DateOnly property type.
77
+ */
78
+ DateOnly = 303,
79
+
80
+ /**
81
+ * Represents a TimeOnly property type.
82
+ */
83
+ TimeOnly = 304,
84
+
85
+ //#endregion
86
+ }
@@ -0,0 +1,5 @@
1
+ export * from './ReadSelectedCollectionOperator';
2
+ export * from './ReadSelectedComparisonOperator';
3
+ export * from './ReadSelectedLogicalOperator';
4
+ export * from './ReadSelectedOrderingDirection';
5
+ export * from './ReadSelectedPropertyType';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Represents available error codes to be returned as part of the ApiResponse object
3
+ */
4
+ export enum ErrorCode {
5
+ InternalServerError = 500,
6
+ NotFound = 404,
7
+ BadRequest = 400,
8
+ NotImplemented = 501,
9
+ Unauthorized = 401,
10
+ GatewayTimeout = 504,
11
+ ValidationFailed = 422,
12
+ UnknownError = 599,
13
+ }
@@ -0,0 +1 @@
1
+ export * from './ErrorCode';
@@ -0,0 +1,3 @@
1
+ export * from './interface';
2
+ export * from './dto';
3
+ export * from './enum';