@ingenx-io/valets-schema-mcp-server 0.2.3 → 0.2.5

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.
Files changed (76) hide show
  1. package/README.md +26 -0
  2. package/data/docs/collections/firestore-paths.md +32 -20
  3. package/data/docs/enums/app-status.md +24 -0
  4. package/data/docs/enums/attention-status.md +2 -2
  5. package/data/docs/enums/booking-status.md +2 -2
  6. package/data/docs/enums/customer-payment-status.md +2 -2
  7. package/data/docs/enums/customer-payment-target-type.md +2 -2
  8. package/data/docs/enums/delivery-type.md +2 -2
  9. package/data/docs/enums/deployment-link-type.md +2 -2
  10. package/data/docs/enums/event-status.md +2 -2
  11. package/data/docs/enums/fulfillment-status.md +2 -2
  12. package/data/docs/enums/loyalty-transaction-type.md +2 -2
  13. package/data/docs/enums/notification-channel.md +2 -2
  14. package/data/docs/enums/notification-entity-type.md +2 -2
  15. package/data/docs/enums/notification-status.md +2 -2
  16. package/data/docs/enums/order-status.md +2 -2
  17. package/data/docs/enums/outbound-message-format.md +2 -2
  18. package/data/docs/enums/outbound-message-purpose.md +2 -2
  19. package/data/docs/enums/outbound-message-status.md +2 -2
  20. package/data/docs/enums/payment-method.md +2 -2
  21. package/data/docs/enums/payment-proof-status.md +2 -2
  22. package/data/docs/enums/payment-status.md +2 -2
  23. package/data/docs/enums/pending-issue.md +2 -2
  24. package/data/docs/enums/return-status.md +2 -2
  25. package/data/docs/enums/session-status.md +2 -2
  26. package/data/docs/enums/site-status.md +2 -2
  27. package/data/docs/enums/stocktake-frequency.md +2 -2
  28. package/data/docs/enums/stocktake-item-status.md +2 -2
  29. package/data/docs/enums/stocktake-status.md +2 -2
  30. package/data/docs/enums/ticket-status.md +2 -2
  31. package/data/docs/enums/waba-label.md +2 -2
  32. package/data/docs/enums/whatsapp-button-sub-type.md +2 -2
  33. package/data/docs/enums/whatsapp-template-component.md +2 -2
  34. package/data/docs/enums/whatsapp-template-status.md +2 -2
  35. package/data/docs/index.md +9 -5
  36. package/data/docs/models/allowed-user.md +7 -7
  37. package/data/docs/models/analytics-backfill.md +7 -7
  38. package/data/docs/models/analytics-daily.md +6 -6
  39. package/data/docs/models/analytics-event.md +7 -7
  40. package/data/docs/models/analytics-hourly.md +6 -6
  41. package/data/docs/models/app-payment.md +200 -0
  42. package/data/docs/models/app.md +561 -0
  43. package/data/docs/models/booking-version.md +2 -2
  44. package/data/docs/models/booking.md +127 -127
  45. package/data/docs/models/customer-payment-allocation.md +20 -20
  46. package/data/docs/models/customer-payment.md +23 -23
  47. package/data/docs/models/customer.md +11 -11
  48. package/data/docs/models/event.md +22 -22
  49. package/data/docs/models/loyalty-config.md +4 -4
  50. package/data/docs/models/loyalty-reward.md +3 -3
  51. package/data/docs/models/loyalty-status.md +6 -6
  52. package/data/docs/models/loyalty-transaction.md +2 -2
  53. package/data/docs/models/magic-link-request.md +9 -9
  54. package/data/docs/models/metrics-current.md +169 -37
  55. package/data/docs/models/metrics-daily.md +172 -40
  56. package/data/docs/models/metrics-monthly.md +172 -40
  57. package/data/docs/models/notification-record.md +3 -3
  58. package/data/docs/models/order-item.md +6 -6
  59. package/data/docs/models/order.md +78 -78
  60. package/data/docs/models/sale.md +18 -18
  61. package/data/docs/models/site-payment.md +2 -2
  62. package/data/docs/models/site.md +2 -2
  63. package/data/docs/models/stocktake-item.md +4 -4
  64. package/data/docs/models/stocktake.md +5 -5
  65. package/data/docs/models/ticket.md +3 -3
  66. package/data/docs/models/user.md +249 -0
  67. package/data/docs/models/whatsapp-inbound-message.md +2 -2
  68. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +2 -2
  69. package/data/docs/models/whatsapp-outbound-message.md +6 -6
  70. package/data/docs/models/whatsapp-template.md +2 -2
  71. package/data/static/cookbook.json +150 -0
  72. package/data/static/llms.txt +179 -33
  73. package/data/static/openapi.yaml +626 -60
  74. package/data/static/schemas.json +680 -69
  75. package/index.js +32 -0
  76. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "MetricsCurrent"
3
3
  sidebar_label: "MetricsCurrent"
4
- sidebar_position: 17
4
+ sidebar_position: 19
5
5
  ---
6
6
 
7
7
  # MetricsCurrent
@@ -34,6 +34,11 @@ sidebar_position: 17
34
34
  "lowStockItemsCount": 2,
35
35
  "activeRecurringPaymentsCount": 2,
36
36
  "monthlyRecurringRevenue": 0,
37
+ "escalatedOrdersCount": null,
38
+ "staleOrdersCount": null,
39
+ "staleBookingsCount": null,
40
+ "onHoldOrdersCount": null,
41
+ "paymentsByMethod": null,
37
42
  "computedForDay": "computedForDay",
38
43
  "generatedAt": "generatedAt"
39
44
  }
@@ -65,10 +70,16 @@ sidebar_position: 17
65
70
  - [21. Property `lowStockItemsCount`](#lowStockItemsCount)
66
71
  - [22. Property `activeRecurringPaymentsCount`](#activeRecurringPaymentsCount)
67
72
  - [23. Property `monthlyRecurringRevenue`](#monthlyRecurringRevenue)
68
- - [24. Property `computedForDay`](#computedForDay)
69
- - [25. Property `generatedAt`](#generatedAt)
70
- - [25.1. Property `_seconds`](#generatedAt__seconds)
71
- - [25.2. Property `_nanoseconds`](#generatedAt__nanoseconds)
73
+ - [24. Property `escalatedOrdersCount`](#escalatedOrdersCount)
74
+ - [25. Property `staleOrdersCount`](#staleOrdersCount)
75
+ - [26. Property `staleBookingsCount`](#staleBookingsCount)
76
+ - [27. Property `onHoldOrdersCount`](#onHoldOrdersCount)
77
+ - [28. Property `paymentsByMethod`](#paymentsByMethod)
78
+ - [28.1. Property `additionalProperties`](#paymentsByMethod_additionalProperties)
79
+ - [29. Property `computedForDay`](#computedForDay)
80
+ - [30. Property `generatedAt`](#generatedAt)
81
+ - [30.1. Property `_seconds`](#generatedAt__seconds)
82
+ - [30.2. Property `_nanoseconds`](#generatedAt__nanoseconds)
72
83
 
73
84
  | | |
74
85
  | ------------------------- | ----------------------------- |
@@ -79,33 +90,38 @@ sidebar_position: 17
79
90
 
80
91
  **Description:** Server-computed company metrics. Collection: companies/\{companyId\}/metrics/current (singleton). All fields are server-set — clients must never write to this collection. See also MetricsDaily and MetricsMonthly for historical snapshots.
81
92
 
82
- | Property | Pattern | Type | Deprecated | Definition | Title/Description |
83
- | ---------------------------------------------------------------------------- | ------- | ------- | ---------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
84
- | + [todayOrdersCount](#todayOrdersCount ) | No | integer | No | - | (Read-only) Orders created today (UTC). Resets at midnight. |
85
- | + [pendingOrdersCount](#pendingOrdersCount ) | No | integer | No | - | (Read-only) Orders currently in PENDING status (all-time cumulative). Corrected by full recalc on order updates. |
86
- | + [orderCompletionRate30d](#orderCompletionRate30d ) | No | number | No | - | (Read-only) Percentage of orders completed or delivered in the last 30 days. Always full recalc. |
87
- | + [todayPurchasesCount](#todayPurchasesCount ) | No | integer | No | - | (Read-only) Purchases created today (UTC). Resets at midnight. |
88
- | + [todayPurchasesSum](#todayPurchasesSum ) | No | number | No | - | (Read-only) Total value of purchases created today (UTC). Resets at midnight. |
89
- | + [averagePurchaseAmount](#averagePurchaseAmount ) | No | number | No | - | (Read-only) Average purchase value across last 200 purchases (rolling, not time-windowed). |
90
- | + [monthlyRevenue](#monthlyRevenue ) | No | number | No | - | (Read-only) Total purchase value in the current calendar month (UTC). |
91
- | + [monthlyPurchasesCount](#monthlyPurchasesCount ) | No | integer | No | - | (Read-only) Number of purchases in the current calendar month (UTC). |
92
- | + [todayBookingsCount](#todayBookingsCount ) | No | integer | No | - | (Read-only) Bookings with date == today AND status in [PENDING, CONFIRMED]. Resets at midnight. |
93
- | + [bookingsCreatedToday](#bookingsCreatedToday ) | No | integer | No | - | (Read-only) Bookings with createdAt today (all statuses). Resets at midnight. |
94
- | + [todayBookingsConfirmedAmount](#todayBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created today with status CONFIRMED or COMPLETED. Resets at midnight. |
95
- | + [monthlyBookingsConfirmedAmount](#monthlyBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created this month with status CONFIRMED or COMPLETED. |
96
- | + [todayCollectedAmount](#todayCollectedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings where PAYMENT_PAID_AT is today. Resets at midnight. |
97
- | + [todayRevenue](#todayRevenue ) | No | number | No | - | (Read-only) Sum of totalAmount for COMPLETED bookings where startDate == endDate == today (numeric YYYYMMDD). Resets at midnight. |
98
- | + [bookingsPendingPaymentVerification](#bookingsPendingPaymentVerification ) | No | integer | No | - | (Read-only) Bookings with status PENDING/CANCELLATION_REQUESTED and a payment proof uploaded but not yet verified. Current state, always full recalc. |
99
- | + [bookingsPendingValidation](#bookingsPendingValidation ) | No | integer | No | - | (Read-only) PENDING bookings with startDate within ±30 days of today. Rolling window, always full recalc. |
100
- | + [bookingsPendingValidation24h](#bookingsPendingValidation24h ) | No | integer | No | - | (Read-only) PENDING bookings created in the last 24h with startDate >= tomorrow. Always full recalc. |
101
- | + [customersCount](#customersCount ) | No | integer | No | - | (Read-only) Total customer count (all-time cumulative). |
102
- | + [newCustomersThisMonth](#newCustomersThisMonth ) | No | integer | No | - | (Read-only) Customers with createdAt in the current calendar month (UTC). |
103
- | + [averageRating](#averageRating ) | No | number | No | - | (Read-only) Average rating from the last 200 reviews (rolling). Always full recalc. |
104
- | + [lowStockItemsCount](#lowStockItemsCount ) | No | integer | No | - | (Read-only) Active stock items where currentQuantity <= minimumQuantity. Current state, always full recalc. |
105
- | + [activeRecurringPaymentsCount](#activeRecurringPaymentsCount ) | No | integer | No | - | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
106
- | + [monthlyRecurringRevenue](#monthlyRecurringRevenue ) | No | number | No | - | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
107
- | + [computedForDay](#computedForDay ) | No | string | No | - | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
108
- | + [generatedAt](#generatedAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server timestamp of the last metrics write. |
93
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
94
+ | ---------------------------------------------------------------------------- | ------- | --------------- | ---------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
95
+ | + [todayOrdersCount](#todayOrdersCount ) | No | integer | No | - | (Read-only) Orders created today (UTC). Resets at midnight. |
96
+ | + [pendingOrdersCount](#pendingOrdersCount ) | No | integer | No | - | (Read-only) Orders currently in PENDING status (all-time cumulative). Corrected by full recalc on order updates. |
97
+ | + [orderCompletionRate30d](#orderCompletionRate30d ) | No | number | No | - | (Read-only) Percentage of orders completed or delivered in the last 30 days. Always full recalc. |
98
+ | + [todayPurchasesCount](#todayPurchasesCount ) | No | integer | No | - | (Read-only) Purchases created today (UTC). Resets at midnight. |
99
+ | + [todayPurchasesSum](#todayPurchasesSum ) | No | number | No | - | (Read-only) Total value of purchases created today (UTC). Resets at midnight. |
100
+ | + [averagePurchaseAmount](#averagePurchaseAmount ) | No | number | No | - | (Read-only) Average purchase value across last 200 purchases (rolling, not time-windowed). |
101
+ | + [monthlyRevenue](#monthlyRevenue ) | No | number | No | - | (Read-only) Total purchase value in the current calendar month (UTC). |
102
+ | + [monthlyPurchasesCount](#monthlyPurchasesCount ) | No | integer | No | - | (Read-only) Number of purchases in the current calendar month (UTC). |
103
+ | + [todayBookingsCount](#todayBookingsCount ) | No | integer | No | - | (Read-only) Bookings with date == today AND status in [PENDING, CONFIRMED]. Resets at midnight. |
104
+ | + [bookingsCreatedToday](#bookingsCreatedToday ) | No | integer | No | - | (Read-only) Bookings with createdAt today (all statuses). Resets at midnight. |
105
+ | + [todayBookingsConfirmedAmount](#todayBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created today with status CONFIRMED or COMPLETED. Resets at midnight. |
106
+ | + [monthlyBookingsConfirmedAmount](#monthlyBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created this month with status CONFIRMED or COMPLETED. |
107
+ | + [todayCollectedAmount](#todayCollectedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings where PAYMENT_PAID_AT is today. Resets at midnight. |
108
+ | + [todayRevenue](#todayRevenue ) | No | number | No | - | (Read-only) Sum of totalAmount for COMPLETED bookings where startDate == endDate == today (numeric YYYYMMDD). Resets at midnight. |
109
+ | + [bookingsPendingPaymentVerification](#bookingsPendingPaymentVerification ) | No | integer | No | - | (Read-only) Bookings with status PENDING/CANCELLATION_REQUESTED and a payment proof uploaded but not yet verified. Current state, always full recalc. |
110
+ | + [bookingsPendingValidation](#bookingsPendingValidation ) | No | integer | No | - | (Read-only) PENDING bookings with startDate within ±30 days of today. Rolling window, always full recalc. |
111
+ | + [bookingsPendingValidation24h](#bookingsPendingValidation24h ) | No | integer | No | - | (Read-only) PENDING bookings created in the last 24h with startDate >= tomorrow. Always full recalc. |
112
+ | + [customersCount](#customersCount ) | No | integer | No | - | (Read-only) Total customer count (all-time cumulative). |
113
+ | + [newCustomersThisMonth](#newCustomersThisMonth ) | No | integer | No | - | (Read-only) Customers with createdAt in the current calendar month (UTC). |
114
+ | + [averageRating](#averageRating ) | No | number | No | - | (Read-only) Average rating from the last 200 reviews (rolling). Always full recalc. |
115
+ | + [lowStockItemsCount](#lowStockItemsCount ) | No | integer | No | - | (Read-only) Active stock items where currentQuantity <= minimumQuantity. Current state, always full recalc. |
116
+ | + [activeRecurringPaymentsCount](#activeRecurringPaymentsCount ) | No | integer | No | - | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
117
+ | + [monthlyRecurringRevenue](#monthlyRecurringRevenue ) | No | number | No | - | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
118
+ | - [escalatedOrdersCount](#escalatedOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document. |
119
+ | - [staleOrdersCount](#staleOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold. |
120
+ | - [staleBookingsCount](#staleBookingsCount ) | No | integer or null | No | - | (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold. |
121
+ | - [onHoldOrdersCount](#onHoldOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders currently in an on-hold state. |
122
+ | - [paymentsByMethod](#paymentsByMethod ) | No | object or null | No | - | (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map \{\} until first payment. |
123
+ | + [computedForDay](#computedForDay ) | No | string | No | - | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
124
+ | + [generatedAt](#generatedAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server timestamp of the last metrics write. |
109
125
 
110
126
  ## <a name="todayOrdersCount"></a>1. Property `todayOrdersCount`
111
127
 
@@ -471,7 +487,123 @@ Do not include in write requests. This field is set exclusively by the server (F
471
487
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
472
488
  :::
473
489
 
474
- ## <a name="computedForDay"></a>24. Property `computedForDay`
490
+ ## <a name="escalatedOrdersCount"></a>24. Property `escalatedOrdersCount`
491
+
492
+ | | |
493
+ | ------------ | ----------------- |
494
+ | **Type** | `integer or null` |
495
+ | **Required** | No |
496
+
497
+ **Description:** (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document.
498
+
499
+ | Restrictions | |
500
+ | ------------ | ---------------------- |
501
+ | **Minimum** | &ge; -9007199254740991 |
502
+ | **Maximum** | &le; 9007199254740991 |
503
+
504
+ :::warning Server-set
505
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
506
+ :::
507
+
508
+ :::note
509
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
510
+ :::
511
+
512
+ ## <a name="staleOrdersCount"></a>25. Property `staleOrdersCount`
513
+
514
+ | | |
515
+ | ------------ | ----------------- |
516
+ | **Type** | `integer or null` |
517
+ | **Required** | No |
518
+
519
+ **Description:** (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold.
520
+
521
+ | Restrictions | |
522
+ | ------------ | ---------------------- |
523
+ | **Minimum** | &ge; -9007199254740991 |
524
+ | **Maximum** | &le; 9007199254740991 |
525
+
526
+ :::warning Server-set
527
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
528
+ :::
529
+
530
+ :::note
531
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
532
+ :::
533
+
534
+ ## <a name="staleBookingsCount"></a>26. Property `staleBookingsCount`
535
+
536
+ | | |
537
+ | ------------ | ----------------- |
538
+ | **Type** | `integer or null` |
539
+ | **Required** | No |
540
+
541
+ **Description:** (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold.
542
+
543
+ | Restrictions | |
544
+ | ------------ | ---------------------- |
545
+ | **Minimum** | &ge; -9007199254740991 |
546
+ | **Maximum** | &le; 9007199254740991 |
547
+
548
+ :::warning Server-set
549
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
550
+ :::
551
+
552
+ :::note
553
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
554
+ :::
555
+
556
+ ## <a name="onHoldOrdersCount"></a>27. Property `onHoldOrdersCount`
557
+
558
+ | | |
559
+ | ------------ | ----------------- |
560
+ | **Type** | `integer or null` |
561
+ | **Required** | No |
562
+
563
+ **Description:** (Read-only, Optional) Orders currently in an on-hold state.
564
+
565
+ | Restrictions | |
566
+ | ------------ | ---------------------- |
567
+ | **Minimum** | &ge; -9007199254740991 |
568
+ | **Maximum** | &le; 9007199254740991 |
569
+
570
+ :::warning Server-set
571
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
572
+ :::
573
+
574
+ :::note
575
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
576
+ :::
577
+
578
+ ## <a name="paymentsByMethod"></a>28. Property `paymentsByMethod`
579
+
580
+ | | |
581
+ | ------------ | ---------------- |
582
+ | **Type** | `object or null` |
583
+ | **Required** | No |
584
+
585
+ **Description:** (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map \{\} until first payment.
586
+
587
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
588
+ | --------------------------------------------- | ------- | ------ | ---------- | ---------- | ----------------- |
589
+ | - [](#paymentsByMethod_additionalProperties ) | No | number | No | - | - |
590
+
591
+ ### <a name="paymentsByMethod_additionalProperties"></a>28.1. Property `additionalProperties`
592
+
593
+ | | |
594
+ | ------------ | -------- |
595
+ | **Type** | `number` |
596
+ | **Required** | No |
597
+
598
+ :::warning Server-set
599
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
600
+ :::
601
+
602
+ :::note
603
+ Always \{\} until the first real payment is recorded. Present on all tenants once rewritten by current aggregator (#8).
604
+ :::
605
+
606
+ ## <a name="computedForDay"></a>29. Property `computedForDay`
475
607
 
476
608
  | | |
477
609
  | ------------ | -------- |
@@ -484,7 +616,7 @@ Do not include in write requests. This field is set exclusively by the server (F
484
616
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
485
617
  :::
486
618
 
487
- ## <a name="generatedAt"></a>25. Property `generatedAt`
619
+ ## <a name="generatedAt"></a>30. Property `generatedAt`
488
620
 
489
621
  | | |
490
622
  | ------------------------- | --------------------------------- |
@@ -500,7 +632,7 @@ Do not include in write requests. This field is set exclusively by the server (F
500
632
  | + [_seconds](#generatedAt__seconds ) | No | integer | No | - | - |
501
633
  | + [_nanoseconds](#generatedAt__nanoseconds ) | No | integer | No | - | - |
502
634
 
503
- ### <a name="generatedAt__seconds"></a>25.1. Property `_seconds`
635
+ ### <a name="generatedAt__seconds"></a>30.1. Property `_seconds`
504
636
 
505
637
  | | |
506
638
  | ------------ | --------- |
@@ -512,7 +644,7 @@ Do not include in write requests. This field is set exclusively by the server (F
512
644
  | **Minimum** | &ge; -9007199254740991 |
513
645
  | **Maximum** | &le; 9007199254740991 |
514
646
 
515
- ### <a name="generatedAt__nanoseconds"></a>25.2. Property `_nanoseconds`
647
+ ### <a name="generatedAt__nanoseconds"></a>30.2. Property `_nanoseconds`
516
648
 
517
649
  | | |
518
650
  | ------------ | --------- |
@@ -525,7 +657,7 @@ Do not include in write requests. This field is set exclusively by the server (F
525
657
  | **Maximum** | &le; 9007199254740991 |
526
658
 
527
659
  ----------------------------------------------------------------------------------------------------------------------------
528
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
660
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 12:42:51 +0000
529
661
 
530
662
  :::warning Server-set
531
663
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "MetricsDaily"
3
3
  sidebar_label: "MetricsDaily"
4
- sidebar_position: 18
4
+ sidebar_position: 20
5
5
  ---
6
6
 
7
7
  # MetricsDaily
@@ -34,6 +34,11 @@ sidebar_position: 18
34
34
  "lowStockItemsCount": 2,
35
35
  "activeRecurringPaymentsCount": 2,
36
36
  "monthlyRecurringRevenue": 0,
37
+ "escalatedOrdersCount": null,
38
+ "staleOrdersCount": null,
39
+ "staleBookingsCount": null,
40
+ "onHoldOrdersCount": null,
41
+ "paymentsByMethod": null,
37
42
  "computedForDay": "computedForDay",
38
43
  "generatedAt": "generatedAt",
39
44
  "date": "2026-02-15"
@@ -66,11 +71,17 @@ sidebar_position: 18
66
71
  - [21. Property `lowStockItemsCount`](#lowStockItemsCount)
67
72
  - [22. Property `activeRecurringPaymentsCount`](#activeRecurringPaymentsCount)
68
73
  - [23. Property `monthlyRecurringRevenue`](#monthlyRecurringRevenue)
69
- - [24. Property `computedForDay`](#computedForDay)
70
- - [25. Property `generatedAt`](#generatedAt)
71
- - [25.1. Property `_seconds`](#generatedAt__seconds)
72
- - [25.2. Property `_nanoseconds`](#generatedAt__nanoseconds)
73
- - [26. Property `date`](#date)
74
+ - [24. Property `escalatedOrdersCount`](#escalatedOrdersCount)
75
+ - [25. Property `staleOrdersCount`](#staleOrdersCount)
76
+ - [26. Property `staleBookingsCount`](#staleBookingsCount)
77
+ - [27. Property `onHoldOrdersCount`](#onHoldOrdersCount)
78
+ - [28. Property `paymentsByMethod`](#paymentsByMethod)
79
+ - [28.1. Property `additionalProperties`](#paymentsByMethod_additionalProperties)
80
+ - [29. Property `computedForDay`](#computedForDay)
81
+ - [30. Property `generatedAt`](#generatedAt)
82
+ - [30.1. Property `_seconds`](#generatedAt__seconds)
83
+ - [30.2. Property `_nanoseconds`](#generatedAt__nanoseconds)
84
+ - [31. Property `date`](#date)
74
85
 
75
86
  | | |
76
87
  | ------------------------- | --------------------------- |
@@ -81,34 +92,39 @@ sidebar_position: 18
81
92
 
82
93
  **Description:** Daily metrics snapshot. Collection: companies/\{companyId\}/metrics_daily/\{YYYY-MM-DD\}. Same fields as MetricsCurrent plus `date`. Written by computeDailyCompanyMetrics cron (02:00 UTC) and inline after full recalcs.
83
94
 
84
- | Property | Pattern | Type | Deprecated | Definition | Title/Description |
85
- | ---------------------------------------------------------------------------- | ------- | ------- | ---------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
86
- | + [todayOrdersCount](#todayOrdersCount ) | No | integer | No | - | (Read-only) Orders created today (UTC). Resets at midnight. |
87
- | + [pendingOrdersCount](#pendingOrdersCount ) | No | integer | No | - | (Read-only) Orders currently in PENDING status (all-time cumulative). Corrected by full recalc on order updates. |
88
- | + [orderCompletionRate30d](#orderCompletionRate30d ) | No | number | No | - | (Read-only) Percentage of orders completed or delivered in the last 30 days. Always full recalc. |
89
- | + [todayPurchasesCount](#todayPurchasesCount ) | No | integer | No | - | (Read-only) Purchases created today (UTC). Resets at midnight. |
90
- | + [todayPurchasesSum](#todayPurchasesSum ) | No | number | No | - | (Read-only) Total value of purchases created today (UTC). Resets at midnight. |
91
- | + [averagePurchaseAmount](#averagePurchaseAmount ) | No | number | No | - | (Read-only) Average purchase value across last 200 purchases (rolling, not time-windowed). |
92
- | + [monthlyRevenue](#monthlyRevenue ) | No | number | No | - | (Read-only) Total purchase value in the current calendar month (UTC). |
93
- | + [monthlyPurchasesCount](#monthlyPurchasesCount ) | No | integer | No | - | (Read-only) Number of purchases in the current calendar month (UTC). |
94
- | + [todayBookingsCount](#todayBookingsCount ) | No | integer | No | - | (Read-only) Bookings with date == today AND status in [PENDING, CONFIRMED]. Resets at midnight. |
95
- | + [bookingsCreatedToday](#bookingsCreatedToday ) | No | integer | No | - | (Read-only) Bookings with createdAt today (all statuses). Resets at midnight. |
96
- | + [todayBookingsConfirmedAmount](#todayBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created today with status CONFIRMED or COMPLETED. Resets at midnight. |
97
- | + [monthlyBookingsConfirmedAmount](#monthlyBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created this month with status CONFIRMED or COMPLETED. |
98
- | + [todayCollectedAmount](#todayCollectedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings where PAYMENT_PAID_AT is today. Resets at midnight. |
99
- | + [todayRevenue](#todayRevenue ) | No | number | No | - | (Read-only) Sum of totalAmount for COMPLETED bookings where startDate == endDate == today (numeric YYYYMMDD). Resets at midnight. |
100
- | + [bookingsPendingPaymentVerification](#bookingsPendingPaymentVerification ) | No | integer | No | - | (Read-only) Bookings with status PENDING/CANCELLATION_REQUESTED and a payment proof uploaded but not yet verified. Current state, always full recalc. |
101
- | + [bookingsPendingValidation](#bookingsPendingValidation ) | No | integer | No | - | (Read-only) PENDING bookings with startDate within ±30 days of today. Rolling window, always full recalc. |
102
- | + [bookingsPendingValidation24h](#bookingsPendingValidation24h ) | No | integer | No | - | (Read-only) PENDING bookings created in the last 24h with startDate &gt;= tomorrow. Always full recalc. |
103
- | + [customersCount](#customersCount ) | No | integer | No | - | (Read-only) Total customer count (all-time cumulative). |
104
- | + [newCustomersThisMonth](#newCustomersThisMonth ) | No | integer | No | - | (Read-only) Customers with createdAt in the current calendar month (UTC). |
105
- | + [averageRating](#averageRating ) | No | number | No | - | (Read-only) Average rating from the last 200 reviews (rolling). Always full recalc. |
106
- | + [lowStockItemsCount](#lowStockItemsCount ) | No | integer | No | - | (Read-only) Active stock items where currentQuantity &lt;= minimumQuantity. Current state, always full recalc. |
107
- | + [activeRecurringPaymentsCount](#activeRecurringPaymentsCount ) | No | integer | No | - | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
108
- | + [monthlyRecurringRevenue](#monthlyRecurringRevenue ) | No | number | No | - | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
109
- | + [computedForDay](#computedForDay ) | No | string | No | - | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
110
- | + [generatedAt](#generatedAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server timestamp of the last metrics write. |
111
- | + [date](#date ) | No | string | No | - | (Read-only) YYYY-MM-DD document ID repeated as a field. Identifies the day this snapshot covers. |
95
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
96
+ | ---------------------------------------------------------------------------- | ------- | --------------- | ---------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
97
+ | + [todayOrdersCount](#todayOrdersCount ) | No | integer | No | - | (Read-only) Orders created today (UTC). Resets at midnight. |
98
+ | + [pendingOrdersCount](#pendingOrdersCount ) | No | integer | No | - | (Read-only) Orders currently in PENDING status (all-time cumulative). Corrected by full recalc on order updates. |
99
+ | + [orderCompletionRate30d](#orderCompletionRate30d ) | No | number | No | - | (Read-only) Percentage of orders completed or delivered in the last 30 days. Always full recalc. |
100
+ | + [todayPurchasesCount](#todayPurchasesCount ) | No | integer | No | - | (Read-only) Purchases created today (UTC). Resets at midnight. |
101
+ | + [todayPurchasesSum](#todayPurchasesSum ) | No | number | No | - | (Read-only) Total value of purchases created today (UTC). Resets at midnight. |
102
+ | + [averagePurchaseAmount](#averagePurchaseAmount ) | No | number | No | - | (Read-only) Average purchase value across last 200 purchases (rolling, not time-windowed). |
103
+ | + [monthlyRevenue](#monthlyRevenue ) | No | number | No | - | (Read-only) Total purchase value in the current calendar month (UTC). |
104
+ | + [monthlyPurchasesCount](#monthlyPurchasesCount ) | No | integer | No | - | (Read-only) Number of purchases in the current calendar month (UTC). |
105
+ | + [todayBookingsCount](#todayBookingsCount ) | No | integer | No | - | (Read-only) Bookings with date == today AND status in [PENDING, CONFIRMED]. Resets at midnight. |
106
+ | + [bookingsCreatedToday](#bookingsCreatedToday ) | No | integer | No | - | (Read-only) Bookings with createdAt today (all statuses). Resets at midnight. |
107
+ | + [todayBookingsConfirmedAmount](#todayBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created today with status CONFIRMED or COMPLETED. Resets at midnight. |
108
+ | + [monthlyBookingsConfirmedAmount](#monthlyBookingsConfirmedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings created this month with status CONFIRMED or COMPLETED. |
109
+ | + [todayCollectedAmount](#todayCollectedAmount ) | No | number | No | - | (Read-only) Sum of totalAmount for bookings where PAYMENT_PAID_AT is today. Resets at midnight. |
110
+ | + [todayRevenue](#todayRevenue ) | No | number | No | - | (Read-only) Sum of totalAmount for COMPLETED bookings where startDate == endDate == today (numeric YYYYMMDD). Resets at midnight. |
111
+ | + [bookingsPendingPaymentVerification](#bookingsPendingPaymentVerification ) | No | integer | No | - | (Read-only) Bookings with status PENDING/CANCELLATION_REQUESTED and a payment proof uploaded but not yet verified. Current state, always full recalc. |
112
+ | + [bookingsPendingValidation](#bookingsPendingValidation ) | No | integer | No | - | (Read-only) PENDING bookings with startDate within ±30 days of today. Rolling window, always full recalc. |
113
+ | + [bookingsPendingValidation24h](#bookingsPendingValidation24h ) | No | integer | No | - | (Read-only) PENDING bookings created in the last 24h with startDate &gt;= tomorrow. Always full recalc. |
114
+ | + [customersCount](#customersCount ) | No | integer | No | - | (Read-only) Total customer count (all-time cumulative). |
115
+ | + [newCustomersThisMonth](#newCustomersThisMonth ) | No | integer | No | - | (Read-only) Customers with createdAt in the current calendar month (UTC). |
116
+ | + [averageRating](#averageRating ) | No | number | No | - | (Read-only) Average rating from the last 200 reviews (rolling). Always full recalc. |
117
+ | + [lowStockItemsCount](#lowStockItemsCount ) | No | integer | No | - | (Read-only) Active stock items where currentQuantity &lt;= minimumQuantity. Current state, always full recalc. |
118
+ | + [activeRecurringPaymentsCount](#activeRecurringPaymentsCount ) | No | integer | No | - | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
119
+ | + [monthlyRecurringRevenue](#monthlyRecurringRevenue ) | No | number | No | - | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
120
+ | - [escalatedOrdersCount](#escalatedOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document. |
121
+ | - [staleOrdersCount](#staleOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold. |
122
+ | - [staleBookingsCount](#staleBookingsCount ) | No | integer or null | No | - | (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold. |
123
+ | - [onHoldOrdersCount](#onHoldOrdersCount ) | No | integer or null | No | - | (Read-only, Optional) Orders currently in an on-hold state. |
124
+ | - [paymentsByMethod](#paymentsByMethod ) | No | object or null | No | - | (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map \{\} until first payment. |
125
+ | + [computedForDay](#computedForDay ) | No | string | No | - | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
126
+ | + [generatedAt](#generatedAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server timestamp of the last metrics write. |
127
+ | + [date](#date ) | No | string | No | - | (Read-only) YYYY-MM-DD document ID repeated as a field. Identifies the day this snapshot covers. |
112
128
 
113
129
  ## <a name="todayOrdersCount"></a>1. Property `todayOrdersCount`
114
130
 
@@ -474,7 +490,123 @@ Do not include in write requests. This field is set exclusively by the server (F
474
490
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
475
491
  :::
476
492
 
477
- ## <a name="computedForDay"></a>24. Property `computedForDay`
493
+ ## <a name="escalatedOrdersCount"></a>24. Property `escalatedOrdersCount`
494
+
495
+ | | |
496
+ | ------------ | ----------------- |
497
+ | **Type** | `integer or null` |
498
+ | **Required** | No |
499
+
500
+ **Description:** (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document.
501
+
502
+ | Restrictions | |
503
+ | ------------ | ---------------------- |
504
+ | **Minimum** | &ge; -9007199254740991 |
505
+ | **Maximum** | &le; 9007199254740991 |
506
+
507
+ :::warning Server-set
508
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
509
+ :::
510
+
511
+ :::note
512
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
513
+ :::
514
+
515
+ ## <a name="staleOrdersCount"></a>25. Property `staleOrdersCount`
516
+
517
+ | | |
518
+ | ------------ | ----------------- |
519
+ | **Type** | `integer or null` |
520
+ | **Required** | No |
521
+
522
+ **Description:** (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold.
523
+
524
+ | Restrictions | |
525
+ | ------------ | ---------------------- |
526
+ | **Minimum** | &ge; -9007199254740991 |
527
+ | **Maximum** | &le; 9007199254740991 |
528
+
529
+ :::warning Server-set
530
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
531
+ :::
532
+
533
+ :::note
534
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
535
+ :::
536
+
537
+ ## <a name="staleBookingsCount"></a>26. Property `staleBookingsCount`
538
+
539
+ | | |
540
+ | ------------ | ----------------- |
541
+ | **Type** | `integer or null` |
542
+ | **Required** | No |
543
+
544
+ **Description:** (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold.
545
+
546
+ | Restrictions | |
547
+ | ------------ | ---------------------- |
548
+ | **Minimum** | &ge; -9007199254740991 |
549
+ | **Maximum** | &le; 9007199254740991 |
550
+
551
+ :::warning Server-set
552
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
553
+ :::
554
+
555
+ :::note
556
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
557
+ :::
558
+
559
+ ## <a name="onHoldOrdersCount"></a>27. Property `onHoldOrdersCount`
560
+
561
+ | | |
562
+ | ------------ | ----------------- |
563
+ | **Type** | `integer or null` |
564
+ | **Required** | No |
565
+
566
+ **Description:** (Read-only, Optional) Orders currently in an on-hold state.
567
+
568
+ | Restrictions | |
569
+ | ------------ | ---------------------- |
570
+ | **Minimum** | &ge; -9007199254740991 |
571
+ | **Maximum** | &le; 9007199254740991 |
572
+
573
+ :::warning Server-set
574
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
575
+ :::
576
+
577
+ :::note
578
+ Absent on tenants whose metrics/current was last written before aggregator v2. Backfill required for universal presence (#8).
579
+ :::
580
+
581
+ ## <a name="paymentsByMethod"></a>28. Property `paymentsByMethod`
582
+
583
+ | | |
584
+ | ------------ | ---------------- |
585
+ | **Type** | `object or null` |
586
+ | **Required** | No |
587
+
588
+ **Description:** (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map \{\} until first payment.
589
+
590
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
591
+ | --------------------------------------------- | ------- | ------ | ---------- | ---------- | ----------------- |
592
+ | - [](#paymentsByMethod_additionalProperties ) | No | number | No | - | - |
593
+
594
+ ### <a name="paymentsByMethod_additionalProperties"></a>28.1. Property `additionalProperties`
595
+
596
+ | | |
597
+ | ------------ | -------- |
598
+ | **Type** | `number` |
599
+ | **Required** | No |
600
+
601
+ :::warning Server-set
602
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
603
+ :::
604
+
605
+ :::note
606
+ Always \{\} until the first real payment is recorded. Present on all tenants once rewritten by current aggregator (#8).
607
+ :::
608
+
609
+ ## <a name="computedForDay"></a>29. Property `computedForDay`
478
610
 
479
611
  | | |
480
612
  | ------------ | -------- |
@@ -487,7 +619,7 @@ Do not include in write requests. This field is set exclusively by the server (F
487
619
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
488
620
  :::
489
621
 
490
- ## <a name="generatedAt"></a>25. Property `generatedAt`
622
+ ## <a name="generatedAt"></a>30. Property `generatedAt`
491
623
 
492
624
  | | |
493
625
  | ------------------------- | --------------------------------- |
@@ -503,7 +635,7 @@ Do not include in write requests. This field is set exclusively by the server (F
503
635
  | + [_seconds](#generatedAt__seconds ) | No | integer | No | - | - |
504
636
  | + [_nanoseconds](#generatedAt__nanoseconds ) | No | integer | No | - | - |
505
637
 
506
- ### <a name="generatedAt__seconds"></a>25.1. Property `_seconds`
638
+ ### <a name="generatedAt__seconds"></a>30.1. Property `_seconds`
507
639
 
508
640
  | | |
509
641
  | ------------ | --------- |
@@ -515,7 +647,7 @@ Do not include in write requests. This field is set exclusively by the server (F
515
647
  | **Minimum** | &ge; -9007199254740991 |
516
648
  | **Maximum** | &le; 9007199254740991 |
517
649
 
518
- ### <a name="generatedAt__nanoseconds"></a>25.2. Property `_nanoseconds`
650
+ ### <a name="generatedAt__nanoseconds"></a>30.2. Property `_nanoseconds`
519
651
 
520
652
  | | |
521
653
  | ------------ | --------- |
@@ -531,7 +663,7 @@ Do not include in write requests. This field is set exclusively by the server (F
531
663
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
532
664
  :::
533
665
 
534
- ## <a name="date"></a>26. Property `date`
666
+ ## <a name="date"></a>31. Property `date`
535
667
 
536
668
  | | |
537
669
  | ------------ | -------- |
@@ -541,7 +673,7 @@ Do not include in write requests. This field is set exclusively by the server (F
541
673
  **Description:** (Read-only) YYYY-MM-DD document ID repeated as a field. Identifies the day this snapshot covers.
542
674
 
543
675
  ----------------------------------------------------------------------------------------------------------------------------
544
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
676
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 12:42:51 +0000
545
677
 
546
678
  :::warning Server-set
547
679
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.