@autobusal/providers 1.18.0 → 1.19.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/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
7
7
  > Note: 1.8.0 through 1.11.0 were published without changelog entries. The
8
8
  > gap is left as-is rather than reconstructed after the fact.
9
9
 
10
+ ## 1.19.0
11
+
12
+ `types/reviews.ts` — `RatingData`, `ReviewData`, `ReviewSummaryData`. `rating`
13
+ added to `OperatorData` and `RouteData`, always optional and often absent.
14
+
10
15
  ## 1.18.0
11
16
 
12
17
  `LabelSettings.reviews` — the per-brand review moderation setting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
@@ -1,7 +1,11 @@
1
1
  import { RouteData } from './routes';
2
+ import { RatingData } from './reviews';
2
3
  import { UserData } from './users';
3
4
 
4
5
  export interface OperatorData {
6
+ // Edited: Ferjolt Ozuni - Date: 2026-08-03
7
+ // Absent until the operator has enough published reviews - see RatingData.
8
+ rating?: RatingData | null
5
9
  id: number
6
10
  company: string
7
11
  nipt: string
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Published reviews, as the public route and operator pages read them.
3
+ *
4
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
5
+ */
6
+
7
+ /**
8
+ * A score worth showing.
9
+ *
10
+ * ALWAYS optional and often absent: obtapi withholds it entirely until a
11
+ * route or operator has enough published reviews to say something honest
12
+ * (App\Traits\Rateable). "5.0 from one review" reads worse than no rating at
13
+ * all, so the absence is the feature - never fill it in with a zero.
14
+ */
15
+ export interface RatingData {
16
+ average: number
17
+ count: number
18
+ }
19
+
20
+ export interface ReviewSummaryData extends RatingData {
21
+ // 5 down to 1, each mapped to how many reviews gave that many stars. An
22
+ // average of 4.0 from straight fours and one from fives and ones describe
23
+ // different operators, and only the spread tells them apart.
24
+ histogram: Record<string, number>
25
+ }
26
+
27
+ export interface ReviewReplyData {
28
+ body: string
29
+ published_at: string | null
30
+ }
31
+
32
+ export interface ReviewData {
33
+ id: number
34
+ rating: number
35
+ // rating-only reviews are deliberately allowed, so this is often null
36
+ body: string | null
37
+ // what it was WRITTEN in - shown as-is, never machine translated
38
+ language: string
39
+ // first name plus an initial, built server-side
40
+ author: string
41
+ published: string | null
42
+ reply: ReviewReplyData | null
43
+ }
package/types/routes.ts CHANGED
@@ -2,9 +2,13 @@ import { AgentData } from './agents';
2
2
  import { BusData } from './buses';
3
3
  import { LocationData, CountryData } from './locations';
4
4
  import { OperatorData } from './operators';
5
+ import { RatingData } from './reviews';
5
6
  import { OrderData } from './orders';
6
7
 
7
8
  export interface RouteData {
9
+ // Edited: Ferjolt Ozuni - Date: 2026-08-03
10
+ // Absent until the route has enough published reviews - see RatingData.
11
+ rating?: RatingData | null
8
12
  id: number
9
13
  name: string
10
14
  code: string