@sixtyninecommerce/admin 0.11.0 → 0.13.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 (153) hide show
  1. package/README.md +1509 -28
  2. package/dist/auth/index.d.ts +7 -1
  3. package/dist/auth/index.js +8 -1
  4. package/dist/catalog/documents.d.ts +142 -0
  5. package/dist/catalog/documents.js +114 -0
  6. package/dist/catalog/index.d.ts +48 -7
  7. package/dist/catalog/index.js +6 -1
  8. package/dist/catalog/metadata.d.ts +244 -0
  9. package/dist/catalog/metadata.js +220 -0
  10. package/dist/catalog/properties.d.ts +38 -0
  11. package/dist/catalog/properties.js +52 -1
  12. package/dist/catalog/recommendations.d.ts +33 -6
  13. package/dist/catalog/recommendations.js +94 -2
  14. package/dist/catalog/reviews.d.ts +17 -4
  15. package/dist/catalog/reviews.js +7 -0
  16. package/dist/catalog/variants.d.ts +60 -0
  17. package/dist/catalog/variants.js +39 -0
  18. package/dist/catalog/visibility.d.ts +18 -2
  19. package/dist/client.d.ts +29 -3
  20. package/dist/client.js +19 -8
  21. package/dist/content/assets.d.ts +3 -4
  22. package/dist/content/forms.d.ts +332 -1
  23. package/dist/content/forms.js +140 -4
  24. package/dist/content/items.d.ts +31 -8
  25. package/dist/content/items.js +1 -1
  26. package/dist/content/menus.d.ts +254 -0
  27. package/dist/content/menus.js +70 -0
  28. package/dist/content/strings.d.ts +137 -0
  29. package/dist/content/strings.js +82 -0
  30. package/dist/customers/delivery-terms.d.ts +44 -0
  31. package/dist/customers/delivery-terms.js +32 -0
  32. package/dist/customers/groups.d.ts +16 -5
  33. package/dist/customers/groups.js +6 -2
  34. package/dist/customers/index.d.ts +15 -0
  35. package/dist/customers/index.js +4 -0
  36. package/dist/documents/emails.d.ts +154 -0
  37. package/dist/documents/emails.js +220 -0
  38. package/dist/documents/index.d.ts +13 -0
  39. package/dist/documents/index.js +2 -0
  40. package/dist/fulfillments/create.d.ts +1 -1
  41. package/dist/fulfillments/create.js +5 -2
  42. package/dist/fulfillments/index.d.ts +119 -1
  43. package/dist/fulfillments/index.js +124 -4
  44. package/dist/fulfillments/warehouse.d.ts +29 -17
  45. package/dist/fulfillments/warehouse.js +32 -1
  46. package/dist/index.d.ts +43 -23
  47. package/dist/index.js +11 -5
  48. package/dist/integrations/exact-online-types.d.ts +542 -0
  49. package/dist/integrations/exact-online.d.ts +541 -5
  50. package/dist/integrations/exact-online.js +714 -1
  51. package/dist/integrations/index.d.ts +23 -8
  52. package/dist/integrations/index.js +9 -4
  53. package/dist/integrations/pipeline-discoveries.d.ts +65 -0
  54. package/dist/integrations/pipeline-discoveries.js +65 -0
  55. package/dist/integrations/pipeline-runs.d.ts +119 -0
  56. package/dist/integrations/pipeline-runs.js +87 -0
  57. package/dist/integrations/pipelines.d.ts +73 -2
  58. package/dist/integrations/pipelines.js +36 -1
  59. package/dist/integrations/price-import.d.ts +223 -0
  60. package/dist/integrations/price-import.js +124 -0
  61. package/dist/integrations/types.d.ts +221 -3
  62. package/dist/integrations/types.js +4 -3
  63. package/dist/meta/index.d.ts +10 -0
  64. package/dist/metafields/index.d.ts +8 -1
  65. package/dist/metafields/index.js +10 -0
  66. package/dist/orders/cancel-with-money.d.ts +10 -0
  67. package/dist/orders/cancel-with-money.js +2 -0
  68. package/dist/orders/commit-edit.d.ts +16 -0
  69. package/dist/orders/commit-edit.js +14 -1
  70. package/dist/orders/deposit-policy.d.ts +3 -1
  71. package/dist/orders/index.d.ts +22 -11
  72. package/dist/orders/index.js +5 -2
  73. package/dist/orders/list.d.ts +26 -5
  74. package/dist/orders/list.js +123 -13
  75. package/dist/orders/manual-discounts.d.ts +13 -5
  76. package/dist/orders/money-view.d.ts +149 -0
  77. package/dist/orders/money-view.js +99 -0
  78. package/dist/orders/plan-edit.d.ts +34 -2
  79. package/dist/orders/plan-edit.js +110 -12
  80. package/dist/orders/surcharges.d.ts +12 -0
  81. package/dist/orders/surcharges.js +34 -9
  82. package/dist/payments/account-credit.d.ts +17 -1
  83. package/dist/payments/account-credit.js +25 -2
  84. package/dist/payments/credit-noted-fields.d.ts +8 -1
  85. package/dist/payments/credit-noted-fields.js +34 -2
  86. package/dist/payments/customer-consent.d.ts +30 -0
  87. package/dist/payments/customer-consent.js +49 -0
  88. package/dist/payments/index.d.ts +89 -14
  89. package/dist/payments/index.js +22 -2
  90. package/dist/payments/requests.d.ts +6 -3
  91. package/dist/payments/requests.js +1 -0
  92. package/dist/pickups/index.d.ts +5 -3
  93. package/dist/pickups/index.js +5 -2
  94. package/dist/platform/email-gateways.d.ts +165 -0
  95. package/dist/platform/email-gateways.js +78 -0
  96. package/dist/platform/tax.d.ts +11 -3
  97. package/dist/platform/tax.js +30 -0
  98. package/dist/pos/exchanges.d.ts +6 -1
  99. package/dist/pos/index.d.ts +229 -10
  100. package/dist/pos/index.js +113 -4
  101. package/dist/pos/offline-sales.d.ts +44 -3
  102. package/dist/pos/offline-sales.js +57 -3
  103. package/dist/pos/returns.d.ts +28 -1
  104. package/dist/pos/returns.js +36 -6
  105. package/dist/pricing/price-lists.d.ts +3 -1
  106. package/dist/purchasing/alerts.d.ts +19 -4
  107. package/dist/purchasing/alerts.js +29 -3
  108. package/dist/purchasing/backorders.d.ts +61 -0
  109. package/dist/purchasing/backorders.js +92 -0
  110. package/dist/purchasing/index.d.ts +21 -3
  111. package/dist/purchasing/index.js +8 -0
  112. package/dist/purchasing/links.d.ts +263 -0
  113. package/dist/purchasing/links.js +192 -0
  114. package/dist/purchasing/purchase-orders.d.ts +4 -1
  115. package/dist/purchasing/receipts.d.ts +396 -0
  116. package/dist/purchasing/receipts.js +287 -0
  117. package/dist/purchasing/returns.d.ts +273 -0
  118. package/dist/purchasing/returns.js +229 -0
  119. package/dist/quotes/index.d.ts +20 -3
  120. package/dist/returns/index.d.ts +62 -1
  121. package/dist/returns/index.js +61 -0
  122. package/dist/seo/config.d.ts +128 -0
  123. package/dist/seo/config.js +95 -0
  124. package/dist/seo/redirects.d.ts +125 -0
  125. package/dist/seo/redirects.js +60 -1
  126. package/dist/seo/settings.d.ts +147 -0
  127. package/dist/seo/settings.js +209 -0
  128. package/dist/shipping/index.d.ts +6 -0
  129. package/dist/shipping/index.js +2 -0
  130. package/dist/shipping/methods.d.ts +8 -1
  131. package/dist/shipping/myparcel.d.ts +415 -1
  132. package/dist/shipping/myparcel.js +291 -3
  133. package/dist/shipping/rate-tables.d.ts +149 -4
  134. package/dist/shipping/rate-tables.js +229 -23
  135. package/dist/shipping/ship-to-countries.d.ts +75 -0
  136. package/dist/shipping/ship-to-countries.js +47 -0
  137. package/dist/stock/by-location.d.ts +86 -0
  138. package/dist/stock/by-location.js +94 -0
  139. package/dist/stock/index.d.ts +8 -1
  140. package/dist/stock/index.js +4 -0
  141. package/dist/stock/settings.d.ts +106 -0
  142. package/dist/stock/settings.js +103 -0
  143. package/dist/stock/transfers.d.ts +171 -10
  144. package/dist/stock/transfers.js +82 -4
  145. package/dist/stored-value/index.d.ts +98 -7
  146. package/dist/stored-value/index.js +71 -4
  147. package/dist/tax/display-policy.d.ts +105 -0
  148. package/dist/tax/display-policy.js +84 -0
  149. package/dist/tax/index.d.ts +3 -0
  150. package/dist/tax/index.js +2 -0
  151. package/dist/tenant/email-templates.d.ts +222 -1
  152. package/dist/tenant/email-templates.js +227 -10
  153. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { type Transport } from '@sixtyninecommerce/core';
