@intellegens/cornerstone-client 0.0.12 → 0.0.14

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 (58) hide show
  1. package/data/api/dto/ReadSelectedDefinition.d.ts +1 -1
  2. package/data/api/dto/ReadSelectedFilteringDefinition.d.ts +1 -1
  3. package/data/api/dto/ReadSelectedFilteringPropertyDefinition.d.ts +1 -1
  4. package/data/api/dto/ReadSelectedOrderingDefinition.d.ts +1 -1
  5. package/data/api/dto/ReadSelectedOrderingPropertyDefinition.d.ts +1 -1
  6. package/data/api/dto/ReadSelectedOrderingPropertyDefinition.js +1 -1
  7. package/data/auth/UserInfo/index.d.ts +1 -1
  8. package/package.json +5 -3
  9. package/services/api/client/ApiCrudControllerClient/index.d.ts +1 -1
  10. package/services/api/client/ApiCrudControllerClient/index.js +1 -1
  11. package/services/api/client/ApiReadControllerClient/index.d.ts +1 -1
  12. package/services/api/client/ApiReadControllerClient/index.js +1 -1
  13. package/services/auth/index.d.ts +1 -1
  14. package/services/auth/index.js +1 -1
  15. package/data/_generated/Cornerstone/Fixtures/DTOs/AnythingDto.d.ts +0 -15
  16. package/data/_generated/Cornerstone/Fixtures/DTOs/AnythingDto.js +0 -2
  17. package/data/_generated/Cornerstone/Fixtures/DTOs/AnythingManuallyMappedDto.d.ts +0 -15
  18. package/data/_generated/Cornerstone/Fixtures/DTOs/AnythingManuallyMappedDto.js +0 -2
  19. package/data/_generated/Cornerstone/Fixtures/DTOs/PersonDto.d.ts +0 -38
  20. package/data/_generated/Cornerstone/Fixtures/DTOs/PersonDto.js +0 -2
  21. package/data/_generated/Cornerstone/Fixtures/DTOs/PersonManuallyMappedDto.d.ts +0 -38
  22. package/data/_generated/Cornerstone/Fixtures/DTOs/PersonManuallyMappedDto.js +0 -2
  23. package/data/_generated/Cornerstone/Fixtures/DTOs/PetDto.d.ts +0 -15
  24. package/data/_generated/Cornerstone/Fixtures/DTOs/PetDto.js +0 -2
  25. package/data/_generated/Cornerstone/Fixtures/DTOs/PetManuallyMappedDto.d.ts +0 -15
  26. package/data/_generated/Cornerstone/Fixtures/DTOs/PetManuallyMappedDto.js +0 -2
  27. package/data/_generated/Cornerstone/Fixtures/DTOs/VehicleDto.d.ts +0 -127
  28. package/data/_generated/Cornerstone/Fixtures/DTOs/VehicleDto.js +0 -2
  29. package/data/_generated/Cornerstone/Fixtures/DTOs/VehicleManuallyMappedDto.d.ts +0 -127
  30. package/data/_generated/Cornerstone/Fixtures/DTOs/VehicleManuallyMappedDto.js +0 -2
  31. package/data/api/read/ReadSelectedDefinition.d.ts +0 -2
  32. package/data/api/read/ReadSelectedDefinition.js +0 -2
  33. package/data/api/read/ReadSelectedFilteringDefinition.d.ts +0 -2
  34. package/data/api/read/ReadSelectedFilteringDefinition.js +0 -2
  35. package/data/api/read/ReadSelectedFilteringPropertyDefinition.d.ts +0 -2
  36. package/data/api/read/ReadSelectedFilteringPropertyDefinition.js +0 -2
  37. package/data/api/read/ReadSelectedOrderingDefinition.d.ts +0 -2
  38. package/data/api/read/ReadSelectedOrderingDefinition.js +0 -2
  39. package/data/api/read/ReadSelectedOrderingPropertyDefinition.d.ts +0 -2
  40. package/data/api/read/ReadSelectedOrderingPropertyDefinition.js +0 -2
  41. package/data/api/read/ReadSelectedPaginationDefinition.d.ts +0 -2
  42. package/data/api/read/ReadSelectedPaginationDefinition.js +0 -2
  43. package/data/api/read/index.d.ts +0 -6
  44. package/data/api/read/index.js +0 -6
  45. package/services/api/client/crud/index.d.ts +0 -9
  46. package/services/api/client/crud/index.js +0 -9
  47. package/services/api/client/read/index.d.ts +0 -8
  48. package/services/api/client/read/index.js +0 -8
  49. package/services/api/detection/index.d.ts +0 -66
  50. package/services/api/detection/index.js +0 -139
  51. package/services/auth/types/index.d.ts +0 -2
  52. package/services/auth/types/index.js +0 -2
  53. package/services/auth/types/user-info.d.ts +0 -14
  54. package/services/auth/types/user-info.js +0 -1
  55. package/services/auth/types/user.d.ts +0 -12
  56. package/services/auth/types/user.js +0 -1
  57. package/services/config/index.d.ts +0 -47
  58. package/services/config/index.js +0 -120
