1 import { Admin } from "./admin/index.js"
2 import { Auth } from "./auth/index.js"
3 import { Client } from "./client.js"
4 import { Store } from "./store/index.js"
5 import { Config } from "./types.js"
6
7 class Medusa {
8 public client: Client
9
10 public admin: Admin
11 public store: Store
12 public auth: Auth
13
14 constructor(config: Config) {
15 this.client = new Client(config)
16
17 this.admin = new Admin(this.client)
18 this.store = new Store(this.client)
19 this.auth = new Auth(this.client, config)
20 }
21
22 setLocale(locale: string) {
23 this.client.setLocale(locale)
24 }
25
26 getLocale() {
27 return this.client.locale
28 }
29 }
30
31 export default Medusa
32
33 export { FetchError, Client } from "./client.js"
34 export { Admin } from "./admin/index.js"
35 export {
36 Auth,
37 type AuthCallbackResponse,
38 type AuthVerificationConfirmPayload,
39 type AuthVerificationConfirmResponse,
40 type AuthVerificationRequestPayload,
41 type AuthVerificationRequestResponse,
42 type AuthVerificationRequiredResponse,
43 type AuthLoginResponse,
44 type AuthMfaDisablePayload,
45 type AuthMfaFactorResponse,
46 type AuthMfaGenerateRecoveryCodesPayload,
47 type AuthMfaListResponse,
48 type AuthMfaRecoveryCodesResponse,
49 type AuthMfaRequiredResponse,
50 type AuthMfaSetupResponse,
51 type AuthMfaStartPayload,
52 type AuthMfaVerifyChallengePayload,
53 type AuthMfaVerifyPayload,
54 type AuthRedirectResponse,
55 type AuthRegisterResponse,
56 } from "./auth/index.js"
57 export { Store } from "./store/index.js"
58 export {
59 Config,
60 ClientHeaders,
61 ClientFetch,
62 FetchArgs,
63 FetchInput,
64 FetchStreamResponse,
65 Logger,
66 ServerSentEventMessage,
67 } from "./types.js"