1
+ import { type PlatformError, type Transport } from '@sixtyninecommerce/core';
2
2
  import type { OrderOverpaymentChoice, OverpaymentOption } from '../orders/surcharges.js';
3
3
  import type { Call } from '../types.js';
4
4
  import { type FulfillmentCreateMethods } from './create.js';
@@ -182,6 +182,15 @@ export interface FulfillmentCancelPreview {
182
182
  export interface FulfillmentCancelChoice {
183
183
  orderId: string;
184
184
  choice: OrderOverpaymentChoice;
185
+ /**
186
+ * With `ACCOUNT_CREDIT` in a store whose book is store credit (`cancelPreview`'s
187
+ * `accountCredit.book` `STORE_CREDIT`): whether THIS order's customer expressly agreed to store
188
+ * credit instead of a refund to their payment (EU consumer law, CRD art. 13(1)), as staff
189
+ * recorded it. The settlement's move records it on its ledger entries
190
+ * (`StoredValueEntry.customerAgreed`); never a condition, nothing is refused for it. Sent only
191
+ * when given; an engine before the field (incentives sprint 8 PR 6a) refuses a call that gives it.
192
+ */
193
+ customerAgreed?: boolean;
185
194
  }
186
195
  /** What `cancel` sends besides the fulfillment. */
187
196
  export interface CancelFulfillmentInput {
@@ -265,6 +274,35 @@ export interface OrderFulfillmentCoverage {
265
274
  }
266
275
  /** The longest override reason the engine stores. */
267
276
  export declare const FULFILLMENT_COVERAGE_REASON_MAX_LENGTH = 500;
277
+ /** A fulfillment as `transition` leaves it. */
278
+ export interface FulfillmentStateChange {
279
+ id: string;
280
+ /** The state it is in now (`Shipped`, `Delivered`, …). */
281
+ state: string;
282
+ /** The states it may move to next, as the store's fulfillment process allows. */
283
+ nextStates: string[];
284
+ }
285
+ /**
286
+ * The facts a refused `transition` carries on `PlatformError.extensions`, beside its code:
287
+ * the move that was asked for and the refusing step's own words.
288
+ */
289
+ export interface FulfillmentTransitionRefusalFacts {
290
+ /** Core's code for every refused move: `FULFILLMENT_STATE_TRANSITION_ERROR`. */
291
+ errorCode: string;
292
+ fromState: string;
293
+ toState: string;
294
+ /** The refusing step's text, `[CODE]` prefix included when it had one. */
295
+ transitionError: string;
296
+ }
297
+ /**
298
+ * What re-sending a fulfillment's label to the store's 3PL came to (`resendLabelHandoff`):
299
+ * - `QUEUED`: the email with the label is queued for the 3PL recipient;
300
+ * - `NOT_READY`: the fulfillment has no ready MyParcel label yet, so nothing was sent;
301
+ * - `DISABLED`: the store has the label hand-off notification switched off;
302
+ * - `NO_RECIPIENT`: it is on, but names no recipient;
303
+ * - `UNAVAILABLE`: the platform's email delivery is not installed.
304
+ */
305
+ export type LabelHandoffOutcome = 'QUEUED' | 'DISABLED' | 'NO_RECIPIENT' | 'NOT_READY' | 'UNAVAILABLE';
268
306
  /**
269
307
  * Fulfillment parcels (multi-parcel shipments). Each method is its own request
270
308
  * on purpose: a caller deployed ahead of an engine without these fields sees
@@ -412,6 +450,66 @@ export interface FulfillmentsModule extends FulfillmentCreateMethods {
412
450
  allowUncovered(orderId: string, reason: string, options?: Call & {
413
451
  idempotencyKey?: string;
414
452
  }): Promise<FulfillmentCoverageOverride>;
453
+ /**
454
+ * Move a fulfillment to one of its `nextStates` (the order page's "Mark as Shipped" and "Mark as
455
+ * Delivered"). Needs `UpdateOrder`. The move runs the store's own fulfillment process, so the
456
+ * order's state follows and whatever the store does on a shipped or delivered fulfillment (its
457
+ * events, its notifications: the customer gets the shipped e-mail) happens; the process has no
458
+ * way back to an earlier state. Shipping an order's last open lines moves the ORDER to
459
+ * `Shipped`, which on a store that pushes orders to its ERP when they ship (Exact Online's
460
+ * "fulfilled" auto-push) sends the order there, where it cannot be taken back.
461
+ *
462
+ * A move into `Cancelled` is a cancel: it ends the fulfillment for good and has its carrier let
463
+ * go of the shipment, and the delivery charge it added comes off what each of its orders bills.
464
+ * It is refused, before the carrier is told, while the customer has PAID such a charge
465
+ * (`FULFILLMENT_CANCEL_OVERPAYMENT_CHOICE_REQUIRED`): {@link FulfillmentsModule.cancel} takes the
466
+ * choice of how that money goes back. An unpaid charge simply leaves the bill.
467
+ *
468
+ * Tagged `money`, its strongest effect: a cancel changes what a placed order bills.
469
+ *
470
+ * Refused, with nothing moved:
471
+ * - a step of the store's process that refuses the move answers ITS OWN code, which the engine
472
+ * prefixes to its text as `[CODE]`, with the text after it as the message, classed as the
473
+ * warehouse API classes the same code: `ORDER_NOT_COVERED` (the store requires full payment
474
+ * and an order is not paid in full: `coverage` reads what it owes, `allowUncovered` records
475
+ * an override), `ORDER_ON_HOLD` (release the order's fulfilment hold first),
476
+ * `BOOKING_REQUIRED`, `PARCELS_REQUIRED`, `CONSOLIDATION_ADDRESS_DIVERGED`, …;
477
+ * - any other refusal of the process, an edge it does not have included, is
478
+ * `FULFILLMENT_STATE_TRANSITION_ERROR` (`BusinessRuleError`, 422) with the refusing step's
479
+ * text as the message;
480
+ * - both carry {@link FulfillmentTransitionRefusalFacts} on `extensions`;
481
+ * - another store's or a missing fulfillment is `ENTITY_NOT_FOUND` (`NotFoundError`); a
482
+ * credential restricted to stock locations (an API token or app installation with
483
+ * `locationIds`) moves only a fulfillment that ships from one of them
484
+ * (`LOCATION_OUT_OF_SCOPE`, 422);
485
+ * - a blank id or state is refused before any request (`FULFILLMENT_TRANSITION_INVALID`,
486
+ * `ValidationError`).
487
+ *
488
+ * Takes no idempotency key: repeating a move that went through asks for an edge the process no
489
+ * longer has, and is refused as above, never moved twice.
490
+ *
491
+ * @effect money
492
+ * @permission UpdateOrder
493
+ */
494
+ transition(fulfillmentId: string, state: string, options?: Call): Promise<FulfillmentStateChange>;
495
+ /**
496
+ * E-mail the fulfillment's ready MyParcel label again to the store's 3PL recipient (the
497
+ * `fulfillment_label_handoff` notification), whatever the store's automatic hand-off setting.
498
+ * Answers what came of it ({@link LabelHandoffOutcome}): only `QUEUED` sent anything; the
499
+ * others say why nothing was sent. Every outcome leaves an audit row. Needs `UpdateOrder`.
500
+ *
501
+ * Takes no idempotency key: a repeat sends the e-mail again.
502
+ *
503
+ * Refused: another store's or a missing fulfillment is `ENTITY_NOT_FOUND` (`NotFoundError`); a
504
+ * store without the MyParcel plugin `PLUGIN_ACCESS_DENIED` (`PermissionDeniedError`, 403) for
505
+ * an ordinary caller; a credential restricted to other stock locations `LOCATION_OUT_OF_SCOPE`
506
+ * (422). A blank id is refused before any request (`MYPARCEL_LABEL_INPUT_INVALID`,
507
+ * `ValidationError`).
508
+ *
509
+ * @effect irreversible
510
+ * @permission UpdateOrder
511
+ */
512
+ resendLabelHandoff(fulfillmentId: string, options?: Call): Promise<LabelHandoffOutcome>;
415
513
  /**
416
514
  * The store's fulfilment payment policy (`fulfillmentPaymentPolicy`): whether a fulfilment of
417
515
  * an order not paid in full is refused `ORDER_NOT_COVERED`, and which payment methods are
@@ -431,6 +529,12 @@ export interface FulfillmentsModule extends FulfillmentCreateMethods {
431
529
  export declare const FULFILLMENT_CANCEL_PREVIEW_QUERY = "\n query FulfillmentCancelPreview($fulfillmentId: ID!) {\n fulfillmentCancelPreview(fulfillmentId: $fulfillmentId) {\n fulfillmentId\n overpayments {\n orderId\n orderCode\n amount\n currencyCode\n refund { \n available\n code\n message\n book\n }\n accountCredit { \n available\n code\n message\n book\n }\n }\n }\n }\n";
432
530
  /** `$overpayment` and `$idempotencyKey` are optional and left out of the variables when not given. */
433
531
  export declare const CANCEL_FULFILLMENT_MUTATION = "\n mutation CancelFulfillment(\n $fulfillmentId: ID!\n $overpayment: [FulfillmentCancelOverpaymentInput!]\n $idempotencyKey: String\n ) {\n cancelFulfillment(\n fulfillmentId: $fulfillmentId\n overpayment: $overpayment\n idempotencyKey: $idempotencyKey\n ) {\n fulfillment {\n id\n state\n }\n settlements {\n orderId\n orderCode\n amount\n currencyCode\n choice\n book\n }\n }\n }\n";
532
+ /**
533
+ * The refusal member is selected for its facts: `message` is core's per-code template ("Cannot
534
+ * transition Fulfillment from X to Y"), and the refusing step's reason is `transitionError` alone.
535
+ */
536
+ export declare const TRANSITION_FULFILLMENT_MUTATION = "\n mutation TransitionFulfillment($id: ID!, $state: String!) {\n transitionFulfillmentToState(id: $id, state: $state) {\n __typename\n ... on Fulfillment {\n id\n state\n nextStates\n }\n ... on FulfillmentStateTransitionError {\n errorCode\n message\n fromState\n toState\n transitionError\n }\n }\n }\n";
537
+ export declare const RESEND_FULFILLMENT_LABEL_HANDOFF_MUTATION = "\n mutation ResendFulfillmentLabelHandoff($fulfillmentId: ID!) {\n resendFulfillmentLabelHandoff(fulfillmentId: $fulfillmentId)\n }\n";
434
538
  /** Its own document: on an engine without the query this call alone fails validation. */
435
539
  export declare const ORDER_FULFILLMENT_COVERAGE_QUERY = "\n query OrderFulfillmentCoverage($orderId: ID!) {\n orderFulfillmentCoverage(orderId: $orderId) {\n orderId\n orderCode\n currencyCode\n policyActive\n covered\n outstanding\n exempt\n exemptReason\n allowed\n override { \n id\n orderId\n reason\n actorKind\n actorId\n outstandingAtGrant\n currencyCode\n createdAt\n active\n }\n }\n }\n";
436
540
  /** `$idempotencyKey` is optional and left out of the variables when not given. */
@@ -468,4 +572,18 @@ export declare const MYPARCEL_LABEL_TIMEOUT_MS = 55000;
468
572
  export declare function toUnretractedShipments(raw: readonly MyparcelUnretractedShipment[] | null | undefined): MyparcelUnretractedShipment[];
469
573
  /** The bytes of a base64 label document (`atob`: no Node `Buffer`, it ships to browsers). */
470
574
  export declare function decodeBase64(base64: string): Uint8Array;
575
+ interface RawTransitionRefusal {
576
+ errorCode: string;
577
+ message: string;
578
+ fromState?: string | null;
579
+ toState?: string | null;
580
+ transitionError?: string | null;
581
+ }
582
+ /**
583
+ * A refused move as the coded error it is. Core carries a step's refusal only as text, so the
584
+ * step's own code is read off its `[CODE]` prefix and classed through the GraphQL dialect, as the
585
+ * warehouse API's refusals of the same codes are (`warehouseRefusalError`): one code, one class,
586
+ * whichever door answered it.
587
+ */
588
+ export declare function fulfillmentTransitionRefusal(result: RawTransitionRefusal): PlatformError;
471
589
  export declare function createFulfillmentsModule(transport: Transport): FulfillmentsModule;
@@ -1,4 +1,5 @@
1
- import { errorFromErrorResult, isErrorResult, NotFoundError, ValidationError, } from '@sixtyninecommerce/core';
1
+ import { errorForStatus, errorFromErrorResult, errorFromGraphQLErrors, isErrorResult, NotFoundError, ValidationError, } from '@sixtyninecommerce/core';
2
+ import { customerAgreedVariable, statedCustomerAgreed } from '../payments/customer-consent.js';
2
3
  import { storeCreditAware } from '../payments/store-credit-fields.js';
3
4
  import { createFulfillmentCreateMethods } from './create.js';
4
5
  import { createFulfillmentPaymentPolicyModule, } from './payment-policy.js';
@@ -58,6 +59,34 @@ export const CANCEL_FULFILLMENT_MUTATION = /* GraphQL */ `
58
59
  }
59
60
  }
60
61
  `;
62
+ /**
63
+ * The refusal member is selected for its facts: `message` is core's per-code template ("Cannot
64
+ * transition Fulfillment from X to Y"), and the refusing step's reason is `transitionError` alone.
65
+ */
66
+ export const TRANSITION_FULFILLMENT_MUTATION = /* GraphQL */ `
67
+ mutation TransitionFulfillment($id: ID!, $state: String!) {
68
+ transitionFulfillmentToState(id: $id, state: $state) {
69
+ __typename
70
+ ... on Fulfillment {
71
+ id
72
+ state
73
+ nextStates
74
+ }
75
+ ... on FulfillmentStateTransitionError {
76
+ errorCode
77
+ message
78
+ fromState
79
+ toState
80
+ transitionError
81
+ }
82
+ }
83
+ }
84
+ `;
85
+ export const RESEND_FULFILLMENT_LABEL_HANDOFF_MUTATION = /* GraphQL */ `
86
+ mutation ResendFulfillmentLabelHandoff($fulfillmentId: ID!) {
87
+ resendFulfillmentLabelHandoff(fulfillmentId: $fulfillmentId)
88
+ }
89
+ `;
61
90
  /** Every field of `OrderFulfillmentCoverageOverride`. */
62
91
  const COVERAGE_OVERRIDE_FIELDS = /* GraphQL */ `
63
92
  id
@@ -160,15 +189,27 @@ function assertCancelRequest(fulfillmentId, input) {
160
189
  if (!OVERPAYMENT_CHOICES.has(entry.choice)) {
161
190
  throw invalidCancel(`overpayment[${String(index)}].choice`, `The choice for order ${orderId} must be REFUND or ACCOUNT_CREDIT; got ${JSON.stringify(entry.choice)}.`);
162
191
  }
192
+ if (entry.customerAgreed != null &&
193
+ customerAgreedVariable(entry.customerAgreed) === undefined) {
194
+ throw invalidCancel(`overpayment[${String(index)}].customerAgreed`, `The customer's answer for order ${orderId} must be true or false; got ${JSON.stringify(entry.customerAgreed)}.`);
195
+ }
163
196
  if (seen.has(orderId)) {
164
197
  throw invalidCancel(`overpayment[${String(index)}].orderId`, `Order ${orderId} is named twice: give one choice per order.`);
165
198
  }
166
199
  seen.add(orderId);
167
200
  }
