@dapex-tech/elite-online-services 0.0.2 → 0.0.6
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} +1 -6
- package/models/AdminDto.js +2 -0
- package/models/AdminUpdateDto.d.ts +26 -0
- package/models/AdminUpdateDto.js +2 -0
- package/models/{CreateDriverDto.ts → DriverDto.d.ts} +4 -9
- package/models/DriverDto.js +2 -0
- package/models/{UpdateDriverDto.ts → DriverUpdateDto.d.ts} +3 -8
- package/models/DriverUpdateDto.js +2 -0
- package/models/{LoginDto.ts → LoginDto.d.ts} +0 -5
- package/models/LoginDto.js +2 -0
- package/models/OrderDto.d.ts +19 -0
- package/models/OrderDto.js +14 -0
- package/models/{UserDto.ts → UserDto.d.ts} +1 -6
- package/models/UserDto.js +2 -0
- package/models/{CreateUserDto.ts → UserUpdatedDto.d.ts} +2 -7
- package/models/UserUpdatedDto.js +2 -0
- package/models/index.d.ts +8 -0
- package/models/index.js +24 -0
- package/package.json +1 -1
- package/services/AdminService.d.ts +43 -0
- package/services/{AdminService.ts → AdminService.js} +20 -37
- package/services/DriversService.d.ts +43 -0
- package/services/{DriversService.ts → DriversService.js} +20 -37
- package/services/LoginsService.d.ts +43 -0
- package/services/LoginsService.js +96 -0
- package/services/MainService.d.ts +8 -0
- package/services/MainService.js +18 -0
- package/services/UsersService.d.ts +43 -0
- package/services/{UsersService.ts → UsersService.js} +20 -37
- package/services/index.js +21 -0
- package/socketService.js +104 -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/DriverDto.ts +0 -47
- package/models/UpdateAdminDto.ts +0 -31
- package/models/UpdateUserDto.ts +0 -27
- package/models/index.ts +0 -10
- package/services/LoginsService.ts +0 -67
- 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,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { OpenAPI } from '../core/OpenAPI';
|
|
8
|
-
import { request as __request } from '../core/request';
|
|
9
|
-
export class UsersService {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsersService = void 0;
|
|
4
|
+
const OpenAPI_1 = require("../core/OpenAPI");
|
|
5
|
+
const request_1 = require("../core/request");
|
|
6
|
+
class UsersService {
|
|
10
7
|
/**
|
|
11
8
|
* Create a new user
|
|
12
9
|
* @param requestBody
|
|
13
10
|
* @returns any User created successfully.
|
|
14
11
|
* @throws ApiError
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
): CancelablePromise<any> {
|
|
19
|
-
return __request(OpenAPI, {
|
|
13
|
+
static create(requestBody) {
|
|
14
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
20
15
|
method: 'POST',
|
|
21
16
|
url: '/users',
|
|
22
17
|
body: requestBody,
|
|
@@ -29,23 +24,17 @@ export class UsersService {
|
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
31
26
|
* Get all users
|
|
32
|
-
* @param search
|
|
33
|
-
* @param
|
|
34
|
-
* @param order
|
|
27
|
+
* @param search Text to search for in name, surname, phone number or email
|
|
28
|
+
* @param order Sorting options
|
|
35
29
|
* @returns any List of users.
|
|
36
30
|
* @throws ApiError
|
|
37
31
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
orderBy: string,
|
|
41
|
-
order: string,
|
|
42
|
-
): CancelablePromise<any> {
|
|
43
|
-
return __request(OpenAPI, {
|
|
32
|
+
static findAll(search, order) {
|
|
33
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
44
34
|
method: 'GET',
|
|
45
35
|
url: '/users',
|
|
46
36
|
query: {
|
|
47
37
|
'search': search,
|
|
48
|
-
'orderBy': orderBy,
|
|
49
38
|
'order': order,
|
|
50
39
|
},
|
|
51
40
|
errors: {
|
|
@@ -59,10 +48,8 @@ export class UsersService {
|
|
|
59
48
|
* @returns any User found.
|
|
60
49
|
* @throws ApiError
|
|
61
50
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
): CancelablePromise<any> {
|
|
65
|
-
return __request(OpenAPI, {
|
|
51
|
+
static findOne(id) {
|
|
52
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
66
53
|
method: 'GET',
|
|
67
54
|
url: '/users/{id}',
|
|
68
55
|
path: {
|
|
@@ -81,12 +68,9 @@ export class UsersService {
|
|
|
81
68
|
* @returns any User updated successfully.
|
|
82
69
|
* @throws ApiError
|
|
83
70
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
): CancelablePromise<any> {
|
|
88
|
-
return __request(OpenAPI, {
|
|
89
|
-
method: 'PUT',
|
|
71
|
+
static update(id, requestBody) {
|
|
72
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
73
|
+
method: 'PATCH',
|
|
90
74
|
url: '/users/{id}',
|
|
91
75
|
path: {
|
|
92
76
|
'id': id,
|
|
@@ -105,10 +89,8 @@ export class UsersService {
|
|
|
105
89
|
* @returns any User deleted successfully.
|
|
106
90
|
* @throws ApiError
|
|
107
91
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
): CancelablePromise<any> {
|
|
111
|
-
return __request(OpenAPI, {
|
|
92
|
+
static remove(id) {
|
|
93
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
112
94
|
method: 'DELETE',
|
|
113
95
|
url: '/users/{id}',
|
|
114
96
|
path: {
|
|
@@ -121,3 +103,4 @@ export class UsersService {
|
|
|
121
103
|
});
|
|
122
104
|
}
|
|
123
105
|
}
|
|
106
|
+
exports.UsersService = UsersService;
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./AdminService"), exports);
|
|
18
|
+
__exportStar(require("./DriversService"), exports);
|
|
19
|
+
__exportStar(require("./LoginsService"), exports);
|
|
20
|
+
__exportStar(require("./MainService"), exports);
|
|
21
|
+
__exportStar(require("./UsersService"), exports);
|
package/socketService.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.SocketService = void 0;
|
|
4
|
+
const socket_io_client_1 = require('socket.io-client');
|
|
5
|
+
class SocketService {
|
|
6
|
+
/*
|
|
7
|
+
constructor(baseUrl: string) {
|
|
8
|
+
this.socket = io(baseUrl, { transports: ['websocket'] });
|
|
9
|
+
}
|
|
10
|
+
*/
|
|
11
|
+
constructor(baseUrl, token) {
|
|
12
|
+
this.socket = (0, socket_io_client_1.io)(baseUrl, {
|
|
13
|
+
transports: ['websocket'],
|
|
14
|
+
auth: token ? { token } : undefined, // ✅ send token if available
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
connect() {
|
|
18
|
+
this.socket.connect();
|
|
19
|
+
}
|
|
20
|
+
disconnect() {
|
|
21
|
+
this.socket.disconnect();
|
|
22
|
+
}
|
|
23
|
+
isConnected() {
|
|
24
|
+
return this.socket.connected;
|
|
25
|
+
}
|
|
26
|
+
isActive() {
|
|
27
|
+
return this.socket.active;
|
|
28
|
+
}
|
|
29
|
+
on(event, cb) {
|
|
30
|
+
this.socket.on(event, cb);
|
|
31
|
+
}
|
|
32
|
+
off(event, cb) {
|
|
33
|
+
if (cb) {
|
|
34
|
+
this.socket.off(event, cb);
|
|
35
|
+
} else {
|
|
36
|
+
this.socket.removeAllListeners(event);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
emit(event, data) {
|
|
40
|
+
this.socket.emit(event, data);
|
|
41
|
+
}
|
|
42
|
+
// Custom methods
|
|
43
|
+
sendMessage(message) {
|
|
44
|
+
this.emit('message', { text: message });
|
|
45
|
+
}
|
|
46
|
+
onMessageReceived(cb) {
|
|
47
|
+
this.on('messageReceived', cb);
|
|
48
|
+
}
|
|
49
|
+
offMessageReceived(cb) {
|
|
50
|
+
this.off('messageReceived', cb);
|
|
51
|
+
}
|
|
52
|
+
updateLocation(data) {
|
|
53
|
+
this.emit('updateLocation', { ...data });
|
|
54
|
+
}
|
|
55
|
+
onLocationUpdated(cb) {
|
|
56
|
+
this.on('locationUpdated', cb);
|
|
57
|
+
}
|
|
58
|
+
offLocationUpdated(cb) {
|
|
59
|
+
this.off('locationUpdated', cb);
|
|
60
|
+
}
|
|
61
|
+
onAllLocations(cb) {
|
|
62
|
+
this.on('allLocations', cb);
|
|
63
|
+
}
|
|
64
|
+
offAllLocations(cb) {
|
|
65
|
+
this.off('allLocations', cb);
|
|
66
|
+
}
|
|
67
|
+
sendHeartbeat(clientID) {
|
|
68
|
+
this.emit('heartbeat', { clientID });
|
|
69
|
+
}
|
|
70
|
+
onHeartbeatReceived(cb) {
|
|
71
|
+
this.on('heartbeatReceived', cb);
|
|
72
|
+
}
|
|
73
|
+
offHeartbeatReceived(cb) {
|
|
74
|
+
this.off('heartbeatReceived', cb);
|
|
75
|
+
}
|
|
76
|
+
onAllHeartbeats(cb) {
|
|
77
|
+
this.on('allHeartbeats', cb);
|
|
78
|
+
}
|
|
79
|
+
offAllHeartbeats(cb) {
|
|
80
|
+
this.off('allHeartbeats', cb);
|
|
81
|
+
}
|
|
82
|
+
updateServiceOrderStatus(orderID, status) {
|
|
83
|
+
this.emit('serviceOrderStatusUpdate', { orderID, status });
|
|
84
|
+
}
|
|
85
|
+
onServiceOrderStatusUpdated(callback) {
|
|
86
|
+
this.on('serviceOrderStatusUpdated', callback);
|
|
87
|
+
}
|
|
88
|
+
offServiceOrderStatusUpdated(callback) {
|
|
89
|
+
this.off('serviceOrderStatusUpdated', callback);
|
|
90
|
+
}
|
|
91
|
+
onAllServiceOrderStatuses(callback) {
|
|
92
|
+
this.on('allServiceOrderStatuses', callback);
|
|
93
|
+
}
|
|
94
|
+
offAllServiceOrderStatuses(callback) {
|
|
95
|
+
this.off('allServiceOrderStatuses', callback);
|
|
96
|
+
}
|
|
97
|
+
onConnected(callback) {
|
|
98
|
+
this.on('connected', callback);
|
|
99
|
+
}
|
|
100
|
+
offConnected(callback) {
|
|
101
|
+
this.off('connected', callback);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.SocketService = SocketService;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "./compiled",
|
|
10
|
+
"rootDir": "."
|
|
11
|
+
},
|
|
12
|
+
"include": ["**/*.ts"],
|
|
13
|
+
"exclude": ["**/*.d.ts", "node_modules"]
|
|
14
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export interface DriverLocation {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
at?: Date;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
export interface DriverLocationWithClientID extends DriverLocation {
|
|
8
|
-
|
|
7
|
+
clientID: string;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
export interface DriverLocationMap {
|
|
12
|
-
|
|
10
|
+
[clientID: string]: DriverLocation;
|
|
13
11
|
}
|
package/types/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./driver-location.entity"), exports);
|
|
18
|
+
__exportStar(require("./user.entity"), exports);
|
package/core/ApiError.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
6
|
-
import type { ApiResult } from './ApiResult';
|
|
7
|
-
|
|
8
|
-
export class ApiError extends Error {
|
|
9
|
-
public readonly url: string;
|
|
10
|
-
public readonly status: number;
|
|
11
|
-
public readonly statusText: string;
|
|
12
|
-
public readonly body: any;
|
|
13
|
-
public readonly request: ApiRequestOptions;
|
|
14
|
-
|
|
15
|
-
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
|
16
|
-
super(message);
|
|
17
|
-
|
|
18
|
-
this.name = 'ApiError';
|
|
19
|
-
this.url = response.url;
|
|
20
|
-
this.status = response.status;
|
|
21
|
-
this.statusText = response.statusText;
|
|
22
|
-
this.body = response.body;
|
|
23
|
-
this.request = request;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export class CancelError extends Error {
|
|
6
|
-
|
|
7
|
-
constructor(message: string) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = 'CancelError';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public get isCancelled(): boolean {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface OnCancel {
|
|
18
|
-
readonly isResolved: boolean;
|
|
19
|
-
readonly isRejected: boolean;
|
|
20
|
-
readonly isCancelled: boolean;
|
|
21
|
-
|
|
22
|
-
(cancelHandler: () => void): void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class CancelablePromise<T> implements Promise<T> {
|
|
26
|
-
#isResolved: boolean;
|
|
27
|
-
#isRejected: boolean;
|
|
28
|
-
#isCancelled: boolean;
|
|
29
|
-
readonly #cancelHandlers: (() => void)[];
|
|
30
|
-
readonly #promise: Promise<T>;
|
|
31
|
-
#resolve?: (value: T | PromiseLike<T>) => void;
|
|
32
|
-
#reject?: (reason?: any) => void;
|
|
33
|
-
|
|
34
|
-
constructor(
|
|
35
|
-
executor: (
|
|
36
|
-
resolve: (value: T | PromiseLike<T>) => void,
|
|
37
|
-
reject: (reason?: any) => void,
|
|
38
|
-
onCancel: OnCancel
|
|
39
|
-
) => void
|
|
40
|
-
) {
|
|
41
|
-
this.#isResolved = false;
|
|
42
|
-
this.#isRejected = false;
|
|
43
|
-
this.#isCancelled = false;
|
|
44
|
-
this.#cancelHandlers = [];
|
|
45
|
-
this.#promise = new Promise<T>((resolve, reject) => {
|
|
46
|
-
this.#resolve = resolve;
|
|
47
|
-
this.#reject = reject;
|
|
48
|
-
|
|
49
|
-
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
50
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.#isResolved = true;
|
|
54
|
-
if (this.#resolve) this.#resolve(value);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const onReject = (reason?: any): void => {
|
|
58
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
this.#isRejected = true;
|
|
62
|
-
if (this.#reject) this.#reject(reason);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const onCancel = (cancelHandler: () => void): void => {
|
|
66
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.#cancelHandlers.push(cancelHandler);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Object.defineProperty(onCancel, 'isResolved', {
|
|
73
|
-
get: (): boolean => this.#isResolved,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
Object.defineProperty(onCancel, 'isRejected', {
|
|
77
|
-
get: (): boolean => this.#isRejected,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
Object.defineProperty(onCancel, 'isCancelled', {
|
|
81
|
-
get: (): boolean => this.#isCancelled,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get [Symbol.toStringTag]() {
|
|
89
|
-
return "Cancellable Promise";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public then<TResult1 = T, TResult2 = never>(
|
|
93
|
-
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
94
|
-
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
|
95
|
-
): Promise<TResult1 | TResult2> {
|
|
96
|
-
return this.#promise.then(onFulfilled, onRejected);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public catch<TResult = never>(
|
|
100
|
-
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
|
|
101
|
-
): Promise<T | TResult> {
|
|
102
|
-
return this.#promise.catch(onRejected);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
106
|
-
return this.#promise.finally(onFinally);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public cancel(): void {
|
|
110
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this.#isCancelled = true;
|
|
114
|
-
if (this.#cancelHandlers.length) {
|
|
115
|
-
try {
|
|
116
|
-
for (const cancelHandler of this.#cancelHandlers) {
|
|
117
|
-
cancelHandler();
|
|
118
|
-
}
|
|
119
|
-
} catch (error) {
|
|
120
|
-
console.warn('Cancellation threw an error', error);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
this.#cancelHandlers.length = 0;
|
|
125
|
-
if (this.#reject) this.#reject(new CancelError('Request aborted'));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public get isCancelled(): boolean {
|
|
129
|
-
return this.#isCancelled;
|
|
130
|
-
}
|
|
131
|
-
}
|
package/createClient.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { OpenAPI } from './core/OpenAPI';
|
|
2
|
-
import * as services from './services';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Crea un cliente SDK con la URL base configurada
|
|
6
|
-
*/
|
|
7
|
-
export function createClient(baseUrl?: string, token?: string) {
|
|
8
|
-
OpenAPI.BASE = baseUrl || process.env.API_URL || 'http://localhost:3000';
|
|
9
|
-
OpenAPI.TOKEN = token || process.env.API_TOKEN || '';
|
|
10
|
-
return {
|
|
11
|
-
...services, // todos los servicios agrupados
|
|
12
|
-
};
|
|
13
|
-
}
|
package/index.ts
DELETED
package/models/CreateAdminDto.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export type CreateAdminDto = {
|
|
6
|
-
/**
|
|
7
|
-
* Admin First Name
|
|
8
|
-
*/
|
|
9
|
-
first_name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Admin Last Name
|
|
12
|
-
*/
|
|
13
|
-
last_name: string;
|
|
14
|
-
/**
|
|
15
|
-
* Admin Phone Number
|
|
16
|
-
*/
|
|
17
|
-
phone: string;
|
|
18
|
-
/**
|
|
19
|
-
* Admin Email
|
|
20
|
-
*/
|
|
21
|
-
email: string;
|
|
22
|
-
/**
|
|
23
|
-
* Admin Password
|
|
24
|
-
*/
|
|
25
|
-
password: string;
|
|
26
|
-
/**
|
|
27
|
-
* Admin Role ID
|
|
28
|
-
*/
|
|
29
|
-
role_id: number;
|
|
30
|
-
};
|
|
31
|
-
|
package/models/DriverDto.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export type DriverDto = {
|
|
6
|
-
/**
|
|
7
|
-
* Driver First Name
|
|
8
|
-
*/
|
|
9
|
-
first_name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Driver Last Name
|
|
12
|
-
*/
|
|
13
|
-
last_name: string;
|
|
14
|
-
/**
|
|
15
|
-
* Driver Phone Number (10 dígitos)
|
|
16
|
-
*/
|
|
17
|
-
phone: string;
|
|
18
|
-
/**
|
|
19
|
-
* Driver Email
|
|
20
|
-
*/
|
|
21
|
-
email: string;
|
|
22
|
-
/**
|
|
23
|
-
* Driver Password (6-20 caracteres)
|
|
24
|
-
*/
|
|
25
|
-
password: string;
|
|
26
|
-
/**
|
|
27
|
-
* Driver License Number
|
|
28
|
-
*/
|
|
29
|
-
license: string;
|
|
30
|
-
/**
|
|
31
|
-
* Driver Type (e.g., internal, external)
|
|
32
|
-
*/
|
|
33
|
-
type: string;
|
|
34
|
-
/**
|
|
35
|
-
* Driver State (activo/inactivo)
|
|
36
|
-
*/
|
|
37
|
-
state?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Last Location
|
|
40
|
-
*/
|
|
41
|
-
last_location?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Last Heartbeat
|
|
44
|
-
*/
|
|
45
|
-
last_heartbeat?: string;
|
|
46
|
-
};
|
|
47
|
-
|
package/models/UpdateAdminDto.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export type UpdateAdminDto = {
|
|
6
|
-
/**
|
|
7
|
-
* Admin First Name Updated
|
|
8
|
-
*/
|
|
9
|
-
first_name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Admin Last Name Updated
|
|
12
|
-
*/
|
|
13
|
-
last_name: string;
|
|
14
|
-
/**
|
|
15
|
-
* Admin Phone Number Updated
|
|
16
|
-
*/
|
|
17
|
-
phone: string;
|
|
18
|
-
/**
|
|
19
|
-
* Admin Email Updated
|
|
20
|
-
*/
|
|
21
|
-
email: string;
|
|
22
|
-
/**
|
|
23
|
-
* Admin Password Updated
|
|
24
|
-
*/
|
|
25
|
-
password: string;
|
|
26
|
-
/**
|
|
27
|
-
* Admin Role ID Updated
|
|
28
|
-
*/
|
|
29
|
-
role_id: number;
|
|
30
|
-
};
|
|
31
|
-
|
package/models/UpdateUserDto.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export type UpdateUserDto = {
|
|
6
|
-
/**
|
|
7
|
-
* First name of the user
|
|
8
|
-
*/
|
|
9
|
-
first_name?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Last name of the user
|
|
12
|
-
*/
|
|
13
|
-
last_name?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Phone number (10 digits)
|
|
16
|
-
*/
|
|
17
|
-
phone?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Unique email
|
|
20
|
-
*/
|
|
21
|
-
email?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Password (6-20 characters)
|
|
24
|
-
*/
|
|
25
|
-
password?: string;
|
|
26
|
-
};
|
|
27
|
-
|
package/models/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './AdminDto';
|
|
2
|
-
export * from './CreateAdminDto';
|
|
3
|
-
export * from './CreateDriverDto';
|
|
4
|
-
export * from './CreateUserDto';
|
|
5
|
-
export * from './DriverDto';
|
|
6
|
-
export * from './LoginDto';
|
|
7
|
-
export * from './UpdateAdminDto';
|
|
8
|
-
export * from './UpdateDriverDto';
|
|
9
|
-
export * from './UpdateUserDto';
|
|
10
|
-
export * from './UserDto';
|