@crvouga/mockingbird-service-wholescripts 0.2.0 → 1.0.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.
- package/CHANGELOG.md +14 -1
- package/README.md +11 -11
- package/dist/{chunk-ARWCVRNR.js → chunk-A2547YFQ.js} +103 -31
- package/dist/chunk-A2547YFQ.js.map +7 -0
- package/dist/{chunk-XXM4NA4F.js → chunk-FATLEILG.js} +5 -3
- package/dist/chunk-FATLEILG.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +121 -93
- package/dist/index.js +1 -1
- package/dist/server.d.ts +221 -165
- package/dist/server.js +2 -2
- package/package.json +7 -2
- package/dist/chunk-ARWCVRNR.js.map +0 -7
- package/dist/chunk-XXM4NA4F.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-wholescripts
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 1.0.1 (2026-09-26)
|
|
4
|
+
|
|
5
|
+
### Fixes and improvements
|
|
6
|
+
|
|
7
|
+
- take the rejected-request byte count from content-length, never by reading the body ([a0e5fb2](https://github.com/crvouga/mockingbird/commit/a0e5fb2fc80ab725c3552b612f3f091fd6c857fb))
|
|
8
|
+
- reject a present body by media type, and log what a rejected request sent ([12e351a](https://github.com/crvouga/mockingbird/commit/12e351aba53cfb7b41e31a7809419455fc2902eb))
|
|
9
|
+
|
|
10
|
+
## 1.0.0 (2026-09-24)
|
|
11
|
+
|
|
12
|
+
### ⚠️ Breaking changes
|
|
13
|
+
|
|
14
|
+
- vendor branding for every service; purge internal mocks and consumer names ([f689534](https://github.com/crvouga/mockingbird/commit/f6895343543550dafcb7d76b426cae7635e03226))
|
|
15
|
+
|
|
16
|
+
## 0.2.0 (2026-09-23)
|
|
4
17
|
|
|
5
18
|
### Features
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Wholescripts sends no webhooks, so the app sees each change on its next status p
|
|
|
7
7
|
|
|
8
8
|
- Operation coverage: [SUPPORT.md](https://github.com/crvouga/mockingbird/blob/main/packages/service/wholescripts/SUPPORT.md)
|
|
9
9
|
- The vendor publishes no spec. The contract (`openapi.yaml`) is hand-authored from our
|
|
10
|
-
consumers' zod schemas (backend and EMR `wholescripts.types.ts`) and the
|
|
10
|
+
consumers' zod schemas (backend and EMR `wholescripts.types.ts`) and the supplement scheduler's Python client.
|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ with any Fetch server.
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
24
|
Point `WHOLESCRIPTS_API_URL` at the mock. It is read by the backend
|
|
25
|
-
(`global-services/services/wholescripts`), the EMR (`services/wholescripts`) and
|
|
25
|
+
(`global-services/services/wholescripts`), the EMR (`services/wholescripts`) and the supplement scheduler
|
|
26
26
|
(`supplement_management`). Any non-empty `WHOLESCRIPTS_USERNAME` / `WHOLESCRIPTS_PASSWORD`
|
|
27
27
|
pair is accepted unless you pin one with `--username/--password`.
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ npx mockingbird-wholescripts serve --port 8803 --auto-advance "2000:Processing,C
|
|
|
34
34
|
import { createRuntime } from "@crvouga/mockingbird-service-wholescripts"
|
|
35
35
|
|
|
36
36
|
const ws = createRuntime()
|
|
37
|
-
const auth = { authorization: `Basic ${btoa("
|
|
37
|
+
const auth = { authorization: `Basic ${btoa("acme:secret")}`, "content-type": "application/json" }
|
|
38
38
|
|
|
39
39
|
const submitted = (await (
|
|
40
40
|
await ws.fetch(
|
|
@@ -65,7 +65,7 @@ await ws.fetch(
|
|
|
65
65
|
| Route | Behaviour |
|
|
66
66
|
| --- | --- |
|
|
67
67
|
| `GET /api/Orders/PrivateLabelProductList` | `{privateLabelProducts: [], medPaxPills: [{sku, genericName, privateLabelName, quantity}], privateLabelCartons: [{sku, name, cartonImage, quantity}]}`. |
|
|
68
|
-
| `GET /api/Orders/ProductList` | Product rows (`productName`, `sku`, `medPaxSku`, `categories`, prices, `quantity`, `defaultDosing`, optional `medPaxDetails`). `instockonly=true` keeps `quantity > 0` (the EMR), `search` matches name/SKU/brand/categories (
|
|
68
|
+
| `GET /api/Orders/ProductList` | Product rows (`productName`, `sku`, `medPaxSku`, `categories`, prices, `quantity`, `defaultDosing`, optional `medPaxDetails`). `instockonly=true` keeps `quantity > 0` (the EMR), `search` matches name/SKU/brand/categories (the supplement scheduler), `limit` caps. |
|
|
69
69
|
| `POST /api/Orders/Submit` | `{ShippingAddress, Notes?, Items: [{Sku, Quantity, MedPaxName?, MedPaxPills?: [{Sku, Quantity, ItemTime}]}], ShippingMethod}` → `{orderNumber, success: true, msg}`. A contract violation or an unknown SKU (product, MedPax, pill or carton SKU) is still **200** with `success: false` and the reason in `msg`, which is what both consumers read. |
|
|
70
70
|
| `GET /api/Orders/Status?ordernum=` | `[{orderNumber, orderDate, salesOrder, status, tracking: [{trackingNumber, carrier, trackingUrl}], message, subTotal, shipMethod, shipCharge, discount, tax, serviceFee, orderTotal}]`; `[]` for an unknown order. Totals are priced from the catalog (MedPax SKUs at their `medPaxDetails` price) plus 9.95 shipping (0 for "free" methods). |
|
|
71
71
|
| `POST /api/Orders/Cancel` | `{OrderNumber}` → `{success, msg}`. Succeeds while `Pending`/`Processing` with no tracking; otherwise `success: false`. Unknown order: 404. |
|
|
@@ -73,7 +73,7 @@ await ws.fetch(
|
|
|
73
73
|
Missing or wrong Basic credentials answer 401 `{"Message": "Authorization has been denied for this request."}`.
|
|
74
74
|
|
|
75
75
|
Statuses are `Pending` (new), `Processing`, `Complete`, `Cancelled`, `Error`, or any string a
|
|
76
|
-
test sets. How our consumers read them:
|
|
76
|
+
test sets. How our consumers read them: the scheduler maps `Pending`/`Processing` to `placed` (or
|
|
77
77
|
`shipped` once tracking exists), `Complete` to `shipped` (carrier hand-off, not delivery),
|
|
78
78
|
anything containing `cancel`/`error` to `cancelled`/`failed`, and everything else to `unknown`.
|
|
79
79
|
The backend and EMR do not map statuses.
|
|
@@ -90,9 +90,9 @@ The backend and EMR do not map statuses.
|
|
|
90
90
|
|
|
91
91
|
Fault presets (`POST /__admin/faults {"preset": "<name>", "count"?: n}`; `GET /__admin/faults/presets`):
|
|
92
92
|
`submit_rejected` (200 `success: false`), `submit_timeout` (the order is placed, then the
|
|
93
|
-
connection drops:
|
|
93
|
+
connection drops: the scheduler's "order may have been placed" branch), `status_empty` (`[]`),
|
|
94
94
|
`status_schema_drift` (rows the backend's zod rejects, so it returns `null`), `server_error`
|
|
95
|
-
(500, which
|
|
95
|
+
(500, which the scheduler retries), `unauthorized` (401).
|
|
96
96
|
|
|
97
97
|
### Namespaces
|
|
98
98
|
|
|
@@ -102,9 +102,9 @@ username: `PUT /__admin/credentials {"credentials": {"<WHOLESCRIPTS_USERNAME>":
|
|
|
102
102
|
### Corpus and seed data
|
|
103
103
|
|
|
104
104
|
The default catalog is the rows our consumers' own tests use
|
|
105
|
-
(`
|
|
106
|
-
`medPaxSku`s made unique, plus the
|
|
107
|
-
rows the
|
|
105
|
+
(the consumer app's `wholescripts-service.test.ts`), with their repeated
|
|
106
|
+
`medPaxSku`s made unique, plus the scheduler's MedPax box `000000000200095263` and `medPaxDetails`
|
|
107
|
+
rows the scheduler's catalog sync reads. `Protein Powder` (`PP001`) is out of stock. No sandbox
|
|
108
108
|
recording exists; pass `catalog` (or `PUT /__admin/catalog`) to load recorded rows.
|
|
109
109
|
|
|
110
110
|
### Deliberately not modelled
|
|
@@ -128,7 +128,7 @@ recording exists; pass `catalog` (or `PUT /__admin/catalog`) to load recorded ro
|
|
|
128
128
|
| `basicUsername` | function | The Basic username a request carries (how credentials map to namespaces). |
|
|
129
129
|
| `canonicalStatus` | function | The canonical casing of a transition target (`complete` → `Complete`). |
|
|
130
130
|
| `DEFAULT_CATALOG` | object | The default `{products, medPaxPills, privateLabelCartons}`. |
|
|
131
|
-
| `MEDPAX_BOX_SKU` | string | The
|
|
131
|
+
| `MEDPAX_BOX_SKU` | string | The supplement scheduler's MedPax box SKU, `000000000200095263`. |
|
|
132
132
|
| `document`, `operationIds`, `supportedOperationIds` | values | The vendored OpenAPI contract and its operation ids. |
|
|
133
133
|
| `createServer`, `serveTarget`, `DEFAULT_PORT` (`./server`) | Node | Serve over `node:http` (auto-advance ticks every 100 ms); the `serve` CLI target; port 8803. |
|
|
134
134
|
|
|
@@ -1358,6 +1358,90 @@ var operationMetadata = (operation) => {
|
|
|
1358
1358
|
|
|
1359
1359
|
// ../core/dist/service.js
|
|
1360
1360
|
import { Hono } from "hono";
|
|
1361
|
+
|
|
1362
|
+
// ../core/dist/validation.js
|
|
1363
|
+
var requestBodyOf = (context) => {
|
|
1364
|
+
const requestBody = context.operation.operation.requestBody;
|
|
1365
|
+
return requestBody ? deref(context.document, requestBody) : void 0;
|
|
1366
|
+
};
|
|
1367
|
+
var mediaTypeMatches = (accepted, actual) => {
|
|
1368
|
+
const pattern = mediaTypeOf(accepted) ?? accepted.toLowerCase();
|
|
1369
|
+
if (pattern === actual || pattern === "*/*")
|
|
1370
|
+
return true;
|
|
1371
|
+
const [type, subtype] = pattern.split("/");
|
|
1372
|
+
const [actualType, actualSubtype] = actual.split("/");
|
|
1373
|
+
if (type !== actualType && type !== "*")
|
|
1374
|
+
return false;
|
|
1375
|
+
if (subtype === void 0 || subtype === "*")
|
|
1376
|
+
return true;
|
|
1377
|
+
if (subtype.startsWith("*+"))
|
|
1378
|
+
return actualSubtype?.endsWith(subtype.slice(1)) === true;
|
|
1379
|
+
return false;
|
|
1380
|
+
};
|
|
1381
|
+
var acceptedKeyFor = (content, mediaType) => {
|
|
1382
|
+
if (!content || mediaType === void 0)
|
|
1383
|
+
return void 0;
|
|
1384
|
+
const keys = Object.keys(content);
|
|
1385
|
+
return keys.find((key) => mediaTypeOf(key) === mediaType) ?? keys.find((key) => mediaTypeMatches(key, mediaType));
|
|
1386
|
+
};
|
|
1387
|
+
var unsupportedMediaType = (context, options = {}) => {
|
|
1388
|
+
if (context.body.kind === "empty" && options.includeEmpty !== true)
|
|
1389
|
+
return void 0;
|
|
1390
|
+
const content = requestBodyOf(context)?.content;
|
|
1391
|
+
if (!content || Object.keys(content).length === 0)
|
|
1392
|
+
return void 0;
|
|
1393
|
+
const mediaType = mediaTypeOf(context.request.headers.get("content-type"));
|
|
1394
|
+
if (acceptedKeyFor(content, mediaType) !== void 0)
|
|
1395
|
+
return void 0;
|
|
1396
|
+
return { mediaType: mediaType ?? null, accepted: Object.keys(content) };
|
|
1397
|
+
};
|
|
1398
|
+
var recorded = /* @__PURE__ */ new WeakMap();
|
|
1399
|
+
var recordedIssues = (request) => recorded.get(request);
|
|
1400
|
+
var bodyIssues = (context, contentType = "application/json") => {
|
|
1401
|
+
const issues = findBodyIssues(context, contentType);
|
|
1402
|
+
if (issues.length > 0)
|
|
1403
|
+
recorded.set(context.request, issues);
|
|
1404
|
+
return issues;
|
|
1405
|
+
};
|
|
1406
|
+
var findBodyIssues = (context, contentType) => {
|
|
1407
|
+
const resolved = requestBodyOf(context);
|
|
1408
|
+
if (!resolved)
|
|
1409
|
+
return [];
|
|
1410
|
+
const unsupported = unsupportedMediaType(context);
|
|
1411
|
+
if (unsupported) {
|
|
1412
|
+
return [
|
|
1413
|
+
{
|
|
1414
|
+
path: "",
|
|
1415
|
+
kind: "media_type",
|
|
1416
|
+
message: unsupported.mediaType === null ? "request body has no content-type" : `request body media type ${unsupported.mediaType} is not supported`
|
|
1417
|
+
}
|
|
1418
|
+
];
|
|
1419
|
+
}
|
|
1420
|
+
const key = acceptedKeyFor(resolved.content, mediaTypeOf(context.request.headers.get("content-type"))) ?? contentType;
|
|
1421
|
+
const schema = resolved.content?.[key]?.schema;
|
|
1422
|
+
if (!schema)
|
|
1423
|
+
return [];
|
|
1424
|
+
if (context.body.kind === "invalid") {
|
|
1425
|
+
return [
|
|
1426
|
+
{
|
|
1427
|
+
path: "",
|
|
1428
|
+
kind: "syntax",
|
|
1429
|
+
message: `request body is not valid ${context.body.mediaType}`
|
|
1430
|
+
}
|
|
1431
|
+
];
|
|
1432
|
+
}
|
|
1433
|
+
const value = context.body.kind === "json" || context.body.kind === "form" || context.body.kind === "text" ? context.body.value : void 0;
|
|
1434
|
+
if (value === void 0) {
|
|
1435
|
+
return resolved.required && context.body.kind === "empty" ? [{ path: "", kind: "required", message: "request body is required" }] : [];
|
|
1436
|
+
}
|
|
1437
|
+
return validateValue(context.document, resolveSchema(context.document, schema), value).map((issue) => ({ path: issue.path.join("."), kind: "schema", message: issue.message }));
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
// ../core/dist/service.js
|
|
1441
|
+
var withIssues = (request, response) => {
|
|
1442
|
+
const issues = response.status >= 400 ? recordedIssues(request) : void 0;
|
|
1443
|
+
return issues && issues.length > 0 ? annotateResponse(response, { issues }) : response;
|
|
1444
|
+
};
|
|
1361
1445
|
var defineOperations = (handlers) => handlers;
|
|
1362
1446
|
var OperationRegistryError = class extends Error {
|
|
1363
1447
|
problems;
|
|
@@ -1443,9 +1527,7 @@ var createService = (options) => {
|
|
|
1443
1527
|
now
|
|
1444
1528
|
};
|
|
1445
1529
|
const short = await options.before?.(context);
|
|
1446
|
-
|
|
1447
|
-
return short;
|
|
1448
|
-
return handler(context);
|
|
1530
|
+
return withIssues(request, short ?? await handler(context));
|
|
1449
1531
|
};
|
|
1450
1532
|
app.on(operation.method.toUpperCase(), honoPath(operation.path), route);
|
|
1451
1533
|
}
|
|
@@ -1482,7 +1564,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
|
|
|
1482
1564
|
};
|
|
1483
1565
|
|
|
1484
1566
|
// ../core/dist/version.js
|
|
1485
|
-
var PACKAGE_VERSION = true ? "0.
|
|
1567
|
+
var PACKAGE_VERSION = true ? "1.0.1" : UNRELEASED_VERSION;
|
|
1486
1568
|
|
|
1487
1569
|
// ../core/dist/webhooks.js
|
|
1488
1570
|
var json2 = (status, body) => new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } });
|
|
@@ -1922,8 +2004,15 @@ var createRuntime = (options) => {
|
|
|
1922
2004
|
const started = monotonicNow();
|
|
1923
2005
|
const url = new URL(request.url);
|
|
1924
2006
|
const operationId = operationIdFor(request, url.pathname);
|
|
2007
|
+
const contentLength = request.headers.get("content-length");
|
|
2008
|
+
const received = {
|
|
2009
|
+
contentType: request.headers.get("content-type"),
|
|
2010
|
+
bodyBytes: contentLength !== null && /^\d+$/.test(contentLength) ? Number(contentLength) : null,
|
|
2011
|
+
transferEncoding: request.headers.get("transfer-encoding")
|
|
2012
|
+
};
|
|
1925
2013
|
const log = (status, faultId, response2) => {
|
|
1926
2014
|
const noted = response2 ? responseNotes(response2) : void 0;
|
|
2015
|
+
const rejected = status >= 400 && faultId === void 0;
|
|
1927
2016
|
const entry = {
|
|
1928
2017
|
service: options.name,
|
|
1929
2018
|
namespace,
|
|
@@ -1935,7 +2024,9 @@ var createRuntime = (options) => {
|
|
|
1935
2024
|
unmatched: options.document !== void 0 && operationId === void 0,
|
|
1936
2025
|
...faultId !== void 0 ? { faultId } : {},
|
|
1937
2026
|
...noted?.ids && Object.keys(noted.ids).length > 0 ? { ids: noted.ids } : {},
|
|
1938
|
-
...noted?.adopted ? { adopted: true } : {}
|
|
2027
|
+
...noted?.adopted ? { adopted: true } : {},
|
|
2028
|
+
...rejected ? { request: { ...received } } : {},
|
|
2029
|
+
...rejected && noted?.issues && noted.issues.length > 0 ? { issues: noted.issues.map((issue) => ({ ...issue })) } : {}
|
|
1939
2030
|
};
|
|
1940
2031
|
metrics.record(entry);
|
|
1941
2032
|
journal.record({ ...entry, at: new Date(clock.now()).toISOString() });
|
|
@@ -2142,25 +2233,6 @@ var presetRoutes = (presets, runtime) => ({
|
|
|
2142
2233
|
}
|
|
2143
2234
|
});
|
|
2144
2235
|
|
|
2145
|
-
// ../core/dist/validation.js
|
|
2146
|
-
var bodyIssues = (context, contentType = "application/json") => {
|
|
2147
|
-
const requestBody = context.operation.operation.requestBody;
|
|
2148
|
-
if (!requestBody)
|
|
2149
|
-
return [];
|
|
2150
|
-
const resolved = deref(context.document, requestBody);
|
|
2151
|
-
const schema = resolved.content?.[contentType]?.schema;
|
|
2152
|
-
if (!schema)
|
|
2153
|
-
return [];
|
|
2154
|
-
const value = context.body.kind === "json" || context.body.kind === "form" ? context.body.value : void 0;
|
|
2155
|
-
if (context.body.kind === "invalid") {
|
|
2156
|
-
return [{ path: "", message: `request body is not valid ${context.body.mediaType}` }];
|
|
2157
|
-
}
|
|
2158
|
-
if (value === void 0) {
|
|
2159
|
-
return resolved.required ? [{ path: "", message: "request body is required" }] : [];
|
|
2160
|
-
}
|
|
2161
|
-
return validateValue(context.document, resolveSchema(context.document, schema), value).map((issue) => ({ path: issue.path.join("."), message: issue.message }));
|
|
2162
|
-
};
|
|
2163
|
-
|
|
2164
2236
|
// src/catalog.ts
|
|
2165
2237
|
var MEDPAX_BOX_SKU = "000000000200095263";
|
|
2166
2238
|
var product = (row) => ({
|
|
@@ -2263,7 +2335,7 @@ var DEFAULT_CATALOG = {
|
|
|
2263
2335
|
defaultDosing: [{ time: "AM", qty: 1 }]
|
|
2264
2336
|
}),
|
|
2265
2337
|
product({
|
|
2266
|
-
productName: "
|
|
2338
|
+
productName: "Acme Longevity Blend MedPax Box",
|
|
2267
2339
|
sku: MEDPAX_BOX_SKU,
|
|
2268
2340
|
medPaxSku: "",
|
|
2269
2341
|
categories: "MedPax",
|
|
@@ -2324,7 +2396,7 @@ var unitPrice = (catalog, sku) => {
|
|
|
2324
2396
|
};
|
|
2325
2397
|
|
|
2326
2398
|
// src/generated/openapi.ts
|
|
2327
|
-
var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Wholescripts supplement fulfilment API (Mockingbird subset)","description":"Stateful mock subset of the Wholescripts ordering API: the product and private-label\\n(MedPax) catalogs, order submit, status polling and cancel. Hand-authored from the\\nconsumers' zod schemas and clients (the vendor publishes no spec).\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from the wire shapes our consumers read and write (backend and EMR wholescripts.types.ts zod schemas, the
|
|
2399
|
+
var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Wholescripts supplement fulfilment API (Mockingbird subset)","description":"Stateful mock subset of the Wholescripts ordering API: the product and private-label\\n(MedPax) catalogs, order submit, status polling and cancel. Hand-authored from the\\nconsumers' zod schemas and clients (the vendor publishes no spec).\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from the wire shapes our consumers read and write (backend and EMR wholescripts.types.ts zod schemas, the supplement scheduler's Python client, adapter and mappers)."}},"servers":[{"url":"https://api.wholescripts.com"}],"security":[{"basicAuth":[]}],"paths":{"/api/Orders/PrivateLabelProductList":{"get":{"operationId":"GetPrivateLabelProductList","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Private-label (MedPax) catalog","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateLabelProductList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/Orders/ProductList":{"get":{"operationId":"GetProductList","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"instockonly","in":"query","required":false,"description":"\`true\` keeps only rows with quantity > 0 (the EMR sends it).","schema":{"type":"string","enum":["true","false"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000}},{"name":"search","in":"query","required":false,"description":"Case-insensitive match on name, SKU, MedPax SKU, brand or categories (the supplement scheduler).","schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"Products","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/Orders/Submit":{"post":{"operationId":"SubmitOrder","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSubmitRequest"}}}},"responses":{"200":{"description":"Submit outcome. A rejected order (bad body, unknown SKU, payment failure) is still 200, with success false and the reason in msg.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSubmitResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/Orders/Status":{"get":{"operationId":"GetOrderStatus","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"ordernum","in":"query","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"order","missing":"000000"}}}],"responses":{"200":{"description":"The order's status rows (empty for an unknown order number)","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrderStatus"}}}}},"400":{"description":"Missing ordernum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AspNetError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/Orders/Cancel":{"post":{"operationId":"CancelOrder","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["OrderNumber"],"properties":{"OrderNumber":{"type":"string","x-mockingbird-resource-ref":{"type":"order","missing":"000000"}}}}}}},"responses":{"200":{"description":"Cancel outcome; success false when the order has progressed too far","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelResponse"}}}},"400":{"description":"Missing OrderNumber","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Unknown order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelResponse"}}}}}}}},"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"responses":{"Unauthorized":{"description":"Missing or wrong Basic credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AspNetError"}}}}},"schemas":{"AspNetError":{"type":"object","required":["Message"],"properties":{"Message":{"type":"string"}}},"DefaultDosing":{"type":"object","required":["time","qty"],"properties":{"time":{"type":"string"},"qty":{"type":"number"}}},"MedPaxDetails":{"type":"object","required":["name","genericName","quantity","wholesalePrice","retailPrice"],"properties":{"name":{"type":"string"},"genericName":{"type":"string"},"quantity":{"type":"number"},"wholesalePrice":{"type":"number"},"retailPrice":{"type":"number"}}},"Product":{"type":"object","required":["productName","sku","medPaxSku","categories","retailPrice","upc","descriptionShort","brand","productImage","quantity","countUnit","wholesalePrice","supplementFactsHTML","defaultDosing"],"properties":{"productName":{"type":"string"},"sku":{"type":"string","x-mockingbird-resource":{"type":"sku","identity":true}},"medPaxSku":{"type":"string"},"categories":{"type":"string"},"retailPrice":{"type":"number"},"upc":{"type":"string"},"descriptionShort":{"type":"string"},"descriptionFull":{"type":"string"},"brand":{"type":"string"},"productImage":{"type":"string"},"quantity":{"type":"number"},"countUnit":{"type":"string"},"wholesalePrice":{"type":"number"},"supplementFactsHTML":{"type":"string"},"defaultDosing":{"type":"array","items":{"$ref":"#/components/schemas/DefaultDosing"}},"medPaxDetails":{"oneOf":[{"$ref":"#/components/schemas/MedPaxDetails"},{"type":"null"}]}}},"PrivateLabelProductList":{"type":"object","required":["privateLabelProducts","medPaxPills","privateLabelCartons"],"properties":{"privateLabelProducts":{"type":"array","items":{}},"medPaxPills":{"type":"array","items":{"type":"object","required":["sku","genericName","privateLabelName","quantity"],"properties":{"sku":{"type":"string","x-mockingbird-resource":{"type":"sku","identity":true}},"genericName":{"type":"string"},"privateLabelName":{"type":"string"},"quantity":{"type":"number"}}}},"privateLabelCartons":{"type":"array","items":{"type":"object","required":["sku","name","cartonImage","quantity"],"properties":{"sku":{"type":"string","x-mockingbird-resource":{"type":"sku","identity":true}},"name":{"type":"string"},"cartonImage":{"type":"string"},"quantity":{"type":"number"}}}}}},"MedPaxPill":{"type":"object","required":["Sku","Quantity","ItemTime"],"properties":{"productId":{"type":"string","maxLength":64},"Sku":{"type":"string","x-mockingbird-resource-ref":{"type":"sku","missing":"000000000000000000"}},"Quantity":{"type":"integer","minimum":1,"maximum":1000},"ItemTime":{"type":"string","enum":["AM","PM","AM with food","PM with food"]}}},"OrderItem":{"type":"object","required":["Sku","Quantity"],"properties":{"Sku":{"type":"string","x-mockingbird-resource-ref":{"type":"sku","missing":"000000000000000000"}},"Quantity":{"type":"integer","minimum":1,"maximum":1000},"MedPaxName":{"type":["string","null"],"maxLength":60},"MedPaxPills":{"type":["array","null"],"maxItems":4,"items":{"$ref":"#/components/schemas/MedPaxPill"}}}},"OrderSubmitRequest":{"type":"object","required":["ShippingAddress","Items","ShippingMethod"],"properties":{"ShippingAddress":{"type":"object","required":["FName","LName","Address1","City","State","Zip"],"properties":{"FName":{"type":"string","minLength":1,"maxLength":40},"LName":{"type":"string","minLength":1,"maxLength":40},"Address1":{"type":"string","minLength":1,"maxLength":80},"Address2":{"type":["string","null"],"maxLength":80},"City":{"type":"string","minLength":1,"maxLength":40},"State":{"type":"string","pattern":"^[A-Z]{2}$"},"Zip":{"type":"string","pattern":"^[0-9]{5}(-[0-9]{4})?$"},"Email":{"type":"string","format":"email","maxLength":120}}},"Notes":{"type":["string","null"],"maxLength":500},"Items":{"type":"array","minItems":1,"maxItems":4,"items":{"$ref":"#/components/schemas/OrderItem"}},"ShippingMethod":{"type":"string","minLength":1,"maxLength":40}}},"OrderSubmitResponse":{"type":"object","required":["orderNumber","success","msg"],"properties":{"orderNumber":{"type":"string","x-mockingbird-resource":{"type":"order","identity":true}},"success":{"type":"boolean"},"msg":{"type":"string"}}},"Tracking":{"type":"object","required":["trackingNumber","carrier"],"properties":{"trackingNumber":{"type":"string"},"carrier":{"type":"string"},"trackingUrl":{"type":"string"}}},"OrderStatus":{"type":"object","required":["orderNumber","orderDate","salesOrder","status","tracking","message","subTotal","shipMethod","shipCharge","discount","tax","serviceFee","orderTotal"],"properties":{"orderNumber":{"type":"string"},"orderDate":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}},"salesOrder":{"type":"string"},"status":{"type":"string"},"tracking":{"type":"array","items":{"$ref":"#/components/schemas/Tracking"}},"message":{"type":"string"},"subTotal":{"type":"number"},"shipMethod":{"type":"string"},"shipCharge":{"type":"number"},"discount":{"type":"number"},"tax":{"type":"number"},"serviceFee":{"type":"number"},"orderTotal":{"type":"number"}}},"CancelResponse":{"type":"object","required":["success","msg"],"properties":{"success":{"type":"boolean"},"msg":{"type":"string"}}}}}}`);
|
|
2328
2400
|
var operationIds = ["GetPrivateLabelProductList", "GetProductList", "SubmitOrder", "GetOrderStatus", "CancelOrder"];
|
|
2329
2401
|
var supportedOperationIds = ["GetPrivateLabelProductList", "GetProductList", "SubmitOrder", "GetOrderStatus", "CancelOrder"];
|
|
2330
2402
|
|
|
@@ -2375,15 +2447,15 @@ var WholescriptsState = class {
|
|
|
2375
2447
|
// src/runtime.ts
|
|
2376
2448
|
var WHOLESCRIPTS_PRESETS = {
|
|
2377
2449
|
submit_rejected: {
|
|
2378
|
-
description: "Submit answers 200 {success: false, msg} (the backend and
|
|
2450
|
+
description: "Submit answers 200 {success: false, msg} (the backend and the scheduler both reject it)",
|
|
2379
2451
|
rules: [{ operationId: "SubmitOrder", effect: "submit_rejected" }]
|
|
2380
2452
|
},
|
|
2381
2453
|
submit_timeout: {
|
|
2382
|
-
description: "Submit places the order, then drops the connection (
|
|
2454
|
+
description: "Submit places the order, then drops the connection (the scheduler's 'order may have been placed')",
|
|
2383
2455
|
rules: [{ operationId: "SubmitOrder", effect: "submit_timeout" }]
|
|
2384
2456
|
},
|
|
2385
2457
|
status_empty: {
|
|
2386
|
-
description: "Status answers [] even for a known order (backend returns null,
|
|
2458
|
+
description: "Status answers [] even for a known order (backend returns null, the scheduler 'unknown')",
|
|
2387
2459
|
rules: [{ operationId: "GetOrderStatus", effect: "status_empty" }]
|
|
2388
2460
|
},
|
|
2389
2461
|
status_schema_drift: {
|
|
@@ -2391,7 +2463,7 @@ var WHOLESCRIPTS_PRESETS = {
|
|
|
2391
2463
|
rules: [{ operationId: "GetOrderStatus", effect: "status_schema_drift" }]
|
|
2392
2464
|
},
|
|
2393
2465
|
server_error: {
|
|
2394
|
-
description: "Every call answers 500 (
|
|
2466
|
+
description: "Every call answers 500 (the scheduler retries 5xx; the backend throws)",
|
|
2395
2467
|
rules: [{ status: 500, body: { Message: "An error has occurred." } }]
|
|
2396
2468
|
},
|
|
2397
2469
|
unauthorized: {
|
|
@@ -2782,4 +2854,4 @@ export {
|
|
|
2782
2854
|
canonicalStatus,
|
|
2783
2855
|
WholescriptsAPI
|
|
2784
2856
|
};
|
|
2785
|
-
//# sourceMappingURL=chunk-
|
|
2857
|
+
//# sourceMappingURL=chunk-A2547YFQ.js.map
|