Skip to content

Commit

Permalink
ts file regenerated
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhtr committed Jun 3, 2020
1 parent e01bdc2 commit 964ced1
Showing 1 changed file with 79 additions and 135 deletions.
214 changes: 79 additions & 135 deletions maas-schemas-ts/src/core/components/travel-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ Transfer modes used for MaaS internal services
*/

import * as t from "io-ts";
import * as t from 'io-ts';

export const schemaId =
"http://maasglobal.com/core/components/travel-mode.json";
export const schemaId = 'http://maasglobal.com/core/components/travel-mode.json';

// WaitingMode
// A mode that only involves waiting in the current location
export type WaitingMode = t.Branded<string & "WAIT", WaitingModeBrand>;
export type WaitingMode = t.Branded<string & 'WAIT', WaitingModeBrand>;
export const WaitingMode = t.brand(
t.intersection([t.string, t.literal("WAIT")]),
(x): x is t.Branded<string & "WAIT", WaitingModeBrand> => true,
"WaitingMode"
t.intersection([t.string, t.literal('WAIT')]),
(x): x is t.Branded<string & 'WAIT', WaitingModeBrand> => true,
'WaitingMode',
);
export interface WaitingModeBrand {
readonly WaitingMode: unique symbol;
Expand All @@ -27,19 +26,13 @@ export interface WaitingModeBrand {
// TransferMode
// A mode that involves changing transports
export type TransferMode = t.Branded<
string & ("LEG_SWITCH" | "TRANSFER"),
string & ('LEG_SWITCH' | 'TRANSFER'),
TransferModeBrand
>;
export const TransferMode = t.brand(
t.intersection([
t.string,
t.union([t.literal("LEG_SWITCH"), t.literal("TRANSFER")]),
]),
(
x
): x is t.Branded<string & ("LEG_SWITCH" | "TRANSFER"), TransferModeBrand> =>
true,
"TransferMode"
t.intersection([t.string, t.union([t.literal('LEG_SWITCH'), t.literal('TRANSFER')])]),
(x): x is t.Branded<string & ('LEG_SWITCH' | 'TRANSFER'), TransferModeBrand> => true,
'TransferMode',
);
export interface TransferModeBrand {
readonly TransferMode: unique symbol;
Expand All @@ -49,44 +42,29 @@ export interface TransferModeBrand {
// A mode that involves using your personal vehicle or legs
export type PersonalMode = t.Branded<
string &
(
| "BICYCLE"
| "CAR"
| "SCOOTER"
| "SHARED_BICYCLE"
| "WALK"
| "SHARED_E_BICYCLE"
),
('BICYCLE' | 'CAR' | 'SCOOTER' | 'SHARED_BICYCLE' | 'WALK' | 'SHARED_E_BICYCLE'),
PersonalModeBrand
>;
export const PersonalMode = t.brand(
t.intersection([
t.string,
t.union([
t.literal("BICYCLE"),
t.literal("CAR"),
t.literal("SCOOTER"),
t.literal("SHARED_BICYCLE"),
t.literal("BICYCLE_RENT"),
t.literal("WALK"),
t.literal("SHARED_E_BICYCLE"),
t.literal('BICYCLE'),
t.literal('CAR'),
t.literal('SCOOTER'),
t.literal('SHARED_BICYCLE'),
t.literal('WALK'),
t.literal('SHARED_E_BICYCLE'),
]),
]),
(
x
x,
): x is t.Branded<
string &
(
| "BICYCLE"
| "CAR"
| "SCOOTER"
| "SHARED_BICYCLE"
| "WALK"
| "SHARED_E_BICYCLE"
),
('BICYCLE' | 'CAR' | 'SCOOTER' | 'SHARED_BICYCLE' | 'WALK' | 'SHARED_E_BICYCLE'),
PersonalModeBrand
> => true,
"PersonalMode"
'PersonalMode',
);
export interface PersonalModeBrand {
readonly PersonalMode: unique symbol;
Expand All @@ -96,49 +74,31 @@ export interface PersonalModeBrand {
// A mode that involves transit with fixed schedules
export type PublicTransitMode = t.Branded<
string &
(
| "AEROPLANE"
| "BUS"
| "FERRY"
| "RAIL"
| "SUBWAY"
| "TRAIN"
| "TRAM"
| "TRANSIT"
),
('AEROPLANE' | 'BUS' | 'FERRY' | 'RAIL' | 'SUBWAY' | 'TRAIN' | 'TRAM' | 'TRANSIT'),
PublicTransitModeBrand
>;
export const PublicTransitMode = t.brand(
t.intersection([
t.string,
t.union([
t.literal("AEROPLANE"),
t.literal("BUS"),
t.literal("FERRY"),
t.literal("RAIL"),
t.literal("SUBWAY"),
t.literal("TRAIN"),
t.literal("TRAM"),
t.literal("TRANSIT"),
t.literal('AEROPLANE'),
t.literal('BUS'),
t.literal('FERRY'),
t.literal('RAIL'),
t.literal('SUBWAY'),
t.literal('TRAIN'),
t.literal('TRAM'),
t.literal('TRANSIT'),
]),
]),
(
x
x,
): x is t.Branded<
string &
(
| "AEROPLANE"
| "BUS"
| "FERRY"
| "RAIL"
| "SUBWAY"
| "TRAIN"
| "TRAM"
| "TRANSIT"
),
('AEROPLANE' | 'BUS' | 'FERRY' | 'RAIL' | 'SUBWAY' | 'TRAIN' | 'TRAM' | 'TRANSIT'),
PublicTransitModeBrand
> => true,
"PublicTransitMode"
'PublicTransitMode',
);
export interface PublicTransitModeBrand {
readonly PublicTransitMode: unique symbol;
Expand All @@ -149,48 +109,48 @@ export interface PublicTransitModeBrand {
export type PrivateTransitMode = t.Branded<
string &
(
| "BUSISH"
| "CABLE_CAR"
| "CAR"
| "FUNICULAR"
| "GONDOLA"
| "SHARED_CAR"
| "TAXI"
| "TRAINISH"
| 'BUSISH'
| 'CABLE_CAR'
| 'CAR'
| 'FUNICULAR'
| 'GONDOLA'
| 'SHARED_CAR'
| 'TAXI'
| 'TRAINISH'
),
PrivateTransitModeBrand
>;
export const PrivateTransitMode = t.brand(
t.intersection([
t.string,
t.union([
t.literal("BUSISH"),
t.literal("CABLE_CAR"),
t.literal("CAR"),
t.literal("FUNICULAR"),
t.literal("GONDOLA"),
t.literal("SHARED_CAR"),
t.literal("TAXI"),
t.literal("TRAINISH"),
t.literal('BUSISH'),
t.literal('CABLE_CAR'),
t.literal('CAR'),
t.literal('FUNICULAR'),
t.literal('GONDOLA'),
t.literal('SHARED_CAR'),
t.literal('TAXI'),
t.literal('TRAINISH'),
]),
]),
(
x
x,
): x is t.Branded<
string &
(
| "BUSISH"
| "CABLE_CAR"
| "CAR"
| "FUNICULAR"
| "GONDOLA"
| "SHARED_CAR"
| "TAXI"
| "TRAINISH"
| 'BUSISH'
| 'CABLE_CAR'
| 'CAR'
| 'FUNICULAR'
| 'GONDOLA'
| 'SHARED_CAR'
| 'TAXI'
| 'TRAINISH'
),
PrivateTransitModeBrand
> => true,
"PrivateTransitMode"
'PrivateTransitMode',
);
export interface PrivateTransitModeBrand {
readonly PrivateTransitMode: unique symbol;
Expand All @@ -200,46 +160,38 @@ export interface PrivateTransitModeBrand {
// A more general mode that abstracts more specific sub-modes
export type SuperMode = t.Branded<
string &
(
| "WALK"
| "PUBLIC_TRANSIT"
| "TAXI"
| "CAR"
| "BICYCLE"
| "BICYCLE_RENT"
| "UNKNOWN"
),
('WALK' | 'PUBLIC_TRANSIT' | 'TAXI' | 'CAR' | 'BICYCLE' | 'BICYCLE_RENT' | 'UNKNOWN'),
SuperModeBrand
>;
export const SuperMode = t.brand(
t.intersection([
t.string,
t.union([
t.literal("WALK"),
t.literal("PUBLIC_TRANSIT"),
t.literal("TAXI"),
t.literal("CAR"),
t.literal("BICYCLE"),
t.literal("BICYCLE_RENT"),
t.literal("UNKNOWN"),
t.literal('WALK'),
t.literal('PUBLIC_TRANSIT'),
t.literal('TAXI'),
t.literal('CAR'),
t.literal('BICYCLE'),
t.literal('BICYCLE_RENT'),
t.literal('UNKNOWN'),
]),
]),
(
x
x,
): x is t.Branded<
string &
(
| "WALK"
| "PUBLIC_TRANSIT"
| "TAXI"
| "CAR"
| "BICYCLE"
| "BICYCLE_RENT"
| "UNKNOWN"
| 'WALK'
| 'PUBLIC_TRANSIT'
| 'TAXI'
| 'CAR'
| 'BICYCLE'
| 'BICYCLE_RENT'
| 'UNKNOWN'
),
SuperModeBrand
> => true,
"SuperMode"
'SuperMode',
);
export interface SuperModeBrand {
readonly SuperMode: unique symbol;
Expand All @@ -248,11 +200,7 @@ export interface SuperModeBrand {
// TravelMode
// The default export. More information at the top.
export type TravelMode = t.Branded<
| WaitingMode
| TransferMode
| PersonalMode
| PublicTransitMode
| PrivateTransitMode,
WaitingMode | TransferMode | PersonalMode | PublicTransitMode | PrivateTransitMode,
TravelModeBrand
>;
export const TravelMode = t.brand(
Expand All @@ -264,16 +212,12 @@ export const TravelMode = t.brand(
PrivateTransitMode,
]),
(
x
x,
): x is t.Branded<
| WaitingMode
| TransferMode
| PersonalMode
| PublicTransitMode
| PrivateTransitMode,
WaitingMode | TransferMode | PersonalMode | PublicTransitMode | PrivateTransitMode,
TravelModeBrand
> => true,
"TravelMode"
'TravelMode',
);
export interface TravelModeBrand {
readonly TravelMode: unique symbol;
Expand Down

0 comments on commit 964ced1

Please sign in to comment.