zet-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/.github/workflows/publish-to-npm.yml +80 -0
- package/LICENSE +674 -0
- package/README.md +257 -0
- package/dist/auth/manager.d.ts +19 -0
- package/dist/auth/manager.js +228 -0
- package/dist/auth/types.d.ts +277 -0
- package/dist/auth/types.js +64 -0
- package/dist/core/auth-manager.d.ts +54 -0
- package/dist/core/auth-manager.js +159 -0
- package/dist/core/auth-types.d.ts +238 -0
- package/dist/core/auth-types.js +54 -0
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.js +18 -0
- package/dist/core/constants.d.ts +25 -0
- package/dist/core/constants.js +51 -0
- package/dist/core/gtfs-types.d.ts +198 -0
- package/dist/core/gtfs-types.js +70 -0
- package/dist/core/manager.d.ts +39 -0
- package/dist/core/manager.js +359 -0
- package/dist/core/parsers.d.ts +893 -0
- package/dist/core/parsers.js +110 -0
- package/dist/core/utils.d.ts +4 -0
- package/dist/core/utils.js +59 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/live-polling.d.ts +1 -0
- package/dist/live-polling.js +105 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +35 -0
- package/dist/text.d.ts +1 -0
- package/dist/text.js +35 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,238 @@
|
|
|
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">;
|
|
@@ -0,0 +1,54 @@
|
|
|
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);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
timetableServiceUrl: string;
|
|
4
|
+
newsProxyServiceUrl: string;
|
|
5
|
+
authServiceUrl: string;
|
|
6
|
+
accountServiceUrl: string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const headers: {
|
|
10
|
+
accept: string;
|
|
11
|
+
appuid: string;
|
|
12
|
+
'Content-Type': string;
|
|
13
|
+
language: string;
|
|
14
|
+
'User-Agent': string;
|
|
15
|
+
'x-tenant': string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.headers = void 0;
|
|
4
|
+
exports.default = {
|
|
5
|
+
baseUrl: 'https://api.zet.hr',
|
|
6
|
+
timetableServiceUrl: 'https://api.zet.hr/TimetableService.Api/api/gtfs',
|
|
7
|
+
newsProxyServiceUrl: 'https://api.zet.hr/NewsProxyService.Api/api/newsfeed',
|
|
8
|
+
authServiceUrl: 'https://api.zet.hr/AuthService.Api/api/auth',
|
|
9
|
+
accountServiceUrl: 'https://api.zet.hr/AccountService.Api/api/account',
|
|
10
|
+
};
|
|
11
|
+
exports.headers = {
|
|
12
|
+
'accept': 'application/json, text/plain, */*',
|
|
13
|
+
'appuid': 'ZET.Mobile',
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
'language': 'hr',
|
|
16
|
+
'User-Agent': 'okhttp/4.9.2',
|
|
17
|
+
'x-tenant': 'KingICT_ZET_Public',
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum RouteTypeEnum {
|
|
2
|
+
Tram = 0,
|
|
3
|
+
Bus = 3
|
|
4
|
+
}
|
|
5
|
+
export declare enum DirectionEnum {
|
|
6
|
+
Outbound = 0,// towards destinationHeadsign
|
|
7
|
+
Inbound = 1
|
|
8
|
+
}
|
|
9
|
+
export declare enum TripStatusEnum {
|
|
10
|
+
Unknown = 0,
|
|
11
|
+
Scheduled = 1,
|
|
12
|
+
InProgress = 2,
|
|
13
|
+
Finished = 3
|
|
14
|
+
}
|
|
15
|
+
export declare enum NewsTypeEnum {
|
|
16
|
+
General = 0,
|
|
17
|
+
StationClosure = 1,
|
|
18
|
+
RouteChange = 2,
|
|
19
|
+
ScheduleChange = 3,
|
|
20
|
+
ServiceChange = 4
|
|
21
|
+
}
|
|
22
|
+
export declare const routeTypeMap: Record<RouteTypeEnum, string>;
|
|
23
|
+
export declare const directionMap: Record<DirectionEnum, string>;
|
|
24
|
+
export declare const tripStatusMap: Record<TripStatusEnum, string>;
|
|
25
|
+
export declare const newsTypeMap: Record<NewsTypeEnum, string>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newsTypeMap = exports.tripStatusMap = exports.directionMap = exports.routeTypeMap = exports.NewsTypeEnum = exports.TripStatusEnum = exports.DirectionEnum = exports.RouteTypeEnum = void 0;
|
|
4
|
+
var RouteTypeEnum;
|
|
5
|
+
(function (RouteTypeEnum) {
|
|
6
|
+
RouteTypeEnum[RouteTypeEnum["Tram"] = 0] = "Tram";
|
|
7
|
+
// 1: Subway (not used)
|
|
8
|
+
// 2: Rail (not used)
|
|
9
|
+
RouteTypeEnum[RouteTypeEnum["Bus"] = 3] = "Bus";
|
|
10
|
+
})(RouteTypeEnum || (exports.RouteTypeEnum = RouteTypeEnum = {}));
|
|
11
|
+
var DirectionEnum;
|
|
12
|
+
(function (DirectionEnum) {
|
|
13
|
+
DirectionEnum[DirectionEnum["Outbound"] = 0] = "Outbound";
|
|
14
|
+
DirectionEnum[DirectionEnum["Inbound"] = 1] = "Inbound";
|
|
15
|
+
})(DirectionEnum || (exports.DirectionEnum = DirectionEnum = {}));
|
|
16
|
+
var TripStatusEnum;
|
|
17
|
+
(function (TripStatusEnum) {
|
|
18
|
+
TripStatusEnum[TripStatusEnum["Unknown"] = 0] = "Unknown";
|
|
19
|
+
TripStatusEnum[TripStatusEnum["Scheduled"] = 1] = "Scheduled";
|
|
20
|
+
TripStatusEnum[TripStatusEnum["InProgress"] = 2] = "InProgress";
|
|
21
|
+
TripStatusEnum[TripStatusEnum["Finished"] = 3] = "Finished";
|
|
22
|
+
})(TripStatusEnum || (exports.TripStatusEnum = TripStatusEnum = {}));
|
|
23
|
+
var NewsTypeEnum;
|
|
24
|
+
(function (NewsTypeEnum) {
|
|
25
|
+
NewsTypeEnum[NewsTypeEnum["General"] = 0] = "General";
|
|
26
|
+
NewsTypeEnum[NewsTypeEnum["StationClosure"] = 1] = "StationClosure";
|
|
27
|
+
NewsTypeEnum[NewsTypeEnum["RouteChange"] = 2] = "RouteChange";
|
|
28
|
+
NewsTypeEnum[NewsTypeEnum["ScheduleChange"] = 3] = "ScheduleChange";
|
|
29
|
+
NewsTypeEnum[NewsTypeEnum["ServiceChange"] = 4] = "ServiceChange";
|
|
30
|
+
})(NewsTypeEnum || (exports.NewsTypeEnum = NewsTypeEnum = {}));
|
|
31
|
+
exports.routeTypeMap = {
|
|
32
|
+
[RouteTypeEnum.Tram]: 'Tram',
|
|
33
|
+
[RouteTypeEnum.Bus]: 'Bus',
|
|
34
|
+
};
|
|
35
|
+
exports.directionMap = {
|
|
36
|
+
[DirectionEnum.Outbound]: 'Outbound',
|
|
37
|
+
[DirectionEnum.Inbound]: 'Inbound',
|
|
38
|
+
};
|
|
39
|
+
exports.tripStatusMap = {
|
|
40
|
+
[TripStatusEnum.Unknown]: 'Unknown',
|
|
41
|
+
[TripStatusEnum.Scheduled]: 'Scheduled',
|
|
42
|
+
[TripStatusEnum.InProgress]: 'In Progress',
|
|
43
|
+
[TripStatusEnum.Finished]: 'Finished',
|
|
44
|
+
};
|
|
45
|
+
exports.newsTypeMap = {
|
|
46
|
+
[NewsTypeEnum.General]: 'General',
|
|
47
|
+
[NewsTypeEnum.StationClosure]: 'Station Closure',
|
|
48
|
+
[NewsTypeEnum.RouteChange]: 'Route Change',
|
|
49
|
+
[NewsTypeEnum.ScheduleChange]: 'Schedule Change',
|
|
50
|
+
[NewsTypeEnum.ServiceChange]: 'Service Change',
|
|
51
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GTFSFeedInfoSchema = exports.GTFSShapePointSchema = exports.GTFSStopTimeSchema = exports.GTFSTripSchema = exports.GTFSStopSchema = exports.GTFSRouteSchema = exports.AgencySchema = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.AgencySchema = zod_1.z.object({
|
|
7
|
+
agencyId: zod_1.z.string(),
|
|
8
|
+
agencyName: zod_1.z.string(),
|
|
9
|
+
agencyUrl: zod_1.z.string().url(),
|
|
10
|
+
agencyTimezone: zod_1.z.string(),
|
|
11
|
+
agencyLang: zod_1.z.string().optional(),
|
|
12
|
+
agencyPhone: zod_1.z.string().optional(),
|
|
13
|
+
agencyFareUrl: zod_1.z.string().url().optional(),
|
|
14
|
+
});
|
|
15
|
+
exports.GTFSRouteSchema = zod_1.z.object({
|
|
16
|
+
routeId: zod_1.z.number(),
|
|
17
|
+
agencyId: zod_1.z.string(),
|
|
18
|
+
routeShortName: zod_1.z.string(),
|
|
19
|
+
routeLongName: zod_1.z.string(),
|
|
20
|
+
routeDesc: zod_1.z.string().optional(),
|
|
21
|
+
routeType: zod_1.z.nativeEnum(constants_1.RouteTypeEnum), // 0 = tram, 3 = bus (GTFS standard)
|
|
22
|
+
});
|
|
23
|
+
exports.GTFSStopSchema = zod_1.z.object({
|
|
24
|
+
stopId: zod_1.z.string(),
|
|
25
|
+
stopCode: zod_1.z.string().optional(),
|
|
26
|
+
stopName: zod_1.z.string(),
|
|
27
|
+
stopDesc: zod_1.z.string().optional(),
|
|
28
|
+
stopLat: zod_1.z.number(),
|
|
29
|
+
stopLon: zod_1.z.number(),
|
|
30
|
+
zoneId: zod_1.z.string().optional(),
|
|
31
|
+
stopUrl: zod_1.z.string().optional(),
|
|
32
|
+
locationType: zod_1.z.nativeEnum(constants_1.LocationTypeEnum).default(constants_1.LocationTypeEnum.StopPlatform),
|
|
33
|
+
parentStation: zod_1.z.string().optional(),
|
|
34
|
+
});
|
|
35
|
+
exports.GTFSTripSchema = zod_1.z.object({
|
|
36
|
+
routeId: zod_1.z.number(),
|
|
37
|
+
serviceId: zod_1.z.string(),
|
|
38
|
+
tripId: zod_1.z.string(),
|
|
39
|
+
tripHeadsign: zod_1.z.string().optional(),
|
|
40
|
+
tripShortName: zod_1.z.string().optional(),
|
|
41
|
+
directionId: zod_1.z.number().min(0).max(1), // 0 = outbound (to destination), 1 = inbound (return trip)
|
|
42
|
+
blockId: zod_1.z.string().optional(),
|
|
43
|
+
shapeId: zod_1.z.string(),
|
|
44
|
+
});
|
|
45
|
+
exports.GTFSStopTimeSchema = zod_1.z.object({
|
|
46
|
+
tripId: zod_1.z.string(),
|
|
47
|
+
arrivalTime: zod_1.z.string(), // HH:MM:SS format (can exceed 24:00:00 for trips past midnight, e.g., 25:30:00)
|
|
48
|
+
departureTime: zod_1.z.string(), // HH:MM:SS format (same rules as arrivalTime),
|
|
49
|
+
stopId: zod_1.z.string(),
|
|
50
|
+
stopSequence: zod_1.z.number(),
|
|
51
|
+
stopHeadsign: zod_1.z.string().optional(),
|
|
52
|
+
pickupType: zod_1.z.number().optional().default(0), // 0 = regular pickup, 1 = no pickup, 2 = phone agency, 3 = coordinate with driver
|
|
53
|
+
dropOffType: zod_1.z.number().optional().default(0), // 0 = regular drop-off, 1 = no drop-off, 2 = phone agency, 3 = coordinate with driver
|
|
54
|
+
shapeDistTraveled: zod_1.z.number().optional(),
|
|
55
|
+
});
|
|
56
|
+
exports.GTFSShapePointSchema = zod_1.z.object({
|
|
57
|
+
shapeId: zod_1.z.string(),
|
|
58
|
+
shapePtLat: zod_1.z.number(),
|
|
59
|
+
shapePtLon: zod_1.z.number(),
|
|
60
|
+
shapePtSequence: zod_1.z.number(),
|
|
61
|
+
shapeDistTraveled: zod_1.z.number().optional(),
|
|
62
|
+
});
|
|
63
|
+
exports.GTFSFeedInfoSchema = zod_1.z.object({
|
|
64
|
+
feedPublisherName: zod_1.z.string(),
|
|
65
|
+
feedPublisherUrl: zod_1.z.string().url(),
|
|
66
|
+
feedLang: zod_1.z.string(), // ISO 639-1 language code, e.g., 'hr' for Croatian
|
|
67
|
+
feedStartDate: zod_1.z.string().optional(), // YYYYMMDD format
|
|
68
|
+
feedEndDate: zod_1.z.string().optional(), // YYYYMMDD format
|
|
69
|
+
feedVersion: zod_1.z.string().optional(),
|
|
70
|
+
});
|