zet-api 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -1
- package/dist/auth/types.d.ts +20 -20
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.js +1 -0
- package/dist/core/constants.d.ts +14 -0
- package/dist/core/constants.js +27 -1
- package/dist/core/manager.d.ts +2 -3
- package/dist/core/manager.js +9 -24
- package/dist/core/parsers.d.ts +916 -9
- package/dist/core/parsers.js +57 -4
- package/dist/core/utils.d.ts +2 -0
- package/dist/core/utils.js +56 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/.github/workflows/publish-to-npm.yml +0 -80
- package/dist/core/auth-manager.d.ts +0 -54
- package/dist/core/auth-manager.js +0 -159
- package/dist/core/auth-types.d.ts +0 -238
- package/dist/core/auth-types.js +0 -54
- package/dist/core/gtfs-types.d.ts +0 -198
- package/dist/core/gtfs-types.js +0 -70
- package/dist/live-polling.d.ts +0 -1
- package/dist/live-polling.js +0 -105
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -35
- package/dist/text.d.ts +0 -1
- package/dist/text.js +0 -35
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ZetAuthManager = void 0;
|
|
7
|
-
const auth_types_1 = require("./auth-types");
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
const axios_1 = __importDefault(require("axios"));
|
|
10
|
-
const config_1 = __importDefault(require("./config"));
|
|
11
|
-
/**
|
|
12
|
-
* ZetAuthManager handles authentication with the ZET API
|
|
13
|
-
* Manages login, token refresh, and account information
|
|
14
|
-
*/
|
|
15
|
-
class ZetAuthManager {
|
|
16
|
-
accessToken = null;
|
|
17
|
-
refreshToken = null;
|
|
18
|
-
tokenExpiresAt = null;
|
|
19
|
-
/**
|
|
20
|
-
* Check if currently authenticated
|
|
21
|
-
*/
|
|
22
|
-
isAuthenticated() {
|
|
23
|
-
return !!this.accessToken && !!this.refreshToken;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Check if access token is expired or about to expire (within 1 minute)
|
|
27
|
-
*/
|
|
28
|
-
isAccessTokenExpired() {
|
|
29
|
-
if (!this.tokenExpiresAt)
|
|
30
|
-
return true;
|
|
31
|
-
return Date.now() >= this.tokenExpiresAt - 60000; // 1 minute buffer
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get current access token, refreshing if needed
|
|
35
|
-
*/
|
|
36
|
-
async getAccessToken() {
|
|
37
|
-
if (!this.isAuthenticated()) {
|
|
38
|
-
throw new Error('Not authenticated. Please login first.');
|
|
39
|
-
}
|
|
40
|
-
if (this.isAccessTokenExpired() && this.refreshToken) {
|
|
41
|
-
await this.refreshAccessToken();
|
|
42
|
-
}
|
|
43
|
-
return this.accessToken;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Login with username and password
|
|
47
|
-
*/
|
|
48
|
-
async login(credentials) {
|
|
49
|
-
const validated = auth_types_1.LoginCredentialsSchema.parse(credentials);
|
|
50
|
-
const response = await axios_1.default.post(`${config_1.default.authServiceUrl}/login`, validated).catch((err) => err.response);
|
|
51
|
-
if (!response || response.status !== 200) {
|
|
52
|
-
throw new Error(`Login failed: ${response?.statusText || 'Unknown error'}`);
|
|
53
|
-
}
|
|
54
|
-
const parsed = auth_types_1.AuthTokensSchema.safeParse(response.data);
|
|
55
|
-
if (!parsed.success) {
|
|
56
|
-
throw new Error(`Failed to parse login response: ${(0, utils_1.parseZodError)(parsed.error).join(', ')}.`);
|
|
57
|
-
}
|
|
58
|
-
this.setTokens(parsed.data);
|
|
59
|
-
return parsed.data;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Refresh access token using refresh token
|
|
63
|
-
*/
|
|
64
|
-
async refreshAccessToken() {
|
|
65
|
-
if (!this.refreshToken) {
|
|
66
|
-
throw new Error('No refresh token available. Please login first.');
|
|
67
|
-
}
|
|
68
|
-
const validated = auth_types_1.RefreshTokenRequestSchema.parse({ refreshToken: this.refreshToken });
|
|
69
|
-
const response = await axios_1.default.post(`${config_1.default.authServiceUrl}/refreshTokens`, validated).catch((err) => err.response);
|
|
70
|
-
if (!response || response.status !== 200) {
|
|
71
|
-
// If refresh fails, clear tokens and require re-login
|
|
72
|
-
this.clearTokens();
|
|
73
|
-
throw new Error(`Token refresh failed: ${response?.statusText || 'Unknown error'}. Please login again.`);
|
|
74
|
-
}
|
|
75
|
-
const parsed = auth_types_1.AuthTokensSchema.safeParse(response.data);
|
|
76
|
-
if (!parsed.success) {
|
|
77
|
-
throw new Error(`Failed to parse refresh response: ${(0, utils_1.parseZodError)(parsed.error).join(', ')}.`);
|
|
78
|
-
}
|
|
79
|
-
this.setTokens(parsed.data);
|
|
80
|
-
return parsed.data;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get account information (requires authentication)
|
|
84
|
-
*/
|
|
85
|
-
async getAccount() {
|
|
86
|
-
const token = await this.getAccessToken();
|
|
87
|
-
if (!token) {
|
|
88
|
-
throw new Error('Not authenticated. Please login first.');
|
|
89
|
-
}
|
|
90
|
-
const response = await axios_1.default.get(config_1.default.accountServiceUrl, {
|
|
91
|
-
headers: {
|
|
92
|
-
Authorization: `Bearer ${token}`,
|
|
93
|
-
},
|
|
94
|
-
}).catch((err) => err.response);
|
|
95
|
-
if (!response || response.status !== 200) {
|
|
96
|
-
throw new Error(`Failed to get account: ${response?.statusText || 'Unknown error'}`);
|
|
97
|
-
}
|
|
98
|
-
const parsed = auth_types_1.AccountSchema.safeParse(response.data);
|
|
99
|
-
if (!parsed.success) {
|
|
100
|
-
throw new Error(`Failed to parse account data: ${(0, utils_1.parseZodError)(parsed.error).join(', ')}.`);
|
|
101
|
-
}
|
|
102
|
-
return parsed.data;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Logout and clear stored tokens
|
|
106
|
-
*/
|
|
107
|
-
logout() {
|
|
108
|
-
this.clearTokens();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Set tokens and calculate expiration
|
|
112
|
-
*/
|
|
113
|
-
setTokens(tokens) {
|
|
114
|
-
this.accessToken = tokens.accessToken;
|
|
115
|
-
this.refreshToken = tokens.refreshToken;
|
|
116
|
-
// Decode JWT to get expiration (simple base64 decode, no verification)
|
|
117
|
-
try {
|
|
118
|
-
const parts = tokens.accessToken.split('.');
|
|
119
|
-
if (parts.length === 3 && parts[1]) {
|
|
120
|
-
const payload = JSON.parse(atob(parts[1]));
|
|
121
|
-
this.tokenExpiresAt = payload.exp * 1000; // Convert to milliseconds
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
// If decode fails, assume 15 minutes
|
|
125
|
-
this.tokenExpiresAt = Date.now() + 900000;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
// If decode fails, assume 15 minutes
|
|
130
|
-
this.tokenExpiresAt = Date.now() + 900000;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Clear all stored tokens
|
|
135
|
-
*/
|
|
136
|
-
clearTokens() {
|
|
137
|
-
this.accessToken = null;
|
|
138
|
-
this.refreshToken = null;
|
|
139
|
-
this.tokenExpiresAt = null;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Manually set tokens (for restoring session)
|
|
143
|
-
*/
|
|
144
|
-
setTokensManually(tokens) {
|
|
145
|
-
this.setTokens(tokens);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get current tokens (for saving session)
|
|
149
|
-
*/
|
|
150
|
-
getTokens() {
|
|
151
|
-
if (!this.accessToken || !this.refreshToken)
|
|
152
|
-
return null;
|
|
153
|
-
return {
|
|
154
|
-
accessToken: this.accessToken,
|
|
155
|
-
refreshToken: this.refreshToken,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
exports.ZetAuthManager = ZetAuthManager;
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export type LoginCredentials = z.infer<typeof LoginCredentialsSchema>;
|
|
3
|
-
export declare const LoginCredentialsSchema: z.ZodObject<{
|
|
4
|
-
username: z.ZodString;
|
|
5
|
-
password: z.ZodString;
|
|
6
|
-
revokeOtherTokens: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
-
fcmToken: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
username: string;
|
|
10
|
-
password: string;
|
|
11
|
-
revokeOtherTokens: boolean;
|
|
12
|
-
fcmToken?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
username: string;
|
|
15
|
-
password: string;
|
|
16
|
-
revokeOtherTokens?: boolean | undefined;
|
|
17
|
-
fcmToken?: string | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
export type AuthTokens = z.infer<typeof AuthTokensSchema>;
|
|
20
|
-
export declare const AuthTokensSchema: z.ZodObject<{
|
|
21
|
-
accessToken: z.ZodString;
|
|
22
|
-
refreshToken: z.ZodString;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
accessToken: string;
|
|
25
|
-
refreshToken: string;
|
|
26
|
-
}, {
|
|
27
|
-
accessToken: string;
|
|
28
|
-
refreshToken: string;
|
|
29
|
-
}>;
|
|
30
|
-
export type RefreshTokenRequest = z.infer<typeof RefreshTokenRequestSchema>;
|
|
31
|
-
export declare const RefreshTokenRequestSchema: z.ZodObject<{
|
|
32
|
-
refreshToken: z.ZodString;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
refreshToken: string;
|
|
35
|
-
}, {
|
|
36
|
-
refreshToken: string;
|
|
37
|
-
}>;
|
|
38
|
-
export type Account = z.infer<typeof AccountSchema>;
|
|
39
|
-
export declare const AccountSchema: z.ZodObject<{
|
|
40
|
-
id: z.ZodNumber;
|
|
41
|
-
uid: z.ZodString;
|
|
42
|
-
email: z.ZodString;
|
|
43
|
-
firstName: z.ZodString;
|
|
44
|
-
lastName: z.ZodString;
|
|
45
|
-
ePurseAmount: z.ZodNumber;
|
|
46
|
-
clientId: z.ZodNullable<z.ZodNumber>;
|
|
47
|
-
language: z.ZodNumber;
|
|
48
|
-
isFullProfileActivationInProgress: z.ZodBoolean;
|
|
49
|
-
messages: z.ZodArray<z.ZodUnknown, "many">;
|
|
50
|
-
processes: z.ZodNullable<z.ZodUnknown>;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
id: number;
|
|
53
|
-
uid: string;
|
|
54
|
-
email: string;
|
|
55
|
-
firstName: string;
|
|
56
|
-
lastName: string;
|
|
57
|
-
ePurseAmount: number;
|
|
58
|
-
clientId: number | null;
|
|
59
|
-
language: number;
|
|
60
|
-
isFullProfileActivationInProgress: boolean;
|
|
61
|
-
messages: unknown[];
|
|
62
|
-
processes?: unknown;
|
|
63
|
-
}, {
|
|
64
|
-
id: number;
|
|
65
|
-
uid: string;
|
|
66
|
-
email: string;
|
|
67
|
-
firstName: string;
|
|
68
|
-
lastName: string;
|
|
69
|
-
ePurseAmount: number;
|
|
70
|
-
clientId: number | null;
|
|
71
|
-
language: number;
|
|
72
|
-
isFullProfileActivationInProgress: boolean;
|
|
73
|
-
messages: unknown[];
|
|
74
|
-
processes?: unknown;
|
|
75
|
-
}>;
|
|
76
|
-
export type StopIncomingTrip = z.infer<typeof StopIncomingTripSchema>;
|
|
77
|
-
export declare const StopIncomingTripSchema: z.ZodObject<{
|
|
78
|
-
tripId: z.ZodString;
|
|
79
|
-
routeShortName: z.ZodString;
|
|
80
|
-
headsign: z.ZodString;
|
|
81
|
-
expectedArrivalDateTime: z.ZodString;
|
|
82
|
-
hasLiveTracking: z.ZodBoolean;
|
|
83
|
-
daysFromToday: z.ZodNumber;
|
|
84
|
-
shapeId: z.ZodString;
|
|
85
|
-
vehicles: z.ZodArray<z.ZodObject<{
|
|
86
|
-
id: z.ZodString;
|
|
87
|
-
isForDisabledPeople: z.ZodNullable<z.ZodBoolean>;
|
|
88
|
-
vehicleTypeId: z.ZodNullable<z.ZodNumber>;
|
|
89
|
-
position: z.ZodOptional<z.ZodObject<{
|
|
90
|
-
latitude: z.ZodNumber;
|
|
91
|
-
longitude: z.ZodNumber;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
latitude: number;
|
|
94
|
-
longitude: number;
|
|
95
|
-
}, {
|
|
96
|
-
latitude: number;
|
|
97
|
-
longitude: number;
|
|
98
|
-
}>>;
|
|
99
|
-
}, "strip", z.ZodTypeAny, {
|
|
100
|
-
id: string;
|
|
101
|
-
isForDisabledPeople: boolean | null;
|
|
102
|
-
vehicleTypeId: number | null;
|
|
103
|
-
position?: {
|
|
104
|
-
latitude: number;
|
|
105
|
-
longitude: number;
|
|
106
|
-
} | undefined;
|
|
107
|
-
}, {
|
|
108
|
-
id: string;
|
|
109
|
-
isForDisabledPeople: boolean | null;
|
|
110
|
-
vehicleTypeId: number | null;
|
|
111
|
-
position?: {
|
|
112
|
-
latitude: number;
|
|
113
|
-
longitude: number;
|
|
114
|
-
} | undefined;
|
|
115
|
-
}>, "many">;
|
|
116
|
-
}, "strip", z.ZodTypeAny, {
|
|
117
|
-
tripId: string;
|
|
118
|
-
routeShortName: string;
|
|
119
|
-
headsign: string;
|
|
120
|
-
expectedArrivalDateTime: string;
|
|
121
|
-
hasLiveTracking: boolean;
|
|
122
|
-
daysFromToday: number;
|
|
123
|
-
shapeId: string;
|
|
124
|
-
vehicles: {
|
|
125
|
-
id: string;
|
|
126
|
-
isForDisabledPeople: boolean | null;
|
|
127
|
-
vehicleTypeId: number | null;
|
|
128
|
-
position?: {
|
|
129
|
-
latitude: number;
|
|
130
|
-
longitude: number;
|
|
131
|
-
} | undefined;
|
|
132
|
-
}[];
|
|
133
|
-
}, {
|
|
134
|
-
tripId: string;
|
|
135
|
-
routeShortName: string;
|
|
136
|
-
headsign: string;
|
|
137
|
-
expectedArrivalDateTime: string;
|
|
138
|
-
hasLiveTracking: boolean;
|
|
139
|
-
daysFromToday: number;
|
|
140
|
-
shapeId: string;
|
|
141
|
-
vehicles: {
|
|
142
|
-
id: string;
|
|
143
|
-
isForDisabledPeople: boolean | null;
|
|
144
|
-
vehicleTypeId: number | null;
|
|
145
|
-
position?: {
|
|
146
|
-
latitude: number;
|
|
147
|
-
longitude: number;
|
|
148
|
-
} | undefined;
|
|
149
|
-
}[];
|
|
150
|
-
}>;
|
|
151
|
-
export type StopIncomingTripWithDates = Omit<StopIncomingTrip, 'expectedArrivalDateTime'> & {
|
|
152
|
-
expectedArrivalDateTime: Date;
|
|
153
|
-
};
|
|
154
|
-
export type GetStopIncomingTripsInput = z.infer<typeof GetStopIncomingTripsInputSchema>;
|
|
155
|
-
export declare const GetStopIncomingTripsInputSchema: z.ZodObject<{
|
|
156
|
-
stopId: z.ZodString;
|
|
157
|
-
isMapView: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
158
|
-
}, "strip", z.ZodTypeAny, {
|
|
159
|
-
stopId: string;
|
|
160
|
-
isMapView: boolean;
|
|
161
|
-
}, {
|
|
162
|
-
stopId: string;
|
|
163
|
-
isMapView?: boolean | undefined;
|
|
164
|
-
}>;
|
|
165
|
-
export declare const StopIncomingTripsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
166
|
-
tripId: z.ZodString;
|
|
167
|
-
routeShortName: z.ZodString;
|
|
168
|
-
headsign: z.ZodString;
|
|
169
|
-
expectedArrivalDateTime: z.ZodString;
|
|
170
|
-
hasLiveTracking: z.ZodBoolean;
|
|
171
|
-
daysFromToday: z.ZodNumber;
|
|
172
|
-
shapeId: z.ZodString;
|
|
173
|
-
vehicles: z.ZodArray<z.ZodObject<{
|
|
174
|
-
id: z.ZodString;
|
|
175
|
-
isForDisabledPeople: z.ZodNullable<z.ZodBoolean>;
|
|
176
|
-
vehicleTypeId: z.ZodNullable<z.ZodNumber>;
|
|
177
|
-
position: z.ZodOptional<z.ZodObject<{
|
|
178
|
-
latitude: z.ZodNumber;
|
|
179
|
-
longitude: z.ZodNumber;
|
|
180
|
-
}, "strip", z.ZodTypeAny, {
|
|
181
|
-
latitude: number;
|
|
182
|
-
longitude: number;
|
|
183
|
-
}, {
|
|
184
|
-
latitude: number;
|
|
185
|
-
longitude: number;
|
|
186
|
-
}>>;
|
|
187
|
-
}, "strip", z.ZodTypeAny, {
|
|
188
|
-
id: string;
|
|
189
|
-
isForDisabledPeople: boolean | null;
|
|
190
|
-
vehicleTypeId: number | null;
|
|
191
|
-
position?: {
|
|
192
|
-
latitude: number;
|
|
193
|
-
longitude: number;
|
|
194
|
-
} | undefined;
|
|
195
|
-
}, {
|
|
196
|
-
id: string;
|
|
197
|
-
isForDisabledPeople: boolean | null;
|
|
198
|
-
vehicleTypeId: number | null;
|
|
199
|
-
position?: {
|
|
200
|
-
latitude: number;
|
|
201
|
-
longitude: number;
|
|
202
|
-
} | undefined;
|
|
203
|
-
}>, "many">;
|
|
204
|
-
}, "strip", z.ZodTypeAny, {
|
|
205
|
-
tripId: string;
|
|
206
|
-
routeShortName: string;
|
|
207
|
-
headsign: string;
|
|
208
|
-
expectedArrivalDateTime: string;
|
|
209
|
-
hasLiveTracking: boolean;
|
|
210
|
-
daysFromToday: number;
|
|
211
|
-
shapeId: string;
|
|
212
|
-
vehicles: {
|
|
213
|
-
id: string;
|
|
214
|
-
isForDisabledPeople: boolean | null;
|
|
215
|
-
vehicleTypeId: number | null;
|
|
216
|
-
position?: {
|
|
217
|
-
latitude: number;
|
|
218
|
-
longitude: number;
|
|
219
|
-
} | undefined;
|
|
220
|
-
}[];
|
|
221
|
-
}, {
|
|
222
|
-
tripId: string;
|
|
223
|
-
routeShortName: string;
|
|
224
|
-
headsign: string;
|
|
225
|
-
expectedArrivalDateTime: string;
|
|
226
|
-
hasLiveTracking: boolean;
|
|
227
|
-
daysFromToday: number;
|
|
228
|
-
shapeId: string;
|
|
229
|
-
vehicles: {
|
|
230
|
-
id: string;
|
|
231
|
-
isForDisabledPeople: boolean | null;
|
|
232
|
-
vehicleTypeId: number | null;
|
|
233
|
-
position?: {
|
|
234
|
-
latitude: number;
|
|
235
|
-
longitude: number;
|
|
236
|
-
} | undefined;
|
|
237
|
-
}[];
|
|
238
|
-
}>, "many">;
|
package/dist/core/auth-types.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StopIncomingTripsResponseSchema = exports.GetStopIncomingTripsInputSchema = exports.StopIncomingTripSchema = exports.AccountSchema = exports.RefreshTokenRequestSchema = exports.AuthTokensSchema = exports.LoginCredentialsSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.LoginCredentialsSchema = zod_1.z.object({
|
|
6
|
-
username: zod_1.z.string().email(),
|
|
7
|
-
password: zod_1.z.string(),
|
|
8
|
-
revokeOtherTokens: zod_1.z.boolean().optional().default(false),
|
|
9
|
-
fcmToken: zod_1.z.string().optional(),
|
|
10
|
-
});
|
|
11
|
-
exports.AuthTokensSchema = zod_1.z.object({
|
|
12
|
-
accessToken: zod_1.z.string(),
|
|
13
|
-
refreshToken: zod_1.z.string(),
|
|
14
|
-
});
|
|
15
|
-
exports.RefreshTokenRequestSchema = zod_1.z.object({
|
|
16
|
-
refreshToken: zod_1.z.string(),
|
|
17
|
-
});
|
|
18
|
-
exports.AccountSchema = zod_1.z.object({
|
|
19
|
-
id: zod_1.z.number(),
|
|
20
|
-
uid: zod_1.z.string(),
|
|
21
|
-
email: zod_1.z.string().email(),
|
|
22
|
-
firstName: zod_1.z.string(),
|
|
23
|
-
lastName: zod_1.z.string(),
|
|
24
|
-
ePurseAmount: zod_1.z.number(),
|
|
25
|
-
clientId: zod_1.z.number().nullable(),
|
|
26
|
-
language: zod_1.z.number(),
|
|
27
|
-
isFullProfileActivationInProgress: zod_1.z.boolean(),
|
|
28
|
-
messages: zod_1.z.array(zod_1.z.unknown()),
|
|
29
|
-
processes: zod_1.z.unknown().nullable(),
|
|
30
|
-
});
|
|
31
|
-
exports.StopIncomingTripSchema = zod_1.z.object({
|
|
32
|
-
tripId: zod_1.z.string(),
|
|
33
|
-
routeShortName: zod_1.z.string(),
|
|
34
|
-
headsign: zod_1.z.string(),
|
|
35
|
-
expectedArrivalDateTime: zod_1.z.string(),
|
|
36
|
-
hasLiveTracking: zod_1.z.boolean(),
|
|
37
|
-
daysFromToday: zod_1.z.number(),
|
|
38
|
-
shapeId: zod_1.z.string(),
|
|
39
|
-
vehicles: zod_1.z.array(zod_1.z.object({
|
|
40
|
-
id: zod_1.z.string(),
|
|
41
|
-
isForDisabledPeople: zod_1.z.boolean().nullable(),
|
|
42
|
-
vehicleTypeId: zod_1.z.number().nullable(),
|
|
43
|
-
position: zod_1.z.object({
|
|
44
|
-
latitude: zod_1.z.number(),
|
|
45
|
-
longitude: zod_1.z.number(),
|
|
46
|
-
}).optional(),
|
|
47
|
-
})),
|
|
48
|
-
});
|
|
49
|
-
exports.GetStopIncomingTripsInputSchema = zod_1.z.object({
|
|
50
|
-
stopId: zod_1.z.string(),
|
|
51
|
-
isMapView: zod_1.z.boolean().optional().default(false),
|
|
52
|
-
});
|
|
53
|
-
// Response Schemas
|
|
54
|
-
exports.StopIncomingTripsResponseSchema = zod_1.z.array(exports.StopIncomingTripSchema);
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { RouteTypeEnum, LocationTypeEnum } from './constants';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type Agency = z.infer<typeof AgencySchema>;
|
|
4
|
-
export declare const AgencySchema: z.ZodObject<{
|
|
5
|
-
agencyId: z.ZodString;
|
|
6
|
-
agencyName: z.ZodString;
|
|
7
|
-
agencyUrl: z.ZodString;
|
|
8
|
-
agencyTimezone: z.ZodString;
|
|
9
|
-
agencyLang: z.ZodOptional<z.ZodString>;
|
|
10
|
-
agencyPhone: z.ZodOptional<z.ZodString>;
|
|
11
|
-
agencyFareUrl: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
agencyId: string;
|
|
14
|
-
agencyName: string;
|
|
15
|
-
agencyUrl: string;
|
|
16
|
-
agencyTimezone: string;
|
|
17
|
-
agencyLang?: string | undefined;
|
|
18
|
-
agencyPhone?: string | undefined;
|
|
19
|
-
agencyFareUrl?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
agencyId: string;
|
|
22
|
-
agencyName: string;
|
|
23
|
-
agencyUrl: string;
|
|
24
|
-
agencyTimezone: string;
|
|
25
|
-
agencyLang?: string | undefined;
|
|
26
|
-
agencyPhone?: string | undefined;
|
|
27
|
-
agencyFareUrl?: string | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
export type GTFSRoute = z.infer<typeof GTFSRouteSchema>;
|
|
30
|
-
export declare const GTFSRouteSchema: z.ZodObject<{
|
|
31
|
-
routeId: z.ZodNumber;
|
|
32
|
-
agencyId: z.ZodString;
|
|
33
|
-
routeShortName: z.ZodString;
|
|
34
|
-
routeLongName: z.ZodString;
|
|
35
|
-
routeDesc: z.ZodOptional<z.ZodString>;
|
|
36
|
-
routeType: z.ZodNativeEnum<typeof RouteTypeEnum>;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
routeType: RouteTypeEnum;
|
|
39
|
-
routeId: number;
|
|
40
|
-
routeShortName: string;
|
|
41
|
-
agencyId: string;
|
|
42
|
-
routeLongName: string;
|
|
43
|
-
routeDesc?: string | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
routeType: RouteTypeEnum;
|
|
46
|
-
routeId: number;
|
|
47
|
-
routeShortName: string;
|
|
48
|
-
agencyId: string;
|
|
49
|
-
routeLongName: string;
|
|
50
|
-
routeDesc?: string | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
export type GTFSStop = z.infer<typeof GTFSStopSchema>;
|
|
53
|
-
export declare const GTFSStopSchema: z.ZodObject<{
|
|
54
|
-
stopId: z.ZodString;
|
|
55
|
-
stopCode: z.ZodOptional<z.ZodString>;
|
|
56
|
-
stopName: z.ZodString;
|
|
57
|
-
stopDesc: z.ZodOptional<z.ZodString>;
|
|
58
|
-
stopLat: z.ZodNumber;
|
|
59
|
-
stopLon: z.ZodNumber;
|
|
60
|
-
zoneId: z.ZodOptional<z.ZodString>;
|
|
61
|
-
stopUrl: z.ZodOptional<z.ZodString>;
|
|
62
|
-
locationType: z.ZodDefault<z.ZodNativeEnum<typeof LocationTypeEnum>>;
|
|
63
|
-
parentStation: z.ZodOptional<z.ZodString>;
|
|
64
|
-
}, "strip", z.ZodTypeAny, {
|
|
65
|
-
stopLat: number;
|
|
66
|
-
stopName: string;
|
|
67
|
-
stopId: string;
|
|
68
|
-
stopLon: number;
|
|
69
|
-
locationType: LocationTypeEnum;
|
|
70
|
-
stopCode?: string | undefined;
|
|
71
|
-
stopDesc?: string | undefined;
|
|
72
|
-
zoneId?: string | undefined;
|
|
73
|
-
stopUrl?: string | undefined;
|
|
74
|
-
parentStation?: string | undefined;
|
|
75
|
-
}, {
|
|
76
|
-
stopLat: number;
|
|
77
|
-
stopName: string;
|
|
78
|
-
stopId: string;
|
|
79
|
-
stopLon: number;
|
|
80
|
-
stopCode?: string | undefined;
|
|
81
|
-
stopDesc?: string | undefined;
|
|
82
|
-
zoneId?: string | undefined;
|
|
83
|
-
stopUrl?: string | undefined;
|
|
84
|
-
locationType?: LocationTypeEnum | undefined;
|
|
85
|
-
parentStation?: string | undefined;
|
|
86
|
-
}>;
|
|
87
|
-
export type GTFSTrip = z.infer<typeof GTFSTripSchema>;
|
|
88
|
-
export declare const GTFSTripSchema: z.ZodObject<{
|
|
89
|
-
routeId: z.ZodNumber;
|
|
90
|
-
serviceId: z.ZodString;
|
|
91
|
-
tripId: z.ZodString;
|
|
92
|
-
tripHeadsign: z.ZodOptional<z.ZodString>;
|
|
93
|
-
tripShortName: z.ZodOptional<z.ZodString>;
|
|
94
|
-
directionId: z.ZodNumber;
|
|
95
|
-
blockId: z.ZodOptional<z.ZodString>;
|
|
96
|
-
shapeId: z.ZodString;
|
|
97
|
-
}, "strip", z.ZodTypeAny, {
|
|
98
|
-
shapeId: string;
|
|
99
|
-
routeId: number;
|
|
100
|
-
tripId: string;
|
|
101
|
-
serviceId: string;
|
|
102
|
-
directionId: number;
|
|
103
|
-
tripHeadsign?: string | undefined;
|
|
104
|
-
tripShortName?: string | undefined;
|
|
105
|
-
blockId?: string | undefined;
|
|
106
|
-
}, {
|
|
107
|
-
shapeId: string;
|
|
108
|
-
routeId: number;
|
|
109
|
-
tripId: string;
|
|
110
|
-
serviceId: string;
|
|
111
|
-
directionId: number;
|
|
112
|
-
tripHeadsign?: string | undefined;
|
|
113
|
-
tripShortName?: string | undefined;
|
|
114
|
-
blockId?: string | undefined;
|
|
115
|
-
}>;
|
|
116
|
-
export type GTFSStopTime = z.infer<typeof GTFSStopTimeSchema>;
|
|
117
|
-
export declare const GTFSStopTimeSchema: z.ZodObject<{
|
|
118
|
-
tripId: z.ZodString;
|
|
119
|
-
arrivalTime: z.ZodString;
|
|
120
|
-
departureTime: z.ZodString;
|
|
121
|
-
stopId: z.ZodString;
|
|
122
|
-
stopSequence: z.ZodNumber;
|
|
123
|
-
stopHeadsign: z.ZodOptional<z.ZodString>;
|
|
124
|
-
pickupType: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
125
|
-
dropOffType: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
126
|
-
shapeDistTraveled: z.ZodOptional<z.ZodNumber>;
|
|
127
|
-
}, "strip", z.ZodTypeAny, {
|
|
128
|
-
stopSequence: number;
|
|
129
|
-
stopId: string;
|
|
130
|
-
tripId: string;
|
|
131
|
-
arrivalTime: string;
|
|
132
|
-
departureTime: string;
|
|
133
|
-
pickupType: number;
|
|
134
|
-
dropOffType: number;
|
|
135
|
-
stopHeadsign?: string | undefined;
|
|
136
|
-
shapeDistTraveled?: number | undefined;
|
|
137
|
-
}, {
|
|
138
|
-
stopSequence: number;
|
|
139
|
-
stopId: string;
|
|
140
|
-
tripId: string;
|
|
141
|
-
arrivalTime: string;
|
|
142
|
-
departureTime: string;
|
|
143
|
-
stopHeadsign?: string | undefined;
|
|
144
|
-
pickupType?: number | undefined;
|
|
145
|
-
dropOffType?: number | undefined;
|
|
146
|
-
shapeDistTraveled?: number | undefined;
|
|
147
|
-
}>;
|
|
148
|
-
export type GTFSShapePoint = z.infer<typeof GTFSShapePointSchema>;
|
|
149
|
-
export declare const GTFSShapePointSchema: z.ZodObject<{
|
|
150
|
-
shapeId: z.ZodString;
|
|
151
|
-
shapePtLat: z.ZodNumber;
|
|
152
|
-
shapePtLon: z.ZodNumber;
|
|
153
|
-
shapePtSequence: z.ZodNumber;
|
|
154
|
-
shapeDistTraveled: z.ZodOptional<z.ZodNumber>;
|
|
155
|
-
}, "strip", z.ZodTypeAny, {
|
|
156
|
-
shapeId: string;
|
|
157
|
-
shapePtLat: number;
|
|
158
|
-
shapePtLon: number;
|
|
159
|
-
shapePtSequence: number;
|
|
160
|
-
shapeDistTraveled?: number | undefined;
|
|
161
|
-
}, {
|
|
162
|
-
shapeId: string;
|
|
163
|
-
shapePtLat: number;
|
|
164
|
-
shapePtLon: number;
|
|
165
|
-
shapePtSequence: number;
|
|
166
|
-
shapeDistTraveled?: number | undefined;
|
|
167
|
-
}>;
|
|
168
|
-
export type GTFSFeedInfo = z.infer<typeof GTFSFeedInfoSchema>;
|
|
169
|
-
export declare const GTFSFeedInfoSchema: z.ZodObject<{
|
|
170
|
-
feedPublisherName: z.ZodString;
|
|
171
|
-
feedPublisherUrl: z.ZodString;
|
|
172
|
-
feedLang: z.ZodString;
|
|
173
|
-
feedStartDate: z.ZodOptional<z.ZodString>;
|
|
174
|
-
feedEndDate: z.ZodOptional<z.ZodString>;
|
|
175
|
-
feedVersion: z.ZodOptional<z.ZodString>;
|
|
176
|
-
}, "strip", z.ZodTypeAny, {
|
|
177
|
-
feedPublisherName: string;
|
|
178
|
-
feedPublisherUrl: string;
|
|
179
|
-
feedLang: string;
|
|
180
|
-
feedStartDate?: string | undefined;
|
|
181
|
-
feedEndDate?: string | undefined;
|
|
182
|
-
feedVersion?: string | undefined;
|
|
183
|
-
}, {
|
|
184
|
-
feedPublisherName: string;
|
|
185
|
-
feedPublisherUrl: string;
|
|
186
|
-
feedLang: string;
|
|
187
|
-
feedStartDate?: string | undefined;
|
|
188
|
-
feedEndDate?: string | undefined;
|
|
189
|
-
feedVersion?: string | undefined;
|
|
190
|
-
}>;
|
|
191
|
-
export type Shape = {
|
|
192
|
-
shapeId: string;
|
|
193
|
-
points: {
|
|
194
|
-
lat: number;
|
|
195
|
-
lon: number;
|
|
196
|
-
sequence: number;
|
|
197
|
-
}[];
|
|
198
|
-
};
|