@ingenx-io/valets-schema-mcp-server 0.1.10 → 0.2.1

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 (66) hide show
  1. package/data/docs/collections/firestore-paths.md +20 -0
  2. package/data/docs/enums/attention-status.md +1 -1
  3. package/data/docs/enums/booking-status.md +1 -1
  4. package/data/docs/enums/customer-payment-status.md +1 -1
  5. package/data/docs/enums/customer-payment-target-type.md +1 -1
  6. package/data/docs/enums/delivery-type.md +1 -1
  7. package/data/docs/enums/deployment-link-type.md +1 -1
  8. package/data/docs/enums/event-status.md +1 -1
  9. package/data/docs/enums/fulfillment-status.md +1 -1
  10. package/data/docs/enums/loyalty-transaction-type.md +1 -1
  11. package/data/docs/enums/order-status.md +1 -1
  12. package/data/docs/enums/outbound-message-format.md +22 -0
  13. package/data/docs/enums/outbound-message-purpose.md +24 -0
  14. package/data/docs/enums/outbound-message-status.md +4 -4
  15. package/data/docs/enums/payment-method.md +2 -2
  16. package/data/docs/enums/payment-proof-status.md +2 -2
  17. package/data/docs/enums/payment-status.md +2 -2
  18. package/data/docs/enums/pending-issue.md +2 -2
  19. package/data/docs/enums/return-status.md +2 -2
  20. package/data/docs/enums/session-status.md +2 -2
  21. package/data/docs/enums/site-status.md +2 -2
  22. package/data/docs/enums/stocktake-frequency.md +2 -2
  23. package/data/docs/enums/stocktake-item-status.md +2 -2
  24. package/data/docs/enums/stocktake-status.md +2 -2
  25. package/data/docs/enums/ticket-status.md +2 -2
  26. package/data/docs/enums/waba-label.md +2 -2
  27. package/data/docs/enums/whatsapp-button-sub-type.md +22 -0
  28. package/data/docs/enums/whatsapp-template-component.md +23 -0
  29. package/data/docs/enums/whatsapp-template-status.md +26 -0
  30. package/data/docs/index.md +11 -5
  31. package/data/docs/models/allowed-user.md +1 -1
  32. package/data/docs/models/analytics-backfill.md +1 -1
  33. package/data/docs/models/analytics-daily.md +1 -1
  34. package/data/docs/models/analytics-event.md +1 -1
  35. package/data/docs/models/analytics-hourly.md +1 -1
  36. package/data/docs/models/booking-version.md +1 -1
  37. package/data/docs/models/booking.md +1 -1
  38. package/data/docs/models/customer-payment-allocation.md +1 -1
  39. package/data/docs/models/customer-payment.md +1 -1
  40. package/data/docs/models/customer.md +1 -1
  41. package/data/docs/models/event.md +1 -1
  42. package/data/docs/models/loyalty-config.md +1 -1
  43. package/data/docs/models/loyalty-reward.md +1 -1
  44. package/data/docs/models/loyalty-status.md +1 -1
  45. package/data/docs/models/loyalty-transaction.md +1 -1
  46. package/data/docs/models/magic-link-request.md +1 -1
  47. package/data/docs/models/metrics-current.md +1 -1
  48. package/data/docs/models/metrics-daily.md +1 -1
  49. package/data/docs/models/metrics-monthly.md +1 -1
  50. package/data/docs/models/order-item.md +1 -1
  51. package/data/docs/models/order.md +1 -1
  52. package/data/docs/models/sale.md +1 -1
  53. package/data/docs/models/site-payment.md +1 -1
  54. package/data/docs/models/site.md +1 -1
  55. package/data/docs/models/stocktake-item.md +1 -1
  56. package/data/docs/models/stocktake.md +1 -1
  57. package/data/docs/models/ticket.md +1 -1
  58. package/data/docs/models/whatsapp-inbound-message.md +1 -1
  59. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +310 -0
  60. package/data/docs/models/whatsapp-outbound-message.md +395 -172
  61. package/data/docs/models/whatsapp-template.md +283 -0
  62. package/data/static/llms.txt +129 -32
  63. package/data/static/openapi.yaml +329 -66
  64. package/data/static/schemas.json +414 -69
  65. package/package.json +1 -1
  66. package/data/docs/enums/outbound-message-kind.md +0 -23
@@ -122,25 +122,38 @@ components:
122
122
  - EXPIRED
123
123
  description: Core order lifecycle status (D03, D34). Universal across all business
124
124
  types. Replaces the Dashboard's legacy 20-value flat enum (MIG-11).
125
- OutboundMessageKind:
125
+ OutboundMessageFormat:
126
+ type: string
127
+ enum:
128
+ - text
129
+ - template
130
+ description: Outbound WhatsApp message format. `text` is a free-form body (only
131
+ valid inside the 24h customer-care window); `template` is a pre-approved WhatsApp
132
+ template send. The backend is the authority on which is allowed (GH#43).
133
+ OutboundMessagePurpose:
126
134
  type: string
127
135
  enum:
128
136
  - otp
129
137
  - review_request
130
138
  - adhoc
131
- description: Outbound WhatsApp message kind. Strict enum — new kinds require
132
- a schema version bump (GH#38).
139
+ - conversational
140
+ description: Business purpose of an outbound WhatsApp message — orthogonal to
141
+ its format (see OutboundMessageFormat). `otp`/`review_request`/`adhoc` are
142
+ system-originated; `conversational` is a human agent reply from the dashboard
143
+ inbox. Optional signal carried for analytics/triggers (GH#43; supersedes the
144
+ GH#38 OutboundMessageKind).
133
145
  OutboundMessageStatus:
134
146
  type: string
135
147
  enum:
136
- - accepted
148
+ - queued
137
149
  - sent
138
150
  - delivered
139
151
  - read
140
152
  - failed
141
- description: 'Outbound WhatsApp message delivery status. Lifecycle: accepted
142
- sent → delivered → read, or accepted → failed. Updated in-place by Meta
143
- delivery callbacks (GH#38).'
153
+ description: 'Outbound WhatsApp message delivery status. Lifecycle: queued →
154
+ sent → delivered → read, or queued → failed. The dashboard creates the message
155
+ with status `queued`; the whatsapp-server backend owns every transition after,
156
+ updating in place from Meta delivery callbacks (GH#43).'
144
157
  PaymentMethod:
145
158
  type: string
146
159
  enum:
@@ -261,6 +274,35 @@ components:
261
274
  - val
262
275
  description: Human-readable WABA label identifying which Meta business number
263
276
  received the message (GH#36).
277
+ WhatsappButtonSubType:
278
+ type: string
279
+ enum:
280
+ - url
281
+ - quick_reply
282
+ description: Sub-type of a WhatsApp template button parameter. Set when WhatsappTemplateParameter.component
283
+ === "button" — maps to Meta `components[].sub_type` (GH#46).
284
+ WhatsappTemplateComponent:
285
+ type: string
286
+ enum:
287
+ - header
288
+ - body
289
+ - button
290
+ description: WhatsApp template component a parameter targets. Determines which
291
+ Meta `components` entry the supplied value is placed in at send time (GH#46).
292
+ WhatsappTemplateStatus:
293
+ type: string
294
+ enum:
295
+ - APPROVED
296
+ - PENDING
297
+ - REJECTED
298
+ - PAUSED
299
+ - DISABLED
300
+ - IN_APPEAL
301
+ description: Meta review status of a WhatsApp message template, synced from
302
+ the WhatsApp Business API. Only APPROVED templates can be sent. The fuller
303
+ Meta status set is used deliberately (vs just APPROVED/PENDING/REJECTED) so
304
+ this enum has a distinct value signature from PaymentProofStatus in the JSON-Schema
305
+ $ref matcher (GH#43).
264
306
  FirestoreTimestamp:
265
307
  type: object
266
308
  properties:
@@ -4524,102 +4566,234 @@ components:
4524
4566
  description: Write payload for partial update (PATCH) of a WhatsappInboundMessage
4525
4567
  document. All fields optional. Fields marked `readOnly` or `x-immutable` must
4526
4568
  not be sent.
4569
+ WhatsappOutboundLifecycleEvent:
4570
+ type: object
4571
+ properties:
4572
+ id:
4573
+ readOnly: true
4574
+ description: (Read-only) Firestore document ID, auto-generated.
4575
+ type:
4576
+ - string
4577
+ - 'null'
4578
+ type:
4579
+ anyOf:
4580
+ - type: string
4581
+ enum:
4582
+ - send_attempt
4583
+ - status_callback
4584
+ - error
4585
+ - type: string
4586
+ description: (Read-only) Event type — send_attempt | status_callback | error
4587
+ | future string.
4588
+ readOnly: true
4589
+ at:
4590
+ $ref: '#/components/schemas/FirestoreTimestamp'
4591
+ description: (Read-only) When the event was recorded server-side.
4592
+ readOnly: true
4593
+ status:
4594
+ anyOf:
4595
+ - $ref: '#/components/schemas/OutboundMessageStatus'
4596
+ - type: 'null'
4597
+ readOnly: true
4598
+ description: (Read-only) Resulting/observed status, when this event implies
4599
+ one.
4600
+ wamid:
4601
+ readOnly: true
4602
+ description: (Read-only) WhatsApp message ID, if known at this point in
4603
+ the lifecycle.
4604
+ type:
4605
+ - string
4606
+ - 'null'
4607
+ phoneNumberId:
4608
+ readOnly: true
4609
+ description: (Read-only) Meta phone number ID (the specific line within
4610
+ the WABA) used for the attempt.
4611
+ type:
4612
+ - string
4613
+ - 'null'
4614
+ contactWaId:
4615
+ readOnly: true
4616
+ description: (Read-only) Normalized wa_id returned by Meta. May differ from
4617
+ the recipient `to`.
4618
+ type:
4619
+ - string
4620
+ - 'null'
4621
+ metaRequest:
4622
+ readOnly: true
4623
+ description: (Read-only) Raw outbound payload sent to the Meta Graph API.
4624
+ metaResponse:
4625
+ readOnly: true
4626
+ description: (Read-only) Raw Meta Graph API response.
4627
+ errorCode:
4628
+ readOnly: true
4629
+ description: (Read-only) Meta error code. Present on failed attempts.
4630
+ type:
4631
+ - integer
4632
+ - 'null'
4633
+ minimum: -9007199254740991
4634
+ maximum: 9007199254740991
4635
+ errorDetail:
4636
+ readOnly: true
4637
+ description: (Read-only) Raw Meta error object(s).
4638
+ required:
4639
+ - type
4640
+ - at
4641
+ additionalProperties: false
4642
+ x-internal: true
4643
+ description: '⚠️ BACKEND-INTERNAL — not a consumer contract. WhatsappOutboundLifecycleEvent:
4644
+ append-only backend log for reconstituting an outbound message lifecycle (GH#43).
4645
+ Collection: whatsapp_outbound_messages/{messageId}/lifecycle_events/{eventId}.
4646
+ Written/read only by the whatsapp-server backend.'
4527
4647
  WhatsappOutboundMessage:
4528
4648
  type: object
4529
4649
  properties:
4530
4650
  id:
4531
4651
  readOnly: true
4532
- description: (Read-only) Firestore document ID — wamid on success, generated
4533
- UUID on failure.
4652
+ description: (Read-only) Firestore document ID — auto-generated at enqueue
4653
+ time.
4534
4654
  type:
4535
4655
  - string
4536
4656
  - 'null'
4537
- messageId:
4538
- type: string
4539
- x-immutable: true
4540
- description: (Immutable) WhatsApp message ID (wamid) on success; generated
4541
- UUID on send failure.
4542
4657
  to:
4543
4658
  type: string
4544
4659
  x-immutable: true
4545
- description: (Immutable) Recipient phone number in E.164 format. Mirrors
4546
- inbound `from`.
4660
+ description: (Immutable) Recipient phone number in E.164 format. Must match
4661
+ the inbound `from` for the same conversation.
4547
4662
  waba:
4548
4663
  $ref: '#/components/schemas/WabaLabel'
4549
- description: (Immutable) WABA that sent the message. Mirrors inbound `waba`.
4664
+ description: (Immutable) WABA that will send the message. Mirrors inbound
4665
+ `waba`.
4550
4666
  x-immutable: true
4551
4667
  wabaId:
4552
4668
  type: string
4553
4669
  x-immutable: true
4554
4670
  description: (Immutable) Meta WABA ID. Mirrors inbound `wabaId`.
4555
- sentAt:
4556
- $ref: '#/components/schemas/FirestoreTimestamp'
4557
- description: (Read-only) Server-side send timestamp. Mirrors inbound `receivedAt`.
4558
- readOnly: true
4559
- phoneNumberId:
4560
- type: string
4561
- x-immutable: true
4562
- description: (Immutable) Meta phone number ID used for the send (specific
4563
- line within the WABA).
4564
4671
  kind:
4565
- $ref: '#/components/schemas/OutboundMessageKind'
4566
- description: (Immutable) Message kind.
4567
- x-immutable: true
4568
- templateName:
4569
- type: string
4672
+ $ref: '#/components/schemas/OutboundMessageFormat'
4673
+ description: '(Immutable) Message format: `text` or `template`. Set `text`
4674
+ xor `template` to match.'
4570
4675
  x-immutable: true
4571
- description: (Immutable) WhatsApp template name used for the send.
4572
- status:
4573
- $ref: '#/components/schemas/OutboundMessageStatus'
4574
- description: Delivery status. Updated in-place by Meta delivery callbacks.
4575
- contactWaId:
4576
- description: Normalized wa_id returned by Meta on success. May differ from
4577
- `to`.
4676
+ text:
4677
+ x-when: Set only when kind === "text" — the free-form message body.
4678
+ description: Free-form message body. Present only when kind=text.
4578
4679
  type:
4579
4680
  - string
4580
4681
  - 'null'
4581
- appId:
4582
- description: Tenant appId when applicable.
4682
+ template:
4683
+ x-when: Set only when kind === "template".
4684
+ description: Template send payload. Present only when kind=template.
4583
4685
  type:
4584
- - string
4686
+ - object
4585
4687
  - 'null'
4688
+ properties:
4689
+ name:
4690
+ type: string
4691
+ description: WhatsApp template name (must exist and be APPROVED in whatsapp_templates).
4692
+ language:
4693
+ type: string
4694
+ description: Template language/locale code (e.g. "en", "fr").
4695
+ variables:
4696
+ description: Template variable values, keyed by the variable name declared
4697
+ on the template.
4698
+ type: object
4699
+ propertyNames:
4700
+ type: string
4701
+ additionalProperties:
4702
+ type: string
4703
+ required:
4704
+ - name
4705
+ - language
4706
+ additionalProperties: false
4707
+ purpose:
4708
+ anyOf:
4709
+ - $ref: '#/components/schemas/OutboundMessagePurpose'
4710
+ - type: 'null'
4711
+ x-immutable: true
4712
+ x-note: Business purpose, orthogonal to `kind`. Carried for analytics/triggers;
4713
+ defaults to conversational for dashboard agent replies.
4714
+ description: Business purpose (otp | review_request | adhoc | conversational).
4715
+ Optional.
4586
4716
  orderUuid:
4587
- description: Order reference. Present on review_request messages only.
4717
+ x-immutable: true
4718
+ description: Order reference. Present on review_request messages.
4588
4719
  type:
4589
4720
  - string
4590
4721
  - 'null'
4591
- statusUpdatedAt:
4592
- anyOf:
4593
- - $ref: '#/components/schemas/FirestoreTimestamp'
4594
- - type: 'null'
4595
- description: Timestamp of the last status update from a Meta delivery callback.
4596
- failureCode:
4597
- description: Meta error code. Present on failed sends only.
4722
+ sentBy:
4723
+ type: object
4724
+ properties:
4725
+ uid:
4726
+ type: string
4727
+ description: Firebase Auth UID of the dashboard user who enqueued the
4728
+ message.
4729
+ email:
4730
+ description: Email of the sender, if available.
4731
+ type: string
4732
+ required:
4733
+ - uid
4734
+ additionalProperties: false
4735
+ x-immutable: true
4736
+ description: (Immutable) Dashboard actor who enqueued the message.
4737
+ createdAt:
4738
+ $ref: '#/components/schemas/FirestoreTimestamp'
4739
+ description: (Immutable) Enqueue timestamp, set by the dashboard at create.
4740
+ x-immutable: true
4741
+ status:
4742
+ $ref: '#/components/schemas/OutboundMessageStatus'
4743
+ description: Delivery status. Created as `queued` by the dashboard; updated
4744
+ in place by the backend.
4745
+ x-note: Dashboard must create with `queued`. The backend owns every transition
4746
+ after (sent → delivered → read, or failed).
4747
+ wamid:
4748
+ readOnly: true
4749
+ description: (Read-only) WhatsApp message ID returned by Meta once the backend
4750
+ sends. Absent while queued or on failure.
4598
4751
  type:
4599
- - integer
4752
+ - string
4600
4753
  - 'null'
4601
- minimum: -9007199254740991
4602
- maximum: 9007199254740991
4603
- failureErrors:
4604
- description: Raw Meta error objects. Present on failed sends only.
4754
+ error:
4755
+ readOnly: true
4756
+ description: (Read-only) Human-readable failure reason. Present on status=failed.
4757
+ Raw Meta error detail lives in the lifecycle_events subcollection.
4605
4758
  type:
4606
- - array
4759
+ - string
4607
4760
  - 'null'
4608
- items: {}
4761
+ sentAt:
4762
+ anyOf:
4763
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4764
+ - type: 'null'
4765
+ readOnly: true
4766
+ description: (Read-only) When the backend sent the message to Meta.
4767
+ deliveredAt:
4768
+ anyOf:
4769
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4770
+ - type: 'null'
4771
+ readOnly: true
4772
+ description: (Read-only) When Meta reported delivery.
4773
+ readAt:
4774
+ anyOf:
4775
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4776
+ - type: 'null'
4777
+ readOnly: true
4778
+ description: (Read-only) When Meta reported the recipient read the message.
4779
+ failedAt:
4780
+ anyOf:
4781
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4782
+ - type: 'null'
4783
+ readOnly: true
4784
+ description: (Read-only) When the send failed.
4609
4785
  required:
4610
- - messageId
4611
4786
  - to
4612
4787
  - waba
4613
4788
  - wabaId
4614
- - sentAt
4615
- - phoneNumberId
4616
4789
  - kind
4617
- - templateName
4790
+ - sentBy
4791
+ - createdAt
4618
4792
  - status
4619
4793
  additionalProperties: false
4620
- description: 'WhatsappOutboundMessage — outbound WhatsApp message persisted
4621
- at send time (GH#38). Collection: whatsapp_outbound_messages/{docId}. Top-level
4622
- scope. Symmetric counterpart to WhatsappInboundMessage (GH#36).'
4794
+ description: 'WhatsappOutboundMessage — Firestore-as-the-bus outbox doc (GH#43).
4795
+ Collection: whatsapp_outbound_messages/{docId}. Top-level scope; mirrors WhatsappInboundMessage.
4796
+ Dashboard enqueues `queued`; backend sends and owns the lifecycle.'
4623
4797
  WhatsappOutboundMessageCreate:
4624
4798
  allOf:
4625
4799
  - $ref: '#/components/schemas/WhatsappOutboundMessage'
@@ -4627,13 +4801,12 @@ components:
4627
4801
  Fields marked `readOnly` are server-set and must not be included. Fields marked
4628
4802
  `x-immutable` may be set once at creation.
4629
4803
  required:
4630
- - messageId
4631
4804
  - to
4632
4805
  - waba
4633
4806
  - wabaId
4634
- - phoneNumberId
4635
4807
  - kind
4636
- - templateName
4808
+ - sentBy
4809
+ - createdAt
4637
4810
  - status
4638
4811
  WhatsappOutboundMessageUpdate:
4639
4812
  allOf:
@@ -4641,6 +4814,96 @@ components:
4641
4814
  description: Write payload for partial update (PATCH) of a WhatsappOutboundMessage
4642
4815
  document. All fields optional. Fields marked `readOnly` or `x-immutable` must
4643
4816
  not be sent.
4817
+ WhatsappTemplate:
4818
+ type: object
4819
+ properties:
4820
+ id:
4821
+ readOnly: true
4822
+ description: (Read-only) Firestore document ID — composite `{waba}__{name}__{language}`.
4823
+ type:
4824
+ - string
4825
+ - 'null'
4826
+ waba:
4827
+ $ref: '#/components/schemas/WabaLabel'
4828
+ description: (Read-only) WABA label this template is approved on. Templates
4829
+ are WABA-scoped. Mirrors WhatsappOutboundMessage.waba.
4830
+ readOnly: true
4831
+ wabaId:
4832
+ type: string
4833
+ readOnly: true
4834
+ description: (Read-only) Meta WABA ID this template belongs to. The sender
4835
+ must verify its phone number belongs to this WABA before using the template.
4836
+ name:
4837
+ type: string
4838
+ readOnly: true
4839
+ description: (Read-only) Template name as registered with Meta.
4840
+ language:
4841
+ type: string
4842
+ readOnly: true
4843
+ description: (Read-only) Template language/locale code (e.g. "en", "fr").
4844
+ category:
4845
+ type: string
4846
+ readOnly: true
4847
+ description: (Read-only) Meta template category (e.g. MARKETING, UTILITY,
4848
+ AUTHENTICATION).
4849
+ status:
4850
+ $ref: '#/components/schemas/WhatsappTemplateStatus'
4851
+ description: (Read-only) Meta review status. Only APPROVED templates can
4852
+ be sent.
4853
+ readOnly: true
4854
+ parameters:
4855
+ type: array
4856
+ items:
4857
+ type: object
4858
+ properties:
4859
+ name:
4860
+ type: string
4861
+ description: Parameter name/placeholder (e.g. "1"). Matches a key
4862
+ in WhatsappOutboundMessage.template.variables.
4863
+ component:
4864
+ $ref: '#/components/schemas/WhatsappTemplateComponent'
4865
+ description: 'Which template component this parameter targets: header
4866
+ | body | button.'
4867
+ buttonIndex:
4868
+ description: 0-based button position. Present only when component=button
4869
+ (Meta requires a string index at send time).
4870
+ type: integer
4871
+ minimum: -9007199254740991
4872
+ maximum: 9007199254740991
4873
+ buttonSubType:
4874
+ $ref: '#/components/schemas/WhatsappButtonSubType'
4875
+ description: Button sub-type (url | quick_reply). Present only when
4876
+ component=button.
4877
+ required:
4878
+ - name
4879
+ - component
4880
+ additionalProperties: false
4881
+ description: Declared WhatsApp template parameter with component placement
4882
+ (GH#46).
4883
+ readOnly: true
4884
+ description: (Read-only) Declared parameters with component placement. Supersedes
4885
+ the flat `variables` list (GH#46) — lets the send group values into the
4886
+ correct header/body/button components. A message supplies values keyed
4887
+ by `name` via WhatsappOutboundMessage.template.variables.
4888
+ preview:
4889
+ type: string
4890
+ readOnly: true
4891
+ description: (Read-only) Rendered preview text for display in the dashboard
4892
+ picker.
4893
+ required:
4894
+ - waba
4895
+ - wabaId
4896
+ - name
4897
+ - language
4898
+ - category
4899
+ - status
4900
+ - parameters
4901
+ - preview
4902
+ additionalProperties: false
4903
+ description: 'WhatsappTemplate — Meta-approved template synced from the WhatsApp
4904
+ Business API (GH#43; parameter placement GH#46). Collection: whatsapp_templates/{docId},
4905
+ doc ID `{waba}__{name}__{language}`. WABA-scoped; backend-synced; dashboard
4906
+ reads only.'
4644
4907
  PaymentSummary:
4645
4908
  type: object
4646
4909
  properties: