@ingenx-io/valets-schema-mcp-server 0.1.9 → 0.2.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.
Files changed (64) 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-template-status.md +26 -0
  28. package/data/docs/index.md +9 -5
  29. package/data/docs/models/allowed-user.md +1 -1
  30. package/data/docs/models/analytics-backfill.md +1 -1
  31. package/data/docs/models/analytics-daily.md +1 -1
  32. package/data/docs/models/analytics-event.md +1 -1
  33. package/data/docs/models/analytics-hourly.md +1 -1
  34. package/data/docs/models/booking-version.md +1 -1
  35. package/data/docs/models/booking.md +1 -1
  36. package/data/docs/models/customer-payment-allocation.md +1 -1
  37. package/data/docs/models/customer-payment.md +1 -1
  38. package/data/docs/models/customer.md +1 -1
  39. package/data/docs/models/event.md +1 -1
  40. package/data/docs/models/loyalty-config.md +1 -1
  41. package/data/docs/models/loyalty-reward.md +1 -1
  42. package/data/docs/models/loyalty-status.md +1 -1
  43. package/data/docs/models/loyalty-transaction.md +1 -1
  44. package/data/docs/models/magic-link-request.md +1 -1
  45. package/data/docs/models/metrics-current.md +1 -1
  46. package/data/docs/models/metrics-daily.md +1 -1
  47. package/data/docs/models/metrics-monthly.md +1 -1
  48. package/data/docs/models/order-item.md +1 -1
  49. package/data/docs/models/order.md +1 -1
  50. package/data/docs/models/sale.md +1 -1
  51. package/data/docs/models/site-payment.md +1 -1
  52. package/data/docs/models/site.md +1 -1
  53. package/data/docs/models/stocktake-item.md +1 -1
  54. package/data/docs/models/stocktake.md +1 -1
  55. package/data/docs/models/ticket.md +1 -1
  56. package/data/docs/models/whatsapp-inbound-message.md +1 -1
  57. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +310 -0
  58. package/data/docs/models/whatsapp-outbound-message.md +396 -172
  59. package/data/docs/models/whatsapp-template.md +177 -0
  60. package/data/static/llms.txt +110 -32
  61. package/data/static/openapi.yaml +275 -66
  62. package/data/static/schemas.json +355 -69
  63. package/package.json +1 -1
  64. package/data/docs/enums/outbound-message-kind.md +0 -22
@@ -122,24 +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
- description: Outbound WhatsApp message kind. Strict enum — new kinds require
131
- a schema version bump (GH#38).
138
+ - adhoc
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).
132
145
  OutboundMessageStatus:
133
146
  type: string
134
147
  enum:
135
- - accepted
148
+ - queued
136
149
  - sent
137
150
  - delivered
138
151
  - read
139
152
  - failed
140
- description: 'Outbound WhatsApp message delivery status. Lifecycle: accepted
141
- sent → delivered → read, or accepted → failed. Updated in-place by Meta
142
- 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).'
143
157
  PaymentMethod:
144
158
  type: string
145
159
  enum:
@@ -260,6 +274,20 @@ components:
260
274
  - val
261
275
  description: Human-readable WABA label identifying which Meta business number
