@sokol111/ecommerce-auth-service-api 1.0.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/api.d.ts +52 -0
- package/dist/api.js +164 -0
- package/dist/api.schemas.d.ts +311 -0
- package/dist/api.schemas.js +40 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +26 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import type { AdminAuthResponse, AdminUserCreateRequest, AdminUserListParams, AdminUserListResponse, AdminUserProfile, AdminUserResponse, AdminUserUpdateRequest, AuthResponse, ChangePasswordRequest, CustomerProfile, CustomerRegisterRequest, CustomerUpdateRequest, LoginRequest, PasswordResetConfirmRequest, PasswordResetRequest, PermissionsResponse, RolesResponse, ServiceTokenRequest, ServiceTokenResponse, TokenIntrospectRequest, TokenIntrospectResponse, TokenRefreshRequest, TokenRefreshResponse, TokenRevokeRequest } from './api.schemas';
|
|
3
|
+
export declare const getAuthAPI: () => {
|
|
4
|
+
customerRegister: <TData = AxiosResponse<AuthResponse, any, {}>>(customerRegisterRequest: CustomerRegisterRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
5
|
+
customerLogin: <TData = AxiosResponse<AuthResponse, any, {}>>(loginRequest: LoginRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
6
|
+
customerLogout: <TData = AxiosResponse<void, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
7
|
+
customerGetProfile: <TData = AxiosResponse<CustomerProfile, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
8
|
+
customerUpdateProfile: <TData = AxiosResponse<CustomerProfile, any, {}>>(customerUpdateRequest: CustomerUpdateRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
9
|
+
customerChangePassword: <TData = AxiosResponse<void, any, {}>>(changePasswordRequest: ChangePasswordRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
10
|
+
customerPasswordResetRequest: <TData = AxiosResponse<void, any, {}>>(passwordResetRequest: PasswordResetRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
11
|
+
customerPasswordResetConfirm: <TData = AxiosResponse<void, any, {}>>(passwordResetConfirmRequest: PasswordResetConfirmRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
12
|
+
adminLogin: <TData = AxiosResponse<AdminAuthResponse, any, {}>>(loginRequest: LoginRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
13
|
+
adminLogout: <TData = AxiosResponse<void, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
14
|
+
adminGetProfile: <TData = AxiosResponse<AdminUserProfile, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
15
|
+
adminChangePassword: <TData = AxiosResponse<void, any, {}>>(changePasswordRequest: ChangePasswordRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
16
|
+
adminUserCreate: <TData = AxiosResponse<AdminUserResponse, any, {}>>(adminUserCreateRequest: AdminUserCreateRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
17
|
+
adminUserUpdate: <TData = AxiosResponse<AdminUserResponse, any, {}>>(adminUserUpdateRequest: AdminUserUpdateRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
18
|
+
adminUserGetById: <TData = AxiosResponse<AdminUserResponse, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
19
|
+
adminUserList: <TData = AxiosResponse<AdminUserListResponse, any, {}>>(params: AdminUserListParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
20
|
+
adminUserDisable: <TData = AxiosResponse<void, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
21
|
+
adminUserEnable: <TData = AxiosResponse<void, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
22
|
+
tokenRefresh: <TData = AxiosResponse<TokenRefreshResponse, any, {}>>(tokenRefreshRequest: TokenRefreshRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
23
|
+
tokenRevoke: <TData = AxiosResponse<void, any, {}>>(tokenRevokeRequest: TokenRevokeRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
24
|
+
tokenIntrospect: <TData = AxiosResponse<TokenIntrospectResponse, any, {}>>(tokenIntrospectRequest: TokenIntrospectRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
25
|
+
serviceGetToken: <TData = AxiosResponse<ServiceTokenResponse, any, {}>>(serviceTokenRequest: ServiceTokenRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
26
|
+
getRoles: <TData = AxiosResponse<RolesResponse, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
27
|
+
getPermissions: <TData = AxiosResponse<PermissionsResponse, any, {}>>(options?: AxiosRequestConfig) => Promise<TData>;
|
|
28
|
+
};
|
|
29
|
+
export type CustomerRegisterResult = AxiosResponse<AuthResponse>;
|
|
30
|
+
export type CustomerLoginResult = AxiosResponse<AuthResponse>;
|
|
31
|
+
export type CustomerLogoutResult = AxiosResponse<void>;
|
|
32
|
+
export type CustomerGetProfileResult = AxiosResponse<CustomerProfile>;
|
|
33
|
+
export type CustomerUpdateProfileResult = AxiosResponse<CustomerProfile>;
|
|
34
|
+
export type CustomerChangePasswordResult = AxiosResponse<void>;
|
|
35
|
+
export type CustomerPasswordResetRequestResult = AxiosResponse<void>;
|
|
36
|
+
export type CustomerPasswordResetConfirmResult = AxiosResponse<void>;
|
|
37
|
+
export type AdminLoginResult = AxiosResponse<AdminAuthResponse>;
|
|
38
|
+
export type AdminLogoutResult = AxiosResponse<void>;
|
|
39
|
+
export type AdminGetProfileResult = AxiosResponse<AdminUserProfile>;
|
|
40
|
+
export type AdminChangePasswordResult = AxiosResponse<void>;
|
|
41
|
+
export type AdminUserCreateResult = AxiosResponse<AdminUserResponse>;
|
|
42
|
+
export type AdminUserUpdateResult = AxiosResponse<AdminUserResponse>;
|
|
43
|
+
export type AdminUserGetByIdResult = AxiosResponse<AdminUserResponse>;
|
|
44
|
+
export type AdminUserListResult = AxiosResponse<AdminUserListResponse>;
|
|
45
|
+
export type AdminUserDisableResult = AxiosResponse<void>;
|
|
46
|
+
export type AdminUserEnableResult = AxiosResponse<void>;
|
|
47
|
+
export type TokenRefreshResult = AxiosResponse<TokenRefreshResponse>;
|
|
48
|
+
export type TokenRevokeResult = AxiosResponse<void>;
|
|
49
|
+
export type TokenIntrospectResult = AxiosResponse<TokenIntrospectResponse>;
|
|
50
|
+
export type ServiceGetTokenResult = AxiosResponse<ServiceTokenResponse>;
|
|
51
|
+
export type GetRolesResult = AxiosResponse<RolesResponse>;
|
|
52
|
+
export type GetPermissionsResult = AxiosResponse<PermissionsResponse>;
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Auth API
|
|
5
|
+
* Authentication and Authorization API for E-commerce platform.
|
|
6
|
+
Supports both public customers and admin panel users with RBAC.
|
|
7
|
+
Uses PASETO tokens for secure authentication.
|
|
8
|
+
|
|
9
|
+
* OpenAPI spec version: 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
import axios from 'axios';
|
|
12
|
+
export const getAuthAPI = () => {
|
|
13
|
+
/**
|
|
14
|
+
* @summary Register a new customer
|
|
15
|
+
*/
|
|
16
|
+
const customerRegister = (customerRegisterRequest, options) => {
|
|
17
|
+
return axios.post(`/v1/customer/register`, customerRegisterRequest, options);
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @summary Customer login
|
|
21
|
+
*/
|
|
22
|
+
const customerLogin = (loginRequest, options) => {
|
|
23
|
+
return axios.post(`/v1/customer/login`, loginRequest, options);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @summary Customer logout (revoke current session)
|
|
27
|
+
*/
|
|
28
|
+
const customerLogout = (options) => {
|
|
29
|
+
return axios.post(`/v1/customer/logout`, undefined, options);
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @summary Get current customer profile
|
|
33
|
+
*/
|
|
34
|
+
const customerGetProfile = (options) => {
|
|
35
|
+
return axios.get(`/v1/customer/me`, options);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @summary Update current customer profile
|
|
39
|
+
*/
|
|
40
|
+
const customerUpdateProfile = (customerUpdateRequest, options) => {
|
|
41
|
+
return axios.put(`/v1/customer/me/update`, customerUpdateRequest, options);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @summary Change customer password
|
|
45
|
+
*/
|
|
46
|
+
const customerChangePassword = (changePasswordRequest, options) => {
|
|
47
|
+
return axios.post(`/v1/customer/password/change`, changePasswordRequest, options);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @summary Request password reset (sends email)
|
|
51
|
+
*/
|
|
52
|
+
const customerPasswordResetRequest = (passwordResetRequest, options) => {
|
|
53
|
+
return axios.post(`/v1/customer/password/reset-request`, passwordResetRequest, options);
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @summary Confirm password reset with token
|
|
57
|
+
*/
|
|
58
|
+
const customerPasswordResetConfirm = (passwordResetConfirmRequest, options) => {
|
|
59
|
+
return axios.post(`/v1/customer/password/reset-confirm`, passwordResetConfirmRequest, options);
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @summary Admin user login
|
|
63
|
+
*/
|
|
64
|
+
const adminLogin = (loginRequest, options) => {
|
|
65
|
+
return axios.post(`/v1/admin/login`, loginRequest, options);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* @summary Admin logout (revoke current session)
|
|
69
|
+
*/
|
|
70
|
+
const adminLogout = (options) => {
|
|
71
|
+
return axios.post(`/v1/admin/logout`, undefined, options);
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* @summary Get current admin user profile
|
|
75
|
+
*/
|
|
76
|
+
const adminGetProfile = (options) => {
|
|
77
|
+
return axios.get(`/v1/admin/me`, options);
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* @summary Change admin user password
|
|
81
|
+
*/
|
|
82
|
+
const adminChangePassword = (changePasswordRequest, options) => {
|
|
83
|
+
return axios.post(`/v1/admin/password/change`, changePasswordRequest, options);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @summary Create a new admin user
|
|
87
|
+
*/
|
|
88
|
+
const adminUserCreate = (adminUserCreateRequest, options) => {
|
|
89
|
+
return axios.post(`/v1/admin/users/create`, adminUserCreateRequest, options);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* @summary Update an admin user
|
|
93
|
+
*/
|
|
94
|
+
const adminUserUpdate = (adminUserUpdateRequest, options) => {
|
|
95
|
+
return axios.put(`/v1/admin/users/update`, adminUserUpdateRequest, options);
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* @summary Get admin user by ID
|
|
99
|
+
*/
|
|
100
|
+
const adminUserGetById = (id, options) => {
|
|
101
|
+
return axios.get(`/v1/admin/users/get/${id}`, options);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @summary List admin users with pagination
|
|
105
|
+
*/
|
|
106
|
+
const adminUserList = (params, options) => {
|
|
107
|
+
return axios.get(`/v1/admin/users/list`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* @summary Disable an admin user
|
|
111
|
+
*/
|
|
112
|
+
const adminUserDisable = (id, options) => {
|
|
113
|
+
return axios.post(`/v1/admin/users/disable/${id}`, undefined, options);
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @summary Enable an admin user
|
|
117
|
+
*/
|
|
118
|
+
const adminUserEnable = (id, options) => {
|
|
119
|
+
return axios.post(`/v1/admin/users/enable/${id}`, undefined, options);
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @summary Refresh access token using refresh token
|
|
123
|
+
*/
|
|
124
|
+
const tokenRefresh = (tokenRefreshRequest, options) => {
|
|
125
|
+
return axios.post(`/v1/token/refresh`, tokenRefreshRequest, options);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @summary Revoke a refresh token
|
|
129
|
+
*/
|
|
130
|
+
const tokenRevoke = (tokenRevokeRequest, options) => {
|
|
131
|
+
return axios.post(`/v1/token/revoke`, tokenRevokeRequest, options);
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Used by other services to validate tokens and get user information.
|
|
135
|
+
Can be called with service credentials or a valid access token.
|
|
136
|
+
|
|
137
|
+
* @summary Introspect a token (validate and get claims)
|
|
138
|
+
*/
|
|
139
|
+
const tokenIntrospect = (tokenIntrospectRequest, options) => {
|
|
140
|
+
return axios.post(`/v1/token/introspect`, tokenIntrospectRequest, options);
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Internal endpoint for services to obtain access tokens for
|
|
144
|
+
inter-service communication. Uses service credentials.
|
|
145
|
+
|
|
146
|
+
* @summary Get service access token
|
|
147
|
+
*/
|
|
148
|
+
const serviceGetToken = (serviceTokenRequest, options) => {
|
|
149
|
+
return axios.post(`/v1/service/token`, serviceTokenRequest, options);
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* @summary Get all available roles
|
|
153
|
+
*/
|
|
154
|
+
const getRoles = (options) => {
|
|
155
|
+
return axios.get(`/v1/roles`, options);
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* @summary Get all available permissions
|
|
159
|
+
*/
|
|
160
|
+
const getPermissions = (options) => {
|
|
161
|
+
return axios.get(`/v1/permissions`, options);
|
|
162
|
+
};
|
|
163
|
+
return { customerRegister, customerLogin, customerLogout, customerGetProfile, customerUpdateProfile, customerChangePassword, customerPasswordResetRequest, customerPasswordResetConfirm, adminLogin, adminLogout, adminGetProfile, adminChangePassword, adminUserCreate, adminUserUpdate, adminUserGetById, adminUserList, adminUserDisable, adminUserEnable, tokenRefresh, tokenRevoke, tokenIntrospect, serviceGetToken, getRoles, getPermissions };
|
|
164
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Auth API
|
|
5
|
+
* Authentication and Authorization API for E-commerce platform.
|
|
6
|
+
Supports both public customers and admin panel users with RBAC.
|
|
7
|
+
Uses PASETO tokens for secure authentication.
|
|
8
|
+
|
|
9
|
+
* OpenAPI spec version: 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Admin user roles:
|
|
13
|
+
- super_admin: Full access to all resources
|
|
14
|
+
- user_manager: Can manage admin users
|
|
15
|
+
- product_manager: Can manage products and attributes
|
|
16
|
+
- category_manager: Can manage categories
|
|
17
|
+
- order_manager: Can manage orders
|
|
18
|
+
- content_manager: Can manage content (images, etc.)
|
|
19
|
+
- viewer: Read-only access
|
|
20
|
+
|
|
21
|
+
*/
|
|
22
|
+
export type AdminRole = typeof AdminRole[keyof typeof AdminRole];
|
|
23
|
+
export declare const AdminRole: {
|
|
24
|
+
readonly super_admin: "super_admin";
|
|
25
|
+
readonly user_manager: "user_manager";
|
|
26
|
+
readonly product_manager: "product_manager";
|
|
27
|
+
readonly category_manager: "category_manager";
|
|
28
|
+
readonly order_manager: "order_manager";
|
|
29
|
+
readonly content_manager: "content_manager";
|
|
30
|
+
readonly viewer: "viewer";
|
|
31
|
+
};
|
|
32
|
+
export type Permission = typeof Permission[keyof typeof Permission];
|
|
33
|
+
export declare const Permission: {
|
|
34
|
+
readonly 'users:read': "users:read";
|
|
35
|
+
readonly 'users:write': "users:write";
|
|
36
|
+
readonly 'users:delete': "users:delete";
|
|
37
|
+
readonly 'products:read': "products:read";
|
|
38
|
+
readonly 'products:write': "products:write";
|
|
39
|
+
readonly 'products:delete': "products:delete";
|
|
40
|
+
readonly 'categories:read': "categories:read";
|
|
41
|
+
readonly 'categories:write': "categories:write";
|
|
42
|
+
readonly 'categories:delete': "categories:delete";
|
|
43
|
+
readonly 'orders:read': "orders:read";
|
|
44
|
+
readonly 'orders:write': "orders:write";
|
|
45
|
+
readonly 'orders:update_status': "orders:update_status";
|
|
46
|
+
readonly 'images:read': "images:read";
|
|
47
|
+
readonly 'images:write': "images:write";
|
|
48
|
+
readonly 'images:delete': "images:delete";
|
|
49
|
+
readonly 'attributes:read': "attributes:read";
|
|
50
|
+
readonly 'attributes:write': "attributes:write";
|
|
51
|
+
readonly 'attributes:delete': "attributes:delete";
|
|
52
|
+
readonly 'customers:read': "customers:read";
|
|
53
|
+
readonly 'customers:write': "customers:write";
|
|
54
|
+
readonly 'customers:disable': "customers:disable";
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Type of the token subject
|
|
58
|
+
*/
|
|
59
|
+
export type TokenType = typeof TokenType[keyof typeof TokenType];
|
|
60
|
+
export declare const TokenType: {
|
|
61
|
+
readonly customer: "customer";
|
|
62
|
+
readonly admin: "admin";
|
|
63
|
+
readonly service: "service";
|
|
64
|
+
};
|
|
65
|
+
export interface CustomerRegisterRequest {
|
|
66
|
+
/** @maxLength 255 */
|
|
67
|
+
email: string;
|
|
68
|
+
/**
|
|
69
|
+
* Must contain at least 8 characters
|
|
70
|
+
* @minLength 8
|
|
71
|
+
* @maxLength 72
|
|
72
|
+
*/
|
|
73
|
+
password: string;
|
|
74
|
+
/**
|
|
75
|
+
* @minLength 1
|
|
76
|
+
* @maxLength 100
|
|
77
|
+
*/
|
|
78
|
+
firstName: string;
|
|
79
|
+
/**
|
|
80
|
+
* @minLength 1
|
|
81
|
+
* @maxLength 100
|
|
82
|
+
*/
|
|
83
|
+
lastName: string;
|
|
84
|
+
/** @maxLength 20 */
|
|
85
|
+
phone?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface LoginRequest {
|
|
88
|
+
/** @maxLength 255 */
|
|
89
|
+
email: string;
|
|
90
|
+
/** @maxLength 72 */
|
|
91
|
+
password: string;
|
|
92
|
+
}
|
|
93
|
+
export interface AuthResponse {
|
|
94
|
+
/** PASETO access token */
|
|
95
|
+
accessToken: string;
|
|
96
|
+
/** Refresh token for obtaining new access tokens */
|
|
97
|
+
refreshToken: string;
|
|
98
|
+
/** Access token expiration time in seconds */
|
|
99
|
+
expiresIn: number;
|
|
100
|
+
tokenType: string;
|
|
101
|
+
}
|
|
102
|
+
export interface AdminAuthResponse {
|
|
103
|
+
/** PASETO access token */
|
|
104
|
+
accessToken: string;
|
|
105
|
+
/** Refresh token for obtaining new access tokens */
|
|
106
|
+
refreshToken: string;
|
|
107
|
+
/** Access token expiration time in seconds */
|
|
108
|
+
expiresIn: number;
|
|
109
|
+
tokenType: string;
|
|
110
|
+
user: AdminUserProfile;
|
|
111
|
+
}
|
|
112
|
+
export interface CustomerProfile {
|
|
113
|
+
id: string;
|
|
114
|
+
email: string;
|
|
115
|
+
firstName: string;
|
|
116
|
+
lastName: string;
|
|
117
|
+
phone?: string;
|
|
118
|
+
emailVerified?: boolean;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
}
|
|
121
|
+
export interface CustomerUpdateRequest {
|
|
122
|
+
/**
|
|
123
|
+
* @minLength 1
|
|
124
|
+
* @maxLength 100
|
|
125
|
+
*/
|
|
126
|
+
firstName?: string;
|
|
127
|
+
/**
|
|
128
|
+
* @minLength 1
|
|
129
|
+
* @maxLength 100
|
|
130
|
+
*/
|
|
131
|
+
lastName?: string;
|
|
132
|
+
/** @maxLength 20 */
|
|
133
|
+
phone?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface ChangePasswordRequest {
|
|
136
|
+
/** @maxLength 72 */
|
|
137
|
+
currentPassword: string;
|
|
138
|
+
/**
|
|
139
|
+
* Must contain at least 8 characters
|
|
140
|
+
* @minLength 8
|
|
141
|
+
* @maxLength 72
|
|
142
|
+
*/
|
|
143
|
+
newPassword: string;
|
|
144
|
+
}
|
|
145
|
+
export interface PasswordResetRequest {
|
|
146
|
+
/** @maxLength 255 */
|
|
147
|
+
email: string;
|
|
148
|
+
}
|
|
149
|
+
export interface PasswordResetConfirmRequest {
|
|
150
|
+
/** Password reset token from email */
|
|
151
|
+
token: string;
|
|
152
|
+
/**
|
|
153
|
+
* @minLength 8
|
|
154
|
+
* @maxLength 72
|
|
155
|
+
*/
|
|
156
|
+
newPassword: string;
|
|
157
|
+
}
|
|
158
|
+
export interface AdminUserProfile {
|
|
159
|
+
id: string;
|
|
160
|
+
email: string;
|
|
161
|
+
firstName: string;
|
|
162
|
+
lastName: string;
|
|
163
|
+
role: AdminRole;
|
|
164
|
+
/** Effective permissions based on role */
|
|
165
|
+
permissions: Permission[];
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
lastLoginAt?: string;
|
|
169
|
+
}
|
|
170
|
+
export interface AdminUserCreateRequest {
|
|
171
|
+
/** @maxLength 255 */
|
|
172
|
+
email: string;
|
|
173
|
+
/**
|
|
174
|
+
* @minLength 8
|
|
175
|
+
* @maxLength 72
|
|
176
|
+
*/
|
|
177
|
+
password: string;
|
|
178
|
+
/**
|
|
179
|
+
* @minLength 1
|
|
180
|
+
* @maxLength 100
|
|
181
|
+
*/
|
|
182
|
+
firstName: string;
|
|
183
|
+
/**
|
|
184
|
+
* @minLength 1
|
|
185
|
+
* @maxLength 100
|
|
186
|
+
*/
|
|
187
|
+
lastName: string;
|
|
188
|
+
role: AdminRole;
|
|
189
|
+
}
|
|
190
|
+
export interface AdminUserUpdateRequest {
|
|
191
|
+
id: string;
|
|
192
|
+
/**
|
|
193
|
+
* @minLength 1
|
|
194
|
+
* @maxLength 100
|
|
195
|
+
*/
|
|
196
|
+
firstName?: string;
|
|
197
|
+
/**
|
|
198
|
+
* @minLength 1
|
|
199
|
+
* @maxLength 100
|
|
200
|
+
*/
|
|
201
|
+
lastName?: string;
|
|
202
|
+
role?: AdminRole;
|
|
203
|
+
}
|
|
204
|
+
export interface AdminUserResponse {
|
|
205
|
+
id: string;
|
|
206
|
+
email: string;
|
|
207
|
+
firstName: string;
|
|
208
|
+
lastName: string;
|
|
209
|
+
role: AdminRole;
|
|
210
|
+
enabled: boolean;
|
|
211
|
+
createdAt: string;
|
|
212
|
+
modifiedAt?: string;
|
|
213
|
+
lastLoginAt?: string;
|
|
214
|
+
}
|
|
215
|
+
export interface AdminUserListResponse {
|
|
216
|
+
items: AdminUserResponse[];
|
|
217
|
+
page: number;
|
|
218
|
+
size: number;
|
|
219
|
+
total: number;
|
|
220
|
+
}
|
|
221
|
+
export interface TokenRefreshRequest {
|
|
222
|
+
/** The refresh token */
|
|
223
|
+
refreshToken: string;
|
|
224
|
+
}
|
|
225
|
+
export interface TokenRefreshResponse {
|
|
226
|
+
accessToken: string;
|
|
227
|
+
/** New refresh token (token rotation) */
|
|
228
|
+
refreshToken: string;
|
|
229
|
+
expiresIn: number;
|
|
230
|
+
}
|
|
231
|
+
export interface TokenRevokeRequest {
|
|
232
|
+
refreshToken: string;
|
|
233
|
+
}
|
|
234
|
+
export interface TokenIntrospectRequest {
|
|
235
|
+
/** The token to introspect */
|
|
236
|
+
token: string;
|
|
237
|
+
}
|
|
238
|
+
export interface TokenIntrospectResponse {
|
|
239
|
+
/** Whether the token is active/valid */
|
|
240
|
+
active: boolean;
|
|
241
|
+
tokenType?: TokenType;
|
|
242
|
+
/** User or service ID */
|
|
243
|
+
subject?: string;
|
|
244
|
+
email?: string;
|
|
245
|
+
role?: AdminRole;
|
|
246
|
+
permissions?: Permission[];
|
|
247
|
+
expiresAt?: string;
|
|
248
|
+
issuedAt?: string;
|
|
249
|
+
}
|
|
250
|
+
export interface ServiceTokenRequest {
|
|
251
|
+
/** Unique service identifier */
|
|
252
|
+
serviceId: string;
|
|
253
|
+
/** Service secret key */
|
|
254
|
+
serviceSecret: string;
|
|
255
|
+
}
|
|
256
|
+
export interface ServiceTokenResponse {
|
|
257
|
+
/** Service access token */
|
|
258
|
+
accessToken: string;
|
|
259
|
+
/** Token expiration in seconds */
|
|
260
|
+
expiresIn: number;
|
|
261
|
+
}
|
|
262
|
+
export interface RoleInfo {
|
|
263
|
+
name: AdminRole;
|
|
264
|
+
description: string;
|
|
265
|
+
permissions: Permission[];
|
|
266
|
+
}
|
|
267
|
+
export interface RolesResponse {
|
|
268
|
+
roles: RoleInfo[];
|
|
269
|
+
}
|
|
270
|
+
export interface PermissionInfo {
|
|
271
|
+
name: Permission;
|
|
272
|
+
description: string;
|
|
273
|
+
resource: string;
|
|
274
|
+
}
|
|
275
|
+
export interface PermissionsResponse {
|
|
276
|
+
permissions: PermissionInfo[];
|
|
277
|
+
}
|
|
278
|
+
export type ProblemErrorsItem = {
|
|
279
|
+
field?: string;
|
|
280
|
+
message?: string;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* RFC7807 Problem Details
|
|
284
|
+
*/
|
|
285
|
+
export interface Problem {
|
|
286
|
+
type: string;
|
|
287
|
+
title: string;
|
|
288
|
+
status: number;
|
|
289
|
+
detail?: string;
|
|
290
|
+
instance?: string;
|
|
291
|
+
traceId?: string;
|
|
292
|
+
errors?: ProblemErrorsItem[];
|
|
293
|
+
}
|
|
294
|
+
export type AdminUserListParams = {
|
|
295
|
+
/**
|
|
296
|
+
* @minimum 1
|
|
297
|
+
*/
|
|
298
|
+
page: number;
|
|
299
|
+
/**
|
|
300
|
+
* @minimum 1
|
|
301
|
+
* @maximum 100
|
|
302
|
+
*/
|
|
303
|
+
size: number;
|
|
304
|
+
role?: AdminRole;
|
|
305
|
+
enabled?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Search by name or email
|
|
308
|
+
* @maxLength 100
|
|
309
|
+
*/
|
|
310
|
+
search?: string;
|
|
311
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
2
|
+
export const AdminRole = {
|
|
3
|
+
super_admin: 'super_admin',
|
|
4
|
+
user_manager: 'user_manager',
|
|
5
|
+
product_manager: 'product_manager',
|
|
6
|
+
category_manager: 'category_manager',
|
|
7
|
+
order_manager: 'order_manager',
|
|
8
|
+
content_manager: 'content_manager',
|
|
9
|
+
viewer: 'viewer',
|
|
10
|
+
};
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
12
|
+
export const Permission = {
|
|
13
|
+
'users:read': 'users:read',
|
|
14
|
+
'users:write': 'users:write',
|
|
15
|
+
'users:delete': 'users:delete',
|
|
16
|
+
'products:read': 'products:read',
|
|
17
|
+
'products:write': 'products:write',
|
|
18
|
+
'products:delete': 'products:delete',
|
|
19
|
+
'categories:read': 'categories:read',
|
|
20
|
+
'categories:write': 'categories:write',
|
|
21
|
+
'categories:delete': 'categories:delete',
|
|
22
|
+
'orders:read': 'orders:read',
|
|
23
|
+
'orders:write': 'orders:write',
|
|
24
|
+
'orders:update_status': 'orders:update_status',
|
|
25
|
+
'images:read': 'images:read',
|
|
26
|
+
'images:write': 'images:write',
|
|
27
|
+
'images:delete': 'images:delete',
|
|
28
|
+
'attributes:read': 'attributes:read',
|
|
29
|
+
'attributes:write': 'attributes:write',
|
|
30
|
+
'attributes:delete': 'attributes:delete',
|
|
31
|
+
'customers:read': 'customers:read',
|
|
32
|
+
'customers:write': 'customers:write',
|
|
33
|
+
'customers:disable': 'customers:disable',
|
|
34
|
+
};
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
36
|
+
export const TokenType = {
|
|
37
|
+
customer: 'customer',
|
|
38
|
+
admin: 'admin',
|
|
39
|
+
service: 'service',
|
|
40
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sokol111/ecommerce-auth-service-api",
|
|
3
|
+
"description": "Generated TypeScript Axios client from OpenAPI for ecommerce-auth-service-api",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepare": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["openapi", "typescript", "axios", "sdk"],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "^1.10.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
]
|
|
26
|
+
}
|