@sekolaos/shared-api 1.3.1 → 1.3.2
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/dist/{chunk-NVU4IIMA.cjs → chunk-EM5HIZFG.cjs} +2 -2
- package/dist/{chunk-NVU4IIMA.cjs.map → chunk-EM5HIZFG.cjs.map} +1 -1
- package/dist/{chunk-H5WMOGLJ.js → chunk-KLRABMYU.js} +2 -2
- package/dist/{chunk-H5WMOGLJ.js.map → chunk-KLRABMYU.js.map} +1 -1
- package/dist/index.cjs +17 -17
- package/dist/index.js +1 -1
- package/dist/modules/auth/index.cjs +17 -17
- package/dist/modules/auth/index.d.cts +3 -21
- package/dist/modules/auth/index.d.ts +3 -21
- package/dist/modules/auth/index.js +1 -1
- package/package.json +138 -137
|
@@ -134,5 +134,5 @@ exports.useLogout = useLogout;
|
|
|
134
134
|
exports.useMe = useMe;
|
|
135
135
|
exports.useSelectTenant = useSelectTenant;
|
|
136
136
|
exports.useSwitchRole = useSwitchRole;
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
138
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-EM5HIZFG.cjs.map
|
|
138
|
+
//# sourceMappingURL=chunk-EM5HIZFG.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modules/auth/auth.api.ts"],"names":["API_ENDPOINTS","postData","getData","putData","useQueryClient","useMutation","authKeys","useQuery"],"mappings":";;;;;;;AAmBA,IAAM,WAAWA,+BAAA,CAAc,IAAA;AAgB/B,eAAsB,MAAM,OAAA,EAA+C;AACzE,EAAA,OAAOC,0BAAA,CAAsC,CAAA,EAAG,QAAQ,CAAA,MAAA,CAAA,EAAU,OAAO,CAAA;AAC3E;AAEA,eAAsB,aAAa,OAAA,EAAsD;AACvF,EAAA,OAAOA,0BAAA,CAA6C,CAAA,EAAG,QAAQ,CAAA,cAAA,CAAA,EAAkB,OAAO,CAAA;AAC1F;AAEA,eAAsB,WAAW,OAAA,EAAkD;AACjF,EAAA,OAAOA,0BAAA,CAAyC,CAAA,EAAG,QAAQ,CAAA,YAAA,CAAA,EAAgB,OAAO,CAAA;AACpF;AAEA,eAAsB,MAAA,GAAwB;AAC5C,EAAA,MAAMA,0BAAA,CAAe,CAAA,EAAG,QAAQ,CAAA,OAAA,CAAS,CAAA;AAC3C;AAEA,eAAsB,KAAA,
|
|
1
|
+
{"version":3,"sources":["../src/modules/auth/auth.api.ts"],"names":["API_ENDPOINTS","postData","getData","putData","useQueryClient","useMutation","authKeys","useQuery"],"mappings":";;;;;;;AAmBA,IAAM,WAAWA,+BAAA,CAAc,IAAA;AAgB/B,eAAsB,MAAM,OAAA,EAA+C;AACzE,EAAA,OAAOC,0BAAA,CAAsC,CAAA,EAAG,QAAQ,CAAA,MAAA,CAAA,EAAU,OAAO,CAAA;AAC3E;AAEA,eAAsB,aAAa,OAAA,EAAsD;AACvF,EAAA,OAAOA,0BAAA,CAA6C,CAAA,EAAG,QAAQ,CAAA,cAAA,CAAA,EAAkB,OAAO,CAAA;AAC1F;AAEA,eAAsB,WAAW,OAAA,EAAkD;AACjF,EAAA,OAAOA,0BAAA,CAAyC,CAAA,EAAG,QAAQ,CAAA,YAAA,CAAA,EAAgB,OAAO,CAAA;AACpF;AAEA,eAAsB,MAAA,GAAwB;AAC5C,EAAA,MAAMA,0BAAA,CAAe,CAAA,EAAG,QAAQ,CAAA,OAAA,CAAS,CAAA;AAC3C;AAEA,eAAsB,KAAA,GAAqC;AACzD,EAAA,OAAOC,yBAAA,CAA4B,CAAA,EAAG,QAAQ,CAAA,GAAA,CAAK,CAAA;AACrD;AAEA,eAAsB,eAAe,OAAA,EAA8D;AACjG,EAAA,OAAOC,yBAAA,CAAoD,CAAA,EAAG,QAAQ,CAAA,gBAAA,CAAA,EAAoB,OAAO,CAAA;AACnG;AAGA,eAAsB,qBAAqB,OAAA,EAA4D;AACrG,EAAA,MAAM,MAAM,MAAM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AA;AAAA,IAC/C,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH;AAEO,SAAS,UAAU,OAAA,EAA6C;AACrE,EAAA,MAAM,cAAcF,yBAAA,EAAe;AACnC,EAAA,OAAOC,sBAAA,CAAY;AAAA,IACjB,UAAA,EAAY,MAAA;AAAA,IACZ,WAAW,MAAM;AACf,MAAA,WAAA,CAAY,KAAA,EAAM;AAClB,MAAA,OAAA,EAAS,SAAA,GAAY,MAAA,EAAW,MAAA,EAAW,MAAS,CAAA;AAAA,IACtD,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH;AAEO,SAAS,kBAAkB,OAAA,EAA6E;AAC7G,EAAA,OAAOA,sBAAA,CAAY;AAAA,IACjB,UAAA,EAAY,cAAA;AAAA,IACZ,GAAG;AAAA,GACJ,CAAA;AACH","file":"chunk-EM5HIZFG.cjs","sourcesContent":["import type {\r\n AuthSession,\r\n ChangePasswordRequest,\r\n ConsumeImpersonationRequest,\r\n LoginRequest,\r\n LoginResponse,\r\n Role,\r\n SelectTenantRequest,\r\n SwitchRoleRequest,\r\n Tenant,\r\n TenantOption,\r\n UserProfile,\r\n} from \"@sekolaos/shared-schema\";\r\nimport { API_ENDPOINTS } from \"../../common/endpoints\";\r\nimport { getData, postData, putData } from \"../../client/http\";\r\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\r\nimport { authKeys } from \"../../keys\";\r\nimport type { MutationOptionsCustom, QueryOptionsWithoutKey } from \"../../client/types\";\r\n\r\nconst ENDPOINT = API_ENDPOINTS.auth;\r\n\r\nexport interface AuthUserSummary {\r\n id: string;\r\n username: string;\r\n email: string | null;\r\n fullName: string;\r\n}\r\n\r\n/** Payload `GET /auth/me`: sesi + profil ringkas user + tenant aktif. */\r\nexport interface AuthSessionPayload {\r\n session: AuthSession;\r\n user: AuthUserSummary;\r\n tenant: Tenant;\r\n}\r\n\r\nexport async function login(payload: LoginRequest): Promise<LoginResponse> {\r\n return postData<LoginResponse, LoginRequest>(`${ENDPOINT}/login`, payload);\r\n}\r\n\r\nexport async function selectTenant(payload: SelectTenantRequest): Promise<LoginResponse> {\r\n return postData<LoginResponse, SelectTenantRequest>(`${ENDPOINT}/select-tenant`, payload);\r\n}\r\n\r\nexport async function switchRole(payload: SwitchRoleRequest): Promise<AuthSession> {\r\n return postData<AuthSession, SwitchRoleRequest>(`${ENDPOINT}/switch-role`, payload);\r\n}\r\n\r\nexport async function logout(): Promise<void> {\r\n await postData<void>(`${ENDPOINT}/logout`);\r\n}\r\n\r\nexport async function getMe(): Promise<AuthSessionPayload> {\r\n return getData<AuthSessionPayload>(`${ENDPOINT}/me`);\r\n}\r\n\r\nexport async function changePassword(payload: ChangePasswordRequest): Promise<{ message: string }> {\r\n return putData<{ message: string }, ChangePasswordRequest>(`${ENDPOINT}/change-password`, payload);\r\n}\r\n\r\n/** Konsumsi token impersonasi dari sekolaos-admin, terbitkan sesi sekolah dengan isImpersonating: true. */\r\nexport async function consumeImpersonation(payload: ConsumeImpersonationRequest): Promise<AuthSession> {\r\n const res = await postData<{ session: AuthSession }, ConsumeImpersonationRequest>(\r\n `${ENDPOINT}/impersonate/consume`,\r\n payload\r\n );\r\n return res.session;\r\n}\r\n\r\n/** Keluar dari mode penyamaran: hapus cookie sesi sekolah. */\r\nexport async function exitImpersonation(): Promise<void> {\r\n await postData<void>(`${ENDPOINT}/impersonate/exit`);\r\n}\r\n\r\nexport function useConsumeImpersonation(options?: MutationOptionsCustom<AuthSession, ConsumeImpersonationRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: consumeImpersonation,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useExitImpersonation(options?: MutationOptionsCustom<void, void>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: exitImpersonation,\r\n onSuccess: () => {\r\n queryClient.clear();\r\n options?.onSuccess?.(undefined, undefined, undefined);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useMe(options?: QueryOptionsWithoutKey<AuthSessionPayload> & { enabled?: boolean }) {\r\n return useQuery({\r\n queryKey: authKeys.me(),\r\n queryFn: getMe,\r\n enabled: options?.enabled ?? true,\r\n staleTime: 60_000,\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useLogin(options?: MutationOptionsCustom<LoginResponse, LoginRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: login,\r\n onSuccess: (data, variables, context) => {\r\n if (data.status === \"SUCCESS\") {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n }\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useSelectTenant(options?: MutationOptionsCustom<LoginResponse, SelectTenantRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: selectTenant,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useSwitchRole(options?: MutationOptionsCustom<AuthSession, SwitchRoleRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: switchRole,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useLogout(options?: MutationOptionsCustom<void, void>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: logout,\r\n onSuccess: () => {\r\n queryClient.clear();\r\n options?.onSuccess?.(undefined, undefined, undefined);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useChangePassword(options?: MutationOptionsCustom<{ message: string }, ChangePasswordRequest>) {\r\n return useMutation({\r\n mutationFn: changePassword,\r\n ...options,\r\n });\r\n}\r\n\r\nexport type {\r\n AuthSession,\r\n ChangePasswordRequest,\r\n ConsumeImpersonationRequest,\r\n LoginRequest,\r\n LoginResponse,\r\n Role,\r\n SelectTenantRequest,\r\n SwitchRoleRequest,\r\n TenantOption,\r\n UserProfile,\r\n};\r\n"]}
|
|
@@ -117,5 +117,5 @@ function useChangePassword(options) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export { changePassword, consumeImpersonation, exitImpersonation, getMe, login, logout, selectTenant, switchRole, useChangePassword, useConsumeImpersonation, useExitImpersonation, useLogin, useLogout, useMe, useSelectTenant, useSwitchRole };
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-KLRABMYU.js.map
|
|
121
|
+
//# sourceMappingURL=chunk-KLRABMYU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modules/auth/auth.api.ts"],"names":[],"mappings":";;;;;AAmBA,IAAM,WAAW,aAAA,CAAc,IAAA;AAgB/B,eAAsB,MAAM,OAAA,EAA+C;AACzE,EAAA,OAAO,QAAA,CAAsC,CAAA,EAAG,QAAQ,CAAA,MAAA,CAAA,EAAU,OAAO,CAAA;AAC3E;AAEA,eAAsB,aAAa,OAAA,EAAsD;AACvF,EAAA,OAAO,QAAA,CAA6C,CAAA,EAAG,QAAQ,CAAA,cAAA,CAAA,EAAkB,OAAO,CAAA;AAC1F;AAEA,eAAsB,WAAW,OAAA,EAAkD;AACjF,EAAA,OAAO,QAAA,CAAyC,CAAA,EAAG,QAAQ,CAAA,YAAA,CAAA,EAAgB,OAAO,CAAA;AACpF;AAEA,eAAsB,MAAA,GAAwB;AAC5C,EAAA,MAAM,QAAA,CAAe,CAAA,EAAG,QAAQ,CAAA,OAAA,CAAS,CAAA;AAC3C;AAEA,eAAsB,KAAA,
|
|
1
|
+
{"version":3,"sources":["../src/modules/auth/auth.api.ts"],"names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AAA,CAAY;AAAA,IACjB,UAAA,EAAY,cAAA;AAAA,IACZ,GAAG;AAAA,GACJ,CAAA;AACH","file":"chunk-KLRABMYU.js","sourcesContent":["import type {\r\n AuthSession,\r\n ChangePasswordRequest,\r\n ConsumeImpersonationRequest,\r\n LoginRequest,\r\n LoginResponse,\r\n Role,\r\n SelectTenantRequest,\r\n SwitchRoleRequest,\r\n Tenant,\r\n TenantOption,\r\n UserProfile,\r\n} from \"@sekolaos/shared-schema\";\r\nimport { API_ENDPOINTS } from \"../../common/endpoints\";\r\nimport { getData, postData, putData } from \"../../client/http\";\r\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\r\nimport { authKeys } from \"../../keys\";\r\nimport type { MutationOptionsCustom, QueryOptionsWithoutKey } from \"../../client/types\";\r\n\r\nconst ENDPOINT = API_ENDPOINTS.auth;\r\n\r\nexport interface AuthUserSummary {\r\n id: string;\r\n username: string;\r\n email: string | null;\r\n fullName: string;\r\n}\r\n\r\n/** Payload `GET /auth/me`: sesi + profil ringkas user + tenant aktif. */\r\nexport interface AuthSessionPayload {\r\n session: AuthSession;\r\n user: AuthUserSummary;\r\n tenant: Tenant;\r\n}\r\n\r\nexport async function login(payload: LoginRequest): Promise<LoginResponse> {\r\n return postData<LoginResponse, LoginRequest>(`${ENDPOINT}/login`, payload);\r\n}\r\n\r\nexport async function selectTenant(payload: SelectTenantRequest): Promise<LoginResponse> {\r\n return postData<LoginResponse, SelectTenantRequest>(`${ENDPOINT}/select-tenant`, payload);\r\n}\r\n\r\nexport async function switchRole(payload: SwitchRoleRequest): Promise<AuthSession> {\r\n return postData<AuthSession, SwitchRoleRequest>(`${ENDPOINT}/switch-role`, payload);\r\n}\r\n\r\nexport async function logout(): Promise<void> {\r\n await postData<void>(`${ENDPOINT}/logout`);\r\n}\r\n\r\nexport async function getMe(): Promise<AuthSessionPayload> {\r\n return getData<AuthSessionPayload>(`${ENDPOINT}/me`);\r\n}\r\n\r\nexport async function changePassword(payload: ChangePasswordRequest): Promise<{ message: string }> {\r\n return putData<{ message: string }, ChangePasswordRequest>(`${ENDPOINT}/change-password`, payload);\r\n}\r\n\r\n/** Konsumsi token impersonasi dari sekolaos-admin, terbitkan sesi sekolah dengan isImpersonating: true. */\r\nexport async function consumeImpersonation(payload: ConsumeImpersonationRequest): Promise<AuthSession> {\r\n const res = await postData<{ session: AuthSession }, ConsumeImpersonationRequest>(\r\n `${ENDPOINT}/impersonate/consume`,\r\n payload\r\n );\r\n return res.session;\r\n}\r\n\r\n/** Keluar dari mode penyamaran: hapus cookie sesi sekolah. */\r\nexport async function exitImpersonation(): Promise<void> {\r\n await postData<void>(`${ENDPOINT}/impersonate/exit`);\r\n}\r\n\r\nexport function useConsumeImpersonation(options?: MutationOptionsCustom<AuthSession, ConsumeImpersonationRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: consumeImpersonation,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useExitImpersonation(options?: MutationOptionsCustom<void, void>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: exitImpersonation,\r\n onSuccess: () => {\r\n queryClient.clear();\r\n options?.onSuccess?.(undefined, undefined, undefined);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useMe(options?: QueryOptionsWithoutKey<AuthSessionPayload> & { enabled?: boolean }) {\r\n return useQuery({\r\n queryKey: authKeys.me(),\r\n queryFn: getMe,\r\n enabled: options?.enabled ?? true,\r\n staleTime: 60_000,\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useLogin(options?: MutationOptionsCustom<LoginResponse, LoginRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: login,\r\n onSuccess: (data, variables, context) => {\r\n if (data.status === \"SUCCESS\") {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n }\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useSelectTenant(options?: MutationOptionsCustom<LoginResponse, SelectTenantRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: selectTenant,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useSwitchRole(options?: MutationOptionsCustom<AuthSession, SwitchRoleRequest>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: switchRole,\r\n onSuccess: (data, variables, context) => {\r\n queryClient.invalidateQueries({ queryKey: authKeys.all });\r\n options?.onSuccess?.(data, variables, context);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useLogout(options?: MutationOptionsCustom<void, void>) {\r\n const queryClient = useQueryClient();\r\n return useMutation({\r\n mutationFn: logout,\r\n onSuccess: () => {\r\n queryClient.clear();\r\n options?.onSuccess?.(undefined, undefined, undefined);\r\n },\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useChangePassword(options?: MutationOptionsCustom<{ message: string }, ChangePasswordRequest>) {\r\n return useMutation({\r\n mutationFn: changePassword,\r\n ...options,\r\n });\r\n}\r\n\r\nexport type {\r\n AuthSession,\r\n ChangePasswordRequest,\r\n ConsumeImpersonationRequest,\r\n LoginRequest,\r\n LoginResponse,\r\n Role,\r\n SelectTenantRequest,\r\n SwitchRoleRequest,\r\n TenantOption,\r\n UserProfile,\r\n};\r\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ var chunk2FTS6JMO_cjs = require('./chunk-2FTS6JMO.cjs');
|
|
|
13
13
|
require('./chunk-WF63F6RJ.cjs');
|
|
14
14
|
var chunkBBJBCD2K_cjs = require('./chunk-BBJBCD2K.cjs');
|
|
15
15
|
var chunkJVX37TC5_cjs = require('./chunk-JVX37TC5.cjs');
|
|
16
|
-
var
|
|
16
|
+
var chunkEM5HIZFG_cjs = require('./chunk-EM5HIZFG.cjs');
|
|
17
17
|
var chunkAMKVNGY4_cjs = require('./chunk-AMKVNGY4.cjs');
|
|
18
18
|
var chunk3TOBH3YY_cjs = require('./chunk-3TOBH3YY.cjs');
|
|
19
19
|
var chunkNGFFI4XQ_cjs = require('./chunk-NGFFI4XQ.cjs');
|
|
@@ -502,67 +502,67 @@ Object.defineProperty(exports, "verifyDynamicQr", {
|
|
|
502
502
|
});
|
|
503
503
|
Object.defineProperty(exports, "changePassword", {
|
|
504
504
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
505
|
+
get: function () { return chunkEM5HIZFG_cjs.changePassword; }
|
|
506
506
|
});
|
|
507
507
|
Object.defineProperty(exports, "consumeImpersonation", {
|
|
508
508
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
509
|
+
get: function () { return chunkEM5HIZFG_cjs.consumeImpersonation; }
|
|
510
510
|
});
|
|
511
511
|
Object.defineProperty(exports, "exitImpersonation", {
|
|
512
512
|
enumerable: true,
|
|
513
|
-
get: function () { return
|
|
513
|
+
get: function () { return chunkEM5HIZFG_cjs.exitImpersonation; }
|
|
514
514
|
});
|
|
515
515
|
Object.defineProperty(exports, "getMe", {
|
|
516
516
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
517
|
+
get: function () { return chunkEM5HIZFG_cjs.getMe; }
|
|
518
518
|
});
|
|
519
519
|
Object.defineProperty(exports, "login", {
|
|
520
520
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
521
|
+
get: function () { return chunkEM5HIZFG_cjs.login; }
|
|
522
522
|
});
|
|
523
523
|
Object.defineProperty(exports, "logout", {
|
|
524
524
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
525
|
+
get: function () { return chunkEM5HIZFG_cjs.logout; }
|
|
526
526
|
});
|
|
527
527
|
Object.defineProperty(exports, "selectTenant", {
|
|
528
528
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
529
|
+
get: function () { return chunkEM5HIZFG_cjs.selectTenant; }
|
|
530
530
|
});
|
|
531
531
|
Object.defineProperty(exports, "switchRole", {
|
|
532
532
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
533
|
+
get: function () { return chunkEM5HIZFG_cjs.switchRole; }
|
|
534
534
|
});
|
|
535
535
|
Object.defineProperty(exports, "useChangePassword", {
|
|
536
536
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
537
|
+
get: function () { return chunkEM5HIZFG_cjs.useChangePassword; }
|
|
538
538
|
});
|
|
539
539
|
Object.defineProperty(exports, "useConsumeImpersonation", {
|
|
540
540
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
541
|
+
get: function () { return chunkEM5HIZFG_cjs.useConsumeImpersonation; }
|
|
542
542
|
});
|
|
543
543
|
Object.defineProperty(exports, "useExitImpersonation", {
|
|
544
544
|
enumerable: true,
|
|
545
|
-
get: function () { return
|
|
545
|
+
get: function () { return chunkEM5HIZFG_cjs.useExitImpersonation; }
|
|
546
546
|
});
|
|
547
547
|
Object.defineProperty(exports, "useLogin", {
|
|
548
548
|
enumerable: true,
|
|
549
|
-
get: function () { return
|
|
549
|
+
get: function () { return chunkEM5HIZFG_cjs.useLogin; }
|
|
550
550
|
});
|
|
551
551
|
Object.defineProperty(exports, "useLogout", {
|
|
552
552
|
enumerable: true,
|
|
553
|
-
get: function () { return
|
|
553
|
+
get: function () { return chunkEM5HIZFG_cjs.useLogout; }
|
|
554
554
|
});
|
|
555
555
|
Object.defineProperty(exports, "useMe", {
|
|
556
556
|
enumerable: true,
|
|
557
|
-
get: function () { return
|
|
557
|
+
get: function () { return chunkEM5HIZFG_cjs.useMe; }
|
|
558
558
|
});
|
|
559
559
|
Object.defineProperty(exports, "useSelectTenant", {
|
|
560
560
|
enumerable: true,
|
|
561
|
-
get: function () { return
|
|
561
|
+
get: function () { return chunkEM5HIZFG_cjs.useSelectTenant; }
|
|
562
562
|
});
|
|
563
563
|
Object.defineProperty(exports, "useSwitchRole", {
|
|
564
564
|
enumerable: true,
|
|
565
|
-
get: function () { return
|
|
565
|
+
get: function () { return chunkEM5HIZFG_cjs.useSwitchRole; }
|
|
566
566
|
});
|
|
567
567
|
Object.defineProperty(exports, "createClassroom", {
|
|
568
568
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { SekolaosQueryProvider, createDefaultQueryClient } from './chunk-CBTITLR
|
|
|
11
11
|
import './chunk-AGPMQFZM.js';
|
|
12
12
|
export { activateAcademicYear, createAcademicYear, listAcademicYears, updateAcademicYear, useAcademicYears, useActivateAcademicYear, useCreateAcademicYear, useUpdateAcademicYear } from './chunk-ROK2DEVT.js';
|
|
13
13
|
export { batchSyncAttendance, createPicketAssignment, getAttendanceHistory, getDynamicQrStream, listPicketSchedules, updateClassAttendance, useAttendanceHistory, useBatchSyncAttendance, useCreatePicketAssignment, useDynamicQrStream, usePicketSchedules, useUpdateClassAttendance, useVerifyDynamicQr, verifyDynamicQr } from './chunk-ID3UGFZZ.js';
|
|
14
|
-
export { changePassword, consumeImpersonation, exitImpersonation, getMe, login, logout, selectTenant, switchRole, useChangePassword, useConsumeImpersonation, useExitImpersonation, useLogin, useLogout, useMe, useSelectTenant, useSwitchRole } from './chunk-
|
|
14
|
+
export { changePassword, consumeImpersonation, exitImpersonation, getMe, login, logout, selectTenant, switchRole, useChangePassword, useConsumeImpersonation, useExitImpersonation, useLogin, useLogout, useMe, useSelectTenant, useSwitchRole } from './chunk-KLRABMYU.js';
|
|
15
15
|
export { createClassroom, getClassroom, getClassroomStudents, listClassrooms, promoteClassStudents, updateClassroom, useClassroom, useClassroomStudents, useClassrooms, useCreateClassroom, usePromoteClassStudents, useUpdateClassroom } from './chunk-FVPR2MOB.js';
|
|
16
16
|
export { API_ENDPOINTS, API_V1_PREFIX } from './chunk-Q5ZX6TKB.js';
|
|
17
17
|
export { deleteData, getData, getEnvelope, getPaginated, patchData, postData, putData, uploadData } from './chunk-6JGO2CUT.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEM5HIZFG_cjs = require('../../chunk-EM5HIZFG.cjs');
|
|
4
4
|
require('../../chunk-3TOBH3YY.cjs');
|
|
5
5
|
require('../../chunk-NGFFI4XQ.cjs');
|
|
6
6
|
require('../../chunk-PPK3HQOY.cjs');
|
|
@@ -11,67 +11,67 @@ require('../../chunk-5KSKHZWB.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "changePassword", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkEM5HIZFG_cjs.changePassword; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "consumeImpersonation", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkEM5HIZFG_cjs.consumeImpersonation; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "exitImpersonation", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkEM5HIZFG_cjs.exitImpersonation; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getMe", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkEM5HIZFG_cjs.getMe; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "login", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkEM5HIZFG_cjs.login; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "logout", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkEM5HIZFG_cjs.logout; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "selectTenant", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkEM5HIZFG_cjs.selectTenant; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "switchRole", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkEM5HIZFG_cjs.switchRole; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "useChangePassword", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkEM5HIZFG_cjs.useChangePassword; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "useConsumeImpersonation", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkEM5HIZFG_cjs.useConsumeImpersonation; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "useExitImpersonation", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkEM5HIZFG_cjs.useExitImpersonation; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "useLogin", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkEM5HIZFG_cjs.useLogin; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "useLogout", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkEM5HIZFG_cjs.useLogout; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "useMe", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkEM5HIZFG_cjs.useMe; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "useSelectTenant", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkEM5HIZFG_cjs.useSelectTenant; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "useSwitchRole", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkEM5HIZFG_cjs.useSwitchRole; }
|
|
75
75
|
});
|
|
76
76
|
//# sourceMappingURL=index.cjs.map
|
|
77
77
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -20,7 +20,7 @@ declare function login(payload: LoginRequest): Promise<LoginResponse>;
|
|
|
20
20
|
declare function selectTenant(payload: SelectTenantRequest): Promise<LoginResponse>;
|
|
21
21
|
declare function switchRole(payload: SwitchRoleRequest): Promise<AuthSession>;
|
|
22
22
|
declare function logout(): Promise<void>;
|
|
23
|
-
declare function getMe(): Promise<
|
|
23
|
+
declare function getMe(): Promise<AuthSessionPayload>;
|
|
24
24
|
declare function changePassword(payload: ChangePasswordRequest): Promise<{
|
|
25
25
|
message: string;
|
|
26
26
|
}>;
|
|
@@ -50,27 +50,9 @@ declare function useConsumeImpersonation(options?: MutationOptionsCustom<AuthSes
|
|
|
50
50
|
token: string;
|
|
51
51
|
}, unknown>;
|
|
52
52
|
declare function useExitImpersonation(options?: MutationOptionsCustom<void, void>): _tanstack_react_query.UseMutationResult<void, SekolaosApiError, void, unknown>;
|
|
53
|
-
declare function useMe(options?: QueryOptionsWithoutKey<
|
|
53
|
+
declare function useMe(options?: QueryOptionsWithoutKey<AuthSessionPayload> & {
|
|
54
54
|
enabled?: boolean;
|
|
55
|
-
}): _tanstack_react_query.UseQueryResult<
|
|
56
|
-
tenantId: string;
|
|
57
|
-
userId: string;
|
|
58
|
-
tenantSlug: string;
|
|
59
|
-
activeAcademicYearId: string;
|
|
60
|
-
activeRole: {
|
|
61
|
-
permissions: Record<string, string[]>;
|
|
62
|
-
roleId: string;
|
|
63
|
-
roleName: string;
|
|
64
|
-
roleSlug: string;
|
|
65
|
-
};
|
|
66
|
-
availableRoles: {
|
|
67
|
-
permissions: Record<string, string[]>;
|
|
68
|
-
roleId: string;
|
|
69
|
-
roleName: string;
|
|
70
|
-
roleSlug: string;
|
|
71
|
-
}[];
|
|
72
|
-
isImpersonating: boolean;
|
|
73
|
-
}, SekolaosApiError>;
|
|
55
|
+
}): _tanstack_react_query.UseQueryResult<AuthSessionPayload, SekolaosApiError>;
|
|
74
56
|
declare function useLogin(options?: MutationOptionsCustom<LoginResponse, LoginRequest>): _tanstack_react_query.UseMutationResult<{
|
|
75
57
|
status: "SUCCESS" | "REQUIRES_TENANT_SELECTION" | "REQUIRES_ROLE_SELECTION";
|
|
76
58
|
session?: {
|
|
@@ -20,7 +20,7 @@ declare function login(payload: LoginRequest): Promise<LoginResponse>;
|
|
|
20
20
|
declare function selectTenant(payload: SelectTenantRequest): Promise<LoginResponse>;
|
|
21
21
|
declare function switchRole(payload: SwitchRoleRequest): Promise<AuthSession>;
|
|
22
22
|
declare function logout(): Promise<void>;
|
|
23
|
-
declare function getMe(): Promise<
|
|
23
|
+
declare function getMe(): Promise<AuthSessionPayload>;
|
|
24
24
|
declare function changePassword(payload: ChangePasswordRequest): Promise<{
|
|
25
25
|
message: string;
|
|
26
26
|
}>;
|
|
@@ -50,27 +50,9 @@ declare function useConsumeImpersonation(options?: MutationOptionsCustom<AuthSes
|
|
|
50
50
|
token: string;
|
|
51
51
|
}, unknown>;
|
|
52
52
|
declare function useExitImpersonation(options?: MutationOptionsCustom<void, void>): _tanstack_react_query.UseMutationResult<void, SekolaosApiError, void, unknown>;
|
|
53
|
-
declare function useMe(options?: QueryOptionsWithoutKey<
|
|
53
|
+
declare function useMe(options?: QueryOptionsWithoutKey<AuthSessionPayload> & {
|
|
54
54
|
enabled?: boolean;
|
|
55
|
-
}): _tanstack_react_query.UseQueryResult<
|
|
56
|
-
tenantId: string;
|
|
57
|
-
userId: string;
|
|
58
|
-
tenantSlug: string;
|
|
59
|
-
activeAcademicYearId: string;
|
|
60
|
-
activeRole: {
|
|
61
|
-
permissions: Record<string, string[]>;
|
|
62
|
-
roleId: string;
|
|
63
|
-
roleName: string;
|
|
64
|
-
roleSlug: string;
|
|
65
|
-
};
|
|
66
|
-
availableRoles: {
|
|
67
|
-
permissions: Record<string, string[]>;
|
|
68
|
-
roleId: string;
|
|
69
|
-
roleName: string;
|
|
70
|
-
roleSlug: string;
|
|
71
|
-
}[];
|
|
72
|
-
isImpersonating: boolean;
|
|
73
|
-
}, SekolaosApiError>;
|
|
55
|
+
}): _tanstack_react_query.UseQueryResult<AuthSessionPayload, SekolaosApiError>;
|
|
74
56
|
declare function useLogin(options?: MutationOptionsCustom<LoginResponse, LoginRequest>): _tanstack_react_query.UseMutationResult<{
|
|
75
57
|
status: "SUCCESS" | "REQUIRES_TENANT_SELECTION" | "REQUIRES_ROLE_SELECTION";
|
|
76
58
|
session?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { changePassword, consumeImpersonation, exitImpersonation, getMe, login, logout, selectTenant, switchRole, useChangePassword, useConsumeImpersonation, useExitImpersonation, useLogin, useLogout, useMe, useSelectTenant, useSwitchRole } from '../../chunk-
|
|
1
|
+
export { changePassword, consumeImpersonation, exitImpersonation, getMe, login, logout, selectTenant, switchRole, useChangePassword, useConsumeImpersonation, useExitImpersonation, useLogin, useLogout, useMe, useSelectTenant, useSwitchRole } from '../../chunk-KLRABMYU.js';
|
|
2
2
|
import '../../chunk-Q5ZX6TKB.js';
|
|
3
3
|
import '../../chunk-6JGO2CUT.js';
|
|
4
4
|
import '../../chunk-GRXFSXG5.js';
|
package/package.json
CHANGED
|
@@ -1,137 +1,138 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sekolaos/shared-api",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Shared HTTP API client, TanStack Query hooks, and query key factory for Sekolaos ecosystem aligned with OpenAPI 3.0.3",
|
|
5
|
-
"license": "ISC",
|
|
6
|
-
"author": "Sekolaos",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./dist/index.cjs",
|
|
9
|
-
"module": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"sideEffects": false,
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.js",
|
|
16
|
-
"require": "./dist/index.cjs"
|
|
17
|
-
},
|
|
18
|
-
"./client": {
|
|
19
|
-
"types": "./dist/client/index.d.ts",
|
|
20
|
-
"import": "./dist/client/index.js",
|
|
21
|
-
"require": "./dist/client/index.cjs"
|
|
22
|
-
},
|
|
23
|
-
"./keys": {
|
|
24
|
-
"types": "./dist/keys/index.d.ts",
|
|
25
|
-
"import": "./dist/keys/index.js",
|
|
26
|
-
"require": "./dist/keys/index.cjs"
|
|
27
|
-
},
|
|
28
|
-
"./provider": {
|
|
29
|
-
"types": "./dist/provider.d.ts",
|
|
30
|
-
"import": "./dist/provider.js",
|
|
31
|
-
"require": "./dist/provider.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./auth": {
|
|
34
|
-
"types": "./dist/modules/auth/index.d.ts",
|
|
35
|
-
"import": "./dist/modules/auth/index.js",
|
|
36
|
-
"require": "./dist/modules/auth/index.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./tenant": {
|
|
39
|
-
"types": "./dist/modules/tenant/index.d.ts",
|
|
40
|
-
"import": "./dist/modules/tenant/index.js",
|
|
41
|
-
"require": "./dist/modules/tenant/index.cjs"
|
|
42
|
-
},
|
|
43
|
-
"./academic": {
|
|
44
|
-
"types": "./dist/modules/academic/index.d.ts",
|
|
45
|
-
"import": "./dist/modules/academic/index.js",
|
|
46
|
-
"require": "./dist/modules/academic/index.cjs"
|
|
47
|
-
},
|
|
48
|
-
"./classroom": {
|
|
49
|
-
"types": "./dist/modules/classroom/index.d.ts",
|
|
50
|
-
"import": "./dist/modules/classroom/index.js",
|
|
51
|
-
"require": "./dist/modules/classroom/index.cjs"
|
|
52
|
-
},
|
|
53
|
-
"./student": {
|
|
54
|
-
"types": "./dist/modules/student/index.d.ts",
|
|
55
|
-
"import": "./dist/modules/student/index.js",
|
|
56
|
-
"require": "./dist/modules/student/index.cjs"
|
|
57
|
-
},
|
|
58
|
-
"./subject": {
|
|
59
|
-
"types": "./dist/modules/subject/index.d.ts",
|
|
60
|
-
"import": "./dist/modules/subject/index.js",
|
|
61
|
-
"require": "./dist/modules/subject/index.cjs"
|
|
62
|
-
},
|
|
63
|
-
"./teaching-schedule": {
|
|
64
|
-
"types": "./dist/modules/teaching-schedule/index.d.ts",
|
|
65
|
-
"import": "./dist/modules/teaching-schedule/index.js",
|
|
66
|
-
"require": "./dist/modules/teaching-schedule/index.cjs"
|
|
67
|
-
},
|
|
68
|
-
"./user": {
|
|
69
|
-
"types": "./dist/modules/user/index.d.ts",
|
|
70
|
-
"import": "./dist/modules/user/index.js",
|
|
71
|
-
"require": "./dist/modules/user/index.cjs"
|
|
72
|
-
},
|
|
73
|
-
"./attendance": {
|
|
74
|
-
"types": "./dist/modules/attendance/index.d.ts",
|
|
75
|
-
"import": "./dist/modules/attendance/index.js",
|
|
76
|
-
"require": "./dist/modules/attendance/index.cjs"
|
|
77
|
-
},
|
|
78
|
-
"./upload": {
|
|
79
|
-
"types": "./dist/modules/upload/index.d.ts",
|
|
80
|
-
"import": "./dist/modules/upload/index.js",
|
|
81
|
-
"require": "./dist/modules/upload/index.cjs"
|
|
82
|
-
},
|
|
83
|
-
"./lead": {
|
|
84
|
-
"types": "./dist/modules/lead/index.d.ts",
|
|
85
|
-
"import": "./dist/modules/lead/index.js",
|
|
86
|
-
"require": "./dist/modules/lead/index.cjs"
|
|
87
|
-
},
|
|
88
|
-
"./system": {
|
|
89
|
-
"types": "./dist/modules/system/index.d.ts",
|
|
90
|
-
"import": "./dist/modules/system/index.js",
|
|
91
|
-
"require": "./dist/modules/system/index.cjs"
|
|
92
|
-
},
|
|
93
|
-
"./package.json": "./package.json"
|
|
94
|
-
},
|
|
95
|
-
"files": [
|
|
96
|
-
"dist"
|
|
97
|
-
],
|
|
98
|
-
"engines": {
|
|
99
|
-
"node": ">=20.0.0"
|
|
100
|
-
},
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"@
|
|
114
|
-
"react": "
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@sekolaos/shared-api",
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "Shared HTTP API client, TanStack Query hooks, and query key factory for Sekolaos ecosystem aligned with OpenAPI 3.0.3",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "Sekolaos",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./client": {
|
|
19
|
+
"types": "./dist/client/index.d.ts",
|
|
20
|
+
"import": "./dist/client/index.js",
|
|
21
|
+
"require": "./dist/client/index.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./keys": {
|
|
24
|
+
"types": "./dist/keys/index.d.ts",
|
|
25
|
+
"import": "./dist/keys/index.js",
|
|
26
|
+
"require": "./dist/keys/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./provider": {
|
|
29
|
+
"types": "./dist/provider.d.ts",
|
|
30
|
+
"import": "./dist/provider.js",
|
|
31
|
+
"require": "./dist/provider.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./auth": {
|
|
34
|
+
"types": "./dist/modules/auth/index.d.ts",
|
|
35
|
+
"import": "./dist/modules/auth/index.js",
|
|
36
|
+
"require": "./dist/modules/auth/index.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./tenant": {
|
|
39
|
+
"types": "./dist/modules/tenant/index.d.ts",
|
|
40
|
+
"import": "./dist/modules/tenant/index.js",
|
|
41
|
+
"require": "./dist/modules/tenant/index.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./academic": {
|
|
44
|
+
"types": "./dist/modules/academic/index.d.ts",
|
|
45
|
+
"import": "./dist/modules/academic/index.js",
|
|
46
|
+
"require": "./dist/modules/academic/index.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./classroom": {
|
|
49
|
+
"types": "./dist/modules/classroom/index.d.ts",
|
|
50
|
+
"import": "./dist/modules/classroom/index.js",
|
|
51
|
+
"require": "./dist/modules/classroom/index.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./student": {
|
|
54
|
+
"types": "./dist/modules/student/index.d.ts",
|
|
55
|
+
"import": "./dist/modules/student/index.js",
|
|
56
|
+
"require": "./dist/modules/student/index.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./subject": {
|
|
59
|
+
"types": "./dist/modules/subject/index.d.ts",
|
|
60
|
+
"import": "./dist/modules/subject/index.js",
|
|
61
|
+
"require": "./dist/modules/subject/index.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./teaching-schedule": {
|
|
64
|
+
"types": "./dist/modules/teaching-schedule/index.d.ts",
|
|
65
|
+
"import": "./dist/modules/teaching-schedule/index.js",
|
|
66
|
+
"require": "./dist/modules/teaching-schedule/index.cjs"
|
|
67
|
+
},
|
|
68
|
+
"./user": {
|
|
69
|
+
"types": "./dist/modules/user/index.d.ts",
|
|
70
|
+
"import": "./dist/modules/user/index.js",
|
|
71
|
+
"require": "./dist/modules/user/index.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./attendance": {
|
|
74
|
+
"types": "./dist/modules/attendance/index.d.ts",
|
|
75
|
+
"import": "./dist/modules/attendance/index.js",
|
|
76
|
+
"require": "./dist/modules/attendance/index.cjs"
|
|
77
|
+
},
|
|
78
|
+
"./upload": {
|
|
79
|
+
"types": "./dist/modules/upload/index.d.ts",
|
|
80
|
+
"import": "./dist/modules/upload/index.js",
|
|
81
|
+
"require": "./dist/modules/upload/index.cjs"
|
|
82
|
+
},
|
|
83
|
+
"./lead": {
|
|
84
|
+
"types": "./dist/modules/lead/index.d.ts",
|
|
85
|
+
"import": "./dist/modules/lead/index.js",
|
|
86
|
+
"require": "./dist/modules/lead/index.cjs"
|
|
87
|
+
},
|
|
88
|
+
"./system": {
|
|
89
|
+
"types": "./dist/modules/system/index.d.ts",
|
|
90
|
+
"import": "./dist/modules/system/index.js",
|
|
91
|
+
"require": "./dist/modules/system/index.cjs"
|
|
92
|
+
},
|
|
93
|
+
"./package.json": "./package.json"
|
|
94
|
+
},
|
|
95
|
+
"files": [
|
|
96
|
+
"dist"
|
|
97
|
+
],
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=20.0.0"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"dev": "tsup --watch",
|
|
103
|
+
"build": "tsup",
|
|
104
|
+
"typecheck": "tsc --noEmit",
|
|
105
|
+
"clean": "rimraf dist",
|
|
106
|
+
"prepublishOnly": "pnpm run typecheck && pnpm run build"
|
|
107
|
+
},
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"react": "^19.3.1",
|
|
110
|
+
"react-dom": "^19.3.1"
|
|
111
|
+
},
|
|
112
|
+
"dependencies": {
|
|
113
|
+
"@sekolaos/shared-schema": "1.6.1",
|
|
114
|
+
"@tanstack/react-query": "^5.59.16",
|
|
115
|
+
"axios": "^1.7.7"
|
|
116
|
+
},
|
|
117
|
+
"devDependencies": {
|
|
118
|
+
"@types/node": "^22.9.0",
|
|
119
|
+
"@types/react": "19.0.0",
|
|
120
|
+
"@types/react-dom": "19.0.0",
|
|
121
|
+
"react": "19.3.1",
|
|
122
|
+
"react-dom": "19.3.1",
|
|
123
|
+
"rimraf": "^6.0.1",
|
|
124
|
+
"tsup": "^8.3.5",
|
|
125
|
+
"typescript": "^5.6.3"
|
|
126
|
+
},
|
|
127
|
+
"publishConfig": {
|
|
128
|
+
"access": "public",
|
|
129
|
+
"registry": "https://registry.npmjs.org"
|
|
130
|
+
},
|
|
131
|
+
"keywords": [
|
|
132
|
+
"sekolaos",
|
|
133
|
+
"http-client",
|
|
134
|
+
"axios",
|
|
135
|
+
"tanstack-query",
|
|
136
|
+
"query-key-factory"
|
|
137
|
+
]
|
|
138
|
+
}
|