@sixtyninecommerce/admin 0.10.0 → 0.11.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 (247) hide show
  1. package/README.md +4347 -171
  2. package/dist/catalog/assets.d.ts +120 -8
  3. package/dist/catalog/assets.js +98 -12
  4. package/dist/catalog/collections.d.ts +279 -14
  5. package/dist/catalog/collections.js +246 -15
  6. package/dist/catalog/index.d.ts +9 -2
  7. package/dist/catalog/index.js +4 -0
  8. package/dist/catalog/products.d.ts +159 -19
  9. package/dist/catalog/products.js +88 -13
  10. package/dist/catalog/properties.d.ts +102 -14
  11. package/dist/catalog/properties.js +13 -0
  12. package/dist/catalog/recommendations.d.ts +261 -0
  13. package/dist/catalog/recommendations.js +145 -0
  14. package/dist/catalog/reviews.d.ts +368 -0
  15. package/dist/catalog/reviews.js +318 -0
  16. package/dist/catalog/types.d.ts +17 -1
  17. package/dist/catalog/types.js +10 -0
  18. package/dist/catalog/variant-find.d.ts +136 -0
  19. package/dist/catalog/variant-find.js +239 -0
  20. package/dist/catalog/variants.d.ts +233 -26
  21. package/dist/catalog/variants.js +125 -7
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +95 -9
  25. package/dist/client.js +35 -7
  26. package/dist/content/assets.d.ts +286 -0
  27. package/dist/content/assets.js +181 -0
  28. package/dist/content/items.d.ts +269 -0
  29. package/dist/content/items.js +170 -0
  30. package/dist/content/types.d.ts +282 -0
  31. package/dist/content/types.js +100 -0
  32. package/dist/customers/age-verification.d.ts +66 -0
  33. package/dist/customers/age-verification.js +79 -0
  34. package/dist/customers/credit.d.ts +263 -0
  35. package/dist/customers/credit.js +244 -0
  36. package/dist/customers/delivery-preferences.d.ts +120 -0
  37. package/dist/customers/delivery-preferences.js +97 -0
  38. package/dist/customers/groups.d.ts +207 -0
  39. package/dist/customers/groups.js +438 -0
  40. package/dist/customers/index.d.ts +447 -37
  41. package/dist/customers/index.js +313 -40
  42. package/dist/customers/invitation-status.d.ts +57 -0
  43. package/dist/customers/invitation-status.js +21 -0
  44. package/dist/customers/notes.d.ts +67 -0
  45. package/dist/customers/notes.js +51 -0
  46. package/dist/customers/notification-recipients.d.ts +97 -0
  47. package/dist/customers/notification-recipients.js +84 -0
  48. package/dist/customers/saved-lists.d.ts +42 -0
  49. package/dist/customers/saved-lists.js +61 -0
  50. package/dist/customers/vat.d.ts +83 -0
  51. package/dist/customers/vat.js +46 -0
  52. package/dist/customers/wire.d.ts +20 -0
  53. package/dist/customers/wire.js +35 -0
  54. package/dist/documents/ar.d.ts +307 -0
  55. package/dist/documents/ar.js +254 -0
  56. package/dist/documents/index.d.ts +731 -21
  57. package/dist/documents/index.js +436 -24
  58. package/dist/documents/pdf.d.ts +2 -0
  59. package/dist/documents/pdf.js +11 -0
  60. package/dist/fulfillments/create.d.ts +167 -0
  61. package/dist/fulfillments/create.js +216 -0
  62. package/dist/fulfillments/index.d.ts +44 -10
  63. package/dist/fulfillments/index.js +11 -2
  64. package/dist/fulfillments/payment-policy.d.ts +64 -0
  65. package/dist/fulfillments/payment-policy.js +140 -0
  66. package/dist/fulfillments/warehouse.d.ts +724 -0
  67. package/dist/fulfillments/warehouse.js +914 -0
  68. package/dist/geo/index.d.ts +119 -0
  69. package/dist/geo/index.js +107 -0
  70. package/dist/index.d.ts +123 -35
  71. package/dist/index.js +45 -12
  72. package/dist/integrations/afas-actions.d.ts +234 -0
  73. package/dist/integrations/afas-actions.js +310 -0
  74. package/dist/integrations/afas-types.d.ts +483 -0
  75. package/dist/integrations/afas-types.js +5 -0
  76. package/dist/integrations/afas.d.ts +234 -0
  77. package/dist/integrations/afas.js +290 -0
  78. package/dist/integrations/connections.d.ts +103 -0
  79. package/dist/integrations/connections.js +55 -0
  80. package/dist/integrations/esp.d.ts +313 -0
  81. package/dist/integrations/esp.js +169 -0
  82. package/dist/integrations/exact-online-types.d.ts +423 -0
  83. package/dist/integrations/exact-online-types.js +6 -0
  84. package/dist/integrations/exact-online.d.ts +248 -0
  85. package/dist/integrations/exact-online.js +376 -0
  86. package/dist/integrations/index.d.ts +29 -3
  87. package/dist/integrations/index.js +18 -3
  88. package/dist/integrations/pipeline-keys.d.ts +13 -0
  89. package/dist/integrations/pipeline-keys.js +22 -0
  90. package/dist/integrations/pipelines.d.ts +15 -14
  91. package/dist/integrations/pipelines.js +6 -22
  92. package/dist/integrations/types.d.ts +146 -0
  93. package/dist/locations/index.d.ts +66 -0
  94. package/dist/locations/index.js +31 -0
  95. package/dist/meta/index.d.ts +162 -0
  96. package/dist/orders/cancel-with-money.d.ts +227 -0
  97. package/dist/orders/cancel-with-money.js +153 -0
  98. package/dist/orders/commit-edit.d.ts +7 -1
  99. package/dist/orders/commit-edit.js +5 -1
  100. package/dist/orders/drafts.d.ts +800 -0
  101. package/dist/orders/drafts.js +771 -0
  102. package/dist/orders/fields.d.ts +245 -0
  103. package/dist/orders/fields.js +188 -0
  104. package/dist/orders/get.d.ts +29 -19
  105. package/dist/orders/get.js +17 -8
  106. package/dist/orders/index.d.ts +49 -9
  107. package/dist/orders/index.js +22 -2
  108. package/dist/orders/lifecycle.d.ts +128 -0
  109. package/dist/orders/lifecycle.js +158 -0
  110. package/dist/orders/line-price-preview.d.ts +7 -2
  111. package/dist/orders/list.d.ts +222 -0
  112. package/dist/orders/list.js +377 -0
  113. package/dist/orders/manual-pricing.d.ts +5 -0
  114. package/dist/orders/order-entry.d.ts +20 -7
  115. package/dist/orders/plan-edit.d.ts +1 -1
  116. package/dist/orders/plan-edit.js +4 -1
  117. package/dist/orders/settings.d.ts +201 -0
  118. package/dist/orders/settings.js +325 -0
  119. package/dist/orders/status.d.ts +159 -13
  120. package/dist/orders/status.js +21 -0
  121. package/dist/orders/surcharges.d.ts +8 -1
  122. package/dist/orders/surcharges.js +3 -2
  123. package/dist/payments/account-credit.d.ts +30 -0
  124. package/dist/payments/account-credit.js +19 -0
  125. package/dist/payments/ar.d.ts +292 -0
  126. package/dist/payments/ar.js +223 -0
  127. package/dist/payments/connected-account.d.ts +47 -0
  128. package/dist/payments/connected-account.js +61 -0
  129. package/dist/payments/credit-noted-fields.d.ts +12 -0
  130. package/dist/payments/credit-noted-fields.js +37 -0
  131. package/dist/payments/index.d.ts +257 -11
  132. package/dist/payments/index.js +131 -1
  133. package/dist/payments/methods.d.ts +303 -8
  134. package/dist/payments/methods.js +337 -7
  135. package/dist/payments/mollie-methods.d.ts +159 -0
  136. package/dist/payments/mollie-methods.js +141 -0
  137. package/dist/payments/payment-links.d.ts +180 -0
  138. package/dist/payments/payment-links.js +97 -0
  139. package/dist/payments/provider-keys.d.ts +150 -0
  140. package/dist/payments/provider-keys.js +118 -0
  141. package/dist/payments/providers.d.ts +86 -11
  142. package/dist/payments/providers.js +29 -0
  143. package/dist/payments/requests.d.ts +144 -0
  144. package/dist/payments/requests.js +92 -0
  145. package/dist/payments/store-credit-fields.d.ts +15 -0
  146. package/dist/payments/store-credit-fields.js +51 -0
  147. package/dist/pickups/index.d.ts +104 -0
  148. package/dist/pickups/index.js +105 -0
  149. package/dist/platform/channels.d.ts +132 -0
  150. package/dist/platform/channels.js +128 -0
  151. package/dist/platform/geo.d.ts +123 -0
  152. package/dist/platform/geo.js +144 -0
  153. package/dist/platform/tax.d.ts +154 -0
  154. package/dist/platform/tax.js +139 -0
  155. package/dist/pos/anomalies.d.ts +158 -0
  156. package/dist/pos/anomalies.js +64 -0
  157. package/dist/pos/assisted-selling.d.ts +79 -0
  158. package/dist/pos/assisted-selling.js +38 -0
  159. package/dist/pos/exchanges.d.ts +103 -0
  160. package/dist/pos/exchanges.js +22 -0
  161. package/dist/pos/gift-cards.d.ts +135 -0
  162. package/dist/pos/gift-cards.js +47 -0
  163. package/dist/pos/index.d.ts +2125 -32
  164. package/dist/pos/index.js +742 -4
  165. package/dist/pos/no-receipt.d.ts +94 -0
  166. package/dist/pos/no-receipt.js +25 -0
  167. package/dist/pos/offline-sales.d.ts +187 -0
  168. package/dist/pos/offline-sales.js +116 -0
  169. package/dist/pos/pay-by-link.d.ts +143 -0
  170. package/dist/pos/pay-by-link.js +57 -0
  171. package/dist/pos/quick-keys.d.ts +103 -0
  172. package/dist/pos/quick-keys.js +45 -0
  173. package/dist/pos/reports.d.ts +360 -0
  174. package/dist/pos/reports.js +62 -0
  175. package/dist/pos/returns.d.ts +217 -0
  176. package/dist/pos/returns.js +53 -0
  177. package/dist/pricing/bulk-coupons.d.ts +139 -0
  178. package/dist/pricing/bulk-coupons.js +112 -0
  179. package/dist/pricing/index.d.ts +174 -4
  180. package/dist/pricing/index.js +174 -1
  181. package/dist/pricing/price-lists.d.ts +604 -0
  182. package/dist/pricing/price-lists.js +600 -0
  183. package/dist/purchasing/alerts.d.ts +89 -0
  184. package/dist/purchasing/alerts.js +62 -0
  185. package/dist/purchasing/cost.d.ts +110 -0
  186. package/dist/purchasing/cost.js +86 -0
  187. package/dist/purchasing/index.d.ts +36 -0
  188. package/dist/purchasing/index.js +16 -0
  189. package/dist/purchasing/purchase-orders.d.ts +548 -0
  190. package/dist/purchasing/purchase-orders.js +491 -0
  191. package/dist/purchasing/replenishment.d.ts +281 -0
  192. package/dist/purchasing/replenishment.js +240 -0
  193. package/dist/purchasing/settings.d.ts +152 -0
  194. package/dist/purchasing/settings.js +181 -0
  195. package/dist/purchasing/suppliers.d.ts +476 -0
  196. package/dist/purchasing/suppliers.js +438 -0
  197. package/dist/quotes/index.d.ts +501 -0
  198. package/dist/quotes/index.js +439 -0
  199. package/dist/reports/index.d.ts +71 -8
  200. package/dist/reports/index.js +74 -11
  201. package/dist/returns/index.d.ts +614 -21
  202. package/dist/returns/index.js +695 -11
  203. package/dist/search/index.d.ts +76 -1
  204. package/dist/search/index.js +63 -0
  205. package/dist/shipping/definitions.d.ts +29 -0
  206. package/dist/shipping/definitions.js +47 -0
  207. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  208. package/dist/shipping/fulfillment-profiles.js +104 -0
  209. package/dist/shipping/hendriks.d.ts +97 -0
  210. package/dist/shipping/hendriks.js +50 -0
  211. package/dist/shipping/index.d.ts +48 -0
  212. package/dist/shipping/index.js +25 -0
  213. package/dist/shipping/methods.d.ts +198 -0
  214. package/dist/shipping/methods.js +240 -0
  215. package/dist/shipping/myparcel.d.ts +254 -0
  216. package/dist/shipping/myparcel.js +178 -0
  217. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  218. package/dist/shipping/parcel-rule.d.ts +6 -5
  219. package/dist/shipping/parcel-rule.js +21 -23
  220. package/dist/shipping/rate-tables.d.ts +179 -0
  221. package/dist/shipping/rate-tables.js +184 -0
  222. package/dist/stock/index.d.ts +10 -3
  223. package/dist/stock/index.js +3 -0
  224. package/dist/stock/locations.d.ts +144 -0
  225. package/dist/stock/locations.js +168 -0
  226. package/dist/stock/transfers.d.ts +216 -43
  227. package/dist/stock/transfers.js +140 -13
  228. package/dist/stored-value/index.d.ts +214 -4
  229. package/dist/stored-value/index.js +152 -0
  230. package/dist/subscriptions/index.d.ts +682 -0
  231. package/dist/subscriptions/index.js +815 -0
  232. package/dist/tax/index.d.ts +76 -1
  233. package/dist/tax/index.js +50 -0
  234. package/dist/tenant/email-style.d.ts +102 -0
  235. package/dist/tenant/email-style.js +72 -0
  236. package/dist/tenant/email-templates.d.ts +66 -0
  237. package/dist/tenant/email-templates.js +54 -0
  238. package/dist/tenant/notifications.d.ts +23 -17
  239. package/dist/tenant/settings-sources.d.ts +1 -1
  240. package/dist/tenant/time-zone.d.ts +17 -0
  241. package/dist/tenant/time-zone.js +11 -0
  242. package/dist/types.d.ts +50 -3
  243. package/dist/users/index.d.ts +3 -0
  244. package/dist/users/index.js +2 -0
  245. package/dist/users/warehouses.d.ts +50 -0
  246. package/dist/users/warehouses.js +51 -0
  247. package/package.json +2 -2
@@ -0,0 +1,724 @@
1
+ /**
2
+ * `admin.fulfillments.warehouse`: the pick/pack/ship workspace (headless W10-37; spec
3
+ * `decoupling-fulfillments`, ADR `2026-09-10-warehouse-access-model`).
4
+ *
5
+ * The warehouse API is the fulfillment's own API, built for warehouse staff who have no
6
+ * `ReadOrder`: it is PRICE-FREE (no order totals, prices, payment amounts, customer e-mail or
7
+ * billing address; a payment shows as a `paid | due | not_required` badge) and LOCATION-SCOPED.
8
+ * `detachPreview` is the one exception: it names money, so it is the order API's (`ReadOrder`).
9
+ *
10
+ * **Who may act where.** Reads need `ReadFulfillment` (or `UpdateOrder`), writes
11
+ * `UpdateFulfillment` (or `UpdateOrder`), and the store needs the `warehouse` entitlement
12
+ * (`WAREHOUSE_NOT_ENABLED` otherwise). `mine`, `demand` and `handlers` also serve office staff of a
13
+ * store without the entitlement: the shared create flow reads them. A caller holding `UpdateOrder`
14
+ * is office staff and works in every warehouse of the store, plus the fulfillments with no recorded
15
+ * warehouse. Anyone else works only in the warehouses a store admin assigned to them (none
16
+ * assigned: nothing). An API token or app restricted to stock locations is held to those
17
+ * locations whatever it holds, and never sees a fulfillment with no recorded warehouse.
18
+ *
19
+ * **One refusal for "not found" and "not yours":** `LOCATION_OUT_OF_SCOPE`, for a fulfillment or a
20
+ * warehouse that does not exist, belongs to another store, or is outside the caller's warehouses.
21
+ * The API never confirms that a fulfillment exists outside the caller's scope.
22
+ *
23
+ * **The stages.** With the entitlement a fulfillment moves `Pending → Picking` (`claim`),
24
+ * `Picking → Pending` (`unclaim`: the claimer or office staff), `Picking → Packed` (`pack`),
25
+ * `Packed → Picking` (`reopen`, while no carrier booking is active), `→ Shipped` from `Packed`, or
26
+ * from `Pending` for a 3PL or a manual method (`ship`), and `→ Delivered` from `Shipped` or
27
+ * `Pending` (`deliver`). A 3PL (`mode: outsourced`) skips picking and packing: creating it was the
28
+ * handoff. A held order, addresses that diverged in a consolidated fulfillment, a carrier booking
29
+ * still missing and, on a store that requires it, an order not paid in full each refuse shipping
30
+ * (`ORDER_ON_HOLD`, `CONSOLIDATION_ADDRESS_DIVERGED`, `BOOKING_REQUIRED`, `ORDER_NOT_COVERED`).
31
+ *
32
+ * **Refusals are coded errors.** A write's `WarehouseError` union member is thrown as a
33
+ * `PlatformError` carrying its `code` (`ALREADY_CLAIMED`, `INVALID_STAGE_TRANSITION`,
34
+ * `LOCATION_OUT_OF_SCOPE`, …), classified by the same code rules as the errors the warehouse
35
+ * queries throw, so one refusal reaches you as one class whichever call answered it:
36
+ * `INVALID_INPUT` is a `ValidationError` (400), `HANDLER_NOT_FOUND` (a carrier code the engine
37
+ * does not know) a `NotFoundError` (404), and the warehouse's other codes `BusinessRuleError`
38
+ * (422). A `COMBINE_RULE_VIOLATED` names the part of the rule that broke in `details[0].field`.
39
+ * Bulk `ship` and `deliver` report each fulfillment's refusal as data and throw only for the call
40
+ * as a whole. Three refusals come from before the warehouse decides: a missing permission is
41
+ * `FORBIDDEN`, a carrier of a plugin the store does not have (`setHandler`, `book`) is
42
+ * `PLUGIN_ACCESS_DENIED` (both `PermissionDeniedError`, 403), and an id that is not a uuid is
43
+ * `ENTITY_NOT_FOUND` (`NotFoundError`).
44
+ *
45
+ * **Idempotency keys: `append` only.** Every other write is safe to repeat: the stage it needs is
46
+ * gone after the first call, so a repeat is refused (see each method), and `options.idempotencyKey`
47
+ * is sent nowhere for it. `append` takes one per attempt (made up when omitted, as
48
+ * `orders.drafts.place` does).
49
+ */
50
+ import { type Page, type PlatformError, type Transport, ValidationError } from '@sixtyninecommerce/core';
51
+ import type { FulfillmentUnitDisposition } from '../orders/fields.js';
52
+ import type { Call, ConfigArgDefinition } from '../types.js';
53
+ /** How a warehouse's "To ship" queue routes a line. */
54
+ export type WarehouseDemandRouting = 'preferred' | 'allocated' | 'unrouted' | 'no_stock';
55
+ /** The payment dimension as the warehouse sees it: never an amount. */
56
+ export type WarehousePaymentBadge = 'paid' | 'due' | 'not_required';
57
+ /** A requested delivery day compared with today in the store's time zone. */
58
+ export type WarehouseDeliveryDue = 'overdue' | 'today';
59
+ /** In-house with a carrier to book, in-house with nothing to book, or handed to a 3PL. */
60
+ export type WarehouseFulfillmentMode = 'in_house_carrier' | 'in_house_manual' | 'outsourced';
61
+ /** The carrier booking's state, as the engine writes it. */
62
+ export type WarehouseBookingStatus = 'none' | 'booking' | 'booked' | 'failed' | 'cancelled';
63
+ /** Why the "To ship" queue leaves an order out (office reads with `includeIneligible`). */
64
+ export type WarehouseQueueExclusion = 'on_hold' | 'source_may_have_shipped' | 'fulfillment_not_required' | 'not_open';
65
+ /** The requested delivery day, counted in the store's time zone; `this_week` runs to Sunday. */
66
+ export type WarehouseRequestedDelivery = 'overdue' | 'today' | 'this_week';
67
+ /** Longest in its current stage first is the default (`STATE_CHANGED_ASC`). */
68
+ export type WarehouseFulfillmentSort = 'STATE_CHANGED_ASC' | 'STATE_CHANGED_DESC' | 'CREATED_ASC' | 'CREATED_DESC';
69
+ /** Options of the keyed warehouse write (`append`). */
70
+ export interface KeyedWarehouseCall extends Call {
71
+ /**
72
+ * One key per attempt, re-sent unchanged on a retry of THAT attempt (a timeout, a dropped
73
+ * connection). Pass your own: left out, one is made up (a UUIDv7) and returned as
74
+ * `idempotencyKey` on the result, but on a thrown error only as an untyped own property of the
75
+ * error. Never reuse a key for a different request or a fresh attempt.
76
+ */
77
+ idempotencyKey?: string;
78
+ }
79
+ /** The most fulfillments one `ship`, `deliver` or `pickList` call takes. */
80
+ export declare const MAX_WAREHOUSE_BULK_IDS = 100;
81
+ export interface WarehouseLocation {
82
+ id: string;
83
+ name: string;
84
+ }
85
+ /** A shipping address as a picker needs it; never the billing address. */
86
+ export interface WarehouseAddress {
87
+ fullName: string | null;
88
+ company: string | null;
89
+ streetLine1: string | null;
90
+ streetLine2: string | null;
91
+ city: string | null;
92
+ province: string | null;
93
+ postalCode: string | null;
94
+ countryCode: string | null;
95
+ }
96
+ /** The buyer as the warehouse sees them: name and phone, no e-mail. */
97
+ export interface WarehouseCustomer {
98
+ id: string;
99
+ name: string | null;
100
+ phone: string | null;
101
+ }
102
+ /** An order's fulfilment hold. Reason and note are null until a reason was recorded. */
103
+ export interface WarehouseHold {
104
+ reason: string | null;
105
+ note: string | null;
106
+ }
107
+ export interface WarehouseAsset {
108
+ id: string;
109
+ preview: string;
110
+ }
111
+ /** Tab badges of one warehouse. "Today" is today in the store's time zone. */
112
+ export interface WarehouseCounts {
113
+ toShip: number;
114
+ toPick: number;
115
+ picking: number;
116
+ packed: number;
117
+ overdue: number;
118
+ shippedToday: number;
119
+ outsourced: number;
120
+ }
121
+ export interface WarehouseDemandLine {
122
+ orderLineId: string;
123
+ productVariantId: string;
124
+ sku: string;
125
+ name: string;
126
+ featuredAsset: WarehouseAsset | null;
127
+ /** Ordered minus the units in fulfillments that are not cancelled. */
128
+ openQty: number;
129
+ routing: WarehouseDemandRouting;
130
+ /** The warehouse whose queue shows the line; null for `no_stock`. */
131
+ routedLocationId: string | null;
132
+ /** On hand at `routedLocationId`; null when there is no stock level for it. */
133
+ onHandAtLocation: number | null;
134
+ }
135
+ /** One order of a warehouse's "To ship" queue, with its open lines there. */
136
+ export interface WarehouseDemandOrder {
137
+ orderId: string;
138
+ orderCode: string;
139
+ poNumber: string | null;
140
+ orderNotes: string | null;
141
+ /** ISO-8601. */
142
+ requestedDeliveryDate: string | null;
143
+ deliveryDue: WarehouseDeliveryDue | null;
144
+ /** ISO-8601. */
145
+ orderPlacedAt: string | null;
146
+ customer: WarehouseCustomer | null;
147
+ shippingAddress: WarehouseAddress | null;
148
+ /** Equal for orders that may ship together (same customer and address); null for guests. */
149
+ consolidationKey: string | null;
150
+ /** The carrier to preselect: the customer's default delivery preference, else the order's. */
151
+ suggestedHandlerCode: string | null;
152
+ paymentBadge: WarehousePaymentBadge;
153
+ /** Set only for a held order, returned with `includeHeld`. */
154
+ hold: WarehouseHold | null;
155
+ /** Why the queue leaves the order out; empty for a queue order (see `includeIneligible`). */
156
+ queueExclusions: WarehouseQueueExclusion[];
157
+ /** The platform an imported order came from; null for a native order. */
158
+ externalPlatform: string | null;
159
+ externalOrderId: string | null;
160
+ /** For an imported order: false = its source never handed it off; null = unknown. */
161
+ sourceFulfillmentHandedOff: boolean | null;
162
+ /**
163
+ * Its source platform already handed this imported order to its own fulfilment provider, and
164
+ * the store blocks shipping it again (the duplicate-export guard's verdict, with the store's own
165
+ * switch): a create through that guard is refused unless the office states why it may go again.
166
+ * False when no such guard is loaded or the store does not block.
167
+ */
168
+ sourceFulfilled: boolean;
169
+ /**
170
+ * Why `sourceFulfilled` is true, in words for staff (the source platform and its order
171
+ * number); set exactly when `sourceFulfilled` is true, else null. Show it as sent.
172
+ */
173
+ sourceFulfilledReason: string | null;
174
+ /**
175
+ * The parcel count the customer paid shipping for, while this entry holds the whole order
176
+ * (every line, nothing of it in a fulfillment yet); null otherwise and when not priced per parcel.
177
+ */
178
+ chargedParcelCount: number | null;
179
+ lines: WarehouseDemandLine[];
180
+ }
181
+ /** What `demand` reads: one warehouse's "To ship" queue. */
182
+ export interface WarehouseDemandInput {
183
+ stockLocationId: string;
184
+ /** Order code, customer reference, customer name or SKU. */
185
+ search?: string;
186
+ requestedDelivery?: WarehouseRequestedDelivery;
187
+ /** Also held orders (the office's "On hold" filter). */
188
+ includeHeld?: boolean;
189
+ /** Default: preferred, allocated, unrouted. `no_stock` is honoured for office staff only. */
190
+ routing?: WarehouseDemandRouting[];
191
+ /** Only these orders (at most 50). */
192
+ orderIds?: string[];
193
+ /** The queue's orders that may ship together with these (at most 50). */
194
+ shipTogetherWith?: string[];
195
+ /** Office staff, with `orderIds`: also those orders when the queue leaves them out. */
196
+ includeIneligible?: boolean;
197
+ /** 1–200, default 50. */
198
+ take?: number;
199
+ skip?: number;
200
+ }
201
+ /**
202
+ * A page of the "To ship" queue. `truncated`: the store had more open lines than the engine reads
203
+ * at once (5000), so the queue is incomplete.
204
+ */
205
+ export type WarehouseDemandPage = Page<WarehouseDemandOrder> & {
206
+ truncated: boolean;
207
+ };
208
+ /** An order a fulfillment ships, as the warehouse sees it. */
209
+ export interface WarehouseOrderRef {
210
+ id: string;
211
+ code: string;
212
+ poNumber: string | null;
213
+ orderNotes: string | null;
214
+ requestedDeliveryDate: string | null;
215
+ deliveryDue: WarehouseDeliveryDue | null;
216
+ paymentBadge: WarehousePaymentBadge;
217
+ hold: WarehouseHold | null;
218
+ }
219
+ export interface WarehouseParcel {
220
+ weightGrams: number;
221
+ lengthMm: number | null;
222
+ widthMm: number | null;
223
+ heightMm: number | null;
224
+ }
225
+ /**
226
+ * A fulfillment as the workspace lists it. Per-parcel barcodes are
227
+ * `admin.fulfillments.parcelTracking(id)`, a request of its own.
228
+ */
229
+ export interface WarehouseFulfillment {
230
+ id: string;
231
+ /** `Pending`, `Picking`, `Packed`, `Shipped`, `Delivered`, `Cancelled`. */
232
+ state: string;
233
+ handlerCode: string;
234
+ method: string | null;
235
+ mode: WarehouseFulfillmentMode;
236
+ trackingCode: string | null;
237
+ /** Null for a legacy fulfillment whose warehouse was never recorded (office staff only). */
238
+ stockLocationId: string | null;
239
+ stockLocationName: string | null;
240
+ /** ISO-8601. */
241
+ createdAt: string;
242
+ /** ISO-8601: when its current stage began. */
243
+ stateChangedAt: string | null;
244
+ /** Past the store's `overdueAfterHours` for its stage. */
245
+ overdue: boolean;
246
+ claimedBy: {
247
+ id: string;
248
+ name: string | null;
249
+ } | null;
250
+ claimedAt: string | null;
251
+ packedAt: string | null;
252
+ bookingStatus: WarehouseBookingStatus | null;
253
+ /** The carrier's last booking error in its own words, never a code. */
254
+ bookingError: string | null;
255
+ parcels: WarehouseParcel[];
256
+ orders: WarehouseOrderRef[];
257
+ customer: WarehouseCustomer | null;
258
+ shippingAddress: WarehouseAddress | null;
259
+ lineCount: number;
260
+ unitCount: number;
261
+ }
262
+ export interface WarehouseFulfillmentLine {
263
+ orderLineId: string;
264
+ orderId: string;
265
+ orderCode: string;
266
+ productVariantId: string;
267
+ sku: string;
268
+ name: string;
269
+ featuredAsset: WarehouseAsset | null;
270
+ quantity: number;
271
+ }
272
+ /** One fulfillment with its lines (`get`). */
273
+ export interface WarehouseFulfillmentDetail extends WarehouseFulfillment {
274
+ lines: WarehouseFulfillmentLine[];
275
+ }
276
+ /** What `list` reads. Delivered and Cancelled older than 14 days are always left out. */
277
+ export interface WarehouseFulfillmentListInput {
278
+ /** Default: every warehouse in the caller's scope. */
279
+ stockLocationId?: string;
280
+ /** Only fulfillments with no recorded warehouse (office staff with no location restriction). */
281
+ unassignedOnly?: boolean;
282
+ states?: string[];
283
+ /** The carrier filter. */
284
+ handlerCodes?: string[];
285
+ overdueOnly?: boolean;
286
+ claimedByMe?: boolean;
287
+ /** true: only 3PL handoffs; false: only in-house work. Default: both. */
288
+ outsourced?: boolean;
289
+ /** Order code, customer reference, customer name, SKU or tracking code. */
290
+ search?: string;
291
+ /** ISO-8601 with an offset. */
292
+ createdAfter?: string;
293
+ /** ISO-8601 with an offset: only those whose current stage began at or after it. */
294
+ stateChangedAfter?: string;
295
+ requestedDelivery?: WarehouseRequestedDelivery;
296
+ /** 1–200, default 50. */
297
+ take?: number;
298
+ skip?: number;
299
+ sort?: WarehouseFulfillmentSort;
300
+ }
301
+ /** A carrier (fulfillment handler) as the warehouse offers it: no price. */
302
+ export interface WarehouseFulfillmentHandler {
303
+ code: string;
304
+ description: string;
305
+ mode: WarehouseFulfillmentMode;
306
+ args: ConfigArgDefinition[];
307
+ /**
308
+ * The arguments a create is actually refused without. Read this, never `args[].required`,
309
+ * which the engine publishes unreliably.
310
+ */
311
+ argsRequiredForCreate: string[];
312
+ }
313
+ export interface WarehousePickListBreakdown {
314
+ fulfillmentId: string;
315
+ reference: string;
316
+ orderCodes: string[];
317
+ quantity: number;
318
+ }
319
+ export interface WarehousePickListLine {
320
+ sku: string;
321
+ name: string;
322
+ productVariantId: string;
323
+ /** Across the whole selection. */
324
+ quantity: number;
325
+ fulfillments: WarehousePickListBreakdown[];
326
+ }
327
+ export interface WarehousePickListFulfillment {
328
+ id: string;
329
+ reference: string;
330
+ state: string;
331
+ orderCodes: string[];
332
+ stockLocationName: string | null;
333
+ lineCount: number;
334
+ unitCount: number;
335
+ }
336
+ /** A pick list: the selection's lines aggregated by SKU. */
337
+ export interface WarehousePickList {
338
+ /** ISO-8601. */
339
+ generatedAt: string;
340
+ /** The store's IANA time zone, to print `generatedAt` in. */
341
+ timeZone: string;
342
+ warehouseNames: string[];
343
+ printedBy: {
344
+ id: string;
345
+ name: string | null;
346
+ } | null;
347
+ /** In selection order. */
348
+ fulfillments: WarehousePickListFulfillment[];
349
+ /** Sorted by SKU. */
350
+ lines: WarehousePickListLine[];
351
+ lineCount: number;
352
+ unitCount: number;
353
+ }
354
+ export interface WarehouseParcelInput {
355
+ /** 1–70000. */
356
+ weightGrams: number;
357
+ /** 1–10000 each, when given. */
358
+ lengthMm?: number;
359
+ widthMm?: number;
360
+ heightMm?: number;
361
+ }
362
+ export interface PackWarehouseFulfillmentInput {
363
+ /**
364
+ * The parcels, 1 to the engine's limit; required while a carrier booking is outstanding
365
+ * (`PARCELS_REQUIRED`). Omitted: the fulfillment is packed as it stands. An empty list is
366
+ * refused (`INVALID_INPUT`).
367
+ */
368
+ parcels?: WarehouseParcelInput[];
369
+ }
370
+ /** One argument of a carrier, as a name and its value as text. */
371
+ export interface WarehouseHandlerArg {
372
+ name: string;
373
+ value: string;
374
+ }
375
+ export interface CorrectWarehouseFulfillmentInput {
376
+ lines: Array<{
377
+ orderLineId: string;
378
+ /** What actually ships for this line within the fulfillment (0 or more, never more). */
379
+ quantity: number;
380
+ /** Office staff only (`OFFICE_ONLY` otherwise): also bill the customer for the lower quantity. */
381
+ reduceOrderLine?: boolean;
382
+ }>;
383
+ disposition: FulfillmentUnitDisposition;
384
+ /** At most 500 characters. */
385
+ reason?: string;
386
+ }
387
+ /** A line to add to a fulfillment. */
388
+ export interface WarehouseFulfillmentLineInput {
389
+ orderLineId: string;
390
+ /** A whole number of 1 or more, at most what is left to ship. */
391
+ quantity: number;
392
+ }
393
+ /** One fulfillment's refusal inside a bulk call. */
394
+ export interface WarehouseRefusal {
395
+ code: string;
396
+ message: string;
397
+ /** For `COMBINE_RULE_VIOLATED`: the part of the rule that broke. */
398
+ field: string | null;
399
+ }
400
+ export interface WarehouseBulkItem {
401
+ fulfillmentId: string;
402
+ /** The fulfillment as it now is; null when refused. */
403
+ fulfillment: WarehouseFulfillment | null;
404
+ error: WarehouseRefusal | null;
405
+ }
406
+ /** A bulk call's outcome: every fulfillment asked for, each on its own. */
407
+ export interface WarehouseBulkResult {
408
+ results: WarehouseBulkItem[];
409
+ succeeded: number;
410
+ failed: number;
411
+ }
412
+ /** Per order that would stay after a detach. Money is integer MINOR UNITS. */
413
+ export interface FulfillmentDetachOrderCharge {
414
+ orderId: string;
415
+ code: string;
416
+ currentCharge: number;
417
+ newCharge: number;
418
+ }
419
+ /**
420
+ * What detaching an order would do to the fulfillment's delivery charge. Nothing was written. Money
421
+ * is integer MINOR UNITS.
422
+ */
423
+ export interface FulfillmentDetachPreview {
424
+ /** False when the fulfillment is not profile-bound; every amount is then 0. */
425
+ deliveryChargeApplies: boolean;
426
+ profileName: string | null;
427
+ /** The profile's minimum order value, NET. */
428
+ profileMinimum: number;
429
+ currencyCode: string;
430
+ /** Basis of `newCharge`; `profileMinimum` and `remainingNet` are always net. */
431
+ priceIncludesTax: boolean;
432
+ /** Basis of `currentCharge`, read off the charges already made; compare the two first. */
433
+ currentIncludesTax: boolean;
434
+ /** What the orders that stay carry of this fulfillment's charge today. */
435
+ currentCharge: number;
436
+ /** What they would be charged once priced alone: may be MORE than their shares. */
437
+ newCharge: number;
438
+ orders: FulfillmentDetachOrderCharge[];
439
+ /** The net of what would still ship, measured against `profileMinimum`. */
440
+ remainingNet: number;
441
+ belowProfileMinimum: boolean;
442
+ /** Set when the detach itself would be refused; no amount is meaningful then. */
443
+ refusal: {
444
+ code: string;
445
+ message: string;
446
+ } | null;
447
+ }
448
+ export interface WarehouseFulfillmentsModule {
449
+ /**
450
+ * The warehouses the caller may work in: every warehouse of the store for office staff, the
451
+ * assigned ones for anyone else (empty until a store admin assigns one), never more than a
452
+ * location-restricted credential's own.
453
+ *
454
+ * @effect read
455
+ */
456
+ mine(options?: Call): Promise<WarehouseLocation[]>;
457
+ /**
458
+ * One warehouse's tab badges. `LOCATION_OUT_OF_SCOPE` for a warehouse outside the caller's scope.
459
+ *
460
+ * @effect read
461
+ */
462
+ counts(stockLocationId: string, options?: Call): Promise<WarehouseCounts>;
463
+ /**
464
+ * A warehouse's "To ship" queue: the open lines it should ship, by order, requested delivery
465
+ * day first, then oldest placement. `page.next()` reads the following page with the same input.
466
+ * `LOCATION_OUT_OF_SCOPE` for a warehouse outside the caller's scope. Each order says whether its
467
+ * source platform already fulfilled it (`sourceFulfilled`, with the engine's own sentence in
468
+ * `sourceFulfilledReason`), the same verdict that refuses its create.
469
+ *
470
+ * @effect read
471
+ */
472
+ demand(input: WarehouseDemandInput, options?: Call): Promise<WarehouseDemandPage>;
473
+ /**
474
+ * The fulfillments in the caller's scope, longest in their stage first by default.
475
+ * `page.next()` reads the following page with the same input.
476
+ *
477
+ * @effect read
478
+ */
479
+ list(input?: WarehouseFulfillmentListInput, options?: Call): Promise<Page<WarehouseFulfillment>>;
480
+ /**
481
+ * One fulfillment with its lines. `LOCATION_OUT_OF_SCOPE` when it does not exist or is not in
482
+ * the caller's scope.
483
+ *
484
+ * @effect read
485
+ */
486
+ get(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillmentDetail>;
487
+ /**
488
+ * The carriers with their argument forms and mode, for switching a fulfillment's carrier and for
489
+ * choosing one at create. Definitions only.
490
+ *
491
+ * @effect read
492
+ */
493
+ handlers(options?: Call): Promise<WarehouseFulfillmentHandler[]>;
494
+ /**
495
+ * The pick list of up to 100 fulfillments in the caller's scope, aggregated by SKU, in the order
496
+ * given. Reading it claims nothing: claim the Pending ones first if the picker takes them.
497
+ *
498
+ * @effect read
499
+ */
500
+ pickList(fulfillmentIds: string[], options?: Call): Promise<WarehousePickList>;
501
+ /**
502
+ * The orders that may join this fulfillment: open lines in its warehouse's "To ship" queue from
503
+ * the same customer and address. Held orders are left out.
504
+ *
505
+ * @effect read
506
+ */
507
+ appendCandidates(fulfillmentId: string, options?: Call): Promise<WarehouseDemandOrder[]>;
508
+ /**
509
+ * What detaching this order would do to the fulfillment's delivery charge, changing nothing: the
510
+ * orders that stay are re-priced as if they shipped alone, which may be MORE than their shares.
511
+ * Office staff only (`ReadOrder`): it names money, which the warehouse API never does. A detach
512
+ * the engine would refuse comes back as `refusal`, not a throw. Read without a lock: the detach
513
+ * decides again.
514
+ *
515
+ * @effect read
516
+ */
517
+ detachPreview(fulfillmentId: string, orderId: string, options?: Call): Promise<FulfillmentDetachPreview>;
518
+ /**
519
+ * `Pending → Picking` for the caller. A 3PL fulfillment cannot be claimed
520
+ * (`OUTSOURCED_NOT_CLAIMABLE`). Someone else's claim, or a repeat of your own, is refused
521
+ * `ALREADY_CLAIMED` naming who holds it.
522
+ *
523
+ * @effect write
524
+ */
525
+ claim(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillment>;
526
+ /**
527
+ * `Picking → Pending`: the claimer, or office staff (`NOT_CLAIMER` for anyone else). A repeat is
528
+ * refused `INVALID_STAGE_TRANSITION`.
529
+ *
530
+ * @effect write
531
+ */
532
+ unclaim(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillment>;
533
+ /**
534
+ * `Packed → Picking`, while no carrier booking is active (`BOOKING_ACTIVE`). A failed booking
535
+ * survives it. A repeat is refused `INVALID_STAGE_TRANSITION`.
536
+ *
537
+ * @effect write
538
+ */
539
+ reopen(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillment>;
540
+ /**
541
+ * `Picking → Packed`, recording the parcels in the same step (a refused pack keeps none).
542
+ * `NOTHING_TO_PACK`, `PARCELS_REQUIRED` (a carrier booking is outstanding), `INVALID_INPUT` for a
543
+ * parcel out of bounds. A repeat is refused `INVALID_STAGE_TRANSITION`.
544
+ *
545
+ * @effect write
546
+ */
547
+ pack(fulfillmentId: string, input?: PackWarehouseFulfillmentInput, options?: Call): Promise<WarehouseFulfillment>;
548
+ /**
549
+ * Book the carrier label of a Packed fulfillment (a 3PL's handoff in any open stage), on the
550
+ * store's own carrier account; also the Retry of a failed booking, which adopts what the carrier
551
+ * already holds instead of booking twice. The label is bought in the background:
552
+ * `bookingStatus` reads `booking`, then `booked` or `failed`. Refused `BOOKING_ACTIVE` while one is
553
+ * being booked or is booked (so a repeat books nothing), `BOOKING_NOT_SUPPORTED` for a method
554
+ * with nothing to book, or one that books only at create. A carrier of a plugin the store does
555
+ * not have is `PLUGIN_ACCESS_DENIED` (`PermissionDeniedError`, 403).
556
+ *
557
+ * @effect money
558
+ */
559
+ book(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillment>;
560
+ /**
561
+ * Cancel the carrier label; the fulfillment stays Packed. `NOT_BOOKED` when nothing is booked,
562
+ * which is also what a repeat answers. A failed booking is cleared by `book` (Retry), never by
563
+ * this.
564
+ *
565
+ * @effect destructive
566
+ */
567
+ unbook(fulfillmentId: string, options?: Call): Promise<WarehouseFulfillment>;
568
+ /**
569
+ * Switch the carrier of a Pending, Picking or Packed fulfillment while nothing is booked
570
+ * (`BOOKING_ACTIVE`). A 3PL is fixed once handed over, and cannot be chosen for an existing
571
+ * fulfillment (`OUTSOURCED_HANDOFF_FIXED`). After a FAILED booking the switch first retracts at
572
+ * the carrier whatever shipment those attempts left, so it neither ships nor is adopted later.
573
+ * Each switch writes a private note on every order of the fulfillment. A carrier code the engine
574
+ * does not know is `HANDLER_NOT_FOUND` (`NotFoundError`, 404); one of a plugin the store does
575
+ * not have is `PLUGIN_ACCESS_DENIED` (`PermissionDeniedError`, 403); arguments the carrier
576
+ * refuses are `PROVIDER_VALIDATION_FAILED`.
577
+ *
578
+ * @effect destructive
579
+ */
580
+ setHandler(fulfillmentId: string, handlerCode: string, handlerArgs?: WarehouseHandlerArg[], options?: Call): Promise<WarehouseFulfillment>;
581
+ /**
582
+ * Office staff only (`UpdateOrder`): give a Pending fulfillment with NO recorded warehouse its
583
+ * warehouse. Refused `SALE_LOCATION_MISMATCH` when its stock was sold from another one, and
584
+ * `WAREHOUSE_ALREADY_SET` once it has one (so a repeat changes nothing). A credential
585
+ * restricted to stock locations is answered `LOCATION_OUT_OF_SCOPE`.
586
+ *
587
+ * @effect write
588
+ */
589
+ setWarehouse(fulfillmentId: string, stockLocationId: string, options?: Call): Promise<WarehouseFulfillment>;
590
+ /**
591
+ * Record a short pick: what actually ships of each named line. The units taken out go back to
592
+ * stock or are written off (`disposition`). Without `reduceOrderLine` the order keeps asking for
593
+ * them (a later fulfillment ships them). A correction that empties an order of a consolidated
594
+ * fulfillment takes it out and re-prices the delivery charge of the orders that stay.
595
+ * `reduceOrderLine` (office staff only, `OFFICE_ONLY` otherwise) also bills the customer for the
596
+ * lower quantity; it issues no refund. A repeat changes nothing and is refused
597
+ * (`INVALID_INPUT`: nothing to correct).
598
+ *
599
+ * @effect money
600
+ */
601
+ correct(fulfillmentId: string, input: CorrectWarehouseFulfillmentInput, options?: Call): Promise<WarehouseFulfillment>;
602
+ /**
603
+ * Mark up to 100 fulfillments shipped (from Packed, or Pending for a 3PL or a manual method), each
604
+ * on its own; `trackingCode` (at most 255 characters) is set on every one. The customer gets the
605
+ * shipped e-mail. Each item's refusal is in its `error`; a repeat is refused per item
606
+ * (`INVALID_STAGE_TRANSITION`), so nothing ships or mails twice. Throws only for the call as a
607
+ * whole (no ids, more than 100, the store without the warehouse workspace).
608
+ *
609
+ * Shipping an order's last open lines moves the ORDER to `Shipped`, which on a store that
610
+ * pushes orders to its ERP when they ship (Exact Online's "fulfilled" auto-push) sends each such
611
+ * order there, where it cannot be taken back.
612
+ *
613
+ * @effect irreversible
614
+ */
615
+ ship(fulfillmentIds: string[], trackingCode?: string, options?: Call): Promise<WarehouseBulkResult>;
616
+ /**
617
+ * Mark up to 100 fulfillments delivered (from Shipped, or Pending), each on its own, as `ship`
618
+ * reports them.
619
+ *
620
+ * @effect write
621
+ */
622
+ deliver(fulfillmentIds: string[], options?: Call): Promise<WarehouseBulkResult>;
623
+ /**
624
+ * Add lines, typically another order of the same customer and address, to a Pending or Picking
625
+ * fulfillment with nothing booked. The lines ship from the fulfillment's warehouse and pass the
626
+ * create path's rules (`COMBINE_RULE_VIOLATED`, `LINE_OVER_FULFILLED`,
627
+ * `INSUFFICIENT_STOCK_AT_LOCATION`, `PROVIDER_NO_CONSOLIDATION`, `ORDER_NOT_COVERED`, …).
628
+ *
629
+ * A line nobody picked a warehouse for, whose stock is reserved at another warehouse, has its
630
+ * reservation moved here: released there and taken from this warehouse, as it is for warehouse
631
+ * staff assigned here (a line whose order picked another warehouse is refused,
632
+ * `LINE_PREFERS_OTHER_LOCATION`).
633
+ *
634
+ * MONEY: the fulfillment's delivery charge is re-priced across its orders, so what each order is
635
+ * billed may change (`SURCHARGE_LOCKED_BY_ERP` when an ERP already holds a share,
636
+ * `ORDER_BILLING_LOCKED` for an invoiced order). A charge it lowers or removes on an order that
637
+ * already paid it is NOT refunded or credited: the engine only logs that a refund may be owed.
638
+ *
639
+ * One key per attempt (`options.idempotencyKey`): a repeat under the same key answers the
640
+ * fulfillment as it is now and adds nothing, however few of a line's units it asked for. Another
641
+ * request under that key is `IDEMPOTENCY_CONFLICT` (`ConflictError`, 409), and a repeat while the
642
+ * first is still running `IDEMPOTENCY_IN_PROGRESS`. A refusal does not spend the key (nothing was
643
+ * added), so a repeat under it runs again. Left out, a key is made up and returned as
644
+ * `idempotencyKey` on the result, and on a thrown error as an untyped own property of the error.
645
+ *
646
+ * @effect money
647
+ */
648
+ append(fulfillmentId: string, lines: WarehouseFulfillmentLineInput[], options?: KeyedWarehouseCall): Promise<WarehouseFulfillment & {
649
+ idempotencyKey: string;
650
+ }>;
651
+ /**
652
+ * Take an order out of a Pending or Picking fulfillment that ships several, with nothing booked:
653
+ * its lines go back to the "To ship" queue, reserved at this warehouse. The last order cannot
654
+ * leave (`DETACH_LAST_ORDER`: remove the fulfillment instead). A repeat is refused
655
+ * (`INVALID_INPUT`: the order is no longer in it).
656
+ *
657
+ * MONEY: the orders that stay are re-priced as if they shipped alone, which may be MORE than
658
+ * their shares (`detachPreview` shows the figure first; `SURCHARGE_LOCKED_BY_ERP` when an ERP
659
+ * holds a share). A charge it lowers or removes on an order that already paid it is NOT refunded
660
+ * or credited: the engine only logs that a refund may be owed.
661
+ *
662
+ * @effect money
663
+ */
664
+ detach(fulfillmentId: string, orderId: string, options?: Call): Promise<WarehouseFulfillment>;
665
+ }
666
+ /**
667
+ * Every field of `WarehouseFulfillment` the workspace reads, without `lines`. A field list, never a
668
+ * named fragment: `orders-coverage.spec.ts` reads each document's root field with every
669
+ * interpolation replaced, which a fragment spread at the top level would not survive.
670
+ */
671
+ export declare const FULFILLMENT_FIELDS = "\n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n";
672
+ export declare const MY_WAREHOUSES_QUERY = "\n query MyWarehouses {\n myWarehouses {\n id\n name\n }\n }\n";
673
+ export declare const WAREHOUSE_COUNTS_QUERY = "\n query WarehouseCounts($stockLocationId: ID!) {\n warehouseCounts(stockLocationId: $stockLocationId) {\n toShip\n toPick\n picking\n packed\n overdue\n shippedToday\n outsourced\n }\n }\n";
674
+ export declare const WAREHOUSE_DEMAND_QUERY = "\n query WarehouseDemand($input: WarehouseDemandInput!) {\n warehouseDemand(input: $input) {\n totalItems\n truncated\n items {\n \n orderId\n orderCode\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n orderPlacedAt\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n consolidationKey\n suggestedHandlerCode\n paymentBadge\n hold {\n reason\n note\n }\n queueExclusions\n externalPlatform\n externalOrderId\n sourceFulfillmentHandedOff\n sourceFulfilled\n sourceFulfilledReason\n chargedParcelCount\n lines {\n orderLineId\n productVariantId\n sku\n name\n featuredAsset {\n id\n preview\n }\n openQty\n routing\n routedLocationId\n onHandAtLocation\n }\n\n }\n }\n }\n";
675
+ export declare const WAREHOUSE_FULFILLMENTS_QUERY = "\n query WarehouseFulfillments($input: WarehouseFulfillmentListInput) {\n warehouseFulfillments(input: $input) {\n totalItems\n items {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n }\n }\n";
676
+ export declare const WAREHOUSE_FULFILLMENT_QUERY = "\n query WarehouseFulfillment($id: ID!) {\n warehouseFulfillment(id: $id) {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n lines {\n orderLineId\n orderId\n orderCode\n productVariantId\n sku\n name\n featuredAsset {\n id\n preview\n }\n quantity\n }\n }\n }\n";
677
+ export declare const WAREHOUSE_FULFILLMENT_HANDLERS_QUERY = "\n query WarehouseFulfillmentHandlers {\n warehouseFulfillmentHandlers {\n code\n description\n mode\n argsRequiredForCreate\n args {\n name\n type\n list\n required\n defaultValue\n label\n description\n ui\n }\n }\n }\n";
678
+ export declare const WAREHOUSE_PICK_LIST_QUERY = "\n query WarehousePickList($fulfillmentIds: [ID!]!) {\n warehousePickList(fulfillmentIds: $fulfillmentIds) {\n generatedAt\n timeZone\n warehouseNames\n lineCount\n unitCount\n printedBy {\n id\n name\n }\n fulfillments {\n id\n reference\n state\n orderCodes\n stockLocationName\n lineCount\n unitCount\n }\n lines {\n sku\n name\n productVariantId\n quantity\n fulfillments {\n fulfillmentId\n reference\n orderCodes\n quantity\n }\n }\n }\n }\n";
679
+ export declare const WAREHOUSE_APPEND_CANDIDATES_QUERY = "\n query WarehouseAppendCandidates($fulfillmentId: ID!) {\n warehouseAppendCandidates(fulfillmentId: $fulfillmentId) {\n \n orderId\n orderCode\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n orderPlacedAt\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n consolidationKey\n suggestedHandlerCode\n paymentBadge\n hold {\n reason\n note\n }\n queueExclusions\n externalPlatform\n externalOrderId\n sourceFulfillmentHandedOff\n sourceFulfilled\n sourceFulfilledReason\n chargedParcelCount\n lines {\n orderLineId\n productVariantId\n sku\n name\n featuredAsset {\n id\n preview\n }\n openQty\n routing\n routedLocationId\n onHandAtLocation\n }\n\n }\n }\n";
680
+ /** The order API, not the warehouse one: it names money (`ReadOrder`). */
681
+ export declare const FULFILLMENT_DETACH_PREVIEW_QUERY = "\n query FulfillmentDetachPreview($fulfillmentId: ID!, $orderId: ID!) {\n fulfillmentDetachPreview(fulfillmentId: $fulfillmentId, orderId: $orderId) {\n deliveryChargeApplies\n profileName\n profileMinimum\n currencyCode\n priceIncludesTax\n currentIncludesTax\n currentCharge\n newCharge\n orders {\n orderId\n code\n currentCharge\n newCharge\n }\n remainingNet\n belowProfileMinimum\n refusal {\n code\n message\n }\n }\n }\n";
682
+ export declare const CLAIM_FULFILLMENT_MUTATION = "\n mutation ClaimFulfillment($id: ID!) {\n claimFulfillment(id: $id) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
683
+ export declare const UNCLAIM_FULFILLMENT_MUTATION = "\n mutation UnclaimFulfillment($id: ID!) {\n unclaimFulfillment(id: $id) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
684
+ export declare const REOPEN_FULFILLMENT_MUTATION = "\n mutation ReopenFulfillment($id: ID!) {\n reopenFulfillment(id: $id) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
685
+ export declare const PACK_FULFILLMENT_MUTATION = "\n mutation PackFulfillment($id: ID!, $parcels: [WarehouseParcelInput!]) {\n packFulfillment(id: $id, parcels: $parcels) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
686
+ export declare const BOOK_FULFILLMENT_MUTATION = "\n mutation BookFulfillment($id: ID!) {\n bookFulfillment(id: $id) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
687
+ export declare const UNBOOK_FULFILLMENT_MUTATION = "\n mutation UnbookFulfillment($id: ID!) {\n unbookFulfillment(id: $id) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
688
+ export declare const SET_FULFILLMENT_HANDLER_MUTATION = "\n mutation SetFulfillmentHandler(\n $id: ID!\n $handlerCode: String!\n $handlerArgs: [WarehouseHandlerArgInput!]\n ) {\n setFulfillmentHandler(id: $id, handlerCode: $handlerCode, handlerArgs: $handlerArgs) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
689
+ export declare const SET_FULFILLMENT_WAREHOUSE_MUTATION = "\n mutation SetFulfillmentWarehouse($id: ID!, $stockLocationId: ID!) {\n setFulfillmentWarehouse(id: $id, stockLocationId: $stockLocationId) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
690
+ export declare const CORRECT_FULFILLMENT_QUANTITIES_MUTATION = "\n mutation CorrectFulfillmentQuantities(\n $fulfillmentId: ID!\n $lines: [WarehouseQuantityCorrectionLineInput!]!\n $disposition: FulfillmentUnitDisposition!\n $reason: String\n ) {\n correctFulfillmentQuantities(\n fulfillmentId: $fulfillmentId\n lines: $lines\n disposition: $disposition\n reason: $reason\n ) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
691
+ export declare const SHIP_FULFILLMENTS_MUTATION = "\n mutation ShipFulfillments($ids: [ID!]!, $trackingCode: String) {\n shipFulfillments(ids: $ids, trackingCode: $trackingCode) {\n \n __typename\n ... on WarehouseBulkResult {\n succeeded\n failed\n results {\n fulfillmentId\n fulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n error {\n code\n message\n field\n }\n }\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
692
+ export declare const DELIVER_FULFILLMENTS_MUTATION = "\n mutation DeliverFulfillments($ids: [ID!]!) {\n deliverFulfillments(ids: $ids) {\n \n __typename\n ... on WarehouseBulkResult {\n succeeded\n failed\n results {\n fulfillmentId\n fulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n error {\n code\n message\n field\n }\n }\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
693
+ export declare const APPEND_TO_FULFILLMENT_MUTATION = "\n mutation AppendToFulfillment(\n $id: ID!\n $lines: [WarehouseFulfillmentLineInput!]!\n $idempotencyKey: String\n ) {\n appendToFulfillment(id: $id, lines: $lines, idempotencyKey: $idempotencyKey) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
694
+ export declare const DETACH_ORDER_FROM_FULFILLMENT_MUTATION = "\n mutation DetachOrderFromFulfillment($id: ID!, $orderId: ID!) {\n detachOrderFromFulfillment(id: $id, orderId: $orderId) {\n \n __typename\n ... on WarehouseFulfillment {\n \n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n createdAt\n stateChangedAt\n overdue\n claimedBy {\n id\n name\n }\n claimedAt\n packedAt\n bookingStatus\n bookingError\n parcels {\n weightGrams\n lengthMm\n widthMm\n heightMm\n }\n orders {\n id\n code\n poNumber\n orderNotes\n requestedDeliveryDate\n deliveryDue\n paymentBadge\n hold {\n reason\n note\n }\n }\n customer {\n id\n name\n phone\n }\n shippingAddress {\n \n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n\n }\n lineCount\n unitCount\n\n }\n \n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n\n\n }\n }\n";
695
+ /** The key a caller retries under, on an error of a call whose key it did not choose. */
696
+ export declare function withAttemptKey(error: unknown, key: string): unknown;
697
+ export interface RawRefusal {
698
+ __typename?: string;
699
+ code: string;
700
+ message: string;
701
+ field?: string | null;
702
+ }
703
+ export declare function isWarehouseErrorMember(value: unknown): value is RawRefusal;
704
+ /**
705
+ * A `WarehouseError` as the error the SAME code would be if a warehouse query had thrown it: the
706
+ * queries refuse with these codes as GraphQL errors, so classifying the union member by the
707
+ * ErrorResult rules would give one refusal two classes (`INVALID_INPUT` a 400 from a query and a
708
+ * 422 from a mutation).
709
+ *
710
+ * NOTE: every SDK method over a `WarehouseError` union classifies through this function, never
711
+ * through `errorFromErrorResult` (the create door, `createWarehouseFulfillments`, included).
712
+ * `fulfillments-warehouse.spec.ts` pins the class of every `WarehouseErrorCode`, so a change to
713
+ * core's GraphQL-dialect rules cannot move one silently.
714
+ */
715
+ export declare function warehouseRefusalError(refusal: RawRefusal): PlatformError;
716
+ export declare function invalid(field: string, message: string): ValidationError;
717
+ /** Refused before any request: an absent id would otherwise fail GraphQL validation, uncoded. */
718
+ export declare function assertId(value: unknown, field: string): asserts value is string;
719
+ export type RawFulfillment = WarehouseFulfillment & {
720
+ __typename?: string;
721
+ };
722
+ export declare function toFulfillment(raw: RawFulfillment): WarehouseFulfillment;
723
+ export declare function toRefusal(raw: RawRefusal | null | undefined): WarehouseRefusal | null;
724
+ export declare function createWarehouseFulfillmentsModule(transport: Transport): WarehouseFulfillmentsModule;