corequery 0.31.3 → 0.32.1
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/package.json +1 -1
- package/server/dist/server/api/args-error.d.ts +3 -0
- package/server/dist/server/api/args-error.js +7 -0
- package/server/dist/server/api/args-error.js.map +1 -0
- package/server/dist/server/api/create-api-router.js +8 -6
- package/server/dist/server/api/create-api-router.js.map +1 -1
- package/server/dist/server/api/handlers/departures/v0/index.d.ts +5 -1
- package/server/dist/server/api/handlers/departures/v0/index.js +85 -39
- package/server/dist/server/api/handlers/departures/v0/index.js.map +1 -1
- package/server/dist/server/api/handlers/departures/v0/to-api-result.d.ts +4 -0
- package/server/dist/server/api/handlers/departures/v0/to-api-result.js +24 -0
- package/server/dist/server/api/handlers/departures/v0/to-api-result.js.map +1 -0
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-line-diagram-entry-foda.d.ts +1 -1
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-line-diagram-foda.d.ts +1 -1
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-line-foda.d.ts +1 -1
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-stop-foda.d.ts +1 -1
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-stop-foda.js +24 -0
- package/server/dist/server/api/handlers/foundational-data/multiversional/multiversional-stop-foda.js.map +1 -1
- package/server/dist/server/config/config.d.ts +7 -1
- package/server/dist/server/config/helpers/corequery-filters.d.ts +14 -0
- package/server/dist/server/config/helpers/corequery-filters.js +37 -0
- package/server/dist/server/config/helpers/corequery-filters.js.map +1 -0
- package/server/dist/server/config/helpers/create-canonical-lines-serving-stop-algorithm.d.ts +1 -1
- package/server/dist/server/config/helpers/index.d.ts +1 -0
- package/server/dist/server/config/helpers/index.js +1 -0
- package/server/dist/server/config/helpers/index.js.map +1 -1
- package/server/dist/server/config/linting/types.d.ts +3 -0
- package/server/dist/server/config/types/custom-filter-function-type.d.ts +8 -0
- package/server/dist/server/config/types/custom-filter-function-type.js +2 -0
- package/server/dist/server/config/types/custom-filter-function-type.js.map +1 -0
- package/server/dist/server/config/types/get-canonical-lines-serving-stop-config.js +2 -0
- package/server/dist/server/config/types/get-canonical-lines-serving-stop-config.js.map +1 -0
- package/server/dist/server/config/types/get-default-departure-feeds-for-stop-config.d.ts +7 -0
- package/server/dist/server/config/types/get-default-departure-feeds-for-stop-config.js +2 -0
- package/server/dist/server/config/types/get-default-departure-feeds-for-stop-config.js.map +1 -0
- package/server/dist/server/config/types/get-filters-for-stop-config.d.ts +15 -0
- package/server/dist/server/config/types/get-filters-for-stop-config.js +2 -0
- package/server/dist/server/config/types/get-filters-for-stop-config.js.map +1 -0
- package/server/dist/server/config/types/index.d.ts +4 -1
- package/server/dist/server/config/types/index.js +4 -1
- package/server/dist/server/config/types/index.js.map +1 -1
- package/server/dist/server/corequery.d.ts +4 -2
- package/server/dist/server/corequery.js +6 -3
- package/server/dist/server/corequery.js.map +1 -1
- package/server/dist/server/data/departure-filters/departure-filter-type.d.ts +9 -0
- package/server/dist/server/data/departure-filters/departure-filter-type.js +9 -0
- package/server/dist/server/data/departure-filters/departure-filter-type.js.map +1 -0
- package/server/dist/server/data/departure-filters/departure-filters.d.ts +31 -0
- package/server/dist/server/data/departure-filters/departure-filters.js +94 -0
- package/server/dist/server/data/departure-filters/departure-filters.js.map +1 -0
- package/server/dist/server/data/departure-filters/index.d.ts +2 -0
- package/server/dist/server/data/departure-filters/index.js +3 -0
- package/server/dist/server/data/departure-filters/index.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/arrival.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/arrival.js +12 -0
- package/server/dist/server/data/departure-filters/types/arrival.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/custom.d.ts +9 -0
- package/server/dist/server/data/departure-filters/types/custom.js +19 -0
- package/server/dist/server/data/departure-filters/types/custom.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/line-tag.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/line-tag.js +17 -0
- package/server/dist/server/data/departure-filters/types/line-tag.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/line.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/line.js +14 -0
- package/server/dist/server/data/departure-filters/types/line.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/position.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/position.js +14 -0
- package/server/dist/server/data/departure-filters/types/position.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/service-tag.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/service-tag.js +14 -0
- package/server/dist/server/data/departure-filters/types/service-tag.js.map +1 -0
- package/server/dist/server/data/departure-filters/types/set-down-only.d.ts +6 -0
- package/server/dist/server/data/departure-filters/types/set-down-only.js +12 -0
- package/server/dist/server/data/departure-filters/types/set-down-only.js.map +1 -0
- package/server/dist/server/data/index.d.ts +3 -6
- package/server/dist/server/data/index.js +3 -6
- package/server/dist/server/data/index.js.map +1 -1
- package/server/dist/server/data/line/index.d.ts +4 -0
- package/server/dist/server/data/line/index.js +5 -0
- package/server/dist/server/data/line/index.js.map +1 -0
- package/server/dist/server/data/{line-collection.d.ts → line/line-collection.d.ts} +2 -2
- package/server/dist/server/data/{line-collection.js → line/line-collection.js} +1 -1
- package/server/dist/server/data/line/line-collection.js.map +1 -0
- package/server/dist/server/data/{line-diagram-entry.d.ts → line/line-diagram-entry.d.ts} +2 -2
- package/server/dist/server/data/{line-diagram-entry.js → line/line-diagram-entry.js} +2 -2
- package/server/dist/server/data/line/line-diagram-entry.js.map +1 -0
- package/server/dist/server/data/{line-diagram.d.ts → line/line-diagram.d.ts} +1 -1
- package/server/dist/server/data/line/line-diagram.js.map +1 -0
- package/server/dist/server/data/{line.d.ts → line/line.d.ts} +3 -3
- package/server/dist/server/data/{line.js → line/line.js} +2 -2
- package/server/dist/server/data/line/line.js.map +1 -0
- package/server/dist/server/data/stop/index.d.ts +5 -0
- package/server/dist/server/data/stop/index.js +6 -0
- package/server/dist/server/data/stop/index.js.map +1 -0
- package/server/dist/server/data/stop/stop-collection.d.ts +9 -0
- package/server/dist/server/data/{stop-collection.js → stop/stop-collection.js} +3 -3
- package/server/dist/server/data/stop/stop-collection.js.map +1 -0
- package/server/dist/server/data/stop/stop-default-departure-feed.d.ts +15 -0
- package/server/dist/server/data/stop/stop-default-departure-feed.js +21 -0
- package/server/dist/server/data/stop/stop-default-departure-feed.js.map +1 -0
- package/server/dist/server/data/stop/stop-departure-filters.d.ts +39 -0
- package/server/dist/server/data/stop/stop-departure-filters.js +63 -0
- package/server/dist/server/data/stop/stop-departure-filters.js.map +1 -0
- package/server/dist/server/data/stop/stop-position.d.ts +13 -0
- package/server/dist/server/data/stop/stop-position.js +18 -0
- package/server/dist/server/data/stop/stop-position.js.map +1 -0
- package/server/dist/server/data/stop/stop.d.ts +34 -0
- package/server/dist/server/data/stop/stop.js +52 -0
- package/server/dist/server/data/stop/stop.js.map +1 -0
- package/server/dist/shared/apis/departures/v0/departure.d.ts +19 -0
- package/server/dist/shared/apis/departures/v0/departure.js +48 -0
- package/server/dist/shared/apis/departures/v0/departure.js.map +1 -0
- package/server/dist/shared/apis/departures/v0/feed.d.ts +10 -0
- package/server/dist/shared/apis/departures/v0/feed.js +15 -0
- package/server/dist/shared/apis/departures/v0/feed.js.map +1 -0
- package/server/dist/shared/apis/departures/v0/index.d.ts +33 -18
- package/server/dist/shared/apis/departures/v0/index.js +12 -68
- package/server/dist/shared/apis/departures/v0/index.js.map +1 -1
- package/server/dist/shared/apis/foundational-data/v1/foundational-data.d.ts +42 -0
- package/server/dist/shared/apis/foundational-data/v1/foundational-data.js +42 -28
- package/server/dist/shared/apis/foundational-data/v1/foundational-data.js.map +1 -1
- package/server/dist/shared/apis/foundational-data/v1/index.d.ts +21 -0
- package/server/dist/shared/data/departure-filter-expression.d.ts +16 -0
- package/server/dist/shared/data/departure-filter-expression.js +82 -0
- package/server/dist/shared/data/departure-filter-expression.js.map +1 -0
- package/web/dist/assets/{About-DGmg1TM-.js → About-BdSlO-kD.js} +1 -1
- package/web/dist/assets/{AdminControls-T05hoDB-.js → AdminControls-DJo59RGN.js} +1 -1
- package/web/dist/assets/{Alert-DfpdtaOB.js → Alert-SQhECZag.js} +1 -1
- package/web/dist/assets/{Debug-Q4Vy4lZ_.js → Debug-5P9iSK2l.js} +1 -1
- package/web/dist/assets/{Home-C6T20k8G.js → Home-hrGQ5RvQ.js} +1 -1
- package/web/dist/assets/{Line-6nd7KD0E.js → Line-ClqpaOxi.js} +1 -1
- package/web/dist/assets/NotFound-D-nyY3X1.js +1 -0
- package/web/dist/assets/{NotFoundPage-UhXr10a9.js → NotFoundPage-qJ2To3wC.js} +1 -1
- package/web/dist/assets/{Picker-D-TjVZAI.js → Picker-di2TPJNV.js} +1 -1
- package/web/dist/assets/{Service-CkHxNopv.js → Service-CjcKHFQZ.js} +1 -1
- package/web/dist/assets/{Settings-Ccrmh7u8.js → Settings-Clz1x2Cr.js} +1 -1
- package/web/dist/assets/{SimpleMobileHeaderContent-Ja68XAJd.js → SimpleMobileHeaderContent-DJTkr_6C.js} +1 -1
- package/web/dist/assets/{Status-CO5w5a1E.js → Status-Bw3AMuJH.js} +1 -1
- package/web/dist/assets/Stop-hkgAICn9.js +1 -0
- package/web/dist/assets/{ZenMode-C3S7FmYt.js → ZenMode-CXXD5IBd.js} +1 -1
- package/web/dist/assets/index-DOvczcZF.js +2 -0
- package/web/dist/assets/{linear-CtNhjlrM.js → linear-BiU4teCm.js} +1 -1
- package/web/dist/assets/{use-api-BJomuYg6.js → use-api-Ft007Dfs.js} +1 -1
- package/web/dist/assets/{use-foda-synced-query-BM-OPAql.js → use-foda-synced-query-hrC70vJ_.js} +1 -1
- package/web/dist/assets/{use-simple-headers-Cbv0t_De.js → use-simple-headers-DM6VutL0.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/server/dist/server/config/types/get-canonical-lines-serving-stop-config-func.js +0 -2
- package/server/dist/server/config/types/get-canonical-lines-serving-stop-config-func.js.map +0 -1
- package/server/dist/server/data/line-collection.js.map +0 -1
- package/server/dist/server/data/line-diagram-entry.js.map +0 -1
- package/server/dist/server/data/line-diagram.js.map +0 -1
- package/server/dist/server/data/line.js.map +0 -1
- package/server/dist/server/data/stop-collection.d.ts +0 -9
- package/server/dist/server/data/stop-collection.js.map +0 -1
- package/server/dist/server/data/stop.d.ts +0 -25
- package/server/dist/server/data/stop.js +0 -36
- package/server/dist/server/data/stop.js.map +0 -1
- package/web/dist/assets/NotFound-BozS7u6u.js +0 -1
- package/web/dist/assets/Stop-BWZOcpvU.js +0 -1
- package/web/dist/assets/index-CrhwkQ9k.js +0 -2
- /package/server/dist/server/config/types/{get-canonical-lines-serving-stop-config-func.d.ts → get-canonical-lines-serving-stop-config.d.ts} +0 -0
- /package/server/dist/server/data/{line-diagram.js → line/line-diagram.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Collection } from "
|
|
1
|
+
import { Collection } from "../../../shared/data/collection.js";
|
|
2
2
|
import { Stop } from "./stop.js";
|
|
3
3
|
export class StopCollection extends Collection {
|
|
4
|
-
static build(stops, stopTagSuccession, getCanonicalLinesServingStop) {
|
|
5
|
-
return new StopCollection(stops.map((s) => Stop.build(s, stopTagSuccession, getCanonicalLinesServingStop(s.id))));
|
|
4
|
+
static build(stops, stopTagSuccession, getCanonicalLinesServingStop, getDepartureFiltersForStop, getDefaultDepartureFeedsForStop) {
|
|
5
|
+
return new StopCollection(stops.map((s) => Stop.build(s, stopTagSuccession, getCanonicalLinesServingStop(s.id), getDepartureFiltersForStop(s.id), getDefaultDepartureFeedsForStop(s.id))));
|
|
6
6
|
}
|
|
7
7
|
_getID(item) {
|
|
8
8
|
return item.id;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-collection.js","sourceRoot":"","sources":["../../../../data/stop/stop-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AASlD,MAAM,OAAO,cAAe,SAAQ,UAAwB;IAC1D,MAAM,CAAC,KAAK,CACV,KAA4B,EAC5B,iBAAsC,EACtC,4BAAgE,EAChE,0BAA4D,EAC5D,+BAAsE;QAEtE,OAAO,IAAI,cAAc,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,IAAI,CAAC,KAAK,CACR,CAAC,EACD,iBAAiB,EACjB,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,EAClC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,EAChC,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC,CACtC,CACF,CACF,CAAC;IACJ,CAAC;IAES,MAAM,CAAC,IAAU;QACzB,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAES,oBAAoB,CAAC,EAAU;QACvC,OAAO,IAAI,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAES,sBAAsB;QAC9B,OAAO,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StopDefaultDepartureFeedConfig } from "../../config/index.js";
|
|
2
|
+
type StopDefaultDepartureFeedFields = {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly desiredCount: number;
|
|
5
|
+
readonly filterExpression: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class StopDefaultDepartureFeed {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly desiredCount: number;
|
|
10
|
+
readonly filterExpression: string;
|
|
11
|
+
constructor(fields: StopDefaultDepartureFeedFields);
|
|
12
|
+
static buildAll(configs: readonly StopDefaultDepartureFeedConfig[]): StopDefaultDepartureFeed[];
|
|
13
|
+
static build(config: StopDefaultDepartureFeedConfig): StopDefaultDepartureFeed;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class StopDefaultDepartureFeed {
|
|
2
|
+
name;
|
|
3
|
+
desiredCount;
|
|
4
|
+
filterExpression;
|
|
5
|
+
constructor(fields) {
|
|
6
|
+
this.name = fields.name;
|
|
7
|
+
this.desiredCount = fields.desiredCount;
|
|
8
|
+
this.filterExpression = fields.filterExpression;
|
|
9
|
+
}
|
|
10
|
+
static buildAll(configs) {
|
|
11
|
+
return configs.map((x) => StopDefaultDepartureFeed.build(x));
|
|
12
|
+
}
|
|
13
|
+
static build(config) {
|
|
14
|
+
return new StopDefaultDepartureFeed({
|
|
15
|
+
name: config.name,
|
|
16
|
+
desiredCount: config.desiredCount,
|
|
17
|
+
filterExpression: config.filterExpression,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=stop-default-departure-feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-default-departure-feed.js","sourceRoot":"","sources":["../../../../data/stop/stop-default-departure-feed.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,wBAAwB;IAC1B,IAAI,CAAS;IACb,YAAY,CAAS;IACrB,gBAAgB,CAAS;IAElC,YAAY,MAAsC;QAChD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAkD;QAChE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAsC;QACjD,OAAO,IAAI,wBAAwB,CAAC;YAClC,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CustomStopDepartureFilterConfig, CustomStopDepartureFilterGroupConfig, StopDepartureFiltersConfig } from "../../config/types/get-filters-for-stop-config.js";
|
|
2
|
+
import type { StopPosition } from "./stop-position.js";
|
|
3
|
+
type StopDepartureFiltersFields = {
|
|
4
|
+
readonly lines: readonly number[];
|
|
5
|
+
readonly positions: readonly number[];
|
|
6
|
+
readonly customGroups: readonly StopDepartureFiltersCustomGroup[];
|
|
7
|
+
};
|
|
8
|
+
export declare class StopDepartureFilters {
|
|
9
|
+
readonly lines: readonly number[];
|
|
10
|
+
readonly positions: readonly number[];
|
|
11
|
+
readonly customGroups: readonly StopDepartureFiltersCustomGroup[];
|
|
12
|
+
constructor(fields: StopDepartureFiltersFields);
|
|
13
|
+
static build(config: StopDepartureFiltersConfig, canonicalLinesServingStop: readonly number[], stopPositions: readonly StopPosition[]): StopDepartureFilters;
|
|
14
|
+
private static _buildLines;
|
|
15
|
+
private static _buildPositions;
|
|
16
|
+
}
|
|
17
|
+
type StopDepartureFiltersCustomGroupFields = {
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly items: StopDepartureFiltersCustomGroupItemFields[];
|
|
20
|
+
};
|
|
21
|
+
export declare class StopDepartureFiltersCustomGroup {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly items: StopDepartureFiltersCustomGroupItem[];
|
|
24
|
+
constructor(fields: StopDepartureFiltersCustomGroupFields);
|
|
25
|
+
static build(config: CustomStopDepartureFilterGroupConfig): StopDepartureFiltersCustomGroup;
|
|
26
|
+
}
|
|
27
|
+
type StopDepartureFiltersCustomGroupItemFields = {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly labelWithinGroup: string;
|
|
30
|
+
readonly filterExpression: string;
|
|
31
|
+
};
|
|
32
|
+
export declare class StopDepartureFiltersCustomGroupItem {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly labelWithinGroup: string;
|
|
35
|
+
readonly filterExpression: string;
|
|
36
|
+
constructor(fields: StopDepartureFiltersCustomGroupItemFields);
|
|
37
|
+
static build(config: CustomStopDepartureFilterConfig): StopDepartureFiltersCustomGroupItem;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export class StopDepartureFilters {
|
|
2
|
+
lines;
|
|
3
|
+
positions;
|
|
4
|
+
customGroups;
|
|
5
|
+
constructor(fields) {
|
|
6
|
+
this.lines = fields.lines;
|
|
7
|
+
this.positions = fields.positions;
|
|
8
|
+
this.customGroups = fields.customGroups;
|
|
9
|
+
}
|
|
10
|
+
static build(config, canonicalLinesServingStop, stopPositions) {
|
|
11
|
+
return new StopDepartureFilters({
|
|
12
|
+
lines: StopDepartureFilters._buildLines(config.lines, canonicalLinesServingStop),
|
|
13
|
+
positions: StopDepartureFilters._buildPositions(config.positions, stopPositions),
|
|
14
|
+
customGroups: config.customGroups.map((x) => StopDepartureFiltersCustomGroup.build(x)),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
static _buildLines(linesConfig, canonicalLinesServingStop) {
|
|
18
|
+
if (linesConfig === "off")
|
|
19
|
+
return [];
|
|
20
|
+
if (linesConfig === "canonical")
|
|
21
|
+
return canonicalLinesServingStop;
|
|
22
|
+
return linesConfig;
|
|
23
|
+
}
|
|
24
|
+
static _buildPositions(positionsConfig, stopPositions) {
|
|
25
|
+
if (positionsConfig === "off")
|
|
26
|
+
return [];
|
|
27
|
+
if (positionsConfig === "all")
|
|
28
|
+
return stopPositions.map((p) => p.id);
|
|
29
|
+
return positionsConfig;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class StopDepartureFiltersCustomGroup {
|
|
33
|
+
label;
|
|
34
|
+
items;
|
|
35
|
+
constructor(fields) {
|
|
36
|
+
this.label = fields.label;
|
|
37
|
+
this.items = fields.items;
|
|
38
|
+
}
|
|
39
|
+
static build(config) {
|
|
40
|
+
return new StopDepartureFiltersCustomGroup({
|
|
41
|
+
label: config.label,
|
|
42
|
+
items: config.items.map((x) => StopDepartureFiltersCustomGroupItem.build(x)),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export class StopDepartureFiltersCustomGroupItem {
|
|
47
|
+
name;
|
|
48
|
+
labelWithinGroup;
|
|
49
|
+
filterExpression;
|
|
50
|
+
constructor(fields) {
|
|
51
|
+
this.name = fields.name;
|
|
52
|
+
this.labelWithinGroup = fields.labelWithinGroup;
|
|
53
|
+
this.filterExpression = fields.filterExpression;
|
|
54
|
+
}
|
|
55
|
+
static build(config) {
|
|
56
|
+
return new StopDepartureFiltersCustomGroupItem({
|
|
57
|
+
name: config.name,
|
|
58
|
+
labelWithinGroup: config.labelWithinGroup,
|
|
59
|
+
filterExpression: config.filterExpression,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=stop-departure-filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-departure-filters.js","sourceRoot":"","sources":["../../../../data/stop/stop-departure-filters.ts"],"names":[],"mappings":"AAaA,MAAM,OAAO,oBAAoB;IACtB,KAAK,CAAoB;IACzB,SAAS,CAAoB;IAC7B,YAAY,CAA6C;IAElE,YAAY,MAAkC;QAC5C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CACV,MAAkC,EAClC,yBAA4C,EAC5C,aAAsC;QAEtC,OAAO,IAAI,oBAAoB,CAAC;YAC9B,KAAK,EAAE,oBAAoB,CAAC,WAAW,CACrC,MAAM,CAAC,KAAK,EACZ,yBAAyB,CAC1B;YACD,SAAS,EAAE,oBAAoB,CAAC,eAAe,CAC7C,MAAM,CAAC,SAAS,EAChB,aAAa,CACd;YACD,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1C,+BAA+B,CAAC,KAAK,CAAC,CAAC,CAAC,CACzC;SACF,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,WAAW,CACxB,WAAgD,EAChD,yBAA4C;QAE5C,IAAI,WAAW,KAAK,KAAK;YAAE,OAAO,EAAE,CAAC;QACrC,IAAI,WAAW,KAAK,WAAW;YAAE,OAAO,yBAAyB,CAAC;QAClE,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,MAAM,CAAC,eAAe,CAC5B,eAAwD,EACxD,aAAsC;QAEtC,IAAI,eAAe,KAAK,KAAK;YAAE,OAAO,EAAE,CAAC;QACzC,IAAI,eAAe,KAAK,KAAK;YAAE,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrE,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAOD,MAAM,OAAO,+BAA+B;IACjC,KAAK,CAAS;IACd,KAAK,CAAwC;IAEtD,YAAY,MAA6C;QACvD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAA4C;QACvD,OAAO,IAAI,+BAA+B,CAAC;YACzC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC5B,mCAAmC,CAAC,KAAK,CAAC,CAAC,CAAC,CAC7C;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAQD,MAAM,OAAO,mCAAmC;IACrC,IAAI,CAAS;IACb,gBAAgB,CAAS;IACzB,gBAAgB,CAAS;IAElC,YAAY,MAAiD;QAC3D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAuC;QAClD,OAAO,IAAI,mCAAmC,CAAC;YAC7C,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PositionConfig } from "../../config/types/stop-config.js";
|
|
2
|
+
type StopPositionFields = {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class StopPosition {
|
|
7
|
+
readonly id: number;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
constructor(fields: StopPositionFields);
|
|
10
|
+
static buildAll(configs: readonly PositionConfig[]): StopPosition[];
|
|
11
|
+
static build(config: PositionConfig): StopPosition;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class StopPosition {
|
|
2
|
+
id;
|
|
3
|
+
name;
|
|
4
|
+
constructor(fields) {
|
|
5
|
+
this.id = fields.id;
|
|
6
|
+
this.name = fields.name;
|
|
7
|
+
}
|
|
8
|
+
static buildAll(configs) {
|
|
9
|
+
return configs.map((x) => StopPosition.build(x));
|
|
10
|
+
}
|
|
11
|
+
static build(config) {
|
|
12
|
+
return new StopPosition({
|
|
13
|
+
id: config.stopPositionId,
|
|
14
|
+
name: config.name,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stop-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-position.js","sourceRoot":"","sources":["../../../../data/stop/stop-position.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,YAAY;IACd,EAAE,CAAS;IACX,IAAI,CAAS;IAEtB,YAAY,MAA0B;QACpC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAkC;QAChD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAsB;QACjC,OAAO,IAAI,YAAY,CAAC;YACtB,EAAE,EAAE,MAAM,CAAC,cAAc;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StopDefaultDepartureFeedsConfig, StopDepartureFiltersConfig, StopConfig, TagSuccessionConfig } from "../../config/index.js";
|
|
2
|
+
import { Tags } from "../tags.js";
|
|
3
|
+
import { Location } from "../location.js";
|
|
4
|
+
import { StopDefaultDepartureFeed } from "./stop-default-departure-feed.js";
|
|
5
|
+
import { StopDepartureFilters } from "./stop-departure-filters.js";
|
|
6
|
+
import { StopPosition } from "./stop-position.js";
|
|
7
|
+
type StopFields = {
|
|
8
|
+
readonly id: number;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly tags: Tags;
|
|
11
|
+
readonly urlPath: string;
|
|
12
|
+
readonly location: Location | null;
|
|
13
|
+
readonly positions: readonly StopPosition[];
|
|
14
|
+
readonly canonicalLinesServingStop: readonly number[];
|
|
15
|
+
readonly departureFilters: StopDepartureFilters;
|
|
16
|
+
readonly defaultDepartureFeeds: readonly StopDefaultDepartureFeed[];
|
|
17
|
+
};
|
|
18
|
+
export declare class Stop {
|
|
19
|
+
readonly id: number;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly tags: Tags;
|
|
22
|
+
readonly urlPath: string;
|
|
23
|
+
readonly location: Location | null;
|
|
24
|
+
readonly positions: readonly StopPosition[];
|
|
25
|
+
readonly canonicalLinesServingStop: readonly number[];
|
|
26
|
+
readonly departureFilters: StopDepartureFilters;
|
|
27
|
+
readonly defaultDepartureFeeds: readonly StopDefaultDepartureFeed[];
|
|
28
|
+
constructor(fields: StopFields);
|
|
29
|
+
static build(stopConfig: StopConfig, stopTagSuccession: TagSuccessionConfig, canonicalLinesServingStop: readonly number[], departureFilters: StopDepartureFiltersConfig, defaultDepartureFeeds: StopDefaultDepartureFeedsConfig): Stop;
|
|
30
|
+
with(newValues: Partial<StopFields>): Stop;
|
|
31
|
+
/** e.g. `"Sandringham" (#1)` */
|
|
32
|
+
get debugName(): string;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Tags } from "../tags.js";
|
|
2
|
+
import { Location } from "../location.js";
|
|
3
|
+
import { StopDefaultDepartureFeed } from "./stop-default-departure-feed.js";
|
|
4
|
+
import { StopDepartureFilters } from "./stop-departure-filters.js";
|
|
5
|
+
import { StopPosition } from "./stop-position.js";
|
|
6
|
+
export class Stop {
|
|
7
|
+
id;
|
|
8
|
+
name;
|
|
9
|
+
tags;
|
|
10
|
+
urlPath;
|
|
11
|
+
location;
|
|
12
|
+
positions;
|
|
13
|
+
canonicalLinesServingStop;
|
|
14
|
+
departureFilters;
|
|
15
|
+
defaultDepartureFeeds;
|
|
16
|
+
constructor(fields) {
|
|
17
|
+
this.id = fields.id;
|
|
18
|
+
this.name = fields.name;
|
|
19
|
+
this.tags = fields.tags;
|
|
20
|
+
this.urlPath = fields.urlPath;
|
|
21
|
+
this.location = fields.location;
|
|
22
|
+
this.positions = fields.positions;
|
|
23
|
+
this.canonicalLinesServingStop = fields.canonicalLinesServingStop;
|
|
24
|
+
this.departureFilters = fields.departureFilters;
|
|
25
|
+
this.defaultDepartureFeeds = fields.defaultDepartureFeeds;
|
|
26
|
+
}
|
|
27
|
+
static build(stopConfig, stopTagSuccession, canonicalLinesServingStop, departureFilters, defaultDepartureFeeds) {
|
|
28
|
+
if (defaultDepartureFeeds.length === 0) {
|
|
29
|
+
throw new Error(`Stop #${stopConfig.id} has no default departure feeds.`);
|
|
30
|
+
}
|
|
31
|
+
const positions = StopPosition.buildAll(stopConfig.positions);
|
|
32
|
+
return new Stop({
|
|
33
|
+
id: stopConfig.id,
|
|
34
|
+
name: stopConfig.name,
|
|
35
|
+
tags: Tags.build(stopConfig.tags, stopTagSuccession),
|
|
36
|
+
urlPath: stopConfig.urlPath,
|
|
37
|
+
location: Location.buildIfPresent(stopConfig.location),
|
|
38
|
+
positions: positions,
|
|
39
|
+
canonicalLinesServingStop,
|
|
40
|
+
departureFilters: StopDepartureFilters.build(departureFilters, canonicalLinesServingStop, positions),
|
|
41
|
+
defaultDepartureFeeds: StopDefaultDepartureFeed.buildAll(defaultDepartureFeeds),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
with(newValues) {
|
|
45
|
+
return new Stop({ ...this, ...newValues });
|
|
46
|
+
}
|
|
47
|
+
/** e.g. `"Sandringham" (#1)` */
|
|
48
|
+
get debugName() {
|
|
49
|
+
return `"${this.name}" (#${this.id})`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../../../data/stop/stop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAenE,MAAM,OAAO,IAAI;IACN,EAAE,CAAS;IACX,IAAI,CAAS;IACb,IAAI,CAAO;IACX,OAAO,CAAS;IAChB,QAAQ,CAAkB;IAC1B,SAAS,CAA0B;IAEnC,yBAAyB,CAAoB;IAC7C,gBAAgB,CAAuB;IACvC,qBAAqB,CAAsC;IAEpE,YAAY,MAAkB;QAC5B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAElC,IAAI,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,CAAC;QAClE,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChD,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,KAAK,CACV,UAAsB,EACtB,iBAAsC,EACtC,yBAA4C,EAC5C,gBAA4C,EAC5C,qBAAsD;QAEtD,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,SAAS,UAAU,CAAC,EAAE,kCAAkC,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE9D,OAAO,IAAI,IAAI,CAAC;YACd,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC;YACpD,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;YACtD,SAAS,EAAE,SAAS;YAEpB,yBAAyB;YACzB,gBAAgB,EAAE,oBAAoB,CAAC,KAAK,CAC1C,gBAAgB,EAChB,yBAAyB,EACzB,SAAS,CACV;YACD,qBAAqB,EAAE,wBAAwB,CAAC,QAAQ,CACtD,qBAAqB,CACtB;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,SAA8B;QACjC,OAAO,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,gCAAgC;IAChC,IAAI,SAAS;QACX,OAAO,IAAI,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,GAAG,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const departureSchema: z.ZodObject<{
|
|
3
|
+
sourceId: z.ZodString;
|
|
4
|
+
intrasourceId: z.ZodString;
|
|
5
|
+
primaryDestinationText: z.ZodString;
|
|
6
|
+
secondaryDestinationText: z.ZodNullable<z.ZodString>;
|
|
7
|
+
lineIds: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
8
|
+
color: z.ZodNullable<z.ZodObject<{
|
|
9
|
+
lightModeHexCode: z.ZodString;
|
|
10
|
+
darkModeHexCode: z.ZodString;
|
|
11
|
+
}, z.z.core.$strip>>;
|
|
12
|
+
isCancelled: z.ZodBoolean;
|
|
13
|
+
movement: z.ZodObject<{
|
|
14
|
+
index: z.ZodNumber;
|
|
15
|
+
positionId: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
time: z.ZodString;
|
|
17
|
+
formerTime: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.z.core.$strip>;
|
|
19
|
+
}, z.z.core.$strip>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export const departureSchema = z.object({
|
|
3
|
+
sourceId: z.string(),
|
|
4
|
+
intrasourceId: z.string(),
|
|
5
|
+
// TODO: Possibly we should calculate these on the frontend, and just pass
|
|
6
|
+
// stop IDs for the destination and stopping pattern array (with an
|
|
7
|
+
// `isServicing` flag for each entry) for the v1 API.
|
|
8
|
+
//
|
|
9
|
+
// We shouldn't just use `stoppingPatternText`, because I could see
|
|
10
|
+
// different users wanting to configure what's shown, e.g. "just list all
|
|
11
|
+
// stops", and Zen mode, which probably re-uses this API, wants to list
|
|
12
|
+
// all stops rather than using "express between X and Y" text.
|
|
13
|
+
//
|
|
14
|
+
// The only complicating factor is how to deal with the fact that
|
|
15
|
+
// sometimes the destination is not from the "current service" we give
|
|
16
|
+
// sourceId/intrasourceId for, but from a future connecting service, e.g.
|
|
17
|
+
// "Watergardens" when viewing citybound departures at Clayton, so we need
|
|
18
|
+
// to find naming for that array that makes it clear that it's all the
|
|
19
|
+
// movements for the same vehicle, until we see a servicing movement at a
|
|
20
|
+
// stop which was already serviced. Once we find that repeated servicing
|
|
21
|
+
// movement, we trim the array to end at the previous servicing movement.
|
|
22
|
+
// What do we call that array?
|
|
23
|
+
//
|
|
24
|
+
// I also don't have a solution in mind for the secondary destination
|
|
25
|
+
// text. If the frontend is expected to calculate it, then my current idea
|
|
26
|
+
// to allow the consumer to configure arbitrary functions returning a
|
|
27
|
+
// `string | null` for a given stop array won't work. I'll need something
|
|
28
|
+
// a little more codified.
|
|
29
|
+
primaryDestinationText: z.string(),
|
|
30
|
+
secondaryDestinationText: z.string().nullable(),
|
|
31
|
+
lineIds: z.number().array().readonly(),
|
|
32
|
+
color: z
|
|
33
|
+
.object({
|
|
34
|
+
lightModeHexCode: z.string(),
|
|
35
|
+
darkModeHexCode: z.string(),
|
|
36
|
+
})
|
|
37
|
+
.nullable(),
|
|
38
|
+
isCancelled: z.boolean(),
|
|
39
|
+
movement: z.object({
|
|
40
|
+
// So that it can link to a service page.
|
|
41
|
+
index: z.number(),
|
|
42
|
+
positionId: z.number().nullable(),
|
|
43
|
+
// "time" not "departureTime", as for arrivals it'll be the arrival time.
|
|
44
|
+
time: z.string(),
|
|
45
|
+
formerTime: z.string().nullable(),
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=departure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departure.js","sourceRoot":"","sources":["../../../../../../shared/apis/departures/v0/departure.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IAEzB,0EAA0E;IAC1E,mEAAmE;IACnE,qDAAqD;IACrD,EAAE;IACF,mEAAmE;IACnE,yEAAyE;IACzE,uEAAuE;IACvE,8DAA8D;IAC9D,EAAE;IACF,iEAAiE;IACjE,sEAAsE;IACtE,yEAAyE;IACzE,0EAA0E;IAC1E,sEAAsE;IACtE,yEAAyE;IACzE,wEAAwE;IACxE,yEAAyE;IACzE,8BAA8B;IAC9B,EAAE;IACF,qEAAqE;IACrE,0EAA0E;IAC1E,qEAAqE;IACrE,yEAAyE;IACzE,0BAA0B;IAC1B,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE;IAClC,wBAAwB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;QAC5B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC5B,CAAC;SACD,QAAQ,EAAE;IAEb,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IAExB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,yCAAyC;QACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QAEjB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAEjC,yEAAyE;QACzE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const feedSchema: z.ZodObject<{
|
|
3
|
+
stopId: z.ZodNumber;
|
|
4
|
+
desiredCount: z.ZodNumber;
|
|
5
|
+
filterExpression: z.ZodString;
|
|
6
|
+
skips: z.ZodArray<z.ZodObject<{
|
|
7
|
+
sourceId: z.ZodString;
|
|
8
|
+
intrasourceId: z.ZodString;
|
|
9
|
+
}, z.z.core.$strip>>;
|
|
10
|
+
}, z.z.core.$strip>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export const feedSchema = z.object({
|
|
3
|
+
stopId: z.number(),
|
|
4
|
+
desiredCount: z.number(),
|
|
5
|
+
filterExpression: z.string(),
|
|
6
|
+
// Will be required for infinite scrolling, as two departures can have the
|
|
7
|
+
// same time.
|
|
8
|
+
skips: z
|
|
9
|
+
.object({
|
|
10
|
+
sourceId: z.string(),
|
|
11
|
+
intrasourceId: z.string(),
|
|
12
|
+
})
|
|
13
|
+
.array(),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.js","sourceRoot":"","sources":["../../../../../../shared/apis/departures/v0/feed.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;IAE5B,0EAA0E;IAC1E,aAAa;IACb,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;KAC1B,CAAC;SACD,KAAK,EAAE;CACX,CAAC,CAAC"}
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
import type { Api } from "../../types.js";
|
|
3
3
|
declare const argsSchema: z.ZodObject<{
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
instant: z.ZodString;
|
|
5
|
+
direction: z.ZodEnum<{
|
|
6
|
+
forwards: "forwards";
|
|
7
|
+
backwards: "backwards";
|
|
8
|
+
}>;
|
|
9
|
+
feeds: z.ZodArray<z.ZodObject<{
|
|
10
|
+
stopId: z.ZodNumber;
|
|
11
|
+
desiredCount: z.ZodNumber;
|
|
12
|
+
filterExpression: z.ZodString;
|
|
13
|
+
skips: z.ZodArray<z.ZodObject<{
|
|
14
|
+
sourceId: z.ZodString;
|
|
15
|
+
intrasourceId: z.ZodString;
|
|
16
|
+
}, z.z.core.$strip>>;
|
|
17
|
+
}, z.z.core.$strip>>;
|
|
6
18
|
}, z.z.core.$strip>;
|
|
7
19
|
declare const resultSchema: z.ZodObject<{
|
|
8
20
|
foundationalDataHash: z.ZodString;
|
|
9
21
|
innerResult: z.ZodObject<{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
feeds: z.ZodArray<z.ZodObject<{
|
|
23
|
+
departures: z.ZodArray<z.ZodObject<{
|
|
24
|
+
sourceId: z.ZodString;
|
|
25
|
+
intrasourceId: z.ZodString;
|
|
26
|
+
primaryDestinationText: z.ZodString;
|
|
27
|
+
secondaryDestinationText: z.ZodNullable<z.ZodString>;
|
|
28
|
+
lineIds: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
29
|
+
color: z.ZodNullable<z.ZodObject<{
|
|
30
|
+
lightModeHexCode: z.ZodString;
|
|
31
|
+
darkModeHexCode: z.ZodString;
|
|
32
|
+
}, z.z.core.$strip>>;
|
|
33
|
+
isCancelled: z.ZodBoolean;
|
|
34
|
+
movement: z.ZodObject<{
|
|
35
|
+
index: z.ZodNumber;
|
|
36
|
+
positionId: z.ZodNullable<z.ZodNumber>;
|
|
37
|
+
time: z.ZodString;
|
|
38
|
+
formerTime: z.ZodNullable<z.ZodString>;
|
|
39
|
+
}, z.z.core.$strip>;
|
|
19
40
|
}, z.z.core.$strip>>;
|
|
20
|
-
isCancelled: z.ZodBoolean;
|
|
21
|
-
movement: z.ZodObject<{
|
|
22
|
-
index: z.ZodNumber;
|
|
23
|
-
positionId: z.ZodNullable<z.ZodNumber>;
|
|
24
|
-
time: z.ZodString;
|
|
25
|
-
formerTime: z.ZodNullable<z.ZodString>;
|
|
26
|
-
}, z.z.core.$strip>;
|
|
27
41
|
}, z.z.core.$strip>>;
|
|
42
|
+
invalidFilterTokens: z.ZodArray<z.ZodString>;
|
|
28
43
|
}, z.z.core.$strip>;
|
|
29
44
|
}, z.z.core.$strip>;
|
|
30
45
|
export declare const api: Api<typeof argsSchema, typeof resultSchema>;
|
|
@@ -1,79 +1,23 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
import { createFodaSyncedResultSchema } from "../../foda-synced-result.js";
|
|
3
|
+
import { departureSchema } from "./departure.js";
|
|
4
|
+
import { feedSchema } from "./feed.js";
|
|
3
5
|
// NOTE: This is a "v0" API, i.e. its not intended to be used by anyone except
|
|
4
6
|
// me, during the "beta" phase. When we switch to "v1" it'll break compatibility
|
|
5
7
|
// with frontends that only understand the v0 API, and that's A-OK.
|
|
6
8
|
const argsSchema = z.object({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// need an array of these arguments! The result needs to be an array too, to
|
|
11
|
-
// compensate.
|
|
12
|
-
//
|
|
13
|
-
// Other things the real v1 API should have:
|
|
14
|
-
//
|
|
15
|
-
// instant: z.string(),
|
|
16
|
-
// direction: z.enum(["forwards", "backwards"]),
|
|
17
|
-
// filters: z.string().array(),
|
|
18
|
-
//
|
|
19
|
-
// // Will be required for infinite scrolling, as two departures can have
|
|
20
|
-
// // the same time.
|
|
21
|
-
// skip: z
|
|
22
|
-
// .object({
|
|
23
|
-
// sourceId: z.string(),
|
|
24
|
-
// intrasourceId: z.string(),
|
|
25
|
-
// })
|
|
26
|
-
// .array(),
|
|
9
|
+
instant: z.string(),
|
|
10
|
+
direction: z.enum(["forwards", "backwards"]),
|
|
11
|
+
feeds: feedSchema.array(),
|
|
27
12
|
});
|
|
28
13
|
const resultSchema = createFodaSyncedResultSchema(z.object({
|
|
29
|
-
departures:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
// We shouldn't just use `stoppingPatternText`, because I could see
|
|
38
|
-
// different users wanting to configure what's shown, e.g. "just list all
|
|
39
|
-
// stops", and Zen mode, which probably re-uses this API, wants to list
|
|
40
|
-
// all stops rather than using "express between X and Y" text.
|
|
41
|
-
//
|
|
42
|
-
// The only complicating factor is how to deal with the fact that
|
|
43
|
-
// sometimes the destination is not from the "current service" we give
|
|
44
|
-
// sourceId/intrasourceId for, but from a future connecting service, e.g.
|
|
45
|
-
// "Watergardens" when viewing citybound departures at Clayton, so we need
|
|
46
|
-
// to find naming for that array that makes it clear that it's all the
|
|
47
|
-
// movements for the same vehicle, until we see a servicing movement at a
|
|
48
|
-
// stop which was already serviced. Once we find that repeated servicing
|
|
49
|
-
// movement, we trim the array to end at the previous servicing movement.
|
|
50
|
-
// What do we call that array?
|
|
51
|
-
//
|
|
52
|
-
// I also don't have a solution in mind for the secondary destination
|
|
53
|
-
// text. If the frontend is expected to calculate it, then my current idea
|
|
54
|
-
// to allow the consumer to configure arbitrary functions returning a
|
|
55
|
-
// `string | null` for a given stop array won't work. I'll need something
|
|
56
|
-
// a little more codified.
|
|
57
|
-
primaryDestinationText: z.string(),
|
|
58
|
-
secondaryDestinationText: z.string().nullable(),
|
|
59
|
-
lineIds: z.number().array().readonly(),
|
|
60
|
-
color: z
|
|
61
|
-
.object({
|
|
62
|
-
lightModeHexCode: z.string(),
|
|
63
|
-
darkModeHexCode: z.string(),
|
|
64
|
-
})
|
|
65
|
-
.nullable(),
|
|
66
|
-
isCancelled: z.boolean(),
|
|
67
|
-
movement: z.object({
|
|
68
|
-
// So that it can link to a service page.
|
|
69
|
-
index: z.number(),
|
|
70
|
-
positionId: z.number().nullable(),
|
|
71
|
-
// "time" not "departureTime", as for arrivals it'll be the arrival time.
|
|
72
|
-
time: z.string(),
|
|
73
|
-
formerTime: z.string().nullable(),
|
|
74
|
-
}),
|
|
75
|
-
})
|
|
76
|
-
.array(),
|
|
14
|
+
feeds: z.object({ departures: departureSchema.array() }).array(),
|
|
15
|
+
// If the client calls the departures API when its FODA is outdated, it
|
|
16
|
+
// might include filter tokens that aren't valid, e.g. `stops-at:123` after
|
|
17
|
+
// stop #123 is gone. In that case, the server will pretend the invalid
|
|
18
|
+
// tokens don't exist, and return them here so the frontend knows to show a
|
|
19
|
+
// toast saying the filters were modified, or whatever.
|
|
20
|
+
invalidFilterTokens: z.string().array(),
|
|
77
21
|
}));
|
|
78
22
|
export const api = {
|
|
79
23
|
path: "/departures/v0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../shared/apis/departures/v0/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../shared/apis/departures/v0/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,8EAA8E;AAC9E,gFAAgF;AAChF,mEAAmE;AAEnE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE5C,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,4BAA4B,CAC/C,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE;IAEhE,uEAAuE;IACvE,2EAA2E;IAC3E,uEAAuE;IACvE,2EAA2E;IAC3E,uDAAuD;IACvD,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;CACxC,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAAgD;IAC9D,IAAI,EAAE,gBAAgB;IACtB,UAAU;IACV,YAAY;CACb,CAAC"}
|
|
@@ -4,10 +4,31 @@ export declare const stopFodaSchema: z.ZodObject<{
|
|
|
4
4
|
name: z.ZodString;
|
|
5
5
|
urlPath: z.ZodString;
|
|
6
6
|
canonicalLinesServingStop: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
7
|
+
positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
8
|
+
id: z.ZodNumber;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
}, z.z.core.$strip>>>;
|
|
7
11
|
location: z.ZodNullable<z.ZodObject<{
|
|
8
12
|
latitude: z.ZodNumber;
|
|
9
13
|
longitude: z.ZodNumber;
|
|
10
14
|
}, z.z.core.$strip>>;
|
|
15
|
+
defaultDepartureFeeds: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
desiredCount: z.ZodNumber;
|
|
18
|
+
filterExpression: z.ZodString;
|
|
19
|
+
}, z.z.core.$strip>>>;
|
|
20
|
+
departureFilters: z.ZodObject<{
|
|
21
|
+
lines: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
22
|
+
positions: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
23
|
+
customGroups: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
24
|
+
label: z.ZodString;
|
|
25
|
+
items: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
labelWithinGroup: z.ZodString;
|
|
28
|
+
filterExpression: z.ZodString;
|
|
29
|
+
}, z.z.core.$strip>>>;
|
|
30
|
+
}, z.z.core.$strip>>>;
|
|
31
|
+
}, z.z.core.$strip>;
|
|
11
32
|
}, z.z.core.$strip>;
|
|
12
33
|
export declare const lineDiagramStopFodaSchema: z.ZodObject<{
|
|
13
34
|
stopId: z.ZodNumber;
|
|
@@ -261,10 +282,31 @@ export declare const fodaSchema: z.ZodObject<{
|
|
|
261
282
|
name: z.ZodString;
|
|
262
283
|
urlPath: z.ZodString;
|
|
263
284
|
canonicalLinesServingStop: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
285
|
+
positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
286
|
+
id: z.ZodNumber;
|
|
287
|
+
name: z.ZodString;
|
|
288
|
+
}, z.z.core.$strip>>>;
|
|
264
289
|
location: z.ZodNullable<z.ZodObject<{
|
|
265
290
|
latitude: z.ZodNumber;
|
|
266
291
|
longitude: z.ZodNumber;
|
|
267
292
|
}, z.z.core.$strip>>;
|
|
293
|
+
defaultDepartureFeeds: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
294
|
+
name: z.ZodString;
|
|
295
|
+
desiredCount: z.ZodNumber;
|
|
296
|
+
filterExpression: z.ZodString;
|
|
297
|
+
}, z.z.core.$strip>>>;
|
|
298
|
+
departureFilters: z.ZodObject<{
|
|
299
|
+
lines: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
300
|
+
positions: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
|
|
301
|
+
customGroups: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
302
|
+
label: z.ZodString;
|
|
303
|
+
items: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
304
|
+
name: z.ZodString;
|
|
305
|
+
labelWithinGroup: z.ZodString;
|
|
306
|
+
filterExpression: z.ZodString;
|
|
307
|
+
}, z.z.core.$strip>>>;
|
|
308
|
+
}, z.z.core.$strip>>>;
|
|
309
|
+
}, z.z.core.$strip>;
|
|
268
310
|
}, z.z.core.$strip>>>;
|
|
269
311
|
lines: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
270
312
|
id: z.ZodNumber;
|