@dapex-tech/elite-online-services 0.0.2 → 0.0.5
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/core/ApiError.d.ts +10 -0
- package/core/ApiError.js +15 -0
- package/core/{ApiRequestOptions.ts → ApiRequestOptions.d.ts} +0 -4
- package/core/ApiRequestOptions.js +2 -0
- package/core/{ApiResult.ts → ApiResult.d.ts} +0 -4
- package/core/ApiResult.js +2 -0
- package/core/CancelablePromise.d.ts +20 -0
- package/core/CancelablePromise.js +116 -0
- package/core/{OpenAPI.ts → OpenAPI.d.ts} +2 -18
- package/core/OpenAPI.js +14 -0
- package/core/index.js +22 -0
- package/core/request.d.ts +30 -0
- package/core/{request.ts → request.js} +117 -145
- package/createClient.js +48 -0
- package/index.d.ts +6 -0
- package/index.js +22 -0
- package/models/{AdminDto.ts → AdminDto.d.ts} +0 -5
- package/models/AdminDto.js +2 -0
- package/models/{DriverDto.ts → DriverDto.d.ts} +0 -5
- package/models/DriverDto.js +2 -0
- package/models/{LoginDto.ts → LoginDto.d.ts} +0 -5
- package/models/LoginDto.js +2 -0
- package/models/{UserDto.ts → UserDto.d.ts} +0 -5
- package/models/UserDto.js +2 -0
- package/models/index.d.ts +4 -0
- package/models/index.js +20 -0
- package/package.json +1 -1
- package/services/AdminService.d.ts +42 -0
- package/services/{AdminService.ts → AdminService.js} +17 -32
- package/services/DriversService.d.ts +42 -0
- package/services/{DriversService.ts → DriversService.js} +17 -32
- package/services/LoginsService.d.ts +25 -0
- package/services/{LoginsService.ts → LoginsService.js} +13 -21
- package/services/MainService.d.ts +8 -0
- package/services/MainService.js +18 -0
- package/services/UsersService.d.ts +42 -0
- package/services/{UsersService.ts → UsersService.js} +17 -32
- package/services/index.js +21 -0
- package/socketService.js +99 -0
- package/tsconfig.json +14 -0
- package/types/{driver-location.entity.ts → driver-location.entity.d.ts} +5 -7
- package/types/driver-location.entity.js +2 -0
- package/types/index.js +18 -0
- package/types/user.entity.d.ts +5 -0
- package/types/user.entity.js +6 -0
- package/core/ApiError.ts +0 -25
- package/core/CancelablePromise.ts +0 -131
- package/createClient.ts +0 -13
- package/index.ts +0 -10
- package/models/CreateAdminDto.ts +0 -31
- package/models/CreateDriverDto.ts +0 -47
- package/models/CreateUserDto.ts +0 -27
- package/models/UpdateAdminDto.ts +0 -31
- package/models/UpdateDriverDto.ts +0 -47
- package/models/UpdateUserDto.ts +0 -27
- package/models/index.ts +0 -10
- package/services/MainService.ts +0 -19
- package/socketService.ts +0 -125
- package/types/user.entity.ts +0 -5
- /package/core/{index.ts → index.d.ts} +0 -0
- /package/services/{index.ts → index.d.ts} +0 -0
- /package/types/{index.ts → index.d.ts} +0 -0
|
@@ -1,256 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = exports.isDefined = void 0;
|
|
1
4
|
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
5
|
/* istanbul ignore file */
|
|
3
6
|
/* tslint:disable */
|
|
4
7
|
/* eslint-disable */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { CancelablePromise } from './CancelablePromise';
|
|
9
|
-
import type { OnCancel } from './CancelablePromise';
|
|
10
|
-
import type { OpenAPIConfig } from './OpenAPI';
|
|
11
|
-
|
|
12
|
-
export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
|
|
8
|
+
const ApiError_1 = require("./ApiError");
|
|
9
|
+
const CancelablePromise_1 = require("./CancelablePromise");
|
|
10
|
+
const isDefined = (value) => {
|
|
13
11
|
return value !== undefined && value !== null;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
exports.isDefined = isDefined;
|
|
14
|
+
const isString = (value) => {
|
|
17
15
|
return typeof value === 'string';
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return isString(value) && value !== '';
|
|
17
|
+
exports.isString = isString;
|
|
18
|
+
const isStringWithValue = (value) => {
|
|
19
|
+
return (0, exports.isString)(value) && value !== '';
|
|
22
20
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
typeof value === 'object' &&
|
|
21
|
+
exports.isStringWithValue = isStringWithValue;
|
|
22
|
+
const isBlob = (value) => {
|
|
23
|
+
return (typeof value === 'object' &&
|
|
27
24
|
typeof value.type === 'string' &&
|
|
28
25
|
typeof value.stream === 'function' &&
|
|
29
26
|
typeof value.arrayBuffer === 'function' &&
|
|
30
27
|
typeof value.constructor === 'function' &&
|
|
31
28
|
typeof value.constructor.name === 'string' &&
|
|
32
29
|
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
33
|
-
/^(Blob|File)$/.test(value[Symbol.toStringTag])
|
|
34
|
-
);
|
|
30
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
35
31
|
};
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
exports.isBlob = isBlob;
|
|
33
|
+
const isFormData = (value) => {
|
|
38
34
|
return value instanceof FormData;
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
exports.isFormData = isFormData;
|
|
37
|
+
const base64 = (str) => {
|
|
42
38
|
try {
|
|
43
39
|
return btoa(str);
|
|
44
|
-
}
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
45
42
|
// @ts-ignore
|
|
46
43
|
return Buffer.from(str).toString('base64');
|
|
47
44
|
}
|
|
48
45
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const qs
|
|
52
|
-
|
|
53
|
-
const append = (key: string, value: any) => {
|
|
46
|
+
exports.base64 = base64;
|
|
47
|
+
const getQueryString = (params) => {
|
|
48
|
+
const qs = [];
|
|
49
|
+
const append = (key, value) => {
|
|
54
50
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
55
51
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (isDefined(value)) {
|
|
52
|
+
const process = (key, value) => {
|
|
53
|
+
if ((0, exports.isDefined)(value)) {
|
|
59
54
|
if (Array.isArray(value)) {
|
|
60
55
|
value.forEach(v => {
|
|
61
56
|
process(key, v);
|
|
62
57
|
});
|
|
63
|
-
}
|
|
58
|
+
}
|
|
59
|
+
else if (typeof value === 'object') {
|
|
64
60
|
Object.entries(value).forEach(([k, v]) => {
|
|
65
61
|
process(`${key}[${k}]`, v);
|
|
66
62
|
});
|
|
67
|
-
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
68
65
|
append(key, value);
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
};
|
|
72
|
-
|
|
73
69
|
Object.entries(params).forEach(([key, value]) => {
|
|
74
70
|
process(key, value);
|
|
75
71
|
});
|
|
76
|
-
|
|
77
72
|
if (qs.length > 0) {
|
|
78
73
|
return `?${qs.join('&')}`;
|
|
79
74
|
}
|
|
80
|
-
|
|
81
75
|
return '';
|
|
82
76
|
};
|
|
83
|
-
|
|
84
|
-
const getUrl = (config
|
|
77
|
+
exports.getQueryString = getQueryString;
|
|
78
|
+
const getUrl = (config, options) => {
|
|
85
79
|
const encoder = config.ENCODE_PATH || encodeURI;
|
|
86
|
-
|
|
87
80
|
const path = options.url
|
|
88
81
|
.replace('{api-version}', config.VERSION)
|
|
89
|
-
.replace(/{(.*?)}/g, (substring
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
83
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
84
|
+
return encoder(String(options.path[group]));
|
|
85
|
+
}
|
|
86
|
+
return substring;
|
|
87
|
+
});
|
|
96
88
|
const url = `${config.BASE}${path}`;
|
|
97
89
|
if (options.query) {
|
|
98
|
-
return `${url}${getQueryString(options.query)}`;
|
|
90
|
+
return `${url}${(0, exports.getQueryString)(options.query)}`;
|
|
99
91
|
}
|
|
100
92
|
return url;
|
|
101
93
|
};
|
|
102
|
-
|
|
103
|
-
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
|
|
94
|
+
const getFormData = (options) => {
|
|
104
95
|
if (options.formData) {
|
|
105
96
|
const formData = new FormData();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (isString(value) || isBlob(value)) {
|
|
97
|
+
const process = (key, value) => {
|
|
98
|
+
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
109
99
|
formData.append(key, value);
|
|
110
|
-
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
111
102
|
formData.append(key, JSON.stringify(value));
|
|
112
103
|
}
|
|
113
104
|
};
|
|
114
|
-
|
|
115
105
|
Object.entries(options.formData)
|
|
116
|
-
.filter(([_, value]) => isDefined(value))
|
|
106
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
117
107
|
.forEach(([key, value]) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
value.forEach(v => process(key, v));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
process(key, value);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
125
115
|
return formData;
|
|
126
116
|
}
|
|
127
117
|
return undefined;
|
|
128
118
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
|
|
119
|
+
exports.getFormData = getFormData;
|
|
120
|
+
const resolve = async (options, resolver) => {
|
|
133
121
|
if (typeof resolver === 'function') {
|
|
134
|
-
return
|
|
122
|
+
return resolver(options);
|
|
135
123
|
}
|
|
136
124
|
return resolver;
|
|
137
125
|
};
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
exports.resolve = resolve;
|
|
127
|
+
const getHeaders = async (config, options) => {
|
|
140
128
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
141
|
-
resolve(options, config.TOKEN),
|
|
142
|
-
resolve(options, config.USERNAME),
|
|
143
|
-
resolve(options, config.PASSWORD),
|
|
144
|
-
resolve(options, config.HEADERS),
|
|
129
|
+
(0, exports.resolve)(options, config.TOKEN),
|
|
130
|
+
(0, exports.resolve)(options, config.USERNAME),
|
|
131
|
+
(0, exports.resolve)(options, config.PASSWORD),
|
|
132
|
+
(0, exports.resolve)(options, config.HEADERS),
|
|
145
133
|
]);
|
|
146
|
-
|
|
147
134
|
const headers = Object.entries({
|
|
148
135
|
Accept: 'application/json',
|
|
149
136
|
...additionalHeaders,
|
|
150
137
|
...options.headers,
|
|
151
138
|
})
|
|
152
|
-
.filter(([_, value]) => isDefined(value))
|
|
139
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
153
140
|
.reduce((headers, [key, value]) => ({
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (isStringWithValue(token)) {
|
|
141
|
+
...headers,
|
|
142
|
+
[key]: String(value),
|
|
143
|
+
}), {});
|
|
144
|
+
if ((0, exports.isStringWithValue)(token)) {
|
|
159
145
|
headers['Authorization'] = `Bearer ${token}`;
|
|
160
146
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const credentials = base64(`${username}:${password}`);
|
|
147
|
+
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
148
|
+
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
164
149
|
headers['Authorization'] = `Basic ${credentials}`;
|
|
165
150
|
}
|
|
166
|
-
|
|
167
151
|
if (options.body !== undefined) {
|
|
168
152
|
if (options.mediaType) {
|
|
169
153
|
headers['Content-Type'] = options.mediaType;
|
|
170
|
-
}
|
|
154
|
+
}
|
|
155
|
+
else if ((0, exports.isBlob)(options.body)) {
|
|
171
156
|
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
172
|
-
}
|
|
157
|
+
}
|
|
158
|
+
else if ((0, exports.isString)(options.body)) {
|
|
173
159
|
headers['Content-Type'] = 'text/plain';
|
|
174
|
-
}
|
|
160
|
+
}
|
|
161
|
+
else if (!(0, exports.isFormData)(options.body)) {
|
|
175
162
|
headers['Content-Type'] = 'application/json';
|
|
176
163
|
}
|
|
177
164
|
}
|
|
178
|
-
|
|
179
165
|
return new Headers(headers);
|
|
180
166
|
};
|
|
181
|
-
|
|
182
|
-
|
|
167
|
+
exports.getHeaders = getHeaders;
|
|
168
|
+
const getRequestBody = (options) => {
|
|
183
169
|
if (options.body !== undefined) {
|
|
184
170
|
if (options.mediaType?.includes('/json')) {
|
|
185
|
-
return JSON.stringify(options.body)
|
|
186
|
-
}
|
|
171
|
+
return JSON.stringify(options.body);
|
|
172
|
+
}
|
|
173
|
+
else if ((0, exports.isString)(options.body) || (0, exports.isBlob)(options.body) || (0, exports.isFormData)(options.body)) {
|
|
187
174
|
return options.body;
|
|
188
|
-
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
189
177
|
return JSON.stringify(options.body);
|
|
190
178
|
}
|
|
191
179
|
}
|
|
192
180
|
return undefined;
|
|
193
181
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
config: OpenAPIConfig,
|
|
197
|
-
options: ApiRequestOptions,
|
|
198
|
-
url: string,
|
|
199
|
-
body: any,
|
|
200
|
-
formData: FormData | undefined,
|
|
201
|
-
headers: Headers,
|
|
202
|
-
onCancel: OnCancel
|
|
203
|
-
): Promise<Response> => {
|
|
182
|
+
exports.getRequestBody = getRequestBody;
|
|
183
|
+
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
204
184
|
const controller = new AbortController();
|
|
205
|
-
|
|
206
|
-
const request: RequestInit = {
|
|
185
|
+
const request = {
|
|
207
186
|
headers,
|
|
208
187
|
body: body ?? formData,
|
|
209
188
|
method: options.method,
|
|
210
189
|
signal: controller.signal,
|
|
211
190
|
};
|
|
212
|
-
|
|
213
191
|
if (config.WITH_CREDENTIALS) {
|
|
214
192
|
request.credentials = config.CREDENTIALS;
|
|
215
193
|
}
|
|
216
|
-
|
|
217
194
|
onCancel(() => controller.abort());
|
|
218
|
-
|
|
219
195
|
return await fetch(url, request);
|
|
220
196
|
};
|
|
221
|
-
|
|
222
|
-
|
|
197
|
+
exports.sendRequest = sendRequest;
|
|
198
|
+
const getResponseHeader = (response, responseHeader) => {
|
|
223
199
|
if (responseHeader) {
|
|
224
200
|
const content = response.headers.get(responseHeader);
|
|
225
|
-
if (isString(content)) {
|
|
201
|
+
if ((0, exports.isString)(content)) {
|
|
226
202
|
return content;
|
|
227
203
|
}
|
|
228
204
|
}
|
|
229
205
|
return undefined;
|
|
230
206
|
};
|
|
231
|
-
|
|
232
|
-
|
|
207
|
+
exports.getResponseHeader = getResponseHeader;
|
|
208
|
+
const getResponseBody = async (response) => {
|
|
233
209
|
if (response.status !== 204) {
|
|
234
210
|
try {
|
|
235
211
|
const contentType = response.headers.get('Content-Type');
|
|
236
212
|
if (contentType) {
|
|
237
|
-
const jsonTypes = ['application/json', 'application/problem+json']
|
|
213
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
238
214
|
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
239
215
|
if (isJSON) {
|
|
240
216
|
return await response.json();
|
|
241
|
-
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
242
219
|
return await response.text();
|
|
243
220
|
}
|
|
244
221
|
}
|
|
245
|
-
}
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
246
224
|
console.error(error);
|
|
247
225
|
}
|
|
248
226
|
}
|
|
249
227
|
return undefined;
|
|
250
228
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const errors
|
|
229
|
+
exports.getResponseBody = getResponseBody;
|
|
230
|
+
const catchErrorCodes = (options, result) => {
|
|
231
|
+
const errors = {
|
|
254
232
|
400: 'Bad Request',
|
|
255
233
|
401: 'Unauthorized',
|
|
256
234
|
403: 'Forbidden',
|
|
@@ -259,30 +237,26 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult):
|
|
|
259
237
|
502: 'Bad Gateway',
|
|
260
238
|
503: 'Service Unavailable',
|
|
261
239
|
...options.errors,
|
|
262
|
-
}
|
|
263
|
-
|
|
240
|
+
};
|
|
264
241
|
const error = errors[result.status];
|
|
265
242
|
if (error) {
|
|
266
|
-
throw new ApiError(options, result, error);
|
|
243
|
+
throw new ApiError_1.ApiError(options, result, error);
|
|
267
244
|
}
|
|
268
|
-
|
|
269
245
|
if (!result.ok) {
|
|
270
246
|
const errorStatus = result.status ?? 'unknown';
|
|
271
247
|
const errorStatusText = result.statusText ?? 'unknown';
|
|
272
248
|
const errorBody = (() => {
|
|
273
249
|
try {
|
|
274
250
|
return JSON.stringify(result.body, null, 2);
|
|
275
|
-
}
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
276
253
|
return undefined;
|
|
277
254
|
}
|
|
278
255
|
})();
|
|
279
|
-
|
|
280
|
-
throw new ApiError(options, result,
|
|
281
|
-
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
|
|
282
|
-
);
|
|
256
|
+
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
283
257
|
}
|
|
284
258
|
};
|
|
285
|
-
|
|
259
|
+
exports.catchErrorCodes = catchErrorCodes;
|
|
286
260
|
/**
|
|
287
261
|
* Request method
|
|
288
262
|
* @param config The OpenAPI configuration object
|
|
@@ -290,33 +264,31 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult):
|
|
|
290
264
|
* @returns CancelablePromise<T>
|
|
291
265
|
* @throws ApiError
|
|
292
266
|
*/
|
|
293
|
-
|
|
294
|
-
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
267
|
+
const request = (config, options) => {
|
|
268
|
+
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
295
269
|
try {
|
|
296
270
|
const url = getUrl(config, options);
|
|
297
|
-
const formData = getFormData(options);
|
|
298
|
-
const body = getRequestBody(options);
|
|
299
|
-
const headers = await getHeaders(config, options);
|
|
300
|
-
|
|
271
|
+
const formData = (0, exports.getFormData)(options);
|
|
272
|
+
const body = (0, exports.getRequestBody)(options);
|
|
273
|
+
const headers = await (0, exports.getHeaders)(config, options);
|
|
301
274
|
if (!onCancel.isCancelled) {
|
|
302
|
-
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
303
|
-
const responseBody = await getResponseBody(response);
|
|
304
|
-
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
305
|
-
|
|
306
|
-
const result: ApiResult = {
|
|
275
|
+
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
276
|
+
const responseBody = await (0, exports.getResponseBody)(response);
|
|
277
|
+
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
278
|
+
const result = {
|
|
307
279
|
url,
|
|
308
280
|
ok: response.ok,
|
|
309
281
|
status: response.status,
|
|
310
282
|
statusText: response.statusText,
|
|
311
283
|
body: responseHeader ?? responseBody,
|
|
312
284
|
};
|
|
313
|
-
|
|
314
|
-
catchErrorCodes(options, result);
|
|
315
|
-
|
|
285
|
+
(0, exports.catchErrorCodes)(options, result);
|
|
316
286
|
resolve(result.body);
|
|
317
287
|
}
|
|
318
|
-
}
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
319
290
|
reject(error);
|
|
320
291
|
}
|
|
321
292
|
});
|
|
322
293
|
};
|
|
294
|
+
exports.request = request;
|
package/createClient.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createClient = createClient;
|
|
37
|
+
const OpenAPI_1 = require("./core/OpenAPI");
|
|
38
|
+
const services = __importStar(require("./services"));
|
|
39
|
+
/**
|
|
40
|
+
* Crea un cliente SDK con la URL base configurada
|
|
41
|
+
*/
|
|
42
|
+
function createClient(baseUrl, token) {
|
|
43
|
+
OpenAPI_1.OpenAPI.BASE = baseUrl || process.env.API_URL || 'http://localhost:3000';
|
|
44
|
+
OpenAPI_1.OpenAPI.TOKEN = token || process.env.API_TOKEN || '';
|
|
45
|
+
return {
|
|
46
|
+
...services, // todos los servicios agrupados
|
|
47
|
+
};
|
|
48
|
+
}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./models"), exports);
|
|
18
|
+
__exportStar(require("./core"), exports);
|
|
19
|
+
__exportStar(require("./services"), exports);
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
__exportStar(require("./createClient"), exports);
|
|
22
|
+
__exportStar(require("./socketService"), exports);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
1
|
export type AdminDto = {
|
|
6
2
|
/**
|
|
7
3
|
* Admin First Name
|
|
@@ -28,4 +24,3 @@ export type AdminDto = {
|
|
|
28
24
|
*/
|
|
29
25
|
role_id: number;
|
|
30
26
|
};
|
|
31
|
-
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
1
|
export type DriverDto = {
|
|
6
2
|
/**
|
|
7
3
|
* Driver First Name
|
|
@@ -44,4 +40,3 @@ export type DriverDto = {
|
|
|
44
40
|
*/
|
|
45
41
|
last_heartbeat?: string;
|
|
46
42
|
};
|
|
47
|
-
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
1
|
export type LoginDto = {
|
|
6
2
|
/**
|
|
7
3
|
* Email must be valid
|
|
@@ -12,4 +8,3 @@ export type LoginDto = {
|
|
|
12
8
|
*/
|
|
13
9
|
password: string;
|
|
14
10
|
};
|
|
15
|
-
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
1
|
export type UserDto = {
|
|
6
2
|
/**
|
|
7
3
|
* User First Name
|
|
@@ -24,4 +20,3 @@ export type UserDto = {
|
|
|
24
20
|
*/
|
|
25
21
|
phone: string;
|
|
26
22
|
};
|
|
27
|
-
|
package/models/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AdminDto"), exports);
|
|
18
|
+
__exportStar(require("./DriverDto"), exports);
|
|
19
|
+
__exportStar(require("./LoginDto"), exports);
|
|
20
|
+
__exportStar(require("./UserDto"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AdminDto } from '../models/AdminDto';
|
|
2
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
3
|
+
export declare class AdminService {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new admin
|
|
6
|
+
* @param requestBody
|
|
7
|
+
* @returns any Admin created successfully.
|
|
8
|
+
* @throws ApiError
|
|
9
|
+
*/
|
|
10
|
+
static create(requestBody: AdminDto): CancelablePromise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* Get all admins
|
|
13
|
+
* @param search
|
|
14
|
+
* @param orderBy
|
|
15
|
+
* @param order
|
|
16
|
+
* @returns any List of admins
|
|
17
|
+
* @throws ApiError
|
|
18
|
+
*/
|
|
19
|
+
static findAll(search: string, orderBy: string, order: string): CancelablePromise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single admin by ID
|
|
22
|
+
* @param id
|
|
23
|
+
* @returns any Admin found
|
|
24
|
+
* @throws ApiError
|
|
25
|
+
*/
|
|
26
|
+
static findOne(id: number): CancelablePromise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* Update an admin by ID
|
|
29
|
+
* @param id
|
|
30
|
+
* @param requestBody
|
|
31
|
+
* @returns any Admin updated successfully.
|
|
32
|
+
* @throws ApiError
|
|
33
|
+
*/
|
|
34
|
+
static update(id: number, requestBody: AdminDto): CancelablePromise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete an admin by ID
|
|
37
|
+
* @param id
|
|
38
|
+
* @returns any Admin deleted successfully.
|
|
39
|
+
* @throws ApiError
|
|
40
|
+
*/
|
|
41
|
+
static remove(id: number): CancelablePromise<any>;
|
|
42
|
+
}
|