262
276
  received the message (GH#36).
277
+ WhatsappTemplateStatus:
278
+ type: string
279
+ enum:
280
+ - APPROVED
281
+ - PENDING
282
+ - REJECTED
283
+ - PAUSED
284
+ - DISABLED
285
+ - IN_APPEAL
286
+ description: Meta review status of a WhatsApp message template, synced from
287
+ the WhatsApp Business API. Only APPROVED templates can be sent. The fuller
288
+ Meta status set is used deliberately (vs just APPROVED/PENDING/REJECTED) so
289
+ this enum has a distinct value signature from PaymentProofStatus in the JSON-Schema
290
+ $ref matcher (GH#43).
263
291
  FirestoreTimestamp:
264
292
  type: object
265
293
  properties:
@@ -4523,102 +4551,234 @@ components:
4523
4551
  description: Write payload for partial update (PATCH) of a WhatsappInboundMessage
4524
4552
  document. All fields optional. Fields marked `readOnly` or `x-immutable` must
4525
4553
  not be sent.
4554
+ WhatsappOutboundLifecycleEvent:
4555
+ type: object
4556
+ properties:
4557
+ id:
4558
+ readOnly: true
4559
+ description: (Read-only) Firestore document ID, auto-generated.
4560
+ type:
4561
+ - string
4562
+ - 'null'
4563
+ type:
4564
+ anyOf:
4565
+ - type: string
4566
+ enum:
4567
+ - send_attempt
4568
+ - status_callback
4569
+ - error
4570
+ - type: string
4571
+ description: (Read-only) Event type — send_attempt | status_callback | error
4572
+ | future string.
4573
+ readOnly: true
4574
+ at:
4575
+ $ref: '#/components/schemas/FirestoreTimestamp'
4576
+ description: (Read-only) When the event was recorded server-side.
4577
+ readOnly: true
4578
+ status:
4579
+ anyOf:
4580
+ - $ref: '#/components/schemas/OutboundMessageStatus'
4581
+ - type: 'null'
4582
+ readOnly: true
4583
+ description: (Read-only) Resulting/observed status, when this event implies
4584
+ one.
4585
+ wamid:
4586
+ readOnly: true
4587
+ description: (Read-only) WhatsApp message ID, if known at this point in
4588
+ the lifecycle.
4589
+ type:
4590
+ - string
4591
+ - 'null'
4592
+ phoneNumberId:
4593
+ readOnly: true
4594
+ description: (Read-only) Meta phone number ID (the specific line within
4595
+ the WABA) used for the attempt.
4596
+ type:
4597
+ - string
4598
+ - 'null'
4599
+ contactWaId:
4600
+ readOnly: true
4601
+ description: (Read-only) Normalized wa_id returned by Meta. May differ from
4602
+ the recipient `to`.
4603
+ type:
4604
+ - string
4605
+ - 'null'
4606
+ metaRequest:
4607
+ readOnly: true
4608
+ description: (Read-only) Raw outbound payload sent to the Meta Graph API.
4609
+ metaResponse:
4610
+ readOnly: true
4611
+ description: (Read-only) Raw Meta Graph API response.
4612
+ errorCode:
4613
+ readOnly: true
4614
+ description: (Read-only) Meta error code. Present on failed attempts.
4615
+ type:
4616
+ - integer
4617
+ - 'null'
4618
+ minimum: -9007199254740991
4619
+ maximum: 9007199254740991
4620
+ errorDetail:
4621
+ readOnly: true
4622
+ description: (Read-only) Raw Meta error object(s).
4623
+ required:
4624
+ - type
4625
+ - at
4626
+ additionalProperties: false
4627
+ x-internal: true
4628
+ description: '⚠️ BACKEND-INTERNAL — not a consumer contract. WhatsappOutboundLifecycleEvent:
4629
+ append-only backend log for reconstituting an outbound message lifecycle (GH#43).
4630
+ Collection: whatsapp_outbound_messages/{messageId}/lifecycle_events/{eventId}.
4631
+ Written/read only by the whatsapp-server backend.'
4526
4632
  WhatsappOutboundMessage:
4527
4633
  type: object
4528
4634
  properties:
4529
4635
  id:
4530
4636
  readOnly: true
4531
- description: (Read-only) Firestore document ID — wamid on success, generated
4532
- UUID on failure.
4637
+ description: (Read-only) Firestore document ID — auto-generated at enqueue
4638
+ time.
4533
4639
  type:
4534
4640
  - string
4535
4641
  - 'null'
4536
- messageId:
4537
- type: string
4538
- x-immutable: true
4539
- description: (Immutable) WhatsApp message ID (wamid) on success; generated
4540
- UUID on send failure.
4541
4642
  to:
4542
4643
  type: string
4543
4644
  x-immutable: true
4544
- description: (Immutable) Recipient phone number in E.164 format. Mirrors
4545
- inbound `from`.
4645
+ description: (Immutable) Recipient phone number in E.164 format. Must match
4646
+ the inbound `from` for the same conversation.
4546
4647
  waba:
4547
4648
  $ref: '#/components/schemas/WabaLabel'
4548
- description: (Immutable) WABA that sent the message. Mirrors inbound `waba`.
4649
+ description: (Immutable) WABA that will send the message. Mirrors inbound
4650
+ `waba`.
4549
4651
  x-immutable: true
4550
4652
  wabaId:
4551
4653
  type: string
4552
4654
  x-immutable: true
4553
4655
  description: (Immutable) Meta WABA ID. Mirrors inbound `wabaId`.
4554
- sentAt:
4555
- $ref: '#/components/schemas/FirestoreTimestamp'
4556
- description: (Read-only) Server-side send timestamp. Mirrors inbound `receivedAt`.
4557
- readOnly: true
4558
- phoneNumberId:
4559
- type: string
4560
- x-immutable: true
4561
- description: (Immutable) Meta phone number ID used for the send (specific
4562
- line within the WABA).
4563
4656
  kind:
4564
- $ref: '#/components/schemas/OutboundMessageKind'
4565
- description: (Immutable) Message kind.
4657
+ $ref: '#/components/schemas/OutboundMessageFormat'
4658
+ description: '(Immutable) Message format: `text` or `template`. Set `text`
4659
+ xor `template` to match.'
4566
4660
  x-immutable: true
4567
- templateName:
4568
- type: string
4569
- x-immutable: true
4570
- description: (Immutable) WhatsApp template name used for the send.
4571
- status:
4572
- $ref: '#/components/schemas/OutboundMessageStatus'
4573
- description: Delivery status. Updated in-place by Meta delivery callbacks.
4574
- contactWaId:
4575
- description: Normalized wa_id returned by Meta on success. May differ from
4576
- `to`.
4661
+ text:
4662
+ x-when: Set only when kind === "text" — the free-form message body.
4663
+ description: Free-form message body. Present only when kind=text.
4577
4664
  type:
4578
4665
  - string
4579
4666
  - 'null'
4580
- appId:
4581
- description: Tenant appId when applicable.
4667
+ template:
4668
+ x-when: Set only when kind === "template".
4669
+ description: Template send payload. Present only when kind=template.
4582
4670
  type:
4583
- - string
4671
+ - object
4584
4672
  - 'null'
4673
+ properties:
4674
+ name:
4675
+ type: string
4676
+ description: WhatsApp template name (must exist and be APPROVED in whatsapp_templates).
4677
+ language:
4678
+ type: string
4679
+ description: Template language/locale code (e.g. "en", "fr").
4680
+ variables:
4681
+ description: Template variable values, keyed by the variable name declared
4682
+ on the template.
4683
+ type: object
4684
+ propertyNames:
4685
+ type: string
4686
+ additionalProperties:
4687
+ type: string
4688
+ required:
4689
+ - name
4690
+ - language
4691
+ additionalProperties: false
4692
+ purpose:
4693
+ anyOf:
4694
+ - $ref: '#/components/schemas/OutboundMessagePurpose'
4695
+ - type: 'null'
4696
+ x-immutable: true
4697
+ x-note: Business purpose, orthogonal to `kind`. Carried for analytics/triggers;
4698
+ defaults to conversational for dashboard agent replies.
4699
+ description: Business purpose (otp | review_request | adhoc | conversational).
4700
+ Optional.
4585
4701
  orderUuid:
4586
- description: Order reference. Present on review_request messages only.
4702
+ x-immutable: true
4703
+ description: Order reference. Present on review_request messages.
4587
4704
  type:
4588
4705
  - string
4589
4706
  - 'null'
4590
- statusUpdatedAt:
4591
- anyOf:
4592
- - $ref: '#/components/schemas/FirestoreTimestamp'
4593
- - type: 'null'
4594
- description: Timestamp of the last status update from a Meta delivery callback.
4595
- failureCode:
4596
- description: Meta error code. Present on failed sends only.
4707
+ sentBy:
4708
+ type: object
4709
+ properties:
4710
+ uid:
4711
+ type: string
4712
+ description: Firebase Auth UID of the dashboard user who enqueued the
4713
+ message.
4714
+ email:
4715
+ description: Email of the sender, if available.
4716
+ type: string
4717
+ required:
4718
+ - uid
4719
+ additionalProperties: false
4720
+ x-immutable: true
4721
+ description: (Immutable) Dashboard actor who enqueued the message.
4722
+ createdAt:
4723
+ $ref: '#/components/schemas/FirestoreTimestamp'
4724
+ description: (Immutable) Enqueue timestamp, set by the dashboard at create.
4725
+ x-immutable: true
4726
+ status:
4727
+ $ref: '#/components/schemas/OutboundMessageStatus'
4728
+ description: Delivery status. Created as `queued` by the dashboard; updated
4729
+ in place by the backend.
4730
+ x-note: Dashboard must create with `queued`. The backend owns every transition
4731
+ after (sent → delivered → read, or failed).
4732
+ wamid:
4733
+ readOnly: true
4734
+ description: (Read-only) WhatsApp message ID returned by Meta once the backend
4735
+ sends. Absent while queued or on failure.
4597
4736
  type:
4598
- - integer
4737
+ - string
4599
4738
  - 'null'
4600
- minimum: -9007199254740991
4601
- maximum: 9007199254740991
4602
- failureErrors:
4603
- description: Raw Meta error objects. Present on failed sends only.
4739
+ error:
4740
+ readOnly: true
4741
+ description: (Read-only) Human-readable failure reason. Present on status=failed.
4742
+ Raw Meta error detail lives in the lifecycle_events subcollection.
4604
4743
  type:
4605
- - array
4744
+ - string
4606
4745
  - 'null'
4607
- items: {}
4746
+ sentAt:
4747
+ anyOf:
4748
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4749
+ - type: 'null'
4750
+ readOnly: true
4751
+ description: (Read-only) When the backend sent the message to Meta.
4752
+ deliveredAt:
4753
+ anyOf:
4754
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4755
+ - type: 'null'
4756
+ readOnly: true
4757
+ description: (Read-only) When Meta reported delivery.
4758
+ readAt:
4759
+ anyOf:
4760
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4761
+ - type: 'null'
4762
+ readOnly: true
4763
+ description: (Read-only) When Meta reported the recipient read the message.
4764
+ failedAt:
4765
+ anyOf:
4766
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4767
+ - type: 'null'
4768
+ readOnly: true
4769
+ description: (Read-only) When the send failed.
4608
4770
  required:
4609
- - messageId
4610
4771
  - to
4611
4772
  - waba
4612
4773
  - wabaId
4613
- - sentAt
4614
- - phoneNumberId
4615
4774
  - kind
4616
- - templateName
4775
+ - sentBy
4776
+ - createdAt
4617
4777
  - status
4618
4778
  additionalProperties: false
4619
- description: 'WhatsappOutboundMessage — outbound WhatsApp message persisted
4620
- at send time (GH#38). Collection: whatsapp_outbound_messages/{docId}. Top-level
4621
- scope. Symmetric counterpart to WhatsappInboundMessage (GH#36).'
4779
+ description: 'WhatsappOutboundMessage — Firestore-as-the-bus outbox doc (GH#43).
4780
+ Collection: whatsapp_outbound_messages/{docId}. Top-level scope; mirrors WhatsappInboundMessage.
4781
+ Dashboard enqueues `queued`; backend sends and owns the lifecycle.'
4622
4782
  WhatsappOutboundMessageCreate:
4623
4783
  allOf:
4624
4784
  - $ref: '#/components/schemas/WhatsappOutboundMessage'
@@ -4626,13 +4786,12 @@ components:
4626
4786
  Fields marked `readOnly` are server-set and must not be included. Fields marked
4627
4787
  `x-immutable` may be set once at creation.
4628
4788
  required:
4629
- - messageId
4630
4789
  - to
4631
4790
  - waba
4632
4791
  - wabaId
4633
- - phoneNumberId
4634
4792
  - kind
4635
- - templateName
4793
+ - sentBy
4794
+ - createdAt
4636
4795
  - status
4637
4796
  WhatsappOutboundMessageUpdate:
4638
4797
  allOf:
@@ -4640,6 +4799,56 @@ components:
4640
4799
  description: Write payload for partial update (PATCH) of a WhatsappOutboundMessage
4641
4800
  document. All fields optional. Fields marked `readOnly` or `x-immutable` must
4642
4801
  not be sent.
4802
+ WhatsappTemplate:
4803
+ type: object
4804
+ properties:
4805
+ id:
4806
+ readOnly: true
4807
+ description: (Read-only) Firestore document ID — composite `{name}__{language}`.
4808
+ type:
4809
+ - string
4810
+ - 'null'
4811
+ name:
4812
+ type: string
4813
+ readOnly: true
4814
+ description: (Read-only) Template name as registered with Meta.
4815
+ language:
4816
+ type: string
4817
+ readOnly: true
4818
+ description: (Read-only) Template language/locale code (e.g. "en", "fr").
4819
+ category:
4820
+ type: string
4821
+ readOnly: true
4822
+ description: (Read-only) Meta template category (e.g. MARKETING, UTILITY,
4823
+ AUTHENTICATION).
4824
+ status:
4825
+ $ref: '#/components/schemas/WhatsappTemplateStatus'
4826
+ description: (Read-only) Meta review status. Only APPROVED templates can
4827
+ be sent.
4828
+ readOnly: true
4829
+ variables:
4830
+ type: array
4831
+ items:
4832
+ type: string
4833
+ readOnly: true
4834
+ description: (Read-only) Declared variable names/placeholders. A message
4835
+ supplies values keyed by these names via WhatsappOutboundMessage.template.variables.
4836
+ preview:
4837
+ type: string
4838
+ readOnly: true
4839
+ description: (Read-only) Rendered preview text for display in the dashboard
4840
+ picker.
4841
+ required:
4842
+ - name
4843
+ - language
4844
+ - category
4845
+ - status
4846
+ - variables
4847
+ - preview
4848
+ additionalProperties: false
4849
+ description: 'WhatsappTemplate — Meta-approved template synced from the WhatsApp
4850
+ Business API (GH#43). Collection: whatsapp_templates/{docId}. Backend-synced;
4851
+ dashboard reads only.'
4643
4852
  PaymentSummary:
4644
4853
  type: object
4645
4854
  properties: