punchout-simulator 0.1.5 → 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.
package/README.md CHANGED
@@ -124,7 +124,7 @@ backend, so there is no CORS between them).
124
124
  | XML parsing | `fast-xml-parser` |
125
125
  | cXML building | template literals (full control over shape/ordering/`xml:lang`) |
126
126
  | multipart/related | hand-assembled (`Buffer` + boundary) |
127
- | Storage | `lowdb` (`config.json`) for connections · append-only JSONL per session for logs · separate files for attachments |
127
+ | Storage | `lowdb` (`config.json`) for buyers/suppliers/connections · append-only JSONL per session for logs · separate files for attachments |
128
128
 
129
129
  ```
130
130
  src/
@@ -133,9 +133,20 @@ src/
133
133
  └─ cxml/ build · parse · validate · multipart · types
134
134
  ```
135
135
 
136
+ ### Data model
137
+
138
+ The config is normalized into three entities:
139
+
140
+ - **Buyer** — a reusable party holding its own cXML identity (the `From` credential).
141
+ - **Supplier** — a reusable party holding its cXML identity (`To`) plus its **endpoints** (PunchOut URL, Order URL) and an optional mock catalog. Endpoints are intrinsic to the supplier — defined once, not per relationship.
142
+ - **Connection** — the edge pairing one Buyer with one Supplier. It holds only what is specific to that pair: which side the tool simulates (`mode`), the `sharedSecret`, an optional per-pair Sender identity override (defaults to the buyer's identity), `authStyle`, and `deploymentMode`.
143
+
144
+ At send time: `From` = buyer identity, `To` = supplier identity, `Sender` = the connection's override (or the buyer), and the request targets the supplier's endpoints. The mock-supplier endpoints are keyed by supplier id (`/sim/<supplierId>/…`).
145
+
136
146
  ### Endpoints
137
147
 
138
- - `*/api/connections` — CRUD for connection configs
148
+ - `*/api/buyers`, `*/api/suppliers` — CRUD for the reusable parties
149
+ - `*/api/connections` — CRUD for connection edges (reference a buyer + supplier)
139
150
  - `POST /api/connections/:id/setup` — send the SetupRequest, capture + validate the response
140
151
  - `POST /api/connections/:id/order` — send the OrderRequest (multipart if attachments), capture + validate
141
152
  - `POST /punchout/return` — callback receiving the punchback auto-submit