@crvouga/mockingbird-service-wholescripts 1.8.0 → 2.0.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/openapi.yaml ADDED
@@ -0,0 +1,487 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Wholescripts supplement fulfilment API (Mockingbird subset)
4
+ description: |
5
+ Stateful mock subset of the Wholescripts ordering API: the product and private-label
6
+ (MedPax) catalogs, order submit, status polling and cancel. Hand-authored from the
7
+ consumers' zod schemas and clients (the vendor publishes no spec).
8
+ version: "1"
9
+ x-mockingbird-upstream:
10
+ note: >-
11
+ Hand-authored from the wire shapes our consumers read and write
12
+ (backend and EMR wholescripts.types.ts zod schemas, the supplement scheduler's Python client,
13
+ adapter and mappers).
14
+ servers:
15
+ - url: https://api.wholescripts.com
16
+ security:
17
+ - basicAuth: []
18
+ paths:
19
+ /api/Orders/PrivateLabelProductList:
20
+ get:
21
+ operationId: GetPrivateLabelProductList
22
+ x-mockingbird:
23
+ supported: true
24
+ parity:
25
+ enabled: true
26
+ safe: true
27
+ responses:
28
+ "200":
29
+ description: Private-label (MedPax) catalog
30
+ content:
31
+ application/json:
32
+ schema:
33
+ $ref: "#/components/schemas/PrivateLabelProductList"
34
+ "401":
35
+ $ref: "#/components/responses/Unauthorized"
36
+ /api/Orders/ProductList:
37
+ get:
38
+ operationId: GetProductList
39
+ x-mockingbird:
40
+ supported: true
41
+ parity:
42
+ enabled: true
43
+ safe: true
44
+ parameters:
45
+ - name: instockonly
46
+ in: query
47
+ required: false
48
+ description: "`true` keeps only rows with quantity > 0 (the EMR sends it)."
49
+ schema:
50
+ type: string
51
+ enum: ["true", "false"]
52
+ - name: limit
53
+ in: query
54
+ required: false
55
+ schema:
56
+ type: integer
57
+ minimum: 1
58
+ maximum: 1000
59
+ - name: search
60
+ in: query
61
+ required: false
62
+ description: Case-insensitive match on name, SKU, MedPax SKU, brand or categories (the supplement scheduler).
63
+ schema:
64
+ type: string
65
+ maxLength: 40
66
+ responses:
67
+ "200":
68
+ description: Products
69
+ content:
70
+ application/json:
71
+ schema:
72
+ type: array
73
+ items:
74
+ $ref: "#/components/schemas/Product"
75
+ "401":
76
+ $ref: "#/components/responses/Unauthorized"
77
+ /api/Orders/Submit:
78
+ post:
79
+ operationId: SubmitOrder
80
+ x-mockingbird:
81
+ supported: true
82
+ parity:
83
+ enabled: true
84
+ safe: false
85
+ requestBody:
86
+ required: true
87
+ content:
88
+ application/json:
89
+ schema:
90
+ $ref: "#/components/schemas/OrderSubmitRequest"
91
+ responses:
92
+ "200":
93
+ description: >-
94
+ Submit outcome. A rejected order (bad body, unknown SKU, payment failure) is still
95
+ 200, with success false and the reason in msg.
96
+ content:
97
+ application/json:
98
+ schema:
99
+ $ref: "#/components/schemas/OrderSubmitResponse"
100
+ "401":
101
+ $ref: "#/components/responses/Unauthorized"
102
+ /api/Orders/Status:
103
+ get:
104
+ operationId: GetOrderStatus
105
+ x-mockingbird:
106
+ supported: true
107
+ parity:
108
+ enabled: true
109
+ safe: true
110
+ parameters:
111
+ - name: ordernum
112
+ in: query
113
+ required: true
114
+ schema:
115
+ type: string
116
+ x-mockingbird-resource-ref:
117
+ type: order
118
+ missing: "000000"
119
+ responses:
120
+ "200":
121
+ description: The order's status rows (empty for an unknown order number)
122
+ content:
123
+ application/json:
124
+ schema:
125
+ type: array
126
+ items:
127
+ $ref: "#/components/schemas/OrderStatus"
128
+ "400":
129
+ description: Missing ordernum
130
+ content:
131
+ application/json:
132
+ schema:
133
+ $ref: "#/components/schemas/AspNetError"
134
+ "401":
135
+ $ref: "#/components/responses/Unauthorized"
136
+ /api/Orders/Cancel:
137
+ post:
138
+ operationId: CancelOrder
139
+ x-mockingbird:
140
+ supported: true
141
+ parity:
142
+ enabled: true
143
+ safe: false
144
+ requestBody:
145
+ required: true
146
+ content:
147
+ application/json:
148
+ schema:
149
+ type: object
150
+ required: [OrderNumber]
151
+ properties:
152
+ OrderNumber:
153
+ type: string
154
+ x-mockingbird-resource-ref:
155
+ type: order
156
+ missing: "000000"
157
+ responses:
158
+ "200":
159
+ description: Cancel outcome; success false when the order has progressed too far
160
+ content:
161
+ application/json:
162
+ schema:
163
+ $ref: "#/components/schemas/CancelResponse"
164
+ "400":
165
+ description: Missing OrderNumber
166
+ content:
167
+ application/json:
168
+ schema:
169
+ $ref: "#/components/schemas/CancelResponse"
170
+ "401":
171
+ $ref: "#/components/responses/Unauthorized"
172
+ "404":
173
+ description: Unknown order
174
+ content:
175
+ application/json:
176
+ schema:
177
+ $ref: "#/components/schemas/CancelResponse"
178
+ components:
179
+ securitySchemes:
180
+ basicAuth:
181
+ type: http
182
+ scheme: basic
183
+ responses:
184
+ Unauthorized:
185
+ description: Missing or wrong Basic credentials
186
+ content:
187
+ application/json:
188
+ schema:
189
+ $ref: "#/components/schemas/AspNetError"
190
+ schemas:
191
+ AspNetError:
192
+ type: object
193
+ required: [Message]
194
+ properties:
195
+ Message:
196
+ type: string
197
+ DefaultDosing:
198
+ type: object
199
+ required: [time, qty]
200
+ properties:
201
+ time:
202
+ type: string
203
+ qty:
204
+ type: number
205
+ MedPaxDetails:
206
+ type: object
207
+ required: [name, genericName, quantity, wholesalePrice, retailPrice]
208
+ properties:
209
+ name:
210
+ type: string
211
+ genericName:
212
+ type: string
213
+ quantity:
214
+ type: number
215
+ wholesalePrice:
216
+ type: number
217
+ retailPrice:
218
+ type: number
219
+ Product:
220
+ type: object
221
+ required:
222
+ - productName
223
+ - sku
224
+ - medPaxSku
225
+ - categories
226
+ - retailPrice
227
+ - upc
228
+ - descriptionShort
229
+ - brand
230
+ - productImage
231
+ - quantity
232
+ - countUnit
233
+ - wholesalePrice
234
+ - supplementFactsHTML
235
+ - defaultDosing
236
+ properties:
237
+ productName:
238
+ type: string
239
+ sku:
240
+ type: string
241
+ x-mockingbird-resource:
242
+ type: sku
243
+ identity: true
244
+ medPaxSku:
245
+ type: string
246
+ categories:
247
+ type: string
248
+ retailPrice:
249
+ type: number
250
+ upc:
251
+ type: string
252
+ descriptionShort:
253
+ type: string
254
+ descriptionFull:
255
+ type: string
256
+ brand:
257
+ type: string
258
+ productImage:
259
+ type: string
260
+ quantity:
261
+ type: number
262
+ countUnit:
263
+ type: string
264
+ wholesalePrice:
265
+ type: number
266
+ supplementFactsHTML:
267
+ type: string
268
+ defaultDosing:
269
+ type: array
270
+ items:
271
+ $ref: "#/components/schemas/DefaultDosing"
272
+ medPaxDetails:
273
+ oneOf:
274
+ - $ref: "#/components/schemas/MedPaxDetails"
275
+ - type: "null"
276
+ PrivateLabelProductList:
277
+ type: object
278
+ required: [privateLabelProducts, medPaxPills, privateLabelCartons]
279
+ properties:
280
+ privateLabelProducts:
281
+ type: array
282
+ items: {}
283
+ medPaxPills:
284
+ type: array
285
+ items:
286
+ type: object
287
+ required: [sku, genericName, privateLabelName, quantity]
288
+ properties:
289
+ sku:
290
+ type: string
291
+ x-mockingbird-resource:
292
+ type: sku
293
+ identity: true
294
+ genericName:
295
+ type: string
296
+ privateLabelName:
297
+ type: string
298
+ quantity:
299
+ type: number
300
+ privateLabelCartons:
301
+ type: array
302
+ items:
303
+ type: object
304
+ required: [sku, name, cartonImage, quantity]
305
+ properties:
306
+ sku:
307
+ type: string
308
+ x-mockingbird-resource:
309
+ type: sku
310
+ identity: true
311
+ name:
312
+ type: string
313
+ cartonImage:
314
+ type: string
315
+ quantity:
316
+ type: number
317
+ MedPaxPill:
318
+ type: object
319
+ required: [Sku, Quantity, ItemTime]
320
+ properties:
321
+ productId:
322
+ type: string
323
+ maxLength: 64
324
+ Sku:
325
+ type: string
326
+ x-mockingbird-resource-ref:
327
+ type: sku
328
+ missing: "000000000000000000"
329
+ Quantity:
330
+ type: integer
331
+ minimum: 1
332
+ maximum: 1000
333
+ ItemTime:
334
+ type: string
335
+ enum: ["AM", "PM", "AM with food", "PM with food"]
336
+ OrderItem:
337
+ type: object
338
+ required: [Sku, Quantity]
339
+ properties:
340
+ Sku:
341
+ type: string
342
+ x-mockingbird-resource-ref:
343
+ type: sku
344
+ missing: "000000000000000000"
345
+ Quantity:
346
+ type: integer
347
+ minimum: 1
348
+ maximum: 1000
349
+ MedPaxName:
350
+ type: ["string", "null"]
351
+ maxLength: 60
352
+ MedPaxPills:
353
+ type: ["array", "null"]
354
+ description: >-
355
+ The pills packed into one MedPax box. The vendor places boxes of at least 14 pills;
356
+ the bound only keeps generated bodies small.
357
+ maxItems: 30
358
+ items:
359
+ $ref: "#/components/schemas/MedPaxPill"
360
+ OrderSubmitRequest:
361
+ type: object
362
+ required: [ShippingAddress, Items, ShippingMethod]
363
+ properties:
364
+ ShippingAddress:
365
+ type: object
366
+ required: [FName, LName, Address1, City, State, Zip]
367
+ properties:
368
+ FName:
369
+ type: string
370
+ minLength: 1
371
+ maxLength: 40
372
+ LName:
373
+ type: string
374
+ minLength: 1
375
+ maxLength: 40
376
+ Address1:
377
+ type: string
378
+ minLength: 1
379
+ maxLength: 80
380
+ Address2:
381
+ type: ["string", "null"]
382
+ maxLength: 80
383
+ City:
384
+ type: string
385
+ minLength: 1
386
+ maxLength: 40
387
+ State:
388
+ type: string
389
+ pattern: "^[A-Z]{2}$"
390
+ Zip:
391
+ type: string
392
+ pattern: "^[0-9]{5}(-[0-9]{4})?$"
393
+ Email:
394
+ type: string
395
+ format: email
396
+ maxLength: 120
397
+ Notes:
398
+ type: ["string", "null"]
399
+ maxLength: 500
400
+ Items:
401
+ type: array
402
+ minItems: 1
403
+ maxItems: 4
404
+ items:
405
+ $ref: "#/components/schemas/OrderItem"
406
+ ShippingMethod:
407
+ type: string
408
+ minLength: 1
409
+ maxLength: 40
410
+ OrderSubmitResponse:
411
+ type: object
412
+ required: [orderNumber, success, msg]
413
+ properties:
414
+ orderNumber:
415
+ type: string
416
+ x-mockingbird-resource:
417
+ type: order
418
+ identity: true
419
+ success:
420
+ type: boolean
421
+ msg:
422
+ type: string
423
+ Tracking:
424
+ type: object
425
+ required: [trackingNumber, carrier]
426
+ properties:
427
+ trackingNumber:
428
+ type: string
429
+ carrier:
430
+ type: string
431
+ trackingUrl:
432
+ type: string
433
+ OrderStatus:
434
+ type: object
435
+ required:
436
+ - orderNumber
437
+ - orderDate
438
+ - salesOrder
439
+ - status
440
+ - tracking
441
+ - message
442
+ - subTotal
443
+ - shipMethod
444
+ - shipCharge
445
+ - discount
446
+ - tax
447
+ - serviceFee
448
+ - orderTotal
449
+ properties:
450
+ orderNumber:
451
+ type: string
452
+ orderDate:
453
+ type: string
454
+ x-mockingbird-volatile:
455
+ kind: timestamp
456
+ salesOrder:
457
+ type: string
458
+ status:
459
+ type: string
460
+ tracking:
461
+ type: array
462
+ items:
463
+ $ref: "#/components/schemas/Tracking"
464
+ message:
465
+ type: string
466
+ subTotal:
467
+ type: number
468
+ shipMethod:
469
+ type: string
470
+ shipCharge:
471
+ type: number
472
+ discount:
473
+ type: number
474
+ tax:
475
+ type: number
476
+ serviceFee:
477
+ type: number
478
+ orderTotal:
479
+ type: number
480
+ CancelResponse:
481
+ type: object
482
+ required: [success, msg]
483
+ properties:
484
+ success:
485
+ type: boolean
486
+ msg:
487
+ type: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-wholescripts",
3
- "version": "1.8.0",
3
+ "version": "2.0.0",
4
4
  "description": "Stateful mock of the Wholescripts supplement fulfilment API: product and private-label catalogs, order submit, status polling and cancel, with admin status transitions.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,7 +8,10 @@
8
8
  "files": [
9
9
  "dist",
10
10
  "README.md",
11
- "CHANGELOG.md"
11
+ "CHANGELOG.md",
12
+ "DISCOVERY.md",
13
+ "SUPPORT.md",
14
+ "openapi.yaml"
12
15
  ],
13
16
  "main": "./dist/index.js",
14
17
  "types": "./dist/index.d.ts",
@@ -61,6 +64,28 @@
61
64
  "parityTier": "cold",
62
65
  "playground": {
63
66
  "basicAuth": "mockingbird:mockingbird"
67
+ },
68
+ "discovery": {
69
+ "guide": "DISCOVERY.md",
70
+ "behavior": "README.md",
71
+ "capabilities": "SUPPORT.md",
72
+ "contract": "openapi.yaml",
73
+ "types": "dist/index.d.ts",
74
+ "oracle": {
75
+ "kind": "Live vendor API or sandbox",
76
+ "command": "bun run parity:service -- wholescripts",
77
+ "note": "Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2."
78
+ },
79
+ "introspection": [
80
+ "GET /__admin/health",
81
+ "GET /__admin",
82
+ "GET /__admin/state",
83
+ "GET /__admin/requests",
84
+ "GET /__admin/metrics",
85
+ "GET /__admin/faults/presets",
86
+ "GET /__admin/ui"
87
+ ],
88
+ "reporting": "https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md"
64
89
  }
65
90
  },
66
91
  "scripts": {
@@ -76,7 +101,7 @@
76
101
  "pack:check": "bun ../../../scripts/pack-check.ts"
77
102
  },
78
103
  "dependencies": {
79
- "@crvouga/mockingbird-service-sqlite": "1.3.0",
104
+ "@crvouga/mockingbird-service-sqlite": "2.0.0",
80
105
  "hono": "4.11.9"
81
106
  },
82
107
  "devDependencies": {