@sekolaos/shared-api 0.0.0-stage → 1.1.0
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-2FTS6JMO.cjs +66 -0
- package/dist/chunk-2FTS6JMO.cjs.map +1 -0
- package/dist/chunk-3RS57C3E.cjs +90 -0
- package/dist/chunk-3RS57C3E.cjs.map +1 -0
- package/dist/chunk-4ECXVAIQ.cjs +50 -0
- package/dist/chunk-4ECXVAIQ.cjs.map +1 -0
- package/dist/chunk-4T52ABA5.js +63 -0
- package/dist/chunk-4T52ABA5.js.map +1 -0
- package/dist/chunk-6JGO2CUT.js +52 -0
- package/dist/chunk-6JGO2CUT.js.map +1 -0
- package/dist/chunk-6UCHRWSL.js +43 -0
- package/dist/chunk-6UCHRWSL.js.map +1 -0
- package/dist/chunk-AGNLUQKT.cjs +52 -0
- package/dist/chunk-AGNLUQKT.cjs.map +1 -0
- package/dist/chunk-AGPMQFZM.js +3 -0
- package/dist/chunk-AGPMQFZM.js.map +1 -0
- package/dist/chunk-ALMSFTRM.js +66 -0
- package/dist/chunk-ALMSFTRM.js.map +1 -0
- package/dist/chunk-AOBHBJ2G.cjs +89 -0
- package/dist/chunk-AOBHBJ2G.cjs.map +1 -0
- package/dist/chunk-BOASJ3VG.cjs +31 -0
- package/dist/chunk-BOASJ3VG.cjs.map +1 -0
- package/dist/chunk-CBTITLRR.js +43 -0
- package/dist/chunk-CBTITLRR.js.map +1 -0
- package/dist/chunk-CP46K2UB.cjs +74 -0
- package/dist/chunk-CP46K2UB.cjs.map +1 -0
- package/dist/chunk-DMEWJ56D.js +76 -0
- package/dist/chunk-DMEWJ56D.js.map +1 -0
- package/dist/chunk-DNNK2DMM.cjs +119 -0
- package/dist/chunk-DNNK2DMM.cjs.map +1 -0
- package/dist/chunk-GKKJMRCL.js +75 -0
- package/dist/chunk-GKKJMRCL.js.map +1 -0
- package/dist/chunk-GRBBLS5Y.js +77 -0
- package/dist/chunk-GRBBLS5Y.js.map +1 -0
- package/dist/chunk-GRXFSXG5.js +124 -0
- package/dist/chunk-GRXFSXG5.js.map +1 -0
- package/dist/chunk-GUJVCKEN.js +102 -0
- package/dist/chunk-GUJVCKEN.js.map +1 -0
- package/dist/chunk-LA7MRXWR.js +77 -0
- package/dist/chunk-LA7MRXWR.js.map +1 -0
- package/dist/chunk-MRFGUSN2.js +20 -0
- package/dist/chunk-MRFGUSN2.js.map +1 -0
- package/dist/chunk-NBVPN4KL.cjs +23 -0
- package/dist/chunk-NBVPN4KL.cjs.map +1 -0
- package/dist/chunk-NGFFI4XQ.cjs +61 -0
- package/dist/chunk-NGFFI4XQ.cjs.map +1 -0
- package/dist/chunk-OKSRSOYJ.cjs +88 -0
- package/dist/chunk-OKSRSOYJ.cjs.map +1 -0
- package/dist/chunk-PPK3HQOY.cjs +134 -0
- package/dist/chunk-PPK3HQOY.cjs.map +1 -0
- package/dist/chunk-QJSOSQ7M.cjs +23 -0
- package/dist/chunk-QJSOSQ7M.cjs.map +1 -0
- package/dist/chunk-R37QQTQS.cjs +64 -0
- package/dist/chunk-R37QQTQS.cjs.map +1 -0
- package/dist/chunk-R7ACSDOA.cjs +114 -0
- package/dist/chunk-R7ACSDOA.cjs.map +1 -0
- package/dist/chunk-S6QFHKCE.js +99 -0
- package/dist/chunk-S6QFHKCE.js.map +1 -0
- package/dist/chunk-TSLEYQKD.cjs +92 -0
- package/dist/chunk-TSLEYQKD.cjs.map +1 -0
- package/dist/chunk-WF63F6RJ.cjs +4 -0
- package/dist/chunk-WF63F6RJ.cjs.map +1 -0
- package/dist/chunk-XU5UEIBL.js +43 -0
- package/dist/chunk-XU5UEIBL.js.map +1 -0
- package/dist/chunk-XVG5Z6B5.cjs +79 -0
- package/dist/chunk-XVG5Z6B5.cjs.map +1 -0
- package/dist/chunk-YA2KONBB.js +20 -0
- package/dist/chunk-YA2KONBB.js.map +1 -0
- package/dist/chunk-YK7QFPBF.js +55 -0
- package/dist/chunk-YK7QFPBF.js.map +1 -0
- package/dist/chunk-YTF4Z7I4.js +26 -0
- package/dist/chunk-YTF4Z7I4.js.map +1 -0
- package/dist/client/index.cjs +62 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +28 -0
- package/dist/client/index.d.ts +28 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.cjs +620 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +39 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/keys/index.cjs +56 -0
- package/dist/keys/index.cjs.map +1 -0
- package/dist/keys/index.d.cts +64 -0
- package/dist/keys/index.d.ts +64 -0
- package/dist/keys/index.js +3 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/modules/academic/index.cjs +44 -0
- package/dist/modules/academic/index.cjs.map +1 -0
- package/dist/modules/academic/index.d.cts +54 -0
- package/dist/modules/academic/index.d.ts +54 -0
- package/dist/modules/academic/index.js +7 -0
- package/dist/modules/academic/index.js.map +1 -0
- package/dist/modules/attendance/index.cjs +68 -0
- package/dist/modules/attendance/index.cjs.map +1 -0
- package/dist/modules/attendance/index.d.cts +135 -0
- package/dist/modules/attendance/index.d.ts +135 -0
- package/dist/modules/attendance/index.js +7 -0
- package/dist/modules/attendance/index.js.map +1 -0
- package/dist/modules/auth/index.cjs +52 -0
- package/dist/modules/auth/index.cjs.map +1 -0
- package/dist/modules/auth/index.d.cts +44 -0
- package/dist/modules/auth/index.d.ts +44 -0
- package/dist/modules/auth/index.js +7 -0
- package/dist/modules/auth/index.js.map +1 -0
- package/dist/modules/classroom/index.cjs +60 -0
- package/dist/modules/classroom/index.cjs.map +1 -0
- package/dist/modules/classroom/index.d.cts +84 -0
- package/dist/modules/classroom/index.d.ts +84 -0
- package/dist/modules/classroom/index.js +7 -0
- package/dist/modules/classroom/index.js.map +1 -0
- package/dist/modules/lead/index.cjs +44 -0
- package/dist/modules/lead/index.cjs.map +1 -0
- package/dist/modules/lead/index.d.cts +104 -0
- package/dist/modules/lead/index.d.ts +104 -0
- package/dist/modules/lead/index.js +7 -0
- package/dist/modules/lead/index.js.map +1 -0
- package/dist/modules/student/index.cjs +76 -0
- package/dist/modules/student/index.cjs.map +1 -0
- package/dist/modules/student/index.d.cts +125 -0
- package/dist/modules/student/index.d.ts +125 -0
- package/dist/modules/student/index.js +7 -0
- package/dist/modules/student/index.js.map +1 -0
- package/dist/modules/subject/index.cjs +36 -0
- package/dist/modules/subject/index.cjs.map +1 -0
- package/dist/modules/subject/index.d.cts +40 -0
- package/dist/modules/subject/index.d.ts +40 -0
- package/dist/modules/subject/index.js +7 -0
- package/dist/modules/subject/index.js.map +1 -0
- package/dist/modules/system/index.cjs +20 -0
- package/dist/modules/system/index.cjs.map +1 -0
- package/dist/modules/system/index.d.cts +14 -0
- package/dist/modules/system/index.d.ts +14 -0
- package/dist/modules/system/index.js +7 -0
- package/dist/modules/system/index.js.map +1 -0
- package/dist/modules/teaching-schedule/index.cjs +60 -0
- package/dist/modules/teaching-schedule/index.cjs.map +1 -0
- package/dist/modules/teaching-schedule/index.d.cts +97 -0
- package/dist/modules/teaching-schedule/index.d.ts +97 -0
- package/dist/modules/teaching-schedule/index.js +7 -0
- package/dist/modules/teaching-schedule/index.js.map +1 -0
- package/dist/modules/tenant/index.cjs +68 -0
- package/dist/modules/tenant/index.cjs.map +1 -0
- package/dist/modules/tenant/index.d.cts +113 -0
- package/dist/modules/tenant/index.d.ts +113 -0
- package/dist/modules/tenant/index.js +7 -0
- package/dist/modules/tenant/index.js.map +1 -0
- package/dist/modules/upload/index.cjs +27 -0
- package/dist/modules/upload/index.cjs.map +1 -0
- package/dist/modules/upload/index.d.cts +18 -0
- package/dist/modules/upload/index.d.ts +18 -0
- package/dist/modules/upload/index.js +6 -0
- package/dist/modules/upload/index.js.map +1 -0
- package/dist/modules/user/index.cjs +60 -0
- package/dist/modules/user/index.cjs.map +1 -0
- package/dist/modules/user/index.d.cts +117 -0
- package/dist/modules/user/index.d.ts +117 -0
- package/dist/modules/user/index.js +7 -0
- package/dist/modules/user/index.js.map +1 -0
- package/dist/provider.cjs +17 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +15 -0
- package/dist/provider.d.ts +15 -0
- package/dist/provider.js +4 -0
- package/dist/provider.js.map +1 -0
- package/dist/types-BxV0BtVp.d.cts +89 -0
- package/dist/types-BxV0BtVp.d.ts +89 -0
- package/package.json +138 -6
- package/README.md +0 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { AxiosError, AxiosRequestConfig } from 'axios';
|
|
3
|
+
|
|
4
|
+
declare class SekolaosApiError extends Error {
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
readonly errors: ApiErrorDetail[];
|
|
7
|
+
readonly isNetworkError: boolean;
|
|
8
|
+
readonly rawError?: AxiosError | undefined;
|
|
9
|
+
constructor(message: string, statusCode?: number, errors?: ApiErrorDetail[], isNetworkError?: boolean, rawError?: AxiosError | undefined);
|
|
10
|
+
/** HTTP 422 validation failure coming from the Zod validation middleware. */
|
|
11
|
+
get isValidationError(): boolean;
|
|
12
|
+
get isUnauthorized(): boolean;
|
|
13
|
+
get isForbidden(): boolean;
|
|
14
|
+
get isNotFound(): boolean;
|
|
15
|
+
/** Maps field-level validation errors into a `{ field: message }` record. */
|
|
16
|
+
toFieldErrors(): Record<string, string>;
|
|
17
|
+
static fromAxiosError(error: AxiosError<ApiErrorPayload>): SekolaosApiError;
|
|
18
|
+
/** Converts any thrown value into a `SekolaosApiError` instance. */
|
|
19
|
+
static normalize(error: unknown): SekolaosApiError;
|
|
20
|
+
}
|
|
21
|
+
interface RequestOptions {
|
|
22
|
+
/** Extra axios options (headers, signal, params, ...). */
|
|
23
|
+
config?: AxiosRequestConfig;
|
|
24
|
+
/** Query string parameters serialized by axios. */
|
|
25
|
+
params?: AxiosRequestConfig["params"];
|
|
26
|
+
/** Abort signal forwarded to axios for TanStack Query cancellation. */
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface BaseApiResponse<T> {
|
|
31
|
+
success: boolean;
|
|
32
|
+
message: string;
|
|
33
|
+
data: T;
|
|
34
|
+
/** Operator metadata emitted by the backend when available. */
|
|
35
|
+
meta?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
interface PaginationMeta {
|
|
38
|
+
currentPage: number;
|
|
39
|
+
pageSize: number;
|
|
40
|
+
totalItems: number;
|
|
41
|
+
totalPages: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The backend wraps paginated collections inside `data` (see
|
|
45
|
+
* `paginatedDataSchema` in `@sekolaos/shared-schema`).
|
|
46
|
+
*/
|
|
47
|
+
interface PaginatedApiResponse<T> {
|
|
48
|
+
success: boolean;
|
|
49
|
+
message: string;
|
|
50
|
+
data: PaginatedData<T>;
|
|
51
|
+
meta?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
interface PaginatedData<T> {
|
|
54
|
+
items: T[];
|
|
55
|
+
meta: PaginationMeta;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `@sekolaos/shared-schema` declares `PaginatedData<T>` with a Zod schema
|
|
59
|
+
* constraint, so the client exposes an equivalent runtime-shaped alias.
|
|
60
|
+
*/
|
|
61
|
+
type PaginatedResult<T> = PaginatedData<T>;
|
|
62
|
+
interface ApiErrorDetail {
|
|
63
|
+
field?: string;
|
|
64
|
+
message: string;
|
|
65
|
+
}
|
|
66
|
+
interface ApiErrorPayload {
|
|
67
|
+
success: false;
|
|
68
|
+
message: string;
|
|
69
|
+
errors?: ApiErrorDetail[];
|
|
70
|
+
meta?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
interface ClientConfig {
|
|
73
|
+
baseURL?: string;
|
|
74
|
+
timeout?: number;
|
|
75
|
+
bearerToken?: string;
|
|
76
|
+
withCredentials?: boolean;
|
|
77
|
+
onUnauthorized?: () => void;
|
|
78
|
+
onForbidden?: () => void;
|
|
79
|
+
}
|
|
80
|
+
interface UploadFileResult {
|
|
81
|
+
url: string;
|
|
82
|
+
fileName: string;
|
|
83
|
+
size: number;
|
|
84
|
+
mimeType: string;
|
|
85
|
+
}
|
|
86
|
+
type QueryOptionsWithoutKey<TData, TSelect = TData> = Omit<UseQueryOptions<TData, SekolaosApiError, TSelect>, "queryKey" | "queryFn">;
|
|
87
|
+
type MutationOptionsCustom<TData, TVariables, TContext = unknown> = UseMutationOptions<TData, SekolaosApiError, TVariables, TContext>;
|
|
88
|
+
|
|
89
|
+
export { type ApiErrorDetail as A, type BaseApiResponse as B, type ClientConfig as C, type MutationOptionsCustom as M, type PaginatedApiResponse as P, type QueryOptionsWithoutKey as Q, type RequestOptions as R, SekolaosApiError as S, type UploadFileResult as U, type ApiErrorPayload as a, type PaginatedData as b, type PaginatedResult as c, type PaginationMeta as d };
|
package/package.json
CHANGED
|
@@ -1,6 +1,138 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sekolaos/shared-api",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@sekolaos/shared-api",
|
|
3
|
+
"version": "1.1.0",
|
|
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.5.0",
|
|
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
|
+
}
|
package/README.md
DELETED