1
1
import Configuration from './config.json' ;
2
2
import { z } from 'zod' ;
3
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
+ import type { ZodError } from 'zod' ;
3
5
4
6
const Config = z . object ( {
5
7
ONPATIENT_CLIENT_ID : z . string ( ) . optional ( ) ,
@@ -21,6 +23,11 @@ const Config = z.object({
21
23
22
24
type Config = z . infer < typeof Config > ;
23
25
26
+ /**
27
+ * Get the configuration object
28
+ * @returns Config object
29
+ * @throws {ZodError } Error if the configuration is invalid
30
+ */
24
31
export const getConfig = ( ) : Config => {
25
32
try {
26
33
return Config . parse ( Configuration ) ;
@@ -36,10 +43,20 @@ const OnPatientConfig = z.object({
36
43
ONPATIENT_CLIENT_ID : z . string ( ) ,
37
44
} ) ;
38
45
46
+ /**
47
+ * Get the OnPatient configuration object
48
+ * @returns OnPatientConfig object
49
+ * @throws {ZodError } Error if the configuration is invalid
50
+ */
39
51
export const getOnPatientConfig = ( ) => {
40
52
return OnPatientConfig . parse ( Configuration ) ;
41
53
} ;
42
54
55
+ /**
56
+ * Get the configured redirect URI
57
+ * @returns The configured redirect URI
58
+ * @throws {ZodError } Error if the configuration is invalid
59
+ */
43
60
export const getRedirectUri = ( ) => {
44
61
try {
45
62
const config = Config . parse ( Configuration ) ;
0 commit comments