@ingenx-io/valets-schema-mcp-server 0.1.1 → 0.1.3

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 (43) hide show
  1. package/data/docs/collections/firestore-paths.md +49 -0
  2. package/data/docs/decisions/migrations.md +56 -0
  3. package/data/docs/decisions/summary.md +78 -0
  4. package/data/docs/enums/booking-status.md +26 -0
  5. package/data/docs/enums/customer-payment-status.md +26 -0
  6. package/data/docs/enums/customer-payment-target-type.md +23 -0
  7. package/data/docs/enums/delivery-type.md +23 -0
  8. package/data/docs/enums/event-status.md +30 -0
  9. package/data/docs/enums/fulfillment-status.md +32 -0
  10. package/data/docs/enums/loyalty-transaction-type.md +32 -0
  11. package/data/docs/enums/order-status.md +65 -0
  12. package/data/docs/enums/payment-method.md +36 -0
  13. package/data/docs/enums/payment-proof-status.md +23 -0
  14. package/data/docs/enums/payment-status.md +34 -0
  15. package/data/docs/enums/return-status.md +32 -0
  16. package/data/docs/enums/session-status.md +32 -0
  17. package/data/docs/enums/ticket-status.md +29 -0
  18. package/data/docs/index.md +102 -0
  19. package/data/docs/models/booking-version.md +295 -0
  20. package/data/docs/models/booking.md +1754 -0
  21. package/data/docs/models/customer-payment-allocation.md +336 -0
  22. package/data/docs/models/customer-payment.md +392 -0
  23. package/data/docs/models/customer.md +475 -0
  24. package/data/docs/models/event.md +386 -0
  25. package/data/docs/models/loyalty-config.md +317 -0
  26. package/data/docs/models/loyalty-reward.md +236 -0
  27. package/data/docs/models/loyalty-status.md +328 -0
  28. package/data/docs/models/loyalty-transaction.md +326 -0
  29. package/data/docs/models/metrics-current.md +532 -0
  30. package/data/docs/models/metrics-daily.md +548 -0
  31. package/data/docs/models/metrics-monthly.md +548 -0
  32. package/data/docs/models/order-item.md +361 -0
  33. package/data/docs/models/order.md +1637 -0
  34. package/data/docs/models/payment-summary.md +123 -0
  35. package/data/docs/models/sale.md +540 -0
  36. package/data/docs/models/ticket.md +405 -0
  37. package/data/docs/triggers/event-ticket-triggers.md +204 -0
  38. package/data/docs/triggers/loyalty-automation.md +123 -0
  39. package/data/static/decisions.json +966 -0
  40. package/data/static/llms.txt +1056 -0
  41. package/data/static/openapi.yaml +3090 -0
  42. package/data/static/schemas.json +4055 -0
  43. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: "Overview"