@@ -1,4 +1,4 @@
1
- import { ReadSelectedPaginationDefinition, ReadSelectedOrderingDefinition, ReadSelectedFilteringDefinition } from '@data';
1
+ import { ReadSelectedPaginationDefinition, ReadSelectedOrderingDefinition, ReadSelectedFilteringDefinition } from '../..';
2
2
  /**
3
3
  * Defines the selection criteria for a controller to fetch multiple records
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ReadSelectedFilteringPropertyDefinition, ReadSelectedLogicalOperator } from '@data';
1
+ import { ReadSelectedFilteringPropertyDefinition, ReadSelectedLogicalOperator } from '../..';
2
2
  /**
3
3
  * Defines the filtering options for a controller, including the logical operator and an array of property definitions.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ReadSelectedComparisonOperator, ReadSelectedPropertyType } from '@data';
1
+ import { ReadSelectedComparisonOperator, ReadSelectedPropertyType } from '../..';
2
2
  /**
3
3
  * Defines a property used for filtering in a controller.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ReadSelectedOrderingPropertyDefinition } from '@data';
1
+ import { ReadSelectedOrderingPropertyDefinition } from '../..';
2
2
  /**
3
3
  * Represents the ordering definition for a controller.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ReadSelectedOrderingDirection } from '@data';
1
+ import { ReadSelectedOrderingDirection } from '../..';
2
2
  /**
3
3
  * Defines the ordering property for a controller.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ReadSelectedOrderingDirection } from '@data';
1
+ import { ReadSelectedOrderingDirection } from '../..';
2
2
  /**
3
3
  * Defines the ordering property for a controller.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { User } from '@data';
1
+ import { User } from '../..';
2
2
  /**
3
3
  * Represents user information along with access token expiry.
4
4
  *
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@intellegens/cornerstone-client",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "npm run transpile-types && tsc",
8
+ "build": "npm run transpile-types && tsc && tsc-alias",
9
9
  "demo": "npm run build && npx vite build && npx tsx ./demo",
10
10
  "transpile-types": "cd ../utils/cli && npm run cli zod-gen -- --input '../../client/src/data/_jsonschema' --output '../../client/src/data/_generated'"
11
11
  },
@@ -21,8 +21,10 @@
21
21
  "express": "^4.21.2",
22
22
  "globals": "^16.0.0",
23
23
  "prettier": "^3.5.2",
24
+ "tsc-alias": "^1.8.11",
24
25
  "typescript-eslint": "^8.26.0",
25
- "vite": "^6.2.0"
26
+ "vite": "^6.2.0",
27
+ "zod": "^3.24.2"
26
28
  },
27
29
  "dependencies": {
28
30
  "http-proxy-middleware": "^3.0.3"
@@ -1,4 +1,4 @@
1
- import { ApiReadControllerClient } from '@services';
1
+ import { ApiReadControllerClient } from '../../..';
2
2
  /**
3
3
  * Generic API client for consuming any Cornerstone CrudController
4
4
  *
@@ -1,4 +1,4 @@
1
- import { ApiReadControllerClient } from '@services';
1
+ import { ApiReadControllerClient } from '../../..';
2
2
  /**
3
3
  * Generic API client for consuming any Cornerstone CrudController
4
4
  *
@@ -1,4 +1,4 @@
1
- import { IIdentifiable, ReadSelectedDefinition } from '@data';
1
+ import { IIdentifiable, ReadSelectedDefinition } from '../../../../data';
2
2
  /**
3
3
  * Generic API client for consuming any Cornerstone ReadController
4
4
  *
@@ -1,4 +1,4 @@
1
- import { apiInitializationService } from '@services';
1
+ import { apiInitializationService } from '../../..';
2
2
  /**
3
3
  * Generic API client for consuming any Cornerstone ReadController
4
4
  *
@@ -1,4 +1,4 @@
1
- import { User, UserInfo } from '@data';
1
+ import { User, UserInfo } from '../../data';
2
2
  export { User, UserInfo };
3
3
  /**
4
4
  * AuthService class is responsible for managing user authentication operations.
@@ -1,4 +1,4 @@
1
- import { apiInitializationService } from '@services';
1
+ import { apiInitializationService } from '..';
2
2
  /**
3
3
  * AuthService class is responsible for managing user authentication operations.
4
4
  * It supports login, logout, and checking the current user's details.
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AnythingDto: z.ZodObject<{
3
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- id: z.ZodOptional<z.ZodNumber>;
5
- guid: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- name?: string | null | undefined;
8
- id?: number | undefined;
9
- guid?: string | undefined;
10
- }, {
11
- name?: string | null | undefined;
12
- id?: number | undefined;
13
- guid?: string | undefined;
14
- }>;
15
- export type AnythingDto = z.infer<typeof AnythingDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const AnythingDto = z.object({ "name": z.union([z.string(), z.null()]).optional(), "id": z.number().int().optional(), "guid": z.string().optional() });
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AnythingManuallyMappedDto: z.ZodObject<{
3
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- id: z.ZodOptional<z.ZodNumber>;
5
- guid: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- name?: string | null | undefined;
8
- id?: number | undefined;
9
- guid?: string | undefined;
10
- }, {
11
- name?: string | null | undefined;
12
- id?: number | undefined;
13
- guid?: string | undefined;
14
- }>;
15
- export type AnythingManuallyMappedDto = z.infer<typeof AnythingManuallyMappedDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const AnythingManuallyMappedDto = z.object({ "name": z.union([z.string(), z.null()]).optional(), "id": z.number().int().optional(), "guid": z.string().optional() });
@@ -1,38 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PersonDto: z.ZodObject<{
3
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- age: z.ZodOptional<z.ZodNumber>;
5
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
6
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
7
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
8
- id: z.ZodOptional<z.ZodString>;
9
- }, "strip", z.ZodTypeAny, {
10
- name?: string | null | undefined;
11
- id?: string | undefined;
12
- species?: string | null | undefined;
13
- }, {
14
- name?: string | null | undefined;
15
- id?: string | undefined;
16
- species?: string | null | undefined;
17
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
18
- id: z.ZodOptional<z.ZodNumber>;
19
- }, "strip", z.ZodTypeAny, {
20
- name?: string | null | undefined;
21
- id?: number | undefined;
22
- age?: number | undefined;
23
- pets?: ({
24
- name?: string | null | undefined;
25
- id?: string | undefined;
26
- species?: string | null | undefined;
27
- } | null)[] | null | undefined;
28
- }, {
29
- name?: string | null | undefined;
30
- id?: number | undefined;
31
- age?: number | undefined;
32
- pets?: ({
33
- name?: string | null | undefined;
34
- id?: string | undefined;
35
- species?: string | null | undefined;
36
- } | null)[] | null | undefined;
37
- }>;
38
- export type PersonDto = z.infer<typeof PersonDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const PersonDto = z.object({ "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "id": z.number().int().optional() });
@@ -1,38 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PersonManuallyMappedDto: z.ZodObject<{
3
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
4
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
5
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
6
- id: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- name?: string | null | undefined;
9
- id?: string | undefined;
10
- species?: string | null | undefined;
11
- }, {
12
- name?: string | null | undefined;
13
- id?: string | undefined;
14
- species?: string | null | undefined;
15
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
16
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
17
- age: z.ZodOptional<z.ZodNumber>;
18
- id: z.ZodOptional<z.ZodNumber>;
19
- }, "strip", z.ZodTypeAny, {
20
- name?: string | null | undefined;
21
- id?: number | undefined;
22
- age?: number | undefined;
23
- pets?: ({
24
- name?: string | null | undefined;
25
- id?: string | undefined;
26
- species?: string | null | undefined;
27
- } | null)[] | null | undefined;
28
- }, {
29
- name?: string | null | undefined;
30
- id?: number | undefined;
31
- age?: number | undefined;
32
- pets?: ({
33
- name?: string | null | undefined;
34
- id?: string | undefined;
35
- species?: string | null | undefined;
36
- } | null)[] | null | undefined;
37
- }>;
38
- export type PersonManuallyMappedDto = z.infer<typeof PersonManuallyMappedDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const PersonManuallyMappedDto = z.object({ "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "id": z.number().int().optional() });
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PetDto: z.ZodObject<{
3
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
5
- id: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- name?: string | null | undefined;
8
- id?: string | undefined;
9
- species?: string | null | undefined;
10
- }, {
11
- name?: string | null | undefined;
12
- id?: string | undefined;
13
- species?: string | null | undefined;
14
- }>;
15
- export type PetDto = z.infer<typeof PetDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const PetDto = z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() });
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PetManuallyMappedDto: z.ZodObject<{
3
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
5
- id: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- name?: string | null | undefined;
8
- id?: string | undefined;
9
- species?: string | null | undefined;
10
- }, {
11
- name?: string | null | undefined;
12
- id?: string | undefined;
13
- species?: string | null | undefined;
14
- }>;
15
- export type PetManuallyMappedDto = z.infer<typeof PetManuallyMappedDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const PetManuallyMappedDto = z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() });
@@ -1,127 +0,0 @@
1
- import { z } from "zod";
2
- export declare const VehicleDto: z.ZodObject<{
3
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4
- driver: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
5
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
6
- age: z.ZodOptional<z.ZodNumber>;
7
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
8
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
9
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
10
- id: z.ZodOptional<z.ZodString>;
11
- }, "strip", z.ZodTypeAny, {
12
- name?: string | null | undefined;
13
- id?: string | undefined;
14
- species?: string | null | undefined;
15
- }, {
16
- name?: string | null | undefined;
17
- id?: string | undefined;
18
- species?: string | null | undefined;
19
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
20
- id: z.ZodOptional<z.ZodNumber>;
21
- }, "strip", z.ZodTypeAny, {
22
- name?: string | null | undefined;
23
- id?: number | undefined;
24
- age?: number | undefined;
25
- pets?: ({
26
- name?: string | null | undefined;
27
- id?: string | undefined;
28
- species?: string | null | undefined;
29
- } | null)[] | null | undefined;
30
- }, {
31
- name?: string | null | undefined;
32
- id?: number | undefined;
33
- age?: number | undefined;
34
- pets?: ({
35
- name?: string | null | undefined;
36
- id?: string | undefined;
37
- species?: string | null | undefined;
38
- } | null)[] | null | undefined;
39
- }>, z.ZodNull]>>;
40
- passengers: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
41
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
42
- age: z.ZodOptional<z.ZodNumber>;
43
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
44
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
45
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
46
- id: z.ZodOptional<z.ZodString>;
47
- }, "strip", z.ZodTypeAny, {
48
- name?: string | null | undefined;
49
- id?: string | undefined;
50
- species?: string | null | undefined;
51
- }, {
52
- name?: string | null | undefined;
53
- id?: string | undefined;
54
- species?: string | null | undefined;
55
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
56
- id: z.ZodOptional<z.ZodNumber>;
57
- }, "strip", z.ZodTypeAny, {
58
- name?: string | null | undefined;
59
- id?: number | undefined;
60
- age?: number | undefined;
61
- pets?: ({
62
- name?: string | null | undefined;
63
- id?: string | undefined;
64
- species?: string | null | undefined;
65
- } | null)[] | null | undefined;
66
- }, {
67
- name?: string | null | undefined;
68
- id?: number | undefined;
69
- age?: number | undefined;
70
- pets?: ({
71
- name?: string | null | undefined;
72
- id?: string | undefined;
73
- species?: string | null | undefined;
74
- } | null)[] | null | undefined;
75
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
76
- id: z.ZodOptional<z.ZodNumber>;
77
- guid: z.ZodOptional<z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- name?: string | null | undefined;
80
- id?: number | undefined;
81
- guid?: string | undefined;
82
- driver?: {
83
- name?: string | null | undefined;
84
- id?: number | undefined;
85
- age?: number | undefined;
86
- pets?: ({
87
- name?: string | null | undefined;
88
- id?: string | undefined;
89
- species?: string | null | undefined;
90
- } | null)[] | null | undefined;
91
- } | null | undefined;
92
- passengers?: ({
93
- name?: string | null | undefined;
94
- id?: number | undefined;
95
- age?: number | undefined;
96
- pets?: ({
97
- name?: string | null | undefined;
98
- id?: string | undefined;
99
- species?: string | null | undefined;
100
- } | null)[] | null | undefined;
101
- } | null)[] | null | undefined;
102
- }, {
103
- name?: string | null | undefined;
104
- id?: number | undefined;
105
- guid?: string | undefined;
106
- driver?: {
107
- name?: string | null | undefined;
108
- id?: number | undefined;
109
- age?: number | undefined;
110
- pets?: ({
111
- name?: string | null | undefined;
112
- id?: string | undefined;
113
- species?: string | null | undefined;
114
- } | null)[] | null | undefined;
115
- } | null | undefined;
116
- passengers?: ({
117
- name?: string | null | undefined;
118
- id?: number | undefined;
119
- age?: number | undefined;
120
- pets?: ({
121
- name?: string | null | undefined;
122
- id?: string | undefined;
123
- species?: string | null | undefined;
124
- } | null)[] | null | undefined;
125
- } | null)[] | null | undefined;
126
- }>;
127
- export type VehicleDto = z.infer<typeof VehicleDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const VehicleDto = z.object({ "name": z.union([z.string(), z.null()]).optional(), "driver": z.union([z.object({ "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "id": z.number().int().optional() }), z.null()]).optional(), "passengers": z.union([z.array(z.union([z.object({ "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "id": z.number().int().optional() }), z.null()])), z.null()]).optional(), "id": z.number().int().optional(), "guid": z.string().optional() });
@@ -1,127 +0,0 @@
1
- import { z } from "zod";
2
- export declare const VehicleManuallyMappedDto: z.ZodObject<{
3
- driver: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
4
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
5
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
6
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
7
- id: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- name?: string | null | undefined;
10
- id?: string | undefined;
11
- species?: string | null | undefined;
12
- }, {
13
- name?: string | null | undefined;
14
- id?: string | undefined;
15
- species?: string | null | undefined;
16
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
17
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
18
- age: z.ZodOptional<z.ZodNumber>;
19
- id: z.ZodOptional<z.ZodNumber>;
20
- }, "strip", z.ZodTypeAny, {
21
- name?: string | null | undefined;
22
- id?: number | undefined;
23
- age?: number | undefined;
24
- pets?: ({
25
- name?: string | null | undefined;
26
- id?: string | undefined;
27
- species?: string | null | undefined;
28
- } | null)[] | null | undefined;
29
- }, {
30
- name?: string | null | undefined;
31
- id?: number | undefined;
32
- age?: number | undefined;
33
- pets?: ({
34
- name?: string | null | undefined;
35
- id?: string | undefined;
36
- species?: string | null | undefined;
37
- } | null)[] | null | undefined;
38
- }>, z.ZodNull]>>;
39
- passengers: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
40
- pets: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
41
- species: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
42
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
43
- id: z.ZodOptional<z.ZodString>;
44
- }, "strip", z.ZodTypeAny, {
45
- name?: string | null | undefined;
46
- id?: string | undefined;
47
- species?: string | null | undefined;
48
- }, {
49
- name?: string | null | undefined;
50
- id?: string | undefined;
51
- species?: string | null | undefined;
52
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
53
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
54
- age: z.ZodOptional<z.ZodNumber>;
55
- id: z.ZodOptional<z.ZodNumber>;
56
- }, "strip", z.ZodTypeAny, {
57
- name?: string | null | undefined;
58
- id?: number | undefined;
59
- age?: number | undefined;
60
- pets?: ({
61
- name?: string | null | undefined;
62
- id?: string | undefined;
63
- species?: string | null | undefined;
64
- } | null)[] | null | undefined;
65
- }, {
66
- name?: string | null | undefined;
67
- id?: number | undefined;
68
- age?: number | undefined;
69
- pets?: ({
70
- name?: string | null | undefined;
71
- id?: string | undefined;
72
- species?: string | null | undefined;
73
- } | null)[] | null | undefined;
74
- }>, z.ZodNull]>, "many">, z.ZodNull]>>;
75
- name: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
76
- id: z.ZodOptional<z.ZodNumber>;
77
- guid: z.ZodOptional<z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- name?: string | null | undefined;
80
- id?: number | undefined;
81
- guid?: string | undefined;
82
- driver?: {
83
- name?: string | null | undefined;
84
- id?: number | undefined;
85
- age?: number | undefined;
86
- pets?: ({
87
- name?: string | null | undefined;
88
- id?: string | undefined;
89
- species?: string | null | undefined;
90
- } | null)[] | null | undefined;
91
- } | null | undefined;
92
- passengers?: ({
93
- name?: string | null | undefined;
94
- id?: number | undefined;
95
- age?: number | undefined;
96
- pets?: ({
97
- name?: string | null | undefined;
98
- id?: string | undefined;
99
- species?: string | null | undefined;
100
- } | null)[] | null | undefined;
101
- } | null)[] | null | undefined;
102
- }, {
103
- name?: string | null | undefined;
104
- id?: number | undefined;
105
- guid?: string | undefined;
106
- driver?: {
107
- name?: string | null | undefined;
108
- id?: number | undefined;
109
- age?: number | undefined;
110
- pets?: ({
111
- name?: string | null | undefined;
112
- id?: string | undefined;
113
- species?: string | null | undefined;
114
- } | null)[] | null | undefined;
115
- } | null | undefined;
116
- passengers?: ({
117
- name?: string | null | undefined;
118
- id?: number | undefined;
119
- age?: number | undefined;
120
- pets?: ({
121
- name?: string | null | undefined;
122
- id?: string | undefined;
123
- species?: string | null | undefined;
124
- } | null)[] | null | undefined;
125
- } | null)[] | null | undefined;
126
- }>;
127
- export type VehicleManuallyMappedDto = z.infer<typeof VehicleManuallyMappedDto>;
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const VehicleManuallyMappedDto = z.object({ "driver": z.union([z.object({ "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "id": z.number().int().optional() }), z.null()]).optional(), "passengers": z.union([z.array(z.union([z.object({ "pets": z.union([z.array(z.union([z.object({ "species": z.union([z.string(), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.string().optional() }), z.null()])), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "age": z.number().int().optional(), "id": z.number().int().optional() }), z.null()])), z.null()]).optional(), "name": z.union([z.string(), z.null()]).optional(), "id": z.number().int().optional(), "guid": z.string().optional() });
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedFilteringDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedFilteringDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedFilteringPropertyDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedFilteringPropertyDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedOrderingDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedOrderingDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedOrderingPropertyDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedOrderingPropertyDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export declare class ReadSelectedPaginationDefinition {
2
- }
@@ -1,2 +0,0 @@
1
- export class ReadSelectedPaginationDefinition {
2
- }
@@ -1,6 +0,0 @@
1
- export * from './ReadSelectedDefinition';
2
- export * from './ReadSelectedFilteringDefinition';
3
- export * from './ReadSelectedFilteringPropertyDefinition';
4
- export * from './ReadSelectedOrderingDefinition';
5
- export * from './ReadSelectedOrderingPropertyDefinition';
6
- export * from './ReadSelectedPaginationDefinition';
@@ -1,6 +0,0 @@
1
- export * from './ReadSelectedDefinition';
2
- export * from './ReadSelectedFilteringDefinition';
3
- export * from './ReadSelectedFilteringPropertyDefinition';
4
- export * from './ReadSelectedOrderingDefinition';
5
- export * from './ReadSelectedOrderingPropertyDefinition';
6
- export * from './ReadSelectedPaginationDefinition';
@@ -1,9 +0,0 @@
1
- import { ApiReadControllerClient } from '../read';
2
- /**
3
- * Generic API client for consuming any Cornerstone ReadController
4
- *
5
- * @export
6
- * @class ApiService
7
- */
8
- export declare class ApiCrudControllerClient<TDto> extends ApiReadControllerClient<TDto> {
9
- }
@@ -1,9 +0,0 @@
1
- import { ApiReadControllerClient } from '../read';
2
- /**
3
- * Generic API client for consuming any Cornerstone ReadController
4
- *
5
- * @export
6
- * @class ApiService
7
- */
8
- export class ApiCrudControllerClient extends ApiReadControllerClient {
9
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Generic API client for consuming any Cornerstone ReadController
3
- *
4
- * @export
5
- * @class ApiService
6
- */
7
- export declare class ApiReadControllerClient<TDto> {
8
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Generic API client for consuming any Cornerstone ReadController
3
- *
4
- * @export
5
- * @class ApiService
6
- */
7
- export class ApiReadControllerClient {
8
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * Central API configuration service, fetches and exposes Cornerstone API configuration
3
- *
4
- * @export
5
- * @class ApiService
6
- */
7
- export declare class ApiService {
8
- /**
9
- * Initializes the API configuration
10
- *
11
- * This method calls all methods that need to be called during the API configuration phase:
12
- * - Starts detection of API base URL.
13
- *
14
- * @async
15
- * @return {Promise<void>} Resolves when initialization is complete.
16
- */
17
- initialize(): Promise<void>;
18
- private _apiBaseUrlPromise;
19
- /**
20
- * If API base URL detection was completed
21
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
22
- */
23
- _apiBaseUrlDetected: boolean;
24
- /**
25
- * If API base URL detection was completed, this property will hold the method by which detection was performed
26
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
27
- */
28
- _apiBaseUrlDetectionMethod: string | undefined;
29
- /**
30
- * If API base URL detection was completed, this property will hold the detected API base URL
31
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
32
- */
33
- _apiBaseUrl: string | undefined;
34
- /**
35
- * If API base URL detection has failed, this property will hold the error with which it has failed
36
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
37
- */
38
- _apiBaseError: Error | undefined;
39
- /**
40
- * Tries detecting API base URL by multiple methods
41
- *
42
- * - Checks the response headers of the current URL for the `CORNERSTONE-API-BASEURL` header.
43
- * - Attempts to load the `websettings.json` file and looks for an `api` field.
44
- * - Defaults to `undefined`.
45
- *
46
- * IMPORTANT: This method is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
47
- *
48
- * @async
49
- * @return {Promise<string | undefined>} Returns detected API base URL
50
- * @throws {Error} Throws error if either of the detection methods fails
51
- */
52
- _getApiBaseUrl(): Promise<string | undefined>;
53
- /**
54
- * Composes a full API URL for a provided endpoint path.
55
- *
56
- * @async
57
- * @param relativeEndpointPath Relative endpoint path
58
- * @return {Promise<string | undefined>} Returns the API endpoint's URL
59
- * @throws {Error} Throws error if API base URL detection fails
60
- */
61
- getApiUrl(relativeEndpointPath: string): Promise<string>;
62
- }
63
- /**
64
- * Singleton instance of ApiService
65
- */
66
- export declare const apiService: ApiService;
@@ -1,139 +0,0 @@
1
- /**
2
- * Central API configuration service, fetches and exposes Cornerstone API configuration
3
- *
4
- * @export
5
- * @class ApiService
6
- */
7
- export class ApiService {
8
- /**
9
- * Initializes the API configuration
10
- *
11
- * This method calls all methods that need to be called during the API configuration phase:
12
- * - Starts detection of API base URL.
13
- *
14
- * @async
15
- * @return {Promise<void>} Resolves when initialization is complete.
16
- */
17
- async initialize() {
18
- // (Pre)detect API base URL
19
- await this._getApiBaseUrl();
20
- }
21
- // #region API Base URL detection
22
- _apiBaseUrlPromise = undefined;
23
- /**
24
- * If API base URL detection was completed
25
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
26
- */
27
- _apiBaseUrlDetected = false;
28
- /**
29
- * If API base URL detection was completed, this property will hold the method by which detection was performed
30
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
31
- */
32
- _apiBaseUrlDetectionMethod = undefined;
33
- /**
34
- * If API base URL detection was completed, this property will hold the detected API base URL
35
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
36
- */
37
- _apiBaseUrl = undefined;
38
- /**
39
- * If API base URL detection has failed, this property will hold the error with which it has failed
40
- * IMPORTANT: This property is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
41
- */
42
- _apiBaseError = undefined;
43
- /**
44
- * Tries detecting API base URL by multiple methods
45
- *
46
- * - Checks the response headers of the current URL for the `CORNERSTONE-API-BASEURL` header.
47
- * - Attempts to load the `websettings.json` file and looks for an `api` field.
48
- * - Defaults to `undefined`.
49
- *
50
- * IMPORTANT: This method is not meant to be used in normal cases - when ever possible use the .getApiUrl(relativeEndpointPath: string) method instead.
51
- *
52
- * @async
53
- * @return {Promise<string | undefined>} Returns detected API base URL
54
- * @throws {Error} Throws error if either of the detection methods fails
55
- */
56
- async _getApiBaseUrl() {
57
- // Check if API already detected; don't reattempt detection
58
- if (this._apiBaseUrlDetected)
59
- return this._apiBaseUrl;
60
- // Check if detection already in progress; don't allow multiple detections in parallel
61
- if (this._apiBaseUrlPromise)
62
- return this._apiBaseUrlPromise;
63
- // Detect API base URL
64
- return (this._apiBaseUrlPromise = new Promise((resolve, reject) => (async () => {
65
- // Reset
66
- this._apiBaseUrlDetected = false;
67
- this._apiBaseUrlDetectionMethod = undefined;
68
- this._apiBaseUrl = undefined;
69
- this._apiBaseError = undefined;
70
- // Check CORNERSTONE-API-BASEURL header for API base URL
71
- try {
72
- const currentUrlResponse = await fetch(window.location.href, { method: 'GET' });
73
- const apiHeader = currentUrlResponse.headers.get('CORNERSTONE-API-BASEURL');
74
- if (apiHeader) {
75
- this._apiBaseUrlDetected = true;
76
- this._apiBaseUrlDetectionMethod = 'GET / Header:CORNERSTONE-API-BASEURL';
77
- this._apiBaseUrl = apiHeader;
78
- this._apiBaseError = undefined;
79
- this._apiBaseUrlPromise = undefined;
80
- return resolve(this._apiBaseUrl);
81
- }
82
- }
83
- catch (err) {
84
- this._apiBaseError = err instanceof Error ? err : new Error('Failed loading API base URL from response header!');
85
- }
86
- // Check ./websettings.json header for API base URL
87
- try {
88
- const webSettingsResponse = await fetch('./websettings.json', { method: 'GET' });
89
- if (webSettingsResponse.status === 404)
90
- return (this._apiBaseUrl = undefined);
91
- const webSettings = await webSettingsResponse.json();
92
- if (webSettings?.api) {
93
- this._apiBaseUrlDetected = true;
94
- this._apiBaseUrlDetectionMethod = 'GET websettings.json';
95
- this._apiBaseUrl = webSettings.api;
96
- this._apiBaseError = undefined;
97
- this._apiBaseUrlPromise = undefined;
98
- return resolve(this._apiBaseUrl);
99
- }
100
- }
101
- catch (err) {
102
- this._apiBaseError = err instanceof Error ? err : new Error('Failed loading API base URL from settings file!');
103
- }
104
- // Check if error caught during any of the detection methods
105
- if (this._apiBaseError !== undefined) {
106
- this._apiBaseUrlDetected = false;
107
- this._apiBaseUrlDetectionMethod = undefined;
108
- this._apiBaseUrl = undefined;
109
- this._apiBaseUrlPromise = undefined;
110
- return reject(this._apiBaseError);
111
- }
112
- // Default to no API found
113
- this._apiBaseUrlDetected = true;
114
- this._apiBaseUrlDetectionMethod = undefined;
115
- this._apiBaseUrl = undefined;
116
- this._apiBaseError = undefined;
117
- this._apiBaseUrlPromise = undefined;
118
- return resolve(this._apiBaseUrl);
119
- })()));
120
- }
121
- /**
122
- * Composes a full API URL for a provided endpoint path.
123
- *
124
- * @async
125
- * @param relativeEndpointPath Relative endpoint path
126
- * @return {Promise<string | undefined>} Returns the API endpoint's URL
127
- * @throws {Error} Throws error if API base URL detection fails
128
- */
129
- async getApiUrl(relativeEndpointPath) {
130
- const apiBaseUrl = await this._getApiBaseUrl();
131
- const domain = !apiBaseUrl ? `` : apiBaseUrl?.endsWith('/') ? apiBaseUrl : `${apiBaseUrl}/`;
132
- const path = !relativeEndpointPath.startsWith('/') ? relativeEndpointPath : relativeEndpointPath.substring(1);
133
- return `${domain}${path}`;
134
- }
135
- }
136
- /**
137
- * Singleton instance of ApiService
138
- */
139
- export const apiService = new ApiService();
@@ -1,2 +0,0 @@
1
- export * from './user';
2
- export * from './user-info';
@@ -1,2 +0,0 @@
1
- export * from './user';
2
- export * from './user-info';
@@ -1,14 +0,0 @@
1
- import { User } from './user';
2
- /**
3
- * Represents user information along with access token expiry.
4
- *
5
- * @template TId The type of the user identifier.
6
- * @template TUser The type of the user object, defaulting to `User<TId>`.
7
- *
8
- * @param {TUser} user The user object containing user details.
9
- * @param {Date} accessTokenExpiry The date and time when the access token will expire.
10
- */
11
- export type UserInfo<TId, TUser = User<TId>> = {
12
- user: TUser;
13
- accessTokenExpiry: Date;
14
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Represents a user with an identifier and email address.
3
- *
4
- * @template TId The type of the user identifier.
5
- *
6
- * @param {TId} id The unique identifier for the user.
7
- * @param {string} email The email address associated with the user.
8
- */
9
- export type User<TId> = {
10
- id: TId;
11
- email: string;
12
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- /**
2
- * Central configuration service, fetches and exposes Cornerstone configuration
3
- *
4
- * @export
5
- * @class ConfigService
6
- */
7
- export declare class ConfigService {
8
- /**
9
- * Initializes the configuration by detecting the API base URL.
10
- *
11
- * This method calls all methods that need to be called during the config phase.
12
- *
13
- * @async
14
- * @return {Promise<void>} Resolves when the API base URL is detected.
15
- */
16
- initialize(): Promise<void>;
17
- private _apiBaseUrlDetected;
18
- private _apiBaseUrlDetectionMethod;
19
- private _apiBaseUrl;
20
- private _apiBaseError;
21
- private _apiBaseUrlPromise;
22
- /**
23
- * Detects the API base URL by checking the `CORNERSTONE-API-BASEURL` header and the `websettings.json` file.
24
- *
25
- * - First, it checks the response headers of the current URL for the `CORNERSTONE-API-BASEURL` header.
26
- * - If the header is not found, it attempts to load the `websettings.json` file and looks for an `api` field.
27
- * - If no API base URL is found, it defaults to `undefined`.
28
- *
29
- * @async
30
- * @return {Promise<string | undefined>} Returns the API base URL
31
- * @throws {Error} Throws error if either of the detection methods fails
32
- */
33
- _getApiBaseUrl(): Promise<string | undefined>;
34
- /**
35
- * Returns a full URL for a provided endpoint path.
36
- *
37
- * @async
38
- * @param relativeEndpointPath Relative endpoint path
39
- * @return {Promise<string | undefined>} Returns the API endpoint's URL
40
- * @throws {Error} Throws error if API base URL detection fails
41
- */
42
- getApiUrl(relativeEndpointPath: string): Promise<string>;
43
- }
44
- /**
45
- * Singleton instance of ConfigService
46
- */
47
- export declare const configService: ConfigService;
@@ -1,120 +0,0 @@
1
- /**
2
- * Central configuration service, fetches and exposes Cornerstone configuration
3
- *
4
- * @export
5
- * @class ConfigService
6
- */
7
- export class ConfigService {
8
- /**
9
- * Initializes the configuration by detecting the API base URL.
10
- *
11
- * This method calls all methods that need to be called during the config phase.
12
- *
13
- * @async
14
- * @return {Promise<void>} Resolves when the API base URL is detected.
15
- */
16
- async initialize() {
17
- // (Pre)detect API base URL
18
- await this._getApiBaseUrl();
19
- }
20
- // #region API Base URL detection
21
- _apiBaseUrlDetected = false;
22
- _apiBaseUrlDetectionMethod = undefined;
23
- _apiBaseUrl = undefined;
24
- _apiBaseError = undefined;
25
- _apiBaseUrlPromise = undefined;
26
- /**
27
- * Detects the API base URL by checking the `CORNERSTONE-API-BASEURL` header and the `websettings.json` file.
28
- *
29
- * - First, it checks the response headers of the current URL for the `CORNERSTONE-API-BASEURL` header.
30
- * - If the header is not found, it attempts to load the `websettings.json` file and looks for an `api` field.
31
- * - If no API base URL is found, it defaults to `undefined`.
32
- *
33
- * @async
34
- * @return {Promise<string | undefined>} Returns the API base URL
35
- * @throws {Error} Throws error if either of the detection methods fails
36
- */
37
- async _getApiBaseUrl() {
38
- // Check if API already detected; don't reattempt detection
39
- if (this._apiBaseUrlDetected)
40
- return this._apiBaseUrl;
41
- // Check if detection already in progress; don't allow multiple detections in parallel
42
- if (this._apiBaseUrlPromise)
43
- return this._apiBaseUrlPromise;
44
- // Detect API base URL
45
- return (this._apiBaseUrlPromise = new Promise((resolve, reject) => (async () => {
46
- // Reset
47
- this._apiBaseUrlDetected = false;
48
- this._apiBaseUrlDetectionMethod = undefined;
49
- this._apiBaseUrl = undefined;
50
- this._apiBaseError = undefined;
51
- // Check CORNERSTONE-API-BASEURL header for API base URL
52
- try {
53
- const currentUrlResponse = await fetch(window.location.href, { method: 'GET' });
54
- const apiHeader = currentUrlResponse.headers.get('CORNERSTONE-API-BASEURL');
55
- if (apiHeader) {
56
- this._apiBaseUrlDetected = true;
57
- this._apiBaseUrlDetectionMethod = 'GET / Header:CORNERSTONE-API-BASEURL';
58
- this._apiBaseUrl = apiHeader;
59
- this._apiBaseError = undefined;
60
- this._apiBaseUrlPromise = undefined;
61
- return resolve(this._apiBaseUrl);
62
- }
63
- }
64
- catch (err) {
65
- this._apiBaseError = err instanceof Error ? err : new Error('Failed loading configuration from response header!');
66
- }
67
- // Check ./websettings.json header for API base URL
68
- try {
69
- const webSettingsResponse = await fetch('./websettings.json', { method: 'GET' });
70
- if (webSettingsResponse.status === 404)
71
- return (this._apiBaseUrl = undefined);
72
- const webSettings = await webSettingsResponse.json();
73
- if (webSettings?.api) {
74
- this._apiBaseUrlDetected = true;
75
- this._apiBaseUrlDetectionMethod = 'GET websettings.json';
76
- this._apiBaseUrl = webSettings.api;
77
- this._apiBaseError = undefined;
78
- this._apiBaseUrlPromise = undefined;
79
- return resolve(this._apiBaseUrl);
80
- }
81
- }
82
- catch (err) {
83
- this._apiBaseError = err instanceof Error ? err : new Error('Failed loading configuration from settings file!');
84
- }
85
- // Check if error caught during any of the detection methods
86
- if (this._apiBaseError !== undefined) {
87
- this._apiBaseUrlDetected = false;
88
- this._apiBaseUrlDetectionMethod = undefined;
89
- this._apiBaseUrl = undefined;
90
- this._apiBaseUrlPromise = undefined;
91
- return reject(this._apiBaseError);
92
- }
93
- // Default to no API found
94
- this._apiBaseUrlDetected = true;
95
- this._apiBaseUrlDetectionMethod = undefined;
96
- this._apiBaseUrl = undefined;
97
- this._apiBaseError = undefined;
98
- this._apiBaseUrlPromise = undefined;
99
- return resolve(this._apiBaseUrl);
100
- })()));
101
- }
102
- /**
103
- * Returns a full URL for a provided endpoint path.
104
- *
105
- * @async
106
- * @param relativeEndpointPath Relative endpoint path
107
- * @return {Promise<string | undefined>} Returns the API endpoint's URL
108
- * @throws {Error} Throws error if API base URL detection fails
109
- */
110
- async getApiUrl(relativeEndpointPath) {
111
- const apiBaseUrl = await this._getApiBaseUrl();
112
- const domain = !apiBaseUrl ? `` : apiBaseUrl?.endsWith('/') ? apiBaseUrl : `${apiBaseUrl}/`;
113
- const path = !relativeEndpointPath.startsWith('/') ? relativeEndpointPath : relativeEndpointPath.substring(1);
114
- return `${domain}${path}`;
115
- }
116
- }
117
- /**
118
- * Singleton instance of ConfigService
119
- */
120
- export const configService = new ConfigService();