@intellegens/cornerstone-client 0.0.44 → 0.0.9999-alpha-1
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/LICENSE.md +0 -0
- package/README.md +133 -12
- package/adapters/CollectionViewAdapter/index.d.ts +154 -0
- package/adapters/CollectionViewAdapter/index.js +281 -0
- package/adapters/index.d.ts +1 -0
- package/adapters/index.js +1 -0
- package/data/api/dto/PropertyPathDto.d.ts +4 -0
- package/data/api/dto/{crud/CrudMetadata.js → PropertyPathDto.js} +0 -0
- package/data/api/dto/ReadOptionsDto.d.ts +8 -0
- package/data/api/dto/{read/ReadMetadata.js → ReadOptionsDto.js} +0 -0
- package/data/api/dto/ReadResultDto.d.ts +12 -0
- package/data/api/dto/{response/ApiError.js → ReadResultDto.js} +0 -0
- package/data/api/dto/ReadResultMetadataDto.d.ts +8 -0
- package/data/api/dto/{response/ApiResponse.js → ReadResultMetadataDto.js} +0 -0
- package/data/api/dto/crud/{CrudMetadata.d.ts → CrudMetadataDto.d.ts} +1 -1
- package/data/api/dto/{response/ApiSuccessResponse.js → crud/CrudMetadataDto.js} +0 -0
- package/data/api/dto/crud/index.d.ts +1 -1
- package/data/api/dto/crud/index.js +1 -1
- package/data/api/dto/index.d.ts +1 -0
- package/data/api/dto/index.js +1 -0
- package/data/api/dto/read/{ReadMetadata.d.ts → ReadMetadataDto.d.ts} +1 -1
- package/data/api/dto/{response/EmptyMetadata.js → read/ReadMetadataDto.js} +0 -0
- package/data/api/dto/read/ReadSelectedDefinitionDto.d.ts +0 -0
- package/data/api/dto/read/ReadSelectedDefinitionDto.js +0 -0
- package/data/api/dto/read/ReadSelectedOrderingDefinitionDto.d.ts +0 -0
- package/data/api/dto/read/ReadSelectedOrderingDefinitionDto.js +0 -0
- package/data/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.d.ts +2 -2
- package/data/api/dto/read/ReadSelectedOrderingPropertyDefinitionDto.js +0 -0
- package/data/api/dto/read/ReadSelectedPaginationDefinitionDto.d.ts +0 -0
- package/data/api/dto/read/ReadSelectedPaginationDefinitionDto.js +0 -0
- package/data/api/dto/read/ReadSelectedSearchDefinitionDto.d.ts +0 -0
- package/data/api/dto/read/ReadSelectedSearchDefinitionDto.js +0 -0
- package/data/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.d.ts +2 -2
- package/data/api/dto/read/ReadSelectedSearchPropertyDefinitionDto.js +0 -0
- package/data/api/dto/read/index.d.ts +1 -1
- package/data/api/dto/read/index.js +1 -1
- package/data/api/dto/response/{ApiError.d.ts → ApiErrorDto.d.ts} +1 -1
- package/data/api/dto/response/ApiErrorDto.js +1 -0
- package/data/api/dto/response/{ApiResponse.d.ts → ApiResponseDto.d.ts} +3 -3
- package/data/api/dto/response/ApiResponseDto.js +1 -0
- package/data/api/dto/response/{ApiSuccessResponse.d.ts → ApiSuccessResponseDto.d.ts} +1 -1
- package/data/api/dto/response/ApiSuccessResponseDto.js +1 -0
- package/data/api/dto/response/EmptyMetadataDto.d.ts +4 -0
- package/data/api/dto/response/EmptyMetadataDto.js +1 -0
- package/data/api/dto/response/index.d.ts +4 -4
- package/data/api/dto/response/index.js +4 -4
- package/data/api/enum/index.d.ts +0 -0
- package/data/api/enum/index.js +0 -0
- package/data/api/enum/read/ReadSelectedComparisonOperator.d.ts +0 -0
- package/data/api/enum/read/ReadSelectedComparisonOperator.js +0 -0
- package/data/api/enum/read/ReadSelectedLogicalOperator.d.ts +0 -0
- package/data/api/enum/read/ReadSelectedLogicalOperator.js +0 -0
- package/data/api/enum/read/ReadSelectedOrderingDirection.d.ts +0 -0
- package/data/api/enum/read/ReadSelectedOrderingDirection.js +0 -0
- package/data/api/enum/read/ReadSelectedPropertyType.d.ts +0 -0
- package/data/api/enum/read/ReadSelectedPropertyType.js +0 -0
- package/data/api/enum/read/index.d.ts +0 -0
- package/data/api/enum/read/index.js +0 -0
- package/data/api/enum/response/ApiErrorCodes.d.ts +0 -0
- package/data/api/enum/response/ApiErrorCodes.js +0 -0
- package/data/api/enum/response/index.d.ts +0 -0
- package/data/api/enum/response/index.js +0 -0
- package/data/api/index.d.ts +0 -0
- package/data/api/index.js +0 -0
- package/data/api/interface/IConcurrencySafe.d.ts +9 -0
- package/data/api/interface/IConcurrencySafe.js +2 -0
- package/data/api/interface/IIdentifiable.d.ts +4 -3
- package/data/api/interface/IIdentifiable.js +0 -0
- package/data/api/interface/IIdentifiableSecondary.d.ts +3 -3
- package/data/api/interface/IIdentifiableSecondary.js +0 -0
- package/data/api/interface/index.d.ts +1 -0
- package/data/api/interface/index.js +1 -0
- package/data/auth/dto/ClaimDto.d.ts +0 -0
- package/data/auth/dto/ClaimDto.js +0 -0
- package/data/auth/dto/RegisterRequestDto.d.ts +0 -0
- package/data/auth/dto/RegisterRequestDto.js +0 -0
- package/data/auth/dto/RoleDto.d.ts +0 -0
- package/data/auth/dto/RoleDto.js +0 -0
- package/data/auth/dto/SignInRequestDto.d.ts +0 -0
- package/data/auth/dto/SignInRequestDto.js +0 -0
- package/data/auth/dto/TokensDto.d.ts +0 -0
- package/data/auth/dto/TokensDto.js +0 -0
- package/data/auth/dto/UserDto.d.ts +0 -0
- package/data/auth/dto/UserDto.js +0 -0
- package/data/auth/dto/UserInfoDto.d.ts +0 -0
- package/data/auth/dto/UserInfoDto.js +0 -0
- package/data/auth/dto/index.d.ts +0 -0
- package/data/auth/dto/index.js +0 -0
- package/data/auth/index.d.ts +0 -0
- package/data/auth/index.js +0 -0
- package/data/index.d.ts +0 -0
- package/data/index.js +0 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +15 -10
- package/services/api/ApiCrudControllerClient/index.d.ts +9 -5
- package/services/api/ApiCrudControllerClient/index.js +15 -9
- package/services/api/ApiInitializationService/index.d.ts +21 -3
- package/services/api/ApiInitializationService/index.js +36 -7
- package/services/api/ApiReadControllerClient/index.d.ts +12 -13
- package/services/api/ApiReadControllerClient/index.js +17 -18
- package/services/api/HttpService/FetchHttpService.d.ts +1 -1
- package/services/api/HttpService/FetchHttpService.js +2 -1
- package/services/api/HttpService/HttpRequestConfig.d.ts +1 -0
- package/services/api/HttpService/HttpRequestConfig.js +0 -0
- package/services/api/HttpService/HttpResponse.d.ts +0 -0
- package/services/api/HttpService/HttpResponse.js +0 -0
- package/services/api/HttpService/IHttpService.d.ts +1 -1
- package/services/api/HttpService/IHttpService.js +0 -0
- package/services/api/HttpService/index.d.ts +0 -2
- package/services/api/HttpService/index.js +0 -2
- package/services/api/UserManagementControllerClient/index.d.ts +9 -5
- package/services/api/UserManagementControllerClient/index.js +20 -12
- package/services/api/index.d.ts +0 -0
- package/services/api/index.js +0 -0
- package/services/auth/client/AuthService/index.d.ts +5 -5
- package/services/auth/client/AuthService/index.js +9 -9
- package/services/auth/client/AuthorizationManagementControllerClient/index.d.ts +5 -5
- package/services/auth/client/AuthorizationManagementControllerClient/index.js +8 -8
- package/services/auth/client/index.d.ts +0 -0
- package/services/auth/client/index.js +0 -0
- package/services/auth/index.d.ts +0 -0
- package/services/auth/index.js +0 -0
- package/services/index.d.ts +0 -0
- package/services/index.js +0 -0
- package/utils/index.d.ts +37 -0
- package/utils/index.js +106 -0
- package/data/api/dto/response/EmptyMetadata.d.ts +0 -4
- package/services/api/HttpService/AngularHttpService.d.ts +0 -9
- package/services/api/HttpService/AngularHttpService.js +0 -86
- package/services/api/HttpService/AxiosHttpService.d.ts +0 -10
- package/services/api/HttpService/AxiosHttpService.js +0 -53
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './CrudMetadataDto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './CrudMetadataDto';
|
package/data/api/dto/index.d.ts
CHANGED
package/data/api/dto/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadSelectedOrderingDirection } from '../../..';
|
|
1
|
+
import { PropertyPathDto, ReadSelectedOrderingDirection } from '../../..';
|
|
2
2
|
/**
|
|
3
3
|
* Defines the ordering property for a controller.
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ export type ReadSelectedOrderingPropertyDefinitionDto = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets or sets the property path.
|
|
8
8
|
*/
|
|
9
|
-
propertyPath:
|
|
9
|
+
propertyPath: PropertyPathDto[];
|
|
10
10
|
/**
|
|
11
11
|
* Gets or sets the sort direction.
|
|
12
12
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadSelectedComparisonOperator, ReadSelectedPropertyType } from '../../..';
|
|
1
|
+
import { PropertyPathDto, ReadSelectedComparisonOperator, ReadSelectedPropertyType } from '../../..';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a property used for searching in a controller.
|
|
4
4
|
*/
|
|
@@ -10,7 +10,7 @@ type Partial_ReadSelectedSearchPropertyDefinition_IndependentProperties = {
|
|
|
10
10
|
/**
|
|
11
11
|
* The path to the property being searched.
|
|
12
12
|
*/
|
|
13
|
-
propertyPath:
|
|
13
|
+
propertyPath: PropertyPathDto;
|
|
14
14
|
/**
|
|
15
15
|
* The comparison operator to use for the search.
|
|
16
16
|
*/
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiErrorDto } from '../../..';
|
|
2
2
|
/**
|
|
3
3
|
* Represents an API response containing a result and metadata, or an error.
|
|
4
4
|
*
|
|
@@ -7,9 +7,9 @@ import { ApiError } from '../../..';
|
|
|
7
7
|
* @property {T} result - The result returned
|
|
8
8
|
* @property {TMetadata} metadata - Metadata about the result
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type ApiResponseDto<T, TMetadata> = {
|
|
11
11
|
success: boolean;
|
|
12
12
|
result: T;
|
|
13
13
|
metadata: TMetadata;
|
|
14
|
-
error:
|
|
14
|
+
error: ApiErrorDto;
|
|
15
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
1
|
+
export * from './ApiResponseDto';
|
|
2
|
+
export * from './ApiSuccessResponseDto';
|
|
3
|
+
export * from './ApiErrorDto';
|
|
4
|
+
export * from './EmptyMetadataDto';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
1
|
+
export * from './ApiResponseDto';
|
|
2
|
+
export * from './ApiSuccessResponseDto';
|
|
3
|
+
export * from './ApiErrorDto';
|
|
4
|
+
export * from './EmptyMetadataDto';
|
package/data/api/enum/index.d.ts
CHANGED
|
File without changes
|
package/data/api/enum/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/data/api/index.d.ts
CHANGED
|
File without changes
|
package/data/api/index.js
CHANGED
|
File without changes
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { IConcurrencySafe } from './IConcurrencySafe';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Interface for entities that have a Id property.
|
|
3
4
|
* Will be used as a primary key in the database.
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
+
export interface IIdentifiable<TKey> extends IConcurrencySafe {
|
|
6
7
|
/**
|
|
7
8
|
* Gets or sets the Id of the entity.
|
|
8
9
|
*/
|
|
9
10
|
id: TKey;
|
|
10
|
-
}
|
|
11
|
+
}
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Interface for entities that have a secondary Id property.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export interface IIdentifiableSecondary<TKey> {
|
|
5
5
|
/**
|
|
6
6
|
* Gets or sets the secondary Id of the entity.
|
|
7
7
|
*/
|
|
8
8
|
idSecondary: TKey;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/data/auth/dto/RoleDto.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/data/auth/dto/UserDto.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/data/auth/dto/index.d.ts
CHANGED
|
File without changes
|
package/data/auth/dto/index.js
CHANGED
|
File without changes
|
package/data/auth/index.d.ts
CHANGED
|
File without changes
|
package/data/auth/index.js
CHANGED
|
File without changes
|
package/data/index.d.ts
CHANGED
|
File without changes
|
package/data/index.js
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intellegens/cornerstone-client",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.9999-alpha-1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishable": true,
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
5
8
|
"type": "module",
|
|
9
|
+
"author": "Intellegens",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"description": "",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"intellegens",
|
|
14
|
+
"cornerstone"
|
|
15
|
+
],
|
|
6
16
|
"scripts": {
|
|
7
|
-
"clean": "
|
|
17
|
+
"clean": "npx --yes rimraf '{dist}'",
|
|
8
18
|
"test": "jest",
|
|
9
|
-
"
|
|
10
|
-
"test:coverage": "jest --coverage",
|
|
19
|
+
"coverage": "jest --coverage",
|
|
11
20
|
"build": "npm run clean && tsc && tsc-alias",
|
|
12
|
-
"
|
|
21
|
+
"start": "npm run build && npx vite build && npx tsx ./demo"
|
|
13
22
|
},
|
|
14
|
-
"author": "",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"description": "",
|
|
17
23
|
"devDependencies": {
|
|
18
24
|
"@eslint/js": "^9.21.0",
|
|
19
25
|
"@types/express": "^5.0.0",
|
|
@@ -22,7 +28,6 @@
|
|
|
22
28
|
"eslint": "^9.21.0",
|
|
23
29
|
"eslint-config-prettier": "^10.0.1",
|
|
24
30
|
"express": "^4.21.2",
|
|
25
|
-
"fs-extra": "^11.3.0",
|
|
26
31
|
"globals": "^16.0.0",
|
|
27
32
|
"jest": "^29.7.0",
|
|
28
33
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IIdentifiable
|
|
1
|
+
import { ApiSuccessResponseDto, EmptyMetadataDto } from '../../../data/api/dto';
|
|
2
|
+
import { IIdentifiable } from '../../../data/api/interface';
|
|
3
3
|
import { IHttpService } from '../HttpService';
|
|
4
|
+
import { ApiReadControllerClient } from '../ApiReadControllerClient';
|
|
4
5
|
/**
|
|
5
6
|
* Generic API client for consuming any Cornerstone CrudController
|
|
6
7
|
*
|
|
@@ -19,19 +20,22 @@ export declare class ApiCrudControllerClient<TKey, TDto extends IIdentifiable<TK
|
|
|
19
20
|
/**
|
|
20
21
|
* Creates a new entity.
|
|
21
22
|
* @param dto - Insert request DTO
|
|
23
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
22
24
|
* @returns The created entity DTO
|
|
23
25
|
*/
|
|
24
|
-
|
|
26
|
+
createAsync(dto: TDto, signal?: AbortSignal): Promise<ApiSuccessResponseDto<TDto, EmptyMetadataDto>>;
|
|
25
27
|
/**
|
|
26
28
|
* Updates an existing entity.
|
|
27
29
|
* @param id - The ID of the entity to update
|
|
28
30
|
* @param dto - Update request DTO
|
|
31
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
29
32
|
* @returns The updated entity DTO
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
updateAsync(id: TKey, dto: TDto, signal?: AbortSignal): Promise<ApiSuccessResponseDto<TDto, EmptyMetadataDto>>;
|
|
32
35
|
/**
|
|
33
36
|
* Deletes an entity by ID.
|
|
34
37
|
* @param id - The ID of the entity to delete
|
|
38
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
35
39
|
*/
|
|
36
|
-
|
|
40
|
+
deleteAsync(id: TKey, signal?: AbortSignal): Promise<void>;
|
|
37
41
|
}
|
|
@@ -20,16 +20,18 @@ export class ApiCrudControllerClient extends ApiReadControllerClient {
|
|
|
20
20
|
/**
|
|
21
21
|
* Creates a new entity.
|
|
22
22
|
* @param dto - Insert request DTO
|
|
23
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
23
24
|
* @returns The created entity DTO
|
|
24
25
|
*/
|
|
25
|
-
async
|
|
26
|
+
async createAsync(dto, signal) {
|
|
26
27
|
try {
|
|
27
|
-
const url = await apiInitializationService.
|
|
28
|
-
const res = await this.httpService.
|
|
28
|
+
const url = await apiInitializationService.getApiUrlAsync(this.baseControllerPath, `/Create`);
|
|
29
|
+
const res = await this.httpService.requestAsync(url, {
|
|
29
30
|
method: 'POST',
|
|
30
31
|
headers: { 'Content-Type': 'application/json' },
|
|
31
32
|
body: JSON.stringify(dto),
|
|
32
33
|
credentials: 'include',
|
|
34
|
+
signal,
|
|
33
35
|
});
|
|
34
36
|
if (!res.ok)
|
|
35
37
|
throw undefined;
|
|
@@ -47,16 +49,18 @@ export class ApiCrudControllerClient extends ApiReadControllerClient {
|
|
|
47
49
|
* Updates an existing entity.
|
|
48
50
|
* @param id - The ID of the entity to update
|
|
49
51
|
* @param dto - Update request DTO
|
|
52
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
50
53
|
* @returns The updated entity DTO
|
|
51
54
|
*/
|
|
52
|
-
async
|
|
55
|
+
async updateAsync(id, dto, signal) {
|
|
53
56
|
try {
|
|
54
|
-
const url = await apiInitializationService.
|
|
55
|
-
const res = await this.httpService.
|
|
57
|
+
const url = await apiInitializationService.getApiUrlAsync(this.baseControllerPath, `/Update?id=${encodeURIComponent(String(id))}`);
|
|
58
|
+
const res = await this.httpService.requestAsync(url, {
|
|
56
59
|
method: 'PUT',
|
|
57
60
|
headers: { 'Content-Type': 'application/json' },
|
|
58
61
|
body: JSON.stringify(dto),
|
|
59
62
|
credentials: 'include',
|
|
63
|
+
signal,
|
|
60
64
|
});
|
|
61
65
|
if (!res.ok)
|
|
62
66
|
throw undefined;
|
|
@@ -73,13 +77,15 @@ export class ApiCrudControllerClient extends ApiReadControllerClient {
|
|
|
73
77
|
/**
|
|
74
78
|
* Deletes an entity by ID.
|
|
75
79
|
* @param id - The ID of the entity to delete
|
|
80
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
76
81
|
*/
|
|
77
|
-
async
|
|
82
|
+
async deleteAsync(id, signal) {
|
|
78
83
|
try {
|
|
79
|
-
const url = await apiInitializationService.
|
|
80
|
-
const response = await this.httpService.
|
|
84
|
+
const url = await apiInitializationService.getApiUrlAsync(this.baseControllerPath, `/Delete?id=${encodeURIComponent(String(id))}`);
|
|
85
|
+
const response = await this.httpService.requestAsync(url, {
|
|
81
86
|
method: 'DELETE',
|
|
82
87
|
credentials: 'include',
|
|
88
|
+
signal,
|
|
83
89
|
});
|
|
84
90
|
if (!response.ok)
|
|
85
91
|
throw undefined;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic shared settings interface - can represent any user-configured settings structure
|
|
3
|
+
* The actual properties depend on what users configure in their appsettings.json or environment variables
|
|
4
|
+
*/
|
|
5
|
+
type ISharedSettings = {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
1
8
|
import { IHttpService } from '../HttpService';
|
|
2
9
|
/**
|
|
3
10
|
* Central API configuration service, fetches and exposes Cornerstone API configuration
|
|
@@ -11,13 +18,16 @@ export declare class ApiInitializationService {
|
|
|
11
18
|
*
|
|
12
19
|
* This method calls all methods that need to be called during the API configuration phase:
|
|
13
20
|
* - Starts detection of API base URL.
|
|
21
|
+
* - Fetches shared settings from the server.
|
|
14
22
|
*
|
|
15
23
|
* @async
|
|
16
24
|
* @param httpService - HTTP service implementation to use for requests
|
|
25
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
17
26
|
* @return {Promise<void>} Resolves when initialization is complete.
|
|
18
27
|
*/
|
|
19
|
-
|
|
28
|
+
initializeAsync({ httpService, signal }?: {
|
|
20
29
|
httpService?: IHttpService;
|
|
30
|
+
signal?: AbortSignal;
|
|
21
31
|
}): Promise<void>;
|
|
22
32
|
private _httpService;
|
|
23
33
|
/**
|
|
@@ -56,10 +66,11 @@ export declare class ApiInitializationService {
|
|
|
56
66
|
* IMPORTANT: This method is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
|
|
57
67
|
*
|
|
58
68
|
* @async
|
|
69
|
+
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
59
70
|
* @return {Promise<string | undefined>} Returns detected API base URL
|
|
60
71
|
* @throws {Error} Throws error if either of the detection methods fails
|
|
61
72
|
*/
|
|
62
|
-
|
|
73
|
+
_getApiBaseUrlAsync(signal?: AbortSignal): Promise<string | undefined>;
|
|
63
74
|
/**
|
|
64
75
|
* Composes a full API URL for a provided endpoint path.
|
|
65
76
|
*
|
|
@@ -68,7 +79,7 @@ export declare class ApiInitializationService {
|
|
|
68
79
|
* @return {Promise<string | undefined>} Returns the API endpoint's URL
|
|
69
80
|
* @throws {Error} Throws error if API base URL detection fails
|
|
70
81
|
*/
|
|
71
|
-
|
|
82
|
+
getApiUrlAsync(...relativeEndpointPathSections: string[]): Promise<string>;
|
|
72
83
|
/**
|
|
73
84
|
* Removes starting '/' character
|
|
74
85
|
* @param str String to remove the starting '/' character from
|
|
@@ -81,8 +92,15 @@ export declare class ApiInitializationService {
|
|
|
81
92
|
* @returns String with ending '/' character removed
|
|
82
93
|
*/
|
|
83
94
|
private removeEndsWithSlashChar;
|
|
95
|
+
appConfig?: ISharedSettings | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Fetches initialization info (shared settings) from the server
|
|
98
|
+
* @returns Promise that resolves to shared settings or undefined if the request fails
|
|
99
|
+
*/
|
|
100
|
+
private _getAppConfigAsync;
|
|
84
101
|
}
|
|
85
102
|
/**
|
|
86
103
|
* Singleton instance of ApiInitializationService
|
|
87
104
|
*/
|
|
88
105
|
export declare const apiInitializationService: ApiInitializationService;
|
|
106
|
+
export {};
|