@tmlmobilidade/databases 20260528.1147.54 → 20260528.1745.17

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.
@@ -1590,6 +1590,299 @@ declare class RawVehicleEventsNewClass extends MongoInterfaceTemplate<RawVehicle
1590
1590
  created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1591
1591
  entity_id: import("zod").ZodString;
1592
1592
  received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1593
+ } & {
1594
+ payload: import("zod").ZodObject<{
1595
+ header: import("zod").ZodObject<{
1596
+ feed_version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1597
+ gtfs_realtime_version: import("zod").ZodString;
1598
+ incrementality: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodLiteral<"FULL_DATASET">>>;
1599
+ timestamp: import("zod").ZodNumber;
1600
+ }, "strip", import("zod").ZodTypeAny, {
1601
+ timestamp: number;
1602
+ gtfs_realtime_version: string;
1603
+ feed_version?: string | null | undefined;
1604
+ incrementality?: "FULL_DATASET" | null | undefined;
1605
+ }, {
1606
+ timestamp: number;
1607
+ gtfs_realtime_version: string;
1608
+ feed_version?: string | null | undefined;
1609
+ incrementality?: "FULL_DATASET" | null | undefined;
1610
+ }>;
1611
+ vehicle: import("zod").ZodObject<{
1612
+ congestion_level: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["UNKNOWN_CONGESTION_LEVEL", "RUNNING_SMOOTHLY", "STOP_AND_GO", "CONGESTION", "SEVERE_CONGESTION"]>>>;
1613
+ current_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>>>;
1614
+ current_stop_sequence: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1615
+ occupancy_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["EMPTY", "MANY_SEATS_AVAILABLE", "FEW_SEATS_AVAILABLE", "STANDING_ROOM_ONLY", "CRUSHED_STANDING_ROOM_ONLY", "FULL", "NOT_ACCEPTING_PASSENGERS", "NO_DATA_AVAILABLE", "NOT_BOARDABLE"]>>>;
1616
+ position: import("zod").ZodObject<{
1617
+ bearing: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1618
+ latitude: import("zod").ZodNumber;
1619
+ longitude: import("zod").ZodNumber;
1620
+ odometer: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1621
+ speed: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1622
+ }, "strip", import("zod").ZodTypeAny, {
1623
+ latitude: number;
1624
+ longitude: number;
1625
+ bearing?: number | null | undefined;
1626
+ odometer?: number | null | undefined;
1627
+ speed?: number | null | undefined;
1628
+ }, {
1629
+ latitude: number;
1630
+ longitude: number;
1631
+ bearing?: number | null | undefined;
1632
+ odometer?: number | null | undefined;
1633
+ speed?: number | null | undefined;
1634
+ }>;
1635
+ stop_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1636
+ timestamp: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1637
+ trip: import("zod").ZodObject<{
1638
+ direction_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1639
+ route_id: import("zod").ZodString;
1640
+ schedule_relationship: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["SCHEDULED", "NOT_SCHEDULED", "CANCELED"]>>>;
1641
+ start_date: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEffects<import("zod").ZodString, import("@tmlmobilidade/types").OperationalDate, string>>>;
1642
+ start_time: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1643
+ trip_id: import("zod").ZodString;
1644
+ }, "strip", import("zod").ZodTypeAny, {
1645
+ trip_id: string;
1646
+ route_id: string;
1647
+ start_time?: string | null | undefined;
1648
+ direction_id?: number | null | undefined;
1649
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1650
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1651
+ }, {
1652
+ trip_id: string;
1653
+ route_id: string;
1654
+ start_time?: string | null | undefined;
1655
+ direction_id?: number | null | undefined;
1656
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1657
+ start_date?: string | null | undefined;
1658
+ }>;
1659
+ vehicle: import("zod").ZodObject<{
1660
+ id: import("zod").ZodString;
1661
+ label: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1662
+ }, "strip", import("zod").ZodTypeAny, {
1663
+ id: string;
1664
+ label?: string | null | undefined;
1665
+ }, {
1666
+ id: string;
1667
+ label?: string | null | undefined;
1668
+ }>;
1669
+ }, "strip", import("zod").ZodTypeAny, {
1670
+ trip: {
1671
+ trip_id: string;
1672
+ route_id: string;
1673
+ start_time?: string | null | undefined;
1674
+ direction_id?: number | null | undefined;
1675
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1676
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1677
+ };
1678
+ position: {
1679
+ latitude: number;
1680
+ longitude: number;
1681
+ bearing?: number | null | undefined;
1682
+ odometer?: number | null | undefined;
1683
+ speed?: number | null | undefined;
1684
+ };
1685
+ vehicle: {
1686
+ id: string;
1687
+ label?: string | null | undefined;
1688
+ };
1689
+ stop_id?: string | null | undefined;
1690
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1691
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1692
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1693
+ current_stop_sequence?: number | null | undefined;
1694
+ timestamp?: number | null | undefined;
1695
+ }, {
1696
+ trip: {
1697
+ trip_id: string;
1698
+ route_id: string;
1699
+ start_time?: string | null | undefined;
1700
+ direction_id?: number | null | undefined;
1701
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1702
+ start_date?: string | null | undefined;
1703
+ };
1704
+ position: {
1705
+ latitude: number;
1706
+ longitude: number;
1707
+ bearing?: number | null | undefined;
1708
+ odometer?: number | null | undefined;
1709
+ speed?: number | null | undefined;
1710
+ };
1711
+ vehicle: {
1712
+ id: string;
1713
+ label?: string | null | undefined;
1714
+ };
1715
+ stop_id?: string | null | undefined;
1716
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1717
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1718
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1719
+ current_stop_sequence?: number | null | undefined;
1720
+ timestamp?: number | null | undefined;
1721
+ }>;
1722
+ }, "strip", import("zod").ZodTypeAny, {
1723
+ vehicle: {
1724
+ trip: {
1725
+ trip_id: string;
1726
+ route_id: string;
1727
+ start_time?: string | null | undefined;
1728
+ direction_id?: number | null | undefined;
1729
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1730
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1731
+ };
1732
+ position: {
1733
+ latitude: number;
1734
+ longitude: number;
1735
+ bearing?: number | null | undefined;
1736
+ odometer?: number | null | undefined;
1737
+ speed?: number | null | undefined;
1738
+ };
1739
+ vehicle: {
1740
+ id: string;
1741
+ label?: string | null | undefined;
1742
+ };
1743
+ stop_id?: string | null | undefined;
1744
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1745
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1746
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1747
+ current_stop_sequence?: number | null | undefined;
1748
+ timestamp?: number | null | undefined;
1749
+ };
1750
+ header: {
1751
+ timestamp: number;
1752
+ gtfs_realtime_version: string;
1753
+ feed_version?: string | null | undefined;
1754
+ incrementality?: "FULL_DATASET" | null | undefined;
1755
+ };
1756
+ }, {
1757
+ vehicle: {
1758
+ trip: {
1759
+ trip_id: string;
1760
+ route_id: string;
1761
+ start_time?: string | null | undefined;
1762
+ direction_id?: number | null | undefined;
1763
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1764
+ start_date?: string | null | undefined;
1765
+ };
1766
+ position: {
1767
+ latitude: number;
1768
+ longitude: number;
1769
+ bearing?: number | null | undefined;
1770
+ odometer?: number | null | undefined;
1771
+ speed?: number | null | undefined;
1772
+ };
1773
+ vehicle: {
1774
+ id: string;
1775
+ label?: string | null | undefined;
1776
+ };
1777
+ stop_id?: string | null | undefined;
1778
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1779
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1780
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1781
+ current_stop_sequence?: number | null | undefined;
1782
+ timestamp?: number | null | undefined;
1783
+ };
1784
+ header: {
1785
+ timestamp: number;
1786
+ gtfs_realtime_version: string;
1787
+ feed_version?: string | null | undefined;
1788
+ incrementality?: "FULL_DATASET" | null | undefined;
1789
+ };
1790
+ }>;
1791
+ version: import("zod").ZodLiteral<"crtm-aisa-v1">;
1792
+ }, "strip", import("zod").ZodTypeAny, {
1793
+ _id: string;
1794
+ created_at: number & {
1795
+ __brand: "UnixTimestamp";
1796
+ };
1797
+ agency_id: string;
1798
+ received_at: number & {
1799
+ __brand: "UnixTimestamp";
1800
+ };
1801
+ version: "crtm-aisa-v1";
1802
+ payload: {
1803
+ vehicle: {
1804
+ trip: {
1805
+ trip_id: string;
1806
+ route_id: string;
1807
+ start_time?: string | null | undefined;
1808
+ direction_id?: number | null | undefined;
1809
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1810
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1811
+ };
1812
+ position: {
1813
+ latitude: number;
1814
+ longitude: number;
1815
+ bearing?: number | null | undefined;
1816
+ odometer?: number | null | undefined;
1817
+ speed?: number | null | undefined;
1818
+ };
1819
+ vehicle: {
1820
+ id: string;
1821
+ label?: string | null | undefined;
1822
+ };
1823
+ stop_id?: string | null | undefined;
1824
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1825
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1826
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1827
+ current_stop_sequence?: number | null | undefined;
1828
+ timestamp?: number | null | undefined;
1829
+ };
1830
+ header: {
1831
+ timestamp: number;
1832
+ gtfs_realtime_version: string;
1833
+ feed_version?: string | null | undefined;
1834
+ incrementality?: "FULL_DATASET" | null | undefined;
1835
+ };
1836
+ };
1837
+ entity_id: string;
1838
+ }, {
1839
+ _id: string;
1840
+ created_at: number;
1841
+ agency_id: string;
1842
+ received_at: number;
1843
+ version: "crtm-aisa-v1";
1844
+ payload: {
1845
+ vehicle: {
1846
+ trip: {
1847
+ trip_id: string;
1848
+ route_id: string;
1849
+ start_time?: string | null | undefined;
1850
+ direction_id?: number | null | undefined;
1851
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1852
+ start_date?: string | null | undefined;
1853
+ };
1854
+ position: {
1855
+ latitude: number;
1856
+ longitude: number;
1857
+ bearing?: number | null | undefined;
1858
+ odometer?: number | null | undefined;
1859
+ speed?: number | null | undefined;
1860
+ };
1861
+ vehicle: {
1862
+ id: string;
1863
+ label?: string | null | undefined;
1864
+ };
1865
+ stop_id?: string | null | undefined;
1866
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1867
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1868
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1869
+ current_stop_sequence?: number | null | undefined;
1870
+ timestamp?: number | null | undefined;
1871
+ };
1872
+ header: {
1873
+ timestamp: number;
1874
+ gtfs_realtime_version: string;
1875
+ feed_version?: string | null | undefined;
1876
+ incrementality?: "FULL_DATASET" | null | undefined;
1877
+ };
1878
+ };
1879
+ entity_id: string;
1880
+ }>, import("zod").ZodObject<{
1881
+ _id: import("zod").ZodString;
1882
+ agency_id: import("zod").ZodString;
1883
+ created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1884
+ entity_id: import("zod").ZodString;
1885
+ received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1593
1886
  } & {
1594
1887
  payload: import("zod").ZodObject<{
1595
1888
  header: import("zod").ZodObject<{
@@ -1595,6 +1595,299 @@ declare class RawVehicleEventsNewClass extends MongoInterfaceTemplate<RawVehicle
1595
1595
  created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1596
1596
  entity_id: import("zod").ZodString;
1597
1597
  received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1598
+ } & {
1599
+ payload: import("zod").ZodObject<{
1600
+ header: import("zod").ZodObject<{
1601
+ feed_version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1602
+ gtfs_realtime_version: import("zod").ZodString;
1603
+ incrementality: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodLiteral<"FULL_DATASET">>>;
1604
+ timestamp: import("zod").ZodNumber;
1605
+ }, "strip", import("zod").ZodTypeAny, {
1606
+ timestamp: number;
1607
+ gtfs_realtime_version: string;
1608
+ feed_version?: string | null | undefined;
1609
+ incrementality?: "FULL_DATASET" | null | undefined;
1610
+ }, {
1611
+ timestamp: number;
1612
+ gtfs_realtime_version: string;
1613
+ feed_version?: string | null | undefined;
1614
+ incrementality?: "FULL_DATASET" | null | undefined;
1615
+ }>;
1616
+ vehicle: import("zod").ZodObject<{
1617
+ congestion_level: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["UNKNOWN_CONGESTION_LEVEL", "RUNNING_SMOOTHLY", "STOP_AND_GO", "CONGESTION", "SEVERE_CONGESTION"]>>>;
1618
+ current_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>>>;
1619
+ current_stop_sequence: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1620
+ occupancy_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["EMPTY", "MANY_SEATS_AVAILABLE", "FEW_SEATS_AVAILABLE", "STANDING_ROOM_ONLY", "CRUSHED_STANDING_ROOM_ONLY", "FULL", "NOT_ACCEPTING_PASSENGERS", "NO_DATA_AVAILABLE", "NOT_BOARDABLE"]>>>;
1621
+ position: import("zod").ZodObject<{
1622
+ bearing: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1623
+ latitude: import("zod").ZodNumber;
1624
+ longitude: import("zod").ZodNumber;
1625
+ odometer: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1626
+ speed: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1627
+ }, "strip", import("zod").ZodTypeAny, {
1628
+ latitude: number;
1629
+ longitude: number;
1630
+ bearing?: number | null | undefined;
1631
+ odometer?: number | null | undefined;
1632
+ speed?: number | null | undefined;
1633
+ }, {
1634
+ latitude: number;
1635
+ longitude: number;
1636
+ bearing?: number | null | undefined;
1637
+ odometer?: number | null | undefined;
1638
+ speed?: number | null | undefined;
1639
+ }>;
1640
+ stop_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1641
+ timestamp: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1642
+ trip: import("zod").ZodObject<{
1643
+ direction_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
1644
+ route_id: import("zod").ZodString;
1645
+ schedule_relationship: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["SCHEDULED", "NOT_SCHEDULED", "CANCELED"]>>>;
1646
+ start_date: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEffects<import("zod").ZodString, import("@tmlmobilidade/types").OperationalDate, string>>>;
1647
+ start_time: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1648
+ trip_id: import("zod").ZodString;
1649
+ }, "strip", import("zod").ZodTypeAny, {
1650
+ trip_id: string;
1651
+ route_id: string;
1652
+ start_time?: string | null | undefined;
1653
+ direction_id?: number | null | undefined;
1654
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1655
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1656
+ }, {
1657
+ trip_id: string;
1658
+ route_id: string;
1659
+ start_time?: string | null | undefined;
1660
+ direction_id?: number | null | undefined;
1661
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1662
+ start_date?: string | null | undefined;
1663
+ }>;
1664
+ vehicle: import("zod").ZodObject<{
1665
+ id: import("zod").ZodString;
1666
+ label: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
1667
+ }, "strip", import("zod").ZodTypeAny, {
1668
+ id: string;
1669
+ label?: string | null | undefined;
1670
+ }, {
1671
+ id: string;
1672
+ label?: string | null | undefined;
1673
+ }>;
1674
+ }, "strip", import("zod").ZodTypeAny, {
1675
+ trip: {
1676
+ trip_id: string;
1677
+ route_id: string;
1678
+ start_time?: string | null | undefined;
1679
+ direction_id?: number | null | undefined;
1680
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1681
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1682
+ };
1683
+ position: {
1684
+ latitude: number;
1685
+ longitude: number;
1686
+ bearing?: number | null | undefined;
1687
+ odometer?: number | null | undefined;
1688
+ speed?: number | null | undefined;
1689
+ };
1690
+ vehicle: {
1691
+ id: string;
1692
+ label?: string | null | undefined;
1693
+ };
1694
+ stop_id?: string | null | undefined;
1695
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1696
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1697
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1698
+ current_stop_sequence?: number | null | undefined;
1699
+ timestamp?: number | null | undefined;
1700
+ }, {
1701
+ trip: {
1702
+ trip_id: string;
1703
+ route_id: string;
1704
+ start_time?: string | null | undefined;
1705
+ direction_id?: number | null | undefined;
1706
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1707
+ start_date?: string | null | undefined;
1708
+ };
1709
+ position: {
1710
+ latitude: number;
1711
+ longitude: number;
1712
+ bearing?: number | null | undefined;
1713
+ odometer?: number | null | undefined;
1714
+ speed?: number | null | undefined;
1715
+ };
1716
+ vehicle: {
1717
+ id: string;
1718
+ label?: string | null | undefined;
1719
+ };
1720
+ stop_id?: string | null | undefined;
1721
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1722
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1723
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1724
+ current_stop_sequence?: number | null | undefined;
1725
+ timestamp?: number | null | undefined;
1726
+ }>;
1727
+ }, "strip", import("zod").ZodTypeAny, {
1728
+ vehicle: {
1729
+ trip: {
1730
+ trip_id: string;
1731
+ route_id: string;
1732
+ start_time?: string | null | undefined;
1733
+ direction_id?: number | null | undefined;
1734
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1735
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1736
+ };
1737
+ position: {
1738
+ latitude: number;
1739
+ longitude: number;
1740
+ bearing?: number | null | undefined;
1741
+ odometer?: number | null | undefined;
1742
+ speed?: number | null | undefined;
1743
+ };
1744
+ vehicle: {
1745
+ id: string;
1746
+ label?: string | null | undefined;
1747
+ };
1748
+ stop_id?: string | null | undefined;
1749
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1750
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1751
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1752
+ current_stop_sequence?: number | null | undefined;
1753
+ timestamp?: number | null | undefined;
1754
+ };
1755
+ header: {
1756
+ timestamp: number;
1757
+ gtfs_realtime_version: string;
1758
+ feed_version?: string | null | undefined;
1759
+ incrementality?: "FULL_DATASET" | null | undefined;
1760
+ };
1761
+ }, {
1762
+ vehicle: {
1763
+ trip: {
1764
+ trip_id: string;
1765
+ route_id: string;
1766
+ start_time?: string | null | undefined;
1767
+ direction_id?: number | null | undefined;
1768
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1769
+ start_date?: string | null | undefined;
1770
+ };
1771
+ position: {
1772
+ latitude: number;
1773
+ longitude: number;
1774
+ bearing?: number | null | undefined;
1775
+ odometer?: number | null | undefined;
1776
+ speed?: number | null | undefined;
1777
+ };
1778
+ vehicle: {
1779
+ id: string;
1780
+ label?: string | null | undefined;
1781
+ };
1782
+ stop_id?: string | null | undefined;
1783
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1784
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1785
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1786
+ current_stop_sequence?: number | null | undefined;
1787
+ timestamp?: number | null | undefined;
1788
+ };
1789
+ header: {
1790
+ timestamp: number;
1791
+ gtfs_realtime_version: string;
1792
+ feed_version?: string | null | undefined;
1793
+ incrementality?: "FULL_DATASET" | null | undefined;
1794
+ };
1795
+ }>;
1796
+ version: import("zod").ZodLiteral<"crtm-aisa-v1">;
1797
+ }, "strip", import("zod").ZodTypeAny, {
1798
+ _id: string;
1799
+ created_at: number & {
1800
+ __brand: "UnixTimestamp";
1801
+ };
1802
+ agency_id: string;
1803
+ received_at: number & {
1804
+ __brand: "UnixTimestamp";
1805
+ };
1806
+ version: "crtm-aisa-v1";
1807
+ payload: {
1808
+ vehicle: {
1809
+ trip: {
1810
+ trip_id: string;
1811
+ route_id: string;
1812
+ start_time?: string | null | undefined;
1813
+ direction_id?: number | null | undefined;
1814
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1815
+ start_date?: import("@tmlmobilidade/types").OperationalDate | null | undefined;
1816
+ };
1817
+ position: {
1818
+ latitude: number;
1819
+ longitude: number;
1820
+ bearing?: number | null | undefined;
1821
+ odometer?: number | null | undefined;
1822
+ speed?: number | null | undefined;
1823
+ };
1824
+ vehicle: {
1825
+ id: string;
1826
+ label?: string | null | undefined;
1827
+ };
1828
+ stop_id?: string | null | undefined;
1829
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1830
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1831
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1832
+ current_stop_sequence?: number | null | undefined;
1833
+ timestamp?: number | null | undefined;
1834
+ };
1835
+ header: {
1836
+ timestamp: number;
1837
+ gtfs_realtime_version: string;
1838
+ feed_version?: string | null | undefined;
1839
+ incrementality?: "FULL_DATASET" | null | undefined;
1840
+ };
1841
+ };
1842
+ entity_id: string;
1843
+ }, {
1844
+ _id: string;
1845
+ created_at: number;
1846
+ agency_id: string;
1847
+ received_at: number;
1848
+ version: "crtm-aisa-v1";
1849
+ payload: {
1850
+ vehicle: {
1851
+ trip: {
1852
+ trip_id: string;
1853
+ route_id: string;
1854
+ start_time?: string | null | undefined;
1855
+ direction_id?: number | null | undefined;
1856
+ schedule_relationship?: "SCHEDULED" | "NOT_SCHEDULED" | "CANCELED" | null | undefined;
1857
+ start_date?: string | null | undefined;
1858
+ };
1859
+ position: {
1860
+ latitude: number;
1861
+ longitude: number;
1862
+ bearing?: number | null | undefined;
1863
+ odometer?: number | null | undefined;
1864
+ speed?: number | null | undefined;
1865
+ };
1866
+ vehicle: {
1867
+ id: string;
1868
+ label?: string | null | undefined;
1869
+ };
1870
+ stop_id?: string | null | undefined;
1871
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
1872
+ congestion_level?: "UNKNOWN_CONGESTION_LEVEL" | "RUNNING_SMOOTHLY" | "STOP_AND_GO" | "CONGESTION" | "SEVERE_CONGESTION" | null | undefined;
1873
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
1874
+ current_stop_sequence?: number | null | undefined;
1875
+ timestamp?: number | null | undefined;
1876
+ };
1877
+ header: {
1878
+ timestamp: number;
1879
+ gtfs_realtime_version: string;
1880
+ feed_version?: string | null | undefined;
1881
+ incrementality?: "FULL_DATASET" | null | undefined;
1882
+ };
1883
+ };
1884
+ entity_id: string;
1885
+ }>, import("zod").ZodObject<{
1886
+ _id: import("zod").ZodString;
1887
+ agency_id: import("zod").ZodString;
1888
+ created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1889
+ entity_id: import("zod").ZodString;
1890
+ received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
1598
1891
  } & {
1599
1892
  payload: import("zod").ZodObject<{
1600
1893
  header: import("zod").ZodObject<{
@@ -52,8 +52,8 @@ declare class SimplifiedVehicleEventsNewClass extends ClickHouseInterfaceTemplat
52
52
  * @param secondsAgo - The number of seconds in the past to consider for retrieving recent positions. Defaults to 90 seconds.
53
53
  * @returns A promise resolving to an array of SimplifiedVehicleEvent objects, each representing the latest event for a vehicle within the specified period.
54
54
  *
55
- * The method filters out events where any of vehicle_id, agency_id, or trip_id are empty or null,
56
- * and also ensures latitude and longitude are not zero. Only the most recent event per vehicle is returned.
55
+ * When the latest event has no bearing, the immediately previous event's bearing is used if that
56
+ * event is at most 5 minutes older; otherwise bearing stays null.
57
57
  */
58
58
  getPositions(secondsAgo?: number): Promise<SimplifiedVehicleEvent[]>;
59
59
  /**
@@ -62,13 +62,29 @@ class SimplifiedVehicleEventsNewClass extends ClickHouseInterfaceTemplate {
62
62
  * @param secondsAgo - The number of seconds in the past to consider for retrieving recent positions. Defaults to 90 seconds.
63
63
  * @returns A promise resolving to an array of SimplifiedVehicleEvent objects, each representing the latest event for a vehicle within the specified period.
64
64
  *
65
- * The method filters out events where any of vehicle_id, agency_id, or trip_id are empty or null,
66
- * and also ensures latitude and longitude are not zero. Only the most recent event per vehicle is returned.
65
+ * When the latest event has no bearing, the immediately previous event's bearing is used if that
66
+ * event is at most 5 minutes older; otherwise bearing stays null.
67
67
  */
68
68
  async getPositions(secondsAgo = 90) {
69
+ const bearingInferenceLookbackSeconds = 300;
70
+ const bearingInferenceMaxGapMs = bearingInferenceLookbackSeconds * 1000;
69
71
  const query = `
70
72
  SELECT *
71
- FROM "${this.databaseName}"."${this.tableName}"
73
+ FROM (
74
+ SELECT
75
+ * REPLACE(
76
+ if(
77
+ bearing IS NULL
78
+ AND lagInFrame(created_at) OVER w IS NOT NULL
79
+ AND (created_at - lagInFrame(created_at) OVER w) <= ${bearingInferenceMaxGapMs},
80
+ lagInFrame(bearing) OVER w,
81
+ bearing
82
+ ) AS bearing
83
+ )
84
+ FROM "${this.databaseName}"."${this.tableName}"
85
+ WHERE created_at > toUnixTimestamp64Milli(now64(3) - INTERVAL ${secondsAgo + bearingInferenceLookbackSeconds} SECOND)
86
+ WINDOW w AS (PARTITION BY vehicle_id, agency_id ORDER BY created_at)
87
+ )
72
88
  WHERE created_at > toUnixTimestamp64Milli(now64(3) - INTERVAL ${secondsAgo} SECOND)
73
89
  ORDER BY created_at DESC
74
90
  LIMIT 1 BY vehicle_id, agency_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/databases",
3
- "version": "20260528.1147.54",
3
+ "version": "20260528.1745.17",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"