@iveri/contracts 0.93.0 → 0.95.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/README.md CHANGED
@@ -207,6 +207,18 @@ Three shapes here are decisions rather than descriptions, and each is pinned by
207
207
  A template holds message **keys**, never text — the wording lives in `iveri-localization-api`, so
208
208
  there is one place with ICU validation, a review gate and Georgian, rather than two.
209
209
 
210
+ ### `api/taxi/` → `@iveri/contracts/taxi`
211
+
212
+ What a company running a taxi service reads in its own panel: `TaxiRideStatus`, the live board (`TaxiBoard`,
213
+ `TaxiBoardRide`), each driver's work since a moment (`TaxiDriverActivityList`), its passengers
214
+ (`TaxiPassengersPage`), its fare settings (`TaxiFareSettings`, `UpdateTaxiFareSettingsRequest`) and its daily totals
215
+ (`TaxiDailyReport`). The passenger's and driver's own ride shapes stay in `taxi-api` until a second consumer needs them.
216
+
217
+ - **A fare is a quote and stays one.** The distance is a straight line, so every figure is a floor, and the daily
218
+ report sums quoted fares of completed rides, never earnings: nothing settles a fare yet.
219
+ - **A day's totals are the rides requested on it**, so `completed` can never exceed `requested`, and the panel names the
220
+ time zone the days were cut in.
221
+
210
222
  ### Why the wire shapes moved here
211
223
 
212
224
  `conduit-admin-web` hand-transcribed all of it, carefully and with comments. It still drifted:
@@ -0,0 +1,6 @@
1
+ /** Where an invoice stands. An invoice is a snapshot: its lines never change after it is issued. */
2
+ export declare enum BillingInvoiceStatus {
3
+ OPEN = "open",
4
+ PAID = "paid",
5
+ VOID = "void"
6
+ }
@@ -0,0 +1,7 @@
1
+ /** Where an invoice stands. An invoice is a snapshot: its lines never change after it is issued. */
2
+ export var BillingInvoiceStatus;
3
+ (function (BillingInvoiceStatus) {
4
+ BillingInvoiceStatus["OPEN"] = "open";
5
+ BillingInvoiceStatus["PAID"] = "paid";
6
+ BillingInvoiceStatus["VOID"] = "void";
7
+ })(BillingInvoiceStatus || (BillingInvoiceStatus = {}));
@@ -0,0 +1,2 @@
1
+ export * from './billing-invoice-status.enum.js';
2
+ export * from './usage.type.js';
@@ -0,0 +1,2 @@
1
+ export * from './billing-invoice-status.enum.js';
2
+ export * from './usage.type.js';
@@ -0,0 +1,103 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { IveriProduct } from '../platform/iveri-product.enum.js';
5
+ import type { BillingInvoiceStatus } from './billing-invoice-status.enum.js';
6
+ /**
7
+ * A plan's limits for one calendar month in UTC: a metric's name to the most the plan allows, or null for no limit. A
8
+ * metric the plan does not name is not limited by it. Limits are data on the plan, edited like its price.
9
+ */
10
+ export type UsageLimits = Record<string, Nullable<number>>;
11
+ /** A plan Iveri sells for a product, as a company reads it against its usage. */
12
+ export interface UsagePlan {
13
+ id: UUID;
14
+ code: string;
15
+ name: string;
16
+ product: IveriProduct;
17
+ /** The price for one month, in the currency's minor unit. */
18
+ amountMinor: number;
19
+ currency: string;
20
+ /**
21
+ * True while the price and the limits are placeholders nobody has decided. Every screen that shows the plan says so
22
+ * while it is true.
23
+ */
24
+ isPlaceholder: boolean;
25
+ limits: UsageLimits;
26
+ }
27
+ /** One metric this month against the plan. */
28
+ export interface UsageMetricSummary {
29
+ metric: string;
30
+ quantity: number;
31
+ /** The plan's limit, or null when the plan does not limit it. */
32
+ limit: Nullable<number>;
33
+ }
34
+ /**
35
+ * `GET /billing/usage/summary?product=` (a company's own) or `?tenantId=&product=` (behind `billing:usage:read-any`).
36
+ * The period is the current calendar month in UTC, its end exclusive. `plan` is null when nothing is on sale for the
37
+ * product, and then nothing is limited.
38
+ */
39
+ export interface UsageSummary {
40
+ tenantId: UUID;
41
+ product: IveriProduct;
42
+ periodStart: IsoDateTime;
43
+ periodEnd: IsoDateTime;
44
+ plan: Nullable<UsagePlan>;
45
+ metrics: UsageMetricSummary[];
46
+ }
47
+ /** One line of an invoice, as it was when the invoice was issued. */
48
+ export interface UsageInvoiceLine {
49
+ description: string;
50
+ quantity: number;
51
+ unitAmountMinor: number;
52
+ amountMinor: number;
53
+ }
54
+ /**
55
+ * An invoice as a company reads it. One built from a month's usage carries that month as its period; an invoice made
56
+ * by hand carries none.
57
+ */
58
+ export interface UsageInvoice {
59
+ id: UUID;
60
+ number: string;
61
+ status: BillingInvoiceStatus;
62
+ currency: string;
63
+ totalMinor: number;
64
+ periodStart: Nullable<IsoDateTime>;
65
+ periodEnd: Nullable<IsoDateTime>;
66
+ issuedAt: IsoDateTime;
67
+ lines: UsageInvoiceLine[];
68
+ }
69
+ /**
70
+ * `POST /billing/usage`. `tenantId` names the company the usage is for, and is refused with a 403 unless the token
71
+ * holds `billing:usage:record-any` and comes from Iveri's operator workspace. Without it the usage is the token's own
72
+ * company's. The `Idempotency-Key` header is unique per company the usage is for.
73
+ */
74
+ export interface RecordUsageRequest {
75
+ tenantId?: UUID;
76
+ metric: string;
77
+ periodStart: IsoDateTime;
78
+ periodEnd: IsoDateTime;
79
+ quantity: number;
80
+ source: string;
81
+ }
82
+ /** `PUT /platform/usage-plans/:tenantId`: the plan a company is on for a product, from the next request on. */
83
+ export interface AssignUsagePlanRequest {
84
+ product: IveriProduct;
85
+ planCode: string;
86
+ }
87
+ /** Which plan a company is on for a product, and whether an operator chose it or it is the product's default. */
88
+ export interface UsagePlanAssignment {
89
+ tenantId: UUID;
90
+ product: IveriProduct;
91
+ plan: UsagePlan;
92
+ isDefault: boolean;
93
+ }
94
+ /**
95
+ * Carried in the `details` of the 403 a product answers when a plan's limit refuses something, beside the product's
96
+ * own reason, so a client can say which limit was reached.
97
+ */
98
+ export declare const USAGE_LIMIT_REACHED_REASON = "usage-limit-reached";
99
+ export interface UsageLimitReachedDetails {
100
+ reason: typeof USAGE_LIMIT_REACHED_REASON;
101
+ metric: string;
102
+ limit: number;
103
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Carried in the `details` of the 403 a product answers when a plan's limit refuses something, beside the product's
3
+ * own reason, so a client can say which limit was reached.
4
+ */
5
+ export const USAGE_LIMIT_REACHED_REASON = 'usage-limit-reached';
@@ -15,5 +15,11 @@ export declare enum ChatRefusal {
15
15
  INVITATION_EXPIRED = "invitation-expired",
16
16
  SUSPENDED = "suspended",
17
17
  ATTACHMENT_REFUSED = "attachment-refused",
18
- REQUEST_PENDING = "request-pending"
18
+ REQUEST_PENDING = "request-pending",
19
+ /**
20
+ * The app's plan does not allow it this month: a new user over the monthly-active-user limit, or a message over the
21
+ * message limit. The value is `USAGE_LIMIT_REACHED_REASON` from `@iveri/contracts/billing`, and the details name the
22
+ * metric and the limit.
23
+ */
24
+ USAGE_LIMIT = "usage-limit-reached"
19
25
  }
@@ -17,4 +17,10 @@ export var ChatRefusal;
17
17
  ChatRefusal["SUSPENDED"] = "suspended";
18
18
  ChatRefusal["ATTACHMENT_REFUSED"] = "attachment-refused";
19
19
  ChatRefusal["REQUEST_PENDING"] = "request-pending";
20
+ /**
21
+ * The app's plan does not allow it this month: a new user over the monthly-active-user limit, or a message over the
22
+ * message limit. The value is `USAGE_LIMIT_REACHED_REASON` from `@iveri/contracts/billing`, and the details name the
23
+ * metric and the limit.
24
+ */
25
+ ChatRefusal["USAGE_LIMIT"] = "usage-limit-reached";
20
26
  })(ChatRefusal || (ChatRefusal = {}));
@@ -0,0 +1,24 @@
1
+ import type { Nullable } from '../../type/nil.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ import type { UsageInvoice, UsageSummary } from '../billing/usage.type.js';
4
+ /**
5
+ * What Baasi meters for each app, as the metric names billing stores and a plan's limits name. A month is a calendar
6
+ * month in UTC. Iveri's own product tenants, which are not apps, are not metered.
7
+ */
8
+ export declare enum ChatUsageMetric {
9
+ /** People who used the app at least once this month, each counted once. */
10
+ MONTHLY_ACTIVE_USERS = "chat.monthly-active-users",
11
+ /** Messages somebody wrote this month. A product's or a group's own notices are not counted. */
12
+ MESSAGES = "chat.messages",
13
+ /** Bytes of attachments stored this month. */
14
+ STORED_BYTES = "chat.stored-bytes"
15
+ }
16
+ /**
17
+ * `GET /apps/:appId/usage`: the app's month against its plan, and the invoices built from its usage. `summary` is null
18
+ * when billing could not be asked, which the console says rather than showing zeroes.
19
+ */
20
+ export interface ChatAppUsage {
21
+ appId: UUID;
22
+ summary: Nullable<UsageSummary>;
23
+ invoices: UsageInvoice[];
24
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * What Baasi meters for each app, as the metric names billing stores and a plan's limits name. A month is a calendar
3
+ * month in UTC. Iveri's own product tenants, which are not apps, are not metered.
4
+ */
5
+ export var ChatUsageMetric;
6
+ (function (ChatUsageMetric) {
7
+ /** People who used the app at least once this month, each counted once. */
8
+ ChatUsageMetric["MONTHLY_ACTIVE_USERS"] = "chat.monthly-active-users";
9
+ /** Messages somebody wrote this month. A product's or a group's own notices are not counted. */
10
+ ChatUsageMetric["MESSAGES"] = "chat.messages";
11
+ /** Bytes of attachments stored this month. */
12
+ ChatUsageMetric["STORED_BYTES"] = "chat.stored-bytes";
13
+ })(ChatUsageMetric || (ChatUsageMetric = {}));
@@ -28,5 +28,6 @@ export * from './chat-realtime.type.js';
28
28
  export * from './chat-refusal.enum.js';
29
29
  export * from './chat-report-reason.enum.js';
30
30
  export * from './chat-report-target.enum.js';
31
+ export * from './chat-usage.type.js';
31
32
  export * from './chat-webhook-delivery-status.enum.js';
32
33
  export * from './chat-webhook-event.enum.js';
@@ -28,5 +28,6 @@ export * from './chat-realtime.type.js';
28
28
  export * from './chat-refusal.enum.js';
29
29
  export * from './chat-report-reason.enum.js';
30
30
  export * from './chat-report-target.enum.js';
31
+ export * from './chat-usage.type.js';
31
32
  export * from './chat-webhook-delivery-status.enum.js';
32
33
  export * from './chat-webhook-event.enum.js';
@@ -9,3 +9,4 @@ export * from './mobility-service-type.enum.js';
9
9
  export * from './mobility-worker-rating.type.js';
10
10
  export * from './mobility-worker-status.enum.js';
11
11
  export * from './mobility-worker.type.js';
12
+ export * from './mobility-backoffice.type.js';
@@ -9,3 +9,4 @@ export * from './mobility-service-type.enum.js';
9
9
  export * from './mobility-worker-rating.type.js';
10
10
  export * from './mobility-worker-status.enum.js';
11
11
  export * from './mobility-worker.type.js';
12
+ export * from './mobility-backoffice.type.js';
@@ -0,0 +1,20 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ /**
5
+ * One company's workers of one service type, for a product's backoffice. Counts only: who they are stays with the
6
+ * company.
7
+ */
8
+ export interface MobilityBackofficeWorkerCount {
9
+ tenantId: UUID;
10
+ /** Enrolled workers, suspended ones included. */
11
+ workers: number;
12
+ /** Active workers who are available or busy right now. */
13
+ onShift: number;
14
+ /** When any of them last changed, which is how a product dates the company's last activity. */
15
+ lastChangedAt: Nullable<IsoDateTime>;
16
+ }
17
+ /** `GET /api/v1/backoffice/workers?serviceType=`: every company with a worker of that type. */
18
+ export interface MobilityBackofficeWorkerCounts {
19
+ items: MobilityBackofficeWorkerCount[];
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './taxi-admin.type.js';
2
+ export * from './taxi-ride-status.enum.js';
@@ -0,0 +1,2 @@
1
+ export * from './taxi-admin.type.js';
2
+ export * from './taxi-ride-status.enum.js';
@@ -0,0 +1,118 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { Paginated } from '../../type/paginated.type.js';
4
+ import type { UUID } from '../../type/uuid.type.js';
5
+ import type { TaxiRideStatus } from './taxi-ride-status.enum.js';
6
+ /** A place as the passenger gave it. There is no address search, so it is coordinates only. */
7
+ export interface TaxiPoint {
8
+ latitude: number;
9
+ longitude: number;
10
+ }
11
+ /**
12
+ * One ride as the company running the taxi service sees it on its board.
13
+ *
14
+ * The company sees its own customers' stops; Iveri's backoffice never does. A stop is null once the ride's location is
15
+ * past the retention window, which differs from never having one. People are identifiers: the panel
16
+ * names them from identity's public profile.
17
+ */
18
+ export interface TaxiBoardRide {
19
+ id: UUID;
20
+ status: TaxiRideStatus;
21
+ passengerUserId: UUID;
22
+ /** The Mobility worker driving it, once a driver accepted. */
23
+ driverWorkerId: Nullable<UUID>;
24
+ /** The driver as a person; briefly null after acceptance while Taxi resolves the worker. */
25
+ driverUserId: Nullable<UUID>;
26
+ pickup: Nullable<TaxiPoint>;
27
+ dropoff: Nullable<TaxiPoint>;
28
+ /** A straight-line floor, never a final charge. */
29
+ quotedFareMinor: number;
30
+ quotedFareCurrency: string;
31
+ quotedDistanceMeters: number;
32
+ /** When the passenger wants collecting, for a ride booked ahead. */
33
+ scheduledFor: Nullable<IsoDateTime>;
34
+ createdAt: IsoDateTime;
35
+ driverArrivingAt: Nullable<IsoDateTime>;
36
+ startedAt: Nullable<IsoDateTime>;
37
+ completedAt: Nullable<IsoDateTime>;
38
+ cancelledAt: Nullable<IsoDateTime>;
39
+ }
40
+ /**
41
+ * `GET /company/board?since=`: what is happening now, and what finished since `since` (the start of the company's
42
+ * day, which only the panel knows). Each list is capped and newest first.
43
+ */
44
+ export interface TaxiBoard {
45
+ since: IsoDateTime;
46
+ /** Looking for a driver, assigned, on the way, or carrying a passenger. Waiting quotes are not work yet. */
47
+ active: TaxiBoardRide[];
48
+ /** Completed, cancelled or expired since `since`. */
49
+ finished: TaxiBoardRide[];
50
+ }
51
+ /** One driver's work since a moment, keyed by their Mobility worker. Workers with no rides are absent. */
52
+ export interface TaxiDriverActivity {
53
+ workerId: UUID;
54
+ completedRides: number;
55
+ lastCompletedAt: Nullable<IsoDateTime>;
56
+ /** The ride they are on now, if any. */
57
+ activeRideId: Nullable<UUID>;
58
+ activeRideStatus: Nullable<TaxiRideStatus>;
59
+ }
60
+ /** `GET /company/drivers/activity?since=`. */
61
+ export interface TaxiDriverActivityList {
62
+ since: IsoDateTime;
63
+ drivers: TaxiDriverActivity[];
64
+ }
65
+ /** Somebody who has asked this company for a ride. Named by the panel from identity. */
66
+ export interface TaxiPassengerSummary {
67
+ userId: UUID;
68
+ /** Every ride they asked for, including quotes they never accepted. */
69
+ rides: number;
70
+ completedRides: number;
71
+ lastRideAt: IsoDateTime;
72
+ }
73
+ /** `GET /company/passengers`, most recent rider first. */
74
+ export type TaxiPassengersPage = Paginated<TaxiPassengerSummary>;
75
+ /**
76
+ * What a quote costs: `base + round(metres × perKilometre / 1000)`, in minor units of `currency`. The distance is a
77
+ * straight line, so the quote stays a floor whatever these are set to.
78
+ */
79
+ export interface TaxiFareSettings {
80
+ currency: string;
81
+ baseFareMinor: number;
82
+ perKilometreMinor: number;
83
+ /** True while the company has never set its own prices and the service's defaults apply. */
84
+ isDefault: boolean;
85
+ updatedAt: Nullable<IsoDateTime>;
86
+ }
87
+ /** `PUT /company/fare-settings`. Applies to quotes made afterwards; a quote already given keeps its price. */
88
+ export interface UpdateTaxiFareSettingsRequest {
89
+ currency: string;
90
+ baseFareMinor: number;
91
+ perKilometreMinor: number;
92
+ }
93
+ /** Quoted fares of a day's completed rides in one currency. Quoted, not earned: nothing settles a fare yet. */
94
+ export interface TaxiQuotedFareTotal {
95
+ currency: string;
96
+ quotedFareMinor: number;
97
+ }
98
+ /**
99
+ * One day of the rides requested on it, in the report's time zone: how many were asked for, and how those ended.
100
+ * A ride requested late and finished after midnight counts on the day it was asked for.
101
+ */
102
+ export interface TaxiDailyTotals {
103
+ /** `YYYY-MM-DD`. */
104
+ date: string;
105
+ requested: number;
106
+ completed: number;
107
+ cancelled: number;
108
+ expired: number;
109
+ /** Sum of the quoted fares of that day's completed rides, per currency. */
110
+ completedQuotedFares: TaxiQuotedFareTotal[];
111
+ }
112
+ /** `GET /company/reports/daily?days=&timeZone=`: oldest day first, every day present, zeroes included. */
113
+ export interface TaxiDailyReport {
114
+ timeZone: string;
115
+ from: string;
116
+ to: string;
117
+ days: TaxiDailyTotals[];
118
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Where a taxi ride stands. `taxi-api` owns the lifecycle; this is its wire vocabulary, so a company's panel and
3
+ * Iveri's backoffice can label a ride without restating it.
4
+ */
5
+ export declare enum TaxiRideStatus {
6
+ /** Priced and waiting for the passenger to accept the fare. */
7
+ QUOTED = "quoted",
8
+ /** Confirmed, and looking for a driver (or booked ahead and waiting to look). */
9
+ DISPATCHING = "dispatching",
10
+ /** A driver accepted. */
11
+ DRIVER_ASSIGNED = "driver-assigned",
12
+ /** The driver is on their way to the pickup. */
13
+ DRIVER_ARRIVING = "driver-arriving",
14
+ /** The passenger is in the car. */
15
+ IN_PROGRESS = "in-progress",
16
+ COMPLETED = "completed",
17
+ CANCELLED = "cancelled",
18
+ /** Nobody took it before the quote or the search ran out of time. */
19
+ EXPIRED = "expired"
20
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Where a taxi ride stands. `taxi-api` owns the lifecycle; this is its wire vocabulary, so a company's panel and
3
+ * Iveri's backoffice can label a ride without restating it.
4
+ */
5
+ export var TaxiRideStatus;
6
+ (function (TaxiRideStatus) {
7
+ /** Priced and waiting for the passenger to accept the fare. */
8
+ TaxiRideStatus["QUOTED"] = "quoted";
9
+ /** Confirmed, and looking for a driver (or booked ahead and waiting to look). */
10
+ TaxiRideStatus["DISPATCHING"] = "dispatching";
11
+ /** A driver accepted. */
12
+ TaxiRideStatus["DRIVER_ASSIGNED"] = "driver-assigned";
13
+ /** The driver is on their way to the pickup. */
14
+ TaxiRideStatus["DRIVER_ARRIVING"] = "driver-arriving";
15
+ /** The passenger is in the car. */
16
+ TaxiRideStatus["IN_PROGRESS"] = "in-progress";
17
+ TaxiRideStatus["COMPLETED"] = "completed";
18
+ TaxiRideStatus["CANCELLED"] = "cancelled";
19
+ /** Nobody took it before the quote or the search ran out of time. */
20
+ TaxiRideStatus["EXPIRED"] = "expired";
21
+ })(TaxiRideStatus || (TaxiRideStatus = {}));
@@ -238,6 +238,18 @@ export declare enum UserPermission {
238
238
  BILLING_USAGE_READ = "billing:usage:read",
239
239
  /** Record billable usage on behalf of a tenant service. */
240
240
  BILLING_USAGE_RECORD = "billing:usage:record",
241
+ /**
242
+ * Record usage for a company the request names in `tenantId`, rather than the token's own. A platform permission:
243
+ * held only by a service credential in Iveri's operator workspace, so `chat-api` can meter each app it hosts
244
+ * without a key in every app's tenant. The request is authorized and audited as acting for the company it names.
245
+ */
246
+ BILLING_USAGE_RECORD_ANY = "billing:usage:record-any",
247
+ /**
248
+ * Read a company the request names in `tenantId`: its usage this month against its plan, and the invoices billed
249
+ * from that usage. A platform permission, like `record-any`: `chat-api` holds it to enforce an app's limits and to
250
+ * show the app's owner the app's usage.
251
+ */
252
+ BILLING_USAGE_READ_ANY = "billing:usage:read-any",
241
253
  /** Read payment sessions and their provider-neutral status. */
242
254
  BILLING_PAYMENT_READ = "billing:payment:read",
243
255
  /**
@@ -637,6 +649,9 @@ export declare enum UserPermission {
637
649
  * The permissions that act across companies. They are granted only inside Iveri's own operator workspace, which each
638
650
  * service knows as `PLATFORM_TENANT_ID`, and a service honours one only from that workspace: identity refuses them on
639
651
  * any other workspace's role or key, and a route that uses one also checks where the token came from.
652
+ *
653
+ * Two shapes: `platform:*`, the operator console's own, and a service's `*-any`, where a request names the company it
654
+ * acts for in an explicit `tenantId` (option D of `iveri-infra/docs/cross-tenant-service-credential-decision.md`).
640
655
  */
641
656
  export declare const PLATFORM_PERMISSIONS: readonly UserPermission[];
642
657
  /** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
@@ -285,6 +285,18 @@ export var UserPermission;
285
285
  UserPermission["BILLING_USAGE_READ"] = "billing:usage:read";
286
286
  /** Record billable usage on behalf of a tenant service. */
287
287
  UserPermission["BILLING_USAGE_RECORD"] = "billing:usage:record";
288
+ /**
289
+ * Record usage for a company the request names in `tenantId`, rather than the token's own. A platform permission:
290
+ * held only by a service credential in Iveri's operator workspace, so `chat-api` can meter each app it hosts
291
+ * without a key in every app's tenant. The request is authorized and audited as acting for the company it names.
292
+ */
293
+ UserPermission["BILLING_USAGE_RECORD_ANY"] = "billing:usage:record-any";
294
+ /**
295
+ * Read a company the request names in `tenantId`: its usage this month against its plan, and the invoices billed
296
+ * from that usage. A platform permission, like `record-any`: `chat-api` holds it to enforce an app's limits and to
297
+ * show the app's owner the app's usage.
298
+ */
299
+ UserPermission["BILLING_USAGE_READ_ANY"] = "billing:usage:read-any";
288
300
  // ── Payment ────────────────────────────────────────────────────────────
289
301
  /** Read payment sessions and their provider-neutral status. */
290
302
  UserPermission["BILLING_PAYMENT_READ"] = "billing:payment:read";
@@ -704,6 +716,9 @@ export var UserPermission;
704
716
  * The permissions that act across companies. They are granted only inside Iveri's own operator workspace, which each
705
717
  * service knows as `PLATFORM_TENANT_ID`, and a service honours one only from that workspace: identity refuses them on
706
718
  * any other workspace's role or key, and a route that uses one also checks where the token came from.
719
+ *
720
+ * Two shapes: `platform:*`, the operator console's own, and a service's `*-any`, where a request names the company it
721
+ * acts for in an explicit `tenantId` (option D of `iveri-infra/docs/cross-tenant-service-credential-decision.md`).
707
722
  */
708
723
  export const PLATFORM_PERMISSIONS = Object.freeze([
709
724
  UserPermission.PLATFORM_TENANT_READ,
@@ -712,6 +727,8 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
712
727
  UserPermission.PLATFORM_LICENCE_MANAGE,
713
728
  UserPermission.PLATFORM_LICENCE_CHECK,
714
729
  UserPermission.PLATFORM_BACKOFFICE_READ,
730
+ UserPermission.BILLING_USAGE_RECORD_ANY,
731
+ UserPermission.BILLING_USAGE_READ_ANY,
715
732
  ]);
716
733
  /** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
717
734
  export function isPlatformPermission(permission) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.93.0",
3
+ "version": "0.95.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,6 +80,14 @@
80
80
  "types": "./dist/api/platform/index.d.ts",
81
81
  "default": "./dist/api/platform/index.js"
82
82
  },
83
+ "./taxi": {
84
+ "types": "./dist/api/taxi/index.d.ts",
85
+ "default": "./dist/api/taxi/index.js"
86
+ },
87
+ "./billing": {
88
+ "types": "./dist/api/billing/index.d.ts",
89
+ "default": "./dist/api/billing/index.js"
90
+ },
83
91
  "./package.json": "./package.json"
84
92
  },
85
93
  "sideEffects": false,