@intellegens/cornerstone-client 0.0.9999-alpha-8 → 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.
- package/demo/index.ts +29 -0
- package/demo/public_html/favicon.ico +0 -0
- package/demo/public_html/index.html +106 -0
- package/demo/public_html/websettings.json +3 -0
- package/{adapters → dist/adapters}/CollectionViewAdapter/index.d.ts +0 -0
- package/{adapters → dist/adapters}/CollectionViewAdapter/index.js +0 -0
- package/{adapters → dist/adapters}/index.d.ts +0 -0
- package/{adapters → dist/adapters}/index.js +0 -0
- package/{data → dist/data}/api/dto/PropertyPathDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/PropertyPathDto.js +0 -0
- package/{data → dist/data}/api/dto/ReadOptionsDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/ReadOptionsDto.js +0 -0
- package/{data → dist/data}/api/dto/ReadResultDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/ReadResultDto.js +0 -0
- package/{data → dist/data}/api/dto/ReadResultMetadataDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/ReadResultMetadataDto.js +0 -0
- package/{data → dist/data}/api/dto/crud/CrudMetadataDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/crud/CrudMetadataDto.js +0 -0
- package/{data → dist/data}/api/dto/crud/index.d.ts +0 -0
- package/{data → dist/data}/api/dto/crud/index.js +0 -0
- package/{data → dist/data}/api/dto/index.d.ts +0 -0
- package/{data → dist/data}/api/dto/index.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadMetadataDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadMetadataDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedOrderingDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedOrderingDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedPaginationDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedPaginationDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedSearchDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedSearchDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.js +0 -0
- package/{data → dist/data}/api/dto/read/index.d.ts +0 -0
- package/{data → dist/data}/api/dto/read/index.js +0 -0
- package/{data → dist/data}/api/dto/response/ApiErrorDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/response/ApiErrorDto.js +0 -0
- package/{data → dist/data}/api/dto/response/ApiResponseDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/response/ApiResponseDto.js +0 -0
- package/{data → dist/data}/api/dto/response/ApiSuccessResponseDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/response/ApiSuccessResponseDto.js +0 -0
- package/{data → dist/data}/api/dto/response/EmptyMetadataDto.d.ts +0 -0
- package/{data → dist/data}/api/dto/response/EmptyMetadataDto.js +0 -0
- package/{data → dist/data}/api/dto/response/index.d.ts +0 -0
- package/{data → dist/data}/api/dto/response/index.js +0 -0
- package/{data → dist/data}/api/enum/index.d.ts +0 -0
- package/{data → dist/data}/api/enum/index.js +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedComparisonOperator.d.ts +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedComparisonOperator.js +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedLogicalOperator.d.ts +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedLogicalOperator.js +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedOrderingDirection.d.ts +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedOrderingDirection.js +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedPropertyType.d.ts +0 -0
- package/{data → dist/data}/api/enum/read/ReadSelectedPropertyType.js +0 -0
- package/{data → dist/data}/api/enum/read/index.d.ts +0 -0
- package/{data → dist/data}/api/enum/read/index.js +0 -0
- package/{data → dist/data}/api/enum/response/ApiErrorCodes.d.ts +0 -0
- package/{data → dist/data}/api/enum/response/ApiErrorCodes.js +0 -0
- package/{data → dist/data}/api/enum/response/index.d.ts +0 -0
- package/{data → dist/data}/api/enum/response/index.js +0 -0
- package/{data → dist/data}/api/index.d.ts +0 -0
- package/{data → dist/data}/api/index.js +0 -0
- package/{data → dist/data}/api/interface/IConcurrencySafe.d.ts +0 -0
- package/{data → dist/data}/api/interface/IConcurrencySafe.js +0 -0
- package/{data → dist/data}/api/interface/IIdentifiable.d.ts +0 -0
- package/{data → dist/data}/api/interface/IIdentifiable.js +0 -0
- package/{data → dist/data}/api/interface/IIdentifiableSecondary.d.ts +0 -0
- package/{data → dist/data}/api/interface/IIdentifiableSecondary.js +0 -0
- package/{data → dist/data}/api/interface/index.d.ts +0 -0
- package/{data → dist/data}/api/interface/index.js +0 -0
- package/{data → dist/data}/auth/dto/ClaimDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/ClaimDto.js +0 -0
- package/{data → dist/data}/auth/dto/RegisterRequestDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/RegisterRequestDto.js +0 -0
- package/{data → dist/data}/auth/dto/RoleDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/RoleDto.js +0 -0
- package/{data → dist/data}/auth/dto/SignInRequestDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/SignInRequestDto.js +0 -0
- package/{data → dist/data}/auth/dto/TokensDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/TokensDto.js +0 -0
- package/{data → dist/data}/auth/dto/UserDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/UserDto.js +0 -0
- package/{data → dist/data}/auth/dto/UserInfoDto.d.ts +0 -0
- package/{data → dist/data}/auth/dto/UserInfoDto.js +0 -0
- package/{data → dist/data}/auth/dto/index.d.ts +0 -0
- package/{data → dist/data}/auth/dto/index.js +0 -0
- package/{data → dist/data}/auth/index.d.ts +0 -0
- package/{data → dist/data}/auth/index.js +0 -0
- package/{data → dist/data}/index.d.ts +0 -0
- package/{data → dist/data}/index.js +0 -0
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{index.js → dist/index.js} +0 -0
- package/{services → dist/services}/api/ApiCrudControllerClient/index.d.ts +0 -0
- package/{services → dist/services}/api/ApiCrudControllerClient/index.js +0 -0
- package/{services → dist/services}/api/ApiInitializationService/index.d.ts +0 -0
- package/{services → dist/services}/api/ApiInitializationService/index.js +0 -0
- package/{services → dist/services}/api/ApiReadControllerClient/index.d.ts +0 -0
- package/{services → dist/services}/api/ApiReadControllerClient/index.js +0 -0
- package/{services → dist/services}/api/HttpService/FetchHttpService.d.ts +0 -0
- package/{services → dist/services}/api/HttpService/FetchHttpService.js +0 -0
- package/{services → dist/services}/api/HttpService/HttpRequestConfig.d.ts +0 -0
- package/{services → dist/services}/api/HttpService/HttpRequestConfig.js +0 -0
- package/{services → dist/services}/api/HttpService/HttpResponse.d.ts +0 -0
- package/{services → dist/services}/api/HttpService/HttpResponse.js +0 -0
- package/{services → dist/services}/api/HttpService/IHttpService.d.ts +0 -0
- package/{services → dist/services}/api/HttpService/IHttpService.js +0 -0
- package/{services → dist/services}/api/HttpService/index.d.ts +0 -0
- package/{services → dist/services}/api/HttpService/index.js +0 -0
- package/{services → dist/services}/api/UserManagementControllerClient/index.d.ts +0 -0
- package/{services → dist/services}/api/UserManagementControllerClient/index.js +0 -0
- package/{services → dist/services}/api/index.d.ts +0 -0
- package/{services → dist/services}/api/index.js +0 -0
- package/{services → dist/services}/auth/client/AuthService/index.d.ts +0 -0
- package/{services → dist/services}/auth/client/AuthService/index.js +0 -0
- package/{services → dist/services}/auth/client/AuthorizationManagementControllerClient/index.d.ts +0 -0
- package/{services → dist/services}/auth/client/AuthorizationManagementControllerClient/index.js +0 -0
- package/{services → dist/services}/auth/client/index.d.ts +0 -0
- package/{services → dist/services}/auth/client/index.js +0 -0
- package/{services → dist/services}/auth/index.d.ts +0 -0
- package/{services → dist/services}/auth/index.js +0 -0
- package/{services → dist/services}/index.d.ts +0 -0
- package/{services → dist/services}/index.js +0 -0
- package/{utils → dist/utils}/index.d.ts +0 -0
- package/{utils → dist/utils}/index.js +0 -0
- package/jest.config.js +29 -0
- package/package.json +24 -24
- package/src/adapters/CollectionViewAdapter/index.ts +390 -0
- package/src/adapters/index.ts +1 -0
- package/src/data/api/dto/PropertyPathDto.ts +4 -0
- package/src/data/api/dto/ReadOptionsDto.ts +8 -0
- package/src/data/api/dto/ReadResultDto.ts +13 -0
- package/src/data/api/dto/ReadResultMetadataDto.ts +8 -0
- package/src/data/api/dto/crud/CrudMetadataDto.ts +4 -0
- package/src/data/api/dto/crud/index.ts +1 -0
- package/src/data/api/dto/index.ts +4 -0
- package/src/data/api/dto/read/ReadMetadataDto.ts +8 -0
- package/src/data/api/dto/read/ReadSelectedDefinitionDto.ts +21 -0
- package/src/data/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.ts +25 -0
- package/src/data/api/dto/read/ReadSelectedNestedCriteriaDto.ts +20 -0
- package/src/data/api/dto/read/ReadSelectedOrderingDefinitionDto.ts +8 -0
- package/src/data/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.ts +16 -0
- package/src/data/api/dto/read/ReadSelectedPaginationDefinitionDto.ts +13 -0
- package/src/data/api/dto/read/ReadSelectedSearchDefinitionDto.ts +43 -0
- package/src/data/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.ts +186 -0
- package/src/data/api/dto/read/index.ts +9 -0
- package/src/data/api/dto/response/ApiErrorDto.ts +21 -0
- package/src/data/api/dto/response/ApiErrorResponseDto.ts +13 -0
- package/src/data/api/dto/response/ApiResponseDto.ts +7 -0
- package/src/data/api/dto/response/ApiSuccessResponseDto.ts +13 -0
- package/src/data/api/dto/response/MetadataDto.ts +24 -0
- package/src/data/api/dto/response/index.ts +5 -0
- package/src/data/api/enum/index.ts +2 -0
- package/src/data/api/enum/read/ReadSelectedCollectionOperator.ts +17 -0
- package/src/data/api/enum/read/ReadSelectedComparisonOperator.ts +96 -0
- package/src/data/api/enum/read/ReadSelectedLogicalOperator.ts +16 -0
- package/src/data/api/enum/read/ReadSelectedOrderingDirection.ts +13 -0
- package/src/data/api/enum/read/ReadSelectedPropertyType.ts +86 -0
- package/src/data/api/enum/read/index.ts +5 -0
- package/src/data/api/enum/response/ErrorCode.ts +13 -0
- package/src/data/api/enum/response/index.ts +1 -0
- package/src/data/api/index.ts +3 -0
- package/src/data/api/interface/IConcurrencySafe.ts +9 -0
- package/src/data/api/interface/IIdentifiable.ts +12 -0
- package/src/data/api/interface/IIdentifiableSecondary.ts +9 -0
- package/src/data/api/interface/index.ts +3 -0
- package/src/data/auth/dto/ClaimDto.ts +4 -0
- package/src/data/auth/dto/RegisterRequestDto.ts +4 -0
- package/src/data/auth/dto/RoleDto.ts +6 -0
- package/src/data/auth/dto/SignInRequestDto.ts +4 -0
- package/src/data/auth/dto/TokensDto.ts +4 -0
- package/src/data/auth/dto/UserDto.ts +18 -0
- package/src/data/auth/dto/UserInfoDto.ts +15 -0
- package/src/data/auth/dto/index.ts +4 -0
- package/src/data/auth/index.ts +2 -0
- package/src/data/auth/policy.ts +63 -0
- package/src/data/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/services/api/ApiCrudControllerClient/index.ts +129 -0
- package/src/services/api/ApiInitializationService/index.ts +254 -0
- package/src/services/api/ApiReadControllerClient/index.ts +137 -0
- package/src/services/api/HttpService/FetchHttpService.ts +34 -0
- package/src/services/api/HttpService/HttpRequestConfig.ts +10 -0
- package/src/services/api/HttpService/HttpResponse.ts +14 -0
- package/src/services/api/HttpService/IHttpService.ts +17 -0
- package/src/services/api/HttpService/README.md +106 -0
- package/src/services/api/HttpService/index.ts +12 -0
- package/src/services/api/UserManagementControllerClient/index.ts +160 -0
- package/src/services/api/index.ts +5 -0
- package/src/services/auth/client/AuthService/index.ts +187 -0
- package/src/services/auth/client/AuthorizationManagementControllerClient/index.ts +165 -0
- package/src/services/auth/client/index.ts +2 -0
- package/src/services/auth/index.ts +1 -0
- package/src/services/index.ts +2 -0
- package/src/utils/authorization/index.ts +47 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/result/index.ts +25 -0
- package/src/utils/search/index.ts +150 -0
- package/tests/ApiClients.test.ts +284 -0
- package/tests/CollectionViewAdapter.test.ts +392 -0
- package/tests/HttpService.test.ts +303 -0
- package/tests/setup.ts +76 -0
- package/tsconfig.json +19 -0
- package/LICENSE.md +0 -7
- /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.d.ts +0 -0
- /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCollectionCriteriaDto.js +0 -0
- /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCriteriaDto.d.ts +0 -0
- /package/{data → dist/data}/api/dto/read/ReadSelectedNestedCriteriaDto.js +0 -0
- /package/{data → dist/data}/api/dto/response/ApiErrorResponseDto.d.ts +0 -0
- /package/{data → dist/data}/api/dto/response/ApiErrorResponseDto.js +0 -0
- /package/{data → dist/data}/api/dto/response/MetadataDto.d.ts +0 -0
- /package/{data → dist/data}/api/dto/response/MetadataDto.js +0 -0
- /package/{data → dist/data}/api/enum/read/ReadSelectedCollectionOperator.d.ts +0 -0
- /package/{data → dist/data}/api/enum/read/ReadSelectedCollectionOperator.js +0 -0
- /package/{data → dist/data}/api/enum/response/ErrorCode.d.ts +0 -0
- /package/{data → dist/data}/api/enum/response/ErrorCode.js +0 -0
- /package/{data → dist/data}/auth/policy.d.ts +0 -0
- /package/{data → dist/data}/auth/policy.js +0 -0
- /package/{utils → dist/utils}/authorization/index.d.ts +0 -0
- /package/{utils → dist/utils}/authorization/index.js +0 -0
- /package/{utils → dist/utils}/result/index.d.ts +0 -0
- /package/{utils → dist/utils}/result/index.js +0 -0
- /package/{utils → dist/utils}/search/index.d.ts +0 -0
- /package/{utils → dist/utils}/search/index.js +0 -0
|
@@ -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,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,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,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,12 @@
|
|
|
1
|
+
import { IConcurrencySafe } from './IConcurrencySafe';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interface for entities that have a Id property.
|
|
5
|
+
* Will be used as a primary key in the database.
|
|
6
|
+
*/
|
|
7
|
+
export interface IIdentifiable<TKey> extends IConcurrencySafe {
|
|
8
|
+
/**
|
|
9
|
+
* Gets or sets the Id of the entity.
|
|
10
|
+
*/
|
|
11
|
+
id: TKey;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ClaimDto } from '@data';
|
|
2
|
+
import { IIdentifiable } from '@data';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a user with an identifier and email address.
|
|
6
|
+
*
|
|
7
|
+
* @template TKey The type of the user identifier.
|
|
8
|
+
*
|
|
9
|
+
* @param {TKey} id The unique identifier for the user.
|
|
10
|
+
* @param {string} email The email address associated with the user.
|
|
11
|
+
* @param {string[]} roles The roles associated with the user.
|
|
12
|
+
* @param {ClaimDto[]} claims The claims associated with the user.
|
|
13
|
+
*/
|
|
14
|
+
export type UserDto<TKey> = IIdentifiable<TKey> & {
|
|
15
|
+
email: string;
|
|
16
|
+
roles: string[];
|
|
17
|
+
claims: ClaimDto[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserDto } from '@data';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents user information along with access token expiry.
|
|
5
|
+
*
|
|
6
|
+
* @template TKey The type of the user identifier.
|
|
7
|
+
* @template TUser The type of the user object, defaulting to `UserDto<TKey>`.
|
|
8
|
+
*
|
|
9
|
+
* @param {TUser} user The user object containing user details.
|
|
10
|
+
* @param {Date} accessTokenExpiry The date and time when the access token will expire.
|
|
11
|
+
*/
|
|
12
|
+
export type UserInfoDto<TKey, TUser = UserDto<TKey>> = {
|
|
13
|
+
user: TUser;
|
|
14
|
+
accessTokenExpiry: Date;
|
|
15
|
+
};
|