168
201
  }
169
- /** An option as the SDK types it: `code` and `message` are null when it is open. */
202
+ /**
203
+ * An option as the SDK types it: `code` and `message` are null when it is open; `book` (the
204
+ * account credit's, incentives sprint 8) null on the refund and from an engine before it.
205
+ */
170
206
  function toOption(raw) {
171
- return { available: raw.available, code: raw.code ?? null, message: raw.message ?? null };
207
+ return {
208
+ available: raw.available,
209
+ code: raw.code ?? null,
210
+ message: raw.message ?? null,
211
+ book: raw.book ?? null,
212
+ };
172
213
  }
173
214
  export const REPORT_APP_FULFILLMENT_MUTATION = /* GraphQL */ `
174
215
  mutation ReportAppFulfillment(
@@ -364,6 +405,50 @@ function assertLabelRequest(fulfillmentId, format) {
364
405
  throw invalidLabelRequest('format', `format must be 'A4' or 'A6', or left out to label every parcel still missing one; got ${JSON.stringify(format)}.`);
365
406
  }
366
407
  }
408
+ function invalidTransition(field, message) {
409
+ return new ValidationError({
410
+ code: 'FULFILLMENT_TRANSITION_INVALID',
411
+ message,
412
+ status: 400,
413
+ service: 'vendure',
414
+ details: [{ field, code: 'FULFILLMENT_TRANSITION_INVALID', message }],
415
+ });
416
+ }
417
+ /** The `[CODE]` a step of the fulfillment process prefixes its refusal text with. */
418
+ const STEP_CODE = /^\s*\[([A-Z][A-Z0-9_]*)\]\s*/;
419
+ /**
420
+ * A refused move as the coded error it is. Core carries a step's refusal only as text, so the
421
+ * step's own code is read off its `[CODE]` prefix and classed through the GraphQL dialect, as the
422
+ * warehouse API's refusals of the same codes are (`warehouseRefusalError`): one code, one class,
423
+ * whichever door answered it.
424
+ */
425
+ export function fulfillmentTransitionRefusal(result) {
426
+ const text = typeof result.transitionError === 'string' ? result.transitionError.trim() : '';
427
+ const facts = {
428
+ errorCode: result.errorCode,
429
+ fromState: result.fromState ?? '',
430
+ toState: result.toState ?? '',
431
+ transitionError: text,
432
+ };
433
+ const step = STEP_CODE.exec(text);
434
+ const sentence = step ? text.slice(step[0].length).trim() : text;
435
+ // Core's `message` is a per-code template, untranslated on some engines
436
+ // ("errorResult.FULFILLMENT_STATE_TRANSITION_ERROR"): said only when the move is unknown too.
437
+ const message = sentence ||
438
+ (facts.fromState && facts.toState
439
+ ? `The fulfillment cannot move from ${facts.fromState} to ${facts.toState}.`
440
+ : result.message);
441
+ if (step?.[1]) {
442
+ return errorFromGraphQLErrors([{ message, extensions: { ...facts, code: step[1] } }]);
443
+ }
444
+ const base = errorFromErrorResult({ errorCode: result.errorCode, message });
445
+ return errorForStatus(base.status, {
446
+ code: base.code,
447
+ message,
448
+ service: 'vendure',
449
+ extensions: { ...facts },
450
+ });
451
+ }
367
452
  export function createFulfillmentsModule(transport) {
368
453
  return {
369
454
  ...createFulfillmentCreateMethods(transport),
@@ -475,7 +560,14 @@ export function createFulfillmentsModule(transport) {
475
560
  variables: {
476
561
  fulfillmentId,
477
562
  ...(overpayment.length > 0
478
- ? { overpayment: overpayment.map(({ orderId, choice }) => ({ orderId, choice })) }
563
+ ? {
564
+ overpayment: overpayment.map(({ orderId, choice, customerAgreed }) => ({
565
+ orderId,
566
+ choice,
567
+ // Named only when stated: an engine before the field takes the rest.
568
+ ...statedCustomerAgreed(customerAgreed),
569
+ })),
570
+ }
479
571
  : {}),
480
572
  ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
481
573
  },
@@ -489,6 +581,7 @@ export function createFulfillmentsModule(transport) {
489
581
  amount: entry.amount,
490
582
  currencyCode: entry.currencyCode,
491
583
  choice: entry.choice,
584
+ book: entry.book ?? null,
492
585
  })),
493
586
  };
494
587
  },
@@ -524,6 +617,33 @@ export function createFulfillmentsModule(transport) {
524
617
  }, options);
525
618
  return toCoverageOverride(data.allowUncoveredFulfillment);
526
619
  },
620
+ async transition(fulfillmentId, state, options) {
621
+ if (typeof fulfillmentId !== 'string' || fulfillmentId.trim() === '') {
622
+ throw invalidTransition('fulfillmentId', 'A fulfillment id is required.');
623
+ }
624
+ if (typeof state !== 'string' || state.trim() === '') {
625
+ throw invalidTransition('state', 'Name the state to move the fulfillment to.');
626
+ }
627
+ const data = await transport.graphql({
628
+ api: 'admin',
629
+ query: TRANSITION_FULFILLMENT_MUTATION,
630
+ variables: { id: fulfillmentId, state },
631
+ }, options);
632
+ const result = data.transitionFulfillmentToState;
633
+ if (isErrorResult(result))
634
+ throw fulfillmentTransitionRefusal(result);
635
+ const moved = result;
636
+ return { id: moved.id, state: moved.state, nextStates: [...(moved.nextStates ?? [])] };
637
+ },
638
+ async resendLabelHandoff(fulfillmentId, options) {
639
+ assertLabelRequest(fulfillmentId, undefined);
640
+ const data = await transport.graphql({
641
+ api: 'admin',
642
+ query: RESEND_FULFILLMENT_LABEL_HANDOFF_MUTATION,
643
+ variables: { fulfillmentId },
644
+ }, options);
645
+ return data.resendFulfillmentLabelHandoff;
646
+ },
527
647
  async reportAppFulfillment(fulfillmentId, input, options) {
528
648
  const data = await transport.graphql({
529
649
  api: 'admin',
@@ -237,6 +237,12 @@ export interface WarehouseFulfillment {
237
237
  /** Null for a legacy fulfillment whose warehouse was never recorded (office staff only). */
238
238
  stockLocationId: string | null;
239
239
  stockLocationName: string | null;
240
+ /**
241
+ * The supplier that shipped a drop-ship fulfilment (`handlerCode: 'drop-ship'`) straight to the
242
+ * customer: show it where a warehouse fulfilment shows its warehouse. Null otherwise, and against
243
+ * an engine before purchase-orders step 5.5.
244
+ */
245
+ dropShipSupplierName: string | null;
240
246
  /** ISO-8601. */
241
247
  createdAt: string;
242
248
  /** ISO-8601: when its current stage began. */
@@ -668,30 +674,30 @@ export interface WarehouseFulfillmentsModule {
668
674
  * named fragment: `orders-coverage.spec.ts` reads each document's root field with every
669
675
  * interpolation replaced, which a fragment spread at the top level would not survive.
670
676
  */
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";
677
+ export declare const FULFILLMENT_FIELDS = "\n id\n state\n handlerCode\n method\n mode\n trackingCode\n stockLocationId\n stockLocationName\n dropShipSupplierName\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
678
  export declare const MY_WAREHOUSES_QUERY = "\n query MyWarehouses {\n myWarehouses {\n id\n name\n }\n }\n";
673
679
  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
680
  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";
681
+ 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 dropShipSupplierName\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";
682
+ 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 dropShipSupplierName\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
683
  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
684
  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
685
  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
686
  /** The order API, not the warehouse one: it names money (`ReadOrder`). */
681
687
  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";
688
+ 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 dropShipSupplierName\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 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 dropShipSupplierName\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 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 dropShipSupplierName\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 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 dropShipSupplierName\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";
692
+ 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 dropShipSupplierName\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";
693
+ 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 dropShipSupplierName\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 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 dropShipSupplierName\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
+ 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 dropShipSupplierName\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";
696
+ 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 dropShipSupplierName\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";
697
+ 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 dropShipSupplierName\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";
698
+ 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 dropShipSupplierName\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";
699
+ 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 dropShipSupplierName\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";
700
+ 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 dropShipSupplierName\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
701
  /** The key a caller retries under, on an error of a call whose key it did not choose. */
696
702
  export declare function withAttemptKey(error: unknown, key: string): unknown;
697
703
  export interface RawRefusal {
@@ -721,4 +727,10 @@ export type RawFulfillment = WarehouseFulfillment & {
721
727
  };
722
728
  export declare function toFulfillment(raw: RawFulfillment): WarehouseFulfillment;
723
729
  export declare function toRefusal(raw: RawRefusal | null | undefined): WarehouseRefusal | null;
724
- export declare function createWarehouseFulfillmentsModule(transport: Transport): WarehouseFulfillmentsModule;
730
+ /**
731
+ * The transport, sending a document that names `dropShipSupplierName` once more without it when the
732
+ * engine refused it as unknown (an engine before purchase-orders step 5.5): the field then reads
733
+ * null. Safe for a mutation too: a refused document never ran.
734
+ */
735
+ export declare function dropShipSupplierAware(transport: Transport): Transport;
736
+ export declare function createWarehouseFulfillmentsModule(engineTransport: Transport): WarehouseFulfillmentsModule;
@@ -48,6 +48,7 @@
48
48
  * `orders.drafts.place` does).
49
49
  */
50
50
  import { errorFromGraphQLErrors, idempotencyKey as mintIdempotencyKey, pageFromVendureList, readOffsetCursor, ValidationError, } from '@sixtyninecommerce/core';
51
+ import { isUnknownFieldRejection } from '../payments/store-credit-fields.js';
51
52
  /** The most fulfillments one `ship`, `deliver` or `pickList` call takes. */
52
53
  export const MAX_WAREHOUSE_BULK_IDS = 100;
53
54
  const ADDRESS_FIELDS = /* GraphQL */ `