3
+ sidebar_label: "Overview"
4
+ sidebar_position: 0
5
+ slug: /
6
+ ---
7
+
8
+ # @valets/schema Documentation
9
+
10
+ Browsable documentation for the Valets canonical data model, auto-generated from **Zod schemas** via JSON Schema.
11
+
12
+ ## How this works
13
+
14
+ ```
15
+ Zod (source of truth) → JSON Schema → json-schema-for-humans → This site
16
+ ```
17
+
18
+ Developers own the Zod source in `packages/schema/src/`. When schemas change, this documentation regenerates automatically.
19
+
20
+ ## What's documented
21
+
22
+ ### Enums (14)
23
+
24
+ Status enums that drive business logic across Order, Booking, Event, and Loyalty domains:
25
+
26
+ | Enum | Values | Description |
27
+ |------|--------|-------------|
28
+ | [BookingStatus](enums/booking-status) | 6 values | Booking lifecycle status. COMPLETED_MIXED = some sessions completed, others cancelled/no-show. |
29
+ | [CustomerPaymentStatus](enums/customer-payment-status) | 6 values | Customer payment lifecycle status (D22). Tracks allocation progress of received payments. |
30
+ | [CustomerPaymentTargetType](enums/customer-payment-target-type) | 3 values | Target document type for customer payment allocation. |
31
+ | [DeliveryType](enums/delivery-type) | 3 values | Fulfillment channel for an order. Determines whether the customer comes to the business (ON_SITE), collects their order themselves (PICK_UP), or receives a physical delivery (DELIVERY). Drives whether fulfillmentStatus is relevant. |
32
+ | [EventStatus](enums/event-status) | 4 values | Ticketed event lifecycle (D32). Mobile-only today; Dashboard in Wave 4. |
33
+ | [FulfillmentStatus](enums/fulfillment-status) | 6 values | Delivery/fulfillment lifecycle (D34). Optional — null for in-person orders. |
34
+ | [LoyaltyTransactionType](enums/loyalty-transaction-type) | 6 values | Loyalty point transaction type (D07). SCREAMING_SNAKE past tense. |
35
+ | [OrderStatus](enums/order-status) | 7 values | Core order lifecycle status (D03, D34). Universal across all business types. Replaces the Dashboard's legacy 20-value flat enum (MIG-11). |
36
+ | [PaymentMethod](enums/payment-method) | 10 values | Unified payment method set with African + global methods (D02). |
37
+ | [PaymentProofStatus](enums/payment-proof-status) | 3 values | Payment proof review status. Used by Order and Booking payment proof workflows. |
38
+ | [PaymentStatus](enums/payment-status) | 7 values | Payment lifecycle status (D01 amended). Used by Order, Sale/Purchase, Booking. |
39
+ | [ReturnStatus](enums/return-status) | 6 values | Post-sale return/exchange lifecycle (D34). Optional — null until return or exchange initiated. |
40
+ | [SessionStatus](enums/session-status) | 6 values | Per-date/per-slot booking session status (D19). Dashboard is sole writer; Mobile is read-only. |
41
+ | [TicketStatus](enums/ticket-status) | 3 values | Event ticket status (D32). VALID = active and unused. |
42
+
43
+
44
+ ### Models (17)
45
+
46
+ Core Firestore document schemas:
47
+
48
+ | Model | Fields | Required | Description |
49
+ |-------|--------|----------|-------------|
50
+ | [Booking](models/booking) | 52 | 7 | — |
51
+ | [BookingVersion](models/booking-version) | 9 | 6 | — |
52
+ | [Customer](models/customer) | 17 | 4 | — |
53
+ | [CustomerPayment](models/customer-payment) | 17 | 12 | — |
54
+ | [CustomerPaymentAllocation](models/customer-payment-allocation) | 14 | 8 | — |
55
+ | [Event](models/event) | 15 | 9 | — |
56
+ | [LoyaltyConfig](models/loyalty-config) | 11 | 2 | — |
57
+ | [LoyaltyReward](models/loyalty-reward) | 11 | 5 | — |
58
+ | [LoyaltyStatus](models/loyalty-status) | 9 | 2 | — |
59
+ | [LoyaltyTransaction](models/loyalty-transaction) | 16 | 4 | — |
60
+ | [MetricsCurrent](models/metrics-current) | 25 | 25 | — |
61
+ | [MetricsDaily](models/metrics-daily) | 26 | 26 | — |
62
+ | [MetricsMonthly](models/metrics-monthly) | 26 | 26 | — |
63
+ | [Order](models/order) | 47 | 8 | — |
64
+ | [OrderItem](models/order-item) | 12 | 3 | — |
65
+ | [Sale](models/sale) | 12 | 1 | — |
66
+ | [Ticket](models/ticket) | 16 | 6 | — |
67
+
68
+
69
+
70
+ ## ⚗️ Proposed (Work In Progress)
71
+
72
+ > These schemas are under review and **not yet part of `@valets/schema`**. Shape may change.
73
+
74
+
75
+ | Model | Fields | Required | Description |
76
+ |-------|--------|----------|-------------|
77
+ | [PaymentSummary](proposed/models/payment-summary) | 10 | 9 | — |
78
+
79
+
80
+
81
+
82
+ | Enum | Values | Description |
83
+ |------|--------|-------------|
84
+ | [AttentionStatus](proposed/enums/attention-status) | 4 values | Operational attention status for Order and Booking (D39). Controls home-page queue assignment. Server-owned — set via triggers or callable fn only. |
85
+ | [PendingIssue](proposed/enums/pending-issue) | 11 values | Specific detected conditions on an Order or Booking requiring human action (D39). Stored as an array — multiple issues can be active simultaneously. Server-owned. |
86
+
87
+
88
+
89
+
90
+ ## Machine-friendly formats
91
+
92
+ | Format | URL | Use case |
93
+ |--------|-----|----------|
94
+ | [schemas.json](/schemas.json) | `/schemas.json` | Consolidated JSON Schema bundle — programmatic access, tooling |
95
+ | [llms.txt](/llms.txt) | `/llms.txt` | LLM-optimized summary — context injection for AI agents |
96
+ | [openapi.yaml](/openapi.yaml) | `/openapi.yaml` | OpenAPI 3.1 spec — Postman, Swagger UI, codegen, CI validation |
97
+
98
+ ## Source
99
+
100
+ - **Zod schemas**: `packages/schema/src/`
101
+ - **JSON Schema output**: `packages/schema/json-schema/`
102
+ - **Dart codegen output**: `packages/schema/dart/`
@@ -0,0 +1,295 @@
1
+ ---
2
+ title: "BookingVersion"
3
+ sidebar_label: "BookingVersion"
4
+ sidebar_position: 2
5
+ ---
6
+
7
+ # BookingVersion
8
+
9
+ <details>
10
+ <summary>Example JSON</summary>
11
+
12
+ ```json
13
+ {
14
+ "id": "bk_abc123def456",
15
+ "bookingId": "boo_ref123",
16
+ "companyId": "comp_xyz789",
17
+ "changeType": "CREATE",
18
+ "changedAt": "changedAt",
19
+ "changedBy": null,
20
+ "changedByRole": "DASHBOARD",
21
+ "fieldsChanged": null,
22
+ "snapshot": {}
23
+ }
24
+ ```
25
+
26
+ </details>
27
+
28
+
29
+ - [1. Property `id`](#id)
30
+ - [2. Property `bookingId`](#bookingId)
31
+ - [3. Property `companyId`](#companyId)
32
+ - [4. Property `changeType`](#changeType)
33
+ - [5. Property `changedAt`](#changedAt)
34
+ - [5.1. Property `_seconds`](#changedAt__seconds)
35
+ - [5.2. Property `_nanoseconds`](#changedAt__nanoseconds)
36
+ - [6. Property `changedBy`](#changedBy)
37
+ - [7. Property `changedByRole`](#changedByRole)
38
+ - [8. Property `fieldsChanged`](#fieldsChanged)
39
+ - [8.1. fieldsChanged items](#fieldsChanged_items)
40
+ - [9. Property `snapshot`](#snapshot)
41
+ - [9.1. Property `additionalProperties`](#snapshot_additionalProperties)
42
+
43
+ | | |
44
+ | ------------------------- | ----------------------------- |
45
+ | **Type** | `object` |
46
+ | **Required** | No |
47
+ | **Additional properties** | Not allowed |
48
+ | **Defined in** | #/definitions/booking-version |
49
+
50
+ **Description:** BookingVersion model (D18). Collection: companies/\{companyId\}/bookings/\{bookingId\}/versions/\{versionId\}. Server-owned audit trail written by Firebase trigger on every Booking mutation. Captures writes from all clients.
51
+
52
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
53
+ | ---------------------------------- | ------- | ----------------------- | ---------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | + [id](#id ) | No | string | No | - | (Read-only) Firestore document ID. Server-generated version record. |
55
+ | + [bookingId](#bookingId ) | No | string | No | - | (Immutable) FK → Booking.id. Parent booking this version records. |
56
+ | + [companyId](#companyId ) | No | string | No | - | (Immutable) FK → Company document ID. Denormalized for direct queries. |
57
+ | + [changeType](#changeType ) | No | enum (of string) | No | - | (Immutable) What caused this version record: CREATE, UPDATE, or DELETE. |
58
+ | + [changedAt](#changedAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Timestamp of the write that created this version. Server-set. |
59
+ | - [changedBy](#changedBy ) | No | string or null | No | - | (Immutable) FK → User/staff UID who made the change. Null for server-originated writes. |
60
+ | - [changedByRole](#changedByRole ) | No | enum (of string) | No | - | (Immutable) Which platform/context made the write: DASHBOARD, MOBILE, FIREBASE (trigger), CLI (migration script), or UNKNOWN. SCREAMING_SNAKE per D04. |
61
+ | - [fieldsChanged](#fieldsChanged ) | No | array of string or null | No | - | (Immutable, Read-only) List of field paths that changed in this write. Populated by the Firebase trigger diff. Null for CREATE records. |
62
+ | + [snapshot](#snapshot ) | No | object | No | - | (Immutable, Read-only) Full snapshot of the Booking document immediately after the write. Untyped to avoid circular schema dependency — cast to Booking at runtime. |
63
+
64
+ ## <a name="id"></a>1. Property `id`
65
+
66
+ | | |
67
+ | ------------ | -------- |
68
+ | **Type** | `string` |
69
+ | **Required** | Yes |
70
+
71
+ **Description:** (Read-only) Firestore document ID. Server-generated version record.
72
+
73
+ :::warning Server-set
74
+ 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.
75
+ :::
76
+
77
+ ## <a name="bookingId"></a>2. Property `bookingId`
78
+
79
+ | | |
80
+ | ------------ | -------- |
81
+ | **Type** | `string` |
82
+ | **Required** | Yes |
83
+
84
+ **Description:** (Immutable) FK → Booking.id. Parent booking this version records.
85
+
86
+ :::info Immutable
87
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
88
+ :::
89
+
90
+ ## <a name="companyId"></a>3. Property `companyId`
91
+
92
+ | | |
93
+ | ------------ | -------- |
94
+ | **Type** | `string` |
95
+ | **Required** | Yes |
96
+
97
+ **Description:** (Immutable) FK → Company document ID. Denormalized for direct queries.
98
+
99
+ :::info Immutable
100
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
101
+ :::
102
+
103
+ ## <a name="changeType"></a>4. Property `changeType`
104
+
105
+ | | |
106
+ | ------------ | ------------------ |
107
+ | **Type** | `enum (of string)` |
108
+ | **Required** | Yes |
109
+
110
+ **Description:** (Immutable) What caused this version record: CREATE, UPDATE, or DELETE.
111
+
112
+ Must be one of:
113
+ * "CREATE"
114
+ * "UPDATE"
115
+ * "DELETE"
116
+
117
+ :::info Immutable
118
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
119
+ :::
120
+
121
+ :::note
122
+ DELETE versions are written when a booking is soft-deleted (CRDT _deleted flag). Hard deletes bypass this trail.
123
+ :::
124
+
125
+ ## <a name="changedAt"></a>5. Property `changedAt`
126
+
127
+ | | |
128
+ | ------------------------- | --------------------------------- |
129
+ | **Type** | `object` |
130
+ | **Required** | Yes |
131
+ | **Additional properties** | Not allowed |
132
+ | **Defined in** | #/definitions/firestore-timestamp |
133
+
134
+ **Description:** (Read-only) Timestamp of the write that created this version. Server-set.
135
+
136
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
137
+ | ------------------------------------------ | ------- | ------- | ---------- | ---------- | ----------------- |
138
+ | + [_seconds](#changedAt__seconds ) | No | integer | No | - | - |
139
+ | + [_nanoseconds](#changedAt__nanoseconds ) | No | integer | No | - | - |
140
+
141
+ ### <a name="changedAt__seconds"></a>5.1. Property `_seconds`
142
+
143
+ | | |
144
+ | ------------ | --------- |
145
+ | **Type** | `integer` |
146
+ | **Required** | Yes |
147
+
148
+ | Restrictions | |
149
+ | ------------ | ---------------------- |
150
+ | **Minimum** | &ge; -9007199254740991 |
151
+ | **Maximum** | &le; 9007199254740991 |
152
+
153
+ ### <a name="changedAt__nanoseconds"></a>5.2. Property `_nanoseconds`
154
+
155
+ | | |
156
+ | ------------ | --------- |
157
+ | **Type** | `integer` |
158
+ | **Required** | Yes |
159
+
160
+ | Restrictions | |
161
+ | ------------ | ---------------------- |
162
+ | **Minimum** | &ge; -9007199254740991 |
163
+ | **Maximum** | &le; 9007199254740991 |
164
+
165
+ :::warning Server-set
166
+ 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.
167
+ :::
168
+
169
+ ## <a name="changedBy"></a>6. Property `changedBy`
170
+
171
+ | | |
172
+ | ------------ | ---------------- |
173
+ | **Type** | `string or null` |
174
+ | **Required** | No |
175
+
176
+ **Description:** (Immutable) FK → User/staff UID who made the change. Null for server-originated writes.
177
+
178
+ :::info Immutable
179
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
180
+ :::
181
+
182
+ :::note
183
+ Null when the write originated from a Firebase trigger, CLI script, or unknown source.
184
+ :::
185
+
186
+ ## <a name="changedByRole"></a>7. Property `changedByRole`
187
+
188
+ | | |
189
+ | ------------ | ------------------ |
190
+ | **Type** | `enum (of string)` |
191
+ | **Required** | No |
192
+
193
+ **Description:** (Immutable) Which platform/context made the write: DASHBOARD, MOBILE, FIREBASE (trigger), CLI (migration script), or UNKNOWN. SCREAMING_SNAKE per D04.
194
+
195
+ Must be one of:
196
+ * "DASHBOARD"
197
+ * "MOBILE"
198
+ * "FIREBASE"
199
+ * "CLI"
200
+ * "UNKNOWN"
201
+
202
+ :::info Immutable
203
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
204
+ :::
205
+
206
+ :::note
207
+ Populated by the Firebase trigger from the write context. Helps distinguish client vs. server writes.
208
+ :::
209
+
210
+ ## <a name="fieldsChanged"></a>8. Property `fieldsChanged`
211
+
212
+ | | |
213
+ | ------------ | ------------------------- |
214
+ | **Type** | `array of string or null` |
215
+ | **Required** | No |
216
+
217
+ **Description:** (Immutable, Read-only) List of field paths that changed in this write. Populated by the Firebase trigger diff. Null for CREATE records.
218
+
219
+ | | Array restrictions |
220
+ | -------------------- | ------------------ |
221
+ | **Min items** | N/A |
222
+ | **Max items** | N/A |
223
+ | **Items unicity** | False |
224
+ | **Additional items** | False |
225
+ | **Tuple validation** | See below |
226
+
227
+ | Each item of this array must be | Description |
228
+ | ------------------------------------------- | ----------- |
229
+ | [fieldsChanged items](#fieldsChanged_items) | - |
230
+
231
+ ### <a name="fieldsChanged_items"></a>8.1. fieldsChanged items
232
+
233
+ | | |
234
+ | ------------ | -------- |
235
+ | **Type** | `string` |
236
+ | **Required** | No |
237
+
238
+ :::warning Server-set
239
+ 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.
240
+ :::
241
+
242
+ :::info Immutable
243
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
244
+ :::
245
+
246
+ :::note
247
+ Dot-notation paths for nested fields (e.g. "bookingDates.0.status"). Populated by diff in Firebase trigger. Null for CREATE versions.
248
+ :::
249
+
250
+ ## <a name="snapshot"></a>9. Property `snapshot`
251
+
252
+ | | |
253
+ | ------------------------- | ------------------------------------------------------------------------------------- |
254
+ | **Type** | `object` |
255
+ | **Required** | Yes |
256
+ | **Additional properties** | [Each additional property must conform to the schema](#snapshot_additionalProperties) |
257
+
258
+ **Description:** (Immutable, Read-only) Full snapshot of the Booking document immediately after the write. Untyped to avoid circular schema dependency — cast to Booking at runtime.
259
+
260
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
261
+ | ------------------------------------- | ------- | ------ | ---------- | ---------- | ----------------- |
262
+ | - [](#snapshot_additionalProperties ) | No | object | No | - | - |
263
+
264
+ ### <a name="snapshot_additionalProperties"></a>9.1. Property `additionalProperties`
265
+
266
+ | | |
267
+ | ------------------------- | ---------------- |
268
+ | **Type** | `object` |
269
+ | **Required** | No |
270
+ | **Additional properties** | Any type allowed |
271
+
272
+ ----------------------------------------------------------------------------------------------------------------------------
273
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-04-06 at 19:27:48 +0000
274
+
275
+ :::warning Server-set
276
+ 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.
277
+ :::
278
+
279
+ :::info Immutable
280
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
281
+ :::
282
+
283
+ :::note
284
+ Full Booking document at the time of write. Typed as a string-keyed record to avoid circular schema reference. Consumers cast to Booking at runtime.
285
+ :::
286
+
287
+ :::info See also
288
+ **Decisions:** `D18`
289
+ :::
290
+
291
+ ## Related Decisions
292
+
293
+ | Decision | Title |
294
+ |---|---|
295
+ | **D18** | Firebase BookingVersion ownership |