@@ -74,6 +75,7 @@ export const FULFILLMENT_FIELDS = /* GraphQL */ `
74
75
  trackingCode
75
76
  stockLocationId
76
77
  stockLocationName
78
+ dropShipSupplierName
77
79
  createdAt
78
80
  stateChangedAt
79
81
  overdue
@@ -552,6 +554,7 @@ export function toFulfillment(raw) {
552
554
  trackingCode: raw.trackingCode ?? null,
553
555
  stockLocationId: raw.stockLocationId ?? null,
554
556
  stockLocationName: raw.stockLocationName ?? null,
557
+ dropShipSupplierName: raw.dropShipSupplierName ?? null,
555
558
  createdAt: raw.createdAt,
556
559
  stateChangedAt: raw.stateChangedAt ?? null,
557
560
  overdue: raw.overdue,
@@ -653,7 +656,35 @@ function bulkOrThrow(result) {
653
656
  };
654
657
  }
655
658
  const DEFAULT_TAKE = 50;
656
- export function createWarehouseFulfillmentsModule(transport) {
659
+ /**
660
+ * The transport, sending a document that names `dropShipSupplierName` once more without it when the
661
+ * engine refused it as unknown (an engine before purchase-orders step 5.5): the field then reads
662
+ * null. Safe for a mutation too: a refused document never ran.
663
+ */
664
+ export function dropShipSupplierAware(transport) {
665
+ return {
666
+ async graphql(call, options) {
667
+ try {
668
+ return await transport.graphql(call, options);
669
+ }
670
+ catch (error) {
671
+ const legacy = call.query.replace(/\bdropShipSupplierName\b/g, '');
672
+ if (legacy === call.query || !isUnknownFieldRejection(error))
673
+ throw error;
674
+ return transport.graphql({ ...call, query: legacy }, options);
675
+ }
676
+ },
677
+ // Delegated one by one: a transport is a class instance, whose members a spread would drop.
678
+ rest: (service, call, options) => transport.rest(service, call, options),
679
+ get rateLimit() {
680
+ return transport.rateLimit;
681
+ },
682
+ tenant: () => transport.tenant(),
683
+ channel: () => transport.channel(),
684
+ };
685
+ }
686
+ export function createWarehouseFulfillmentsModule(engineTransport) {
687
+ const transport = dropShipSupplierAware(engineTransport);
657
688
  const single = async (query, field, variables, options) => {
658
689
  const data = await transport.graphql({ api: 'admin', query, variables }, options);
659
690
  return fulfillmentOrThrow(data[field]);