@sixtyninecommerce/admin 0.9.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 (258) hide show
  1. package/README.md +4598 -128
  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 +318 -17
  9. package/dist/catalog/products.js +182 -14
  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 +282 -25
  21. package/dist/catalog/variants.js +173 -25
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +116 -9
  25. package/dist/client.js +41 -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 +121 -10
  63. package/dist/fulfillments/index.js +120 -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 +129 -30
  71. package/dist/index.js +47 -9
  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 +40 -0
  87. package/dist/integrations/index.js +24 -0
  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 +114 -0
  91. package/dist/integrations/pipelines.js +46 -0
  92. package/dist/integrations/types.d.ts +322 -0
  93. package/dist/integrations/types.js +8 -0
  94. package/dist/jobs/bulk-action-run.d.ts +11 -2
  95. package/dist/jobs/bulk-action-run.js +4 -5
  96. package/dist/locations/index.d.ts +66 -0
  97. package/dist/locations/index.js +31 -0
  98. package/dist/meta/index.d.ts +162 -0
  99. package/dist/orders/bulk.d.ts +75 -0
  100. package/dist/orders/bulk.js +150 -0
  101. package/dist/orders/cancel-with-money.d.ts +227 -0
  102. package/dist/orders/cancel-with-money.js +153 -0
  103. package/dist/orders/commit-edit.d.ts +7 -1
  104. package/dist/orders/commit-edit.js +5 -1
  105. package/dist/orders/deposit-policy.d.ts +103 -0
  106. package/dist/orders/deposit-policy.js +202 -0
  107. package/dist/orders/drafts.d.ts +800 -0
  108. package/dist/orders/drafts.js +771 -0
  109. package/dist/orders/fields.d.ts +245 -0
  110. package/dist/orders/fields.js +188 -0
  111. package/dist/orders/get.d.ts +29 -19
  112. package/dist/orders/get.js +17 -8
  113. package/dist/orders/index.d.ts +125 -5
  114. package/dist/orders/index.js +35 -2
  115. package/dist/orders/lifecycle.d.ts +128 -0
  116. package/dist/orders/lifecycle.js +158 -0
  117. package/dist/orders/line-price-preview.d.ts +7 -2
  118. package/dist/orders/list.d.ts +222 -0
  119. package/dist/orders/list.js +377 -0
  120. package/dist/orders/manual-discounts.d.ts +11 -2
  121. package/dist/orders/manual-discounts.js +2 -0
  122. package/dist/orders/manual-pricing.d.ts +5 -0
  123. package/dist/orders/order-entry.d.ts +20 -7
  124. package/dist/orders/plan-edit.d.ts +1 -1
  125. package/dist/orders/plan-edit.js +4 -1
  126. package/dist/orders/settings.d.ts +201 -0
  127. package/dist/orders/settings.js +325 -0
  128. package/dist/orders/status.d.ts +159 -13
  129. package/dist/orders/status.js +21 -0
  130. package/dist/orders/surcharges.d.ts +8 -1
  131. package/dist/orders/surcharges.js +3 -2
  132. package/dist/payments/account-credit.d.ts +30 -0
  133. package/dist/payments/account-credit.js +19 -0
  134. package/dist/payments/ar.d.ts +292 -0
  135. package/dist/payments/ar.js +223 -0
  136. package/dist/payments/connected-account.d.ts +47 -0
  137. package/dist/payments/connected-account.js +61 -0
  138. package/dist/payments/credit-noted-fields.d.ts +12 -0
  139. package/dist/payments/credit-noted-fields.js +37 -0
  140. package/dist/payments/index.d.ts +263 -10
  141. package/dist/payments/index.js +133 -1
  142. package/dist/payments/methods.d.ts +332 -0
  143. package/dist/payments/methods.js +363 -0
  144. package/dist/payments/mollie-methods.d.ts +159 -0
  145. package/dist/payments/mollie-methods.js +141 -0
  146. package/dist/payments/payment-links.d.ts +180 -0
  147. package/dist/payments/payment-links.js +97 -0
  148. package/dist/payments/provider-keys.d.ts +150 -0
  149. package/dist/payments/provider-keys.js +118 -0
  150. package/dist/payments/providers.d.ts +86 -11
  151. package/dist/payments/providers.js +29 -0
  152. package/dist/payments/requests.d.ts +144 -0
  153. package/dist/payments/requests.js +92 -0
  154. package/dist/payments/store-credit-fields.d.ts +15 -0
  155. package/dist/payments/store-credit-fields.js +51 -0
  156. package/dist/pickups/index.d.ts +104 -0
  157. package/dist/pickups/index.js +105 -0
  158. package/dist/platform/channels.d.ts +132 -0
  159. package/dist/platform/channels.js +128 -0
  160. package/dist/platform/geo.d.ts +123 -0
  161. package/dist/platform/geo.js +144 -0
  162. package/dist/platform/tax.d.ts +154 -0
  163. package/dist/platform/tax.js +139 -0
  164. package/dist/pos/anomalies.d.ts +158 -0
  165. package/dist/pos/anomalies.js +64 -0
  166. package/dist/pos/assisted-selling.d.ts +79 -0
  167. package/dist/pos/assisted-selling.js +38 -0
  168. package/dist/pos/exchanges.d.ts +103 -0
  169. package/dist/pos/exchanges.js +22 -0
  170. package/dist/pos/gift-cards.d.ts +135 -0
  171. package/dist/pos/gift-cards.js +47 -0
  172. package/dist/pos/index.d.ts +2125 -32
  173. package/dist/pos/index.js +742 -4
  174. package/dist/pos/no-receipt.d.ts +94 -0
  175. package/dist/pos/no-receipt.js +25 -0
  176. package/dist/pos/offline-sales.d.ts +187 -0
  177. package/dist/pos/offline-sales.js +116 -0
  178. package/dist/pos/pay-by-link.d.ts +143 -0
  179. package/dist/pos/pay-by-link.js +57 -0
  180. package/dist/pos/quick-keys.d.ts +103 -0
  181. package/dist/pos/quick-keys.js +45 -0
  182. package/dist/pos/reports.d.ts +360 -0
  183. package/dist/pos/reports.js +62 -0
  184. package/dist/pos/returns.d.ts +217 -0
  185. package/dist/pos/returns.js +53 -0
  186. package/dist/pricing/bulk-coupons.d.ts +139 -0
  187. package/dist/pricing/bulk-coupons.js +112 -0
  188. package/dist/pricing/index.d.ts +177 -4
  189. package/dist/pricing/index.js +176 -1
  190. package/dist/pricing/price-lists.d.ts +604 -0
  191. package/dist/pricing/price-lists.js +600 -0
  192. package/dist/pricing/vouchers.d.ts +103 -0
  193. package/dist/pricing/vouchers.js +69 -0
  194. package/dist/purchasing/alerts.d.ts +89 -0
  195. package/dist/purchasing/alerts.js +62 -0
  196. package/dist/purchasing/cost.d.ts +110 -0
  197. package/dist/purchasing/cost.js +86 -0
  198. package/dist/purchasing/index.d.ts +36 -0
  199. package/dist/purchasing/index.js +16 -0
  200. package/dist/purchasing/purchase-orders.d.ts +548 -0
  201. package/dist/purchasing/purchase-orders.js +491 -0
  202. package/dist/purchasing/replenishment.d.ts +281 -0
  203. package/dist/purchasing/replenishment.js +240 -0
  204. package/dist/purchasing/settings.d.ts +152 -0
  205. package/dist/purchasing/settings.js +181 -0
  206. package/dist/purchasing/suppliers.d.ts +476 -0
  207. package/dist/purchasing/suppliers.js +438 -0
  208. package/dist/quotes/index.d.ts +501 -0
  209. package/dist/quotes/index.js +439 -0
  210. package/dist/reports/index.d.ts +71 -8
  211. package/dist/reports/index.js +74 -11
  212. package/dist/returns/index.d.ts +818 -0
  213. package/dist/returns/index.js +844 -0
  214. package/dist/search/index.d.ts +174 -0
  215. package/dist/search/index.js +125 -0
  216. package/dist/shipping/definitions.d.ts +29 -0
  217. package/dist/shipping/definitions.js +47 -0
  218. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  219. package/dist/shipping/fulfillment-profiles.js +104 -0
  220. package/dist/shipping/hendriks.d.ts +97 -0
  221. package/dist/shipping/hendriks.js +50 -0
  222. package/dist/shipping/index.d.ts +48 -0
  223. package/dist/shipping/index.js +25 -0
  224. package/dist/shipping/methods.d.ts +198 -0
  225. package/dist/shipping/methods.js +240 -0
  226. package/dist/shipping/myparcel.d.ts +254 -0
  227. package/dist/shipping/myparcel.js +178 -0
  228. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  229. package/dist/shipping/parcel-rule.d.ts +6 -5
  230. package/dist/shipping/parcel-rule.js +21 -23
  231. package/dist/shipping/rate-tables.d.ts +179 -0
  232. package/dist/shipping/rate-tables.js +184 -0
  233. package/dist/stock/index.d.ts +10 -3
  234. package/dist/stock/index.js +3 -0
  235. package/dist/stock/locations.d.ts +144 -0
  236. package/dist/stock/locations.js +168 -0
  237. package/dist/stock/transfers.d.ts +216 -43
  238. package/dist/stock/transfers.js +140 -13
  239. package/dist/stored-value/index.d.ts +214 -4
  240. package/dist/stored-value/index.js +152 -0
  241. package/dist/subscriptions/index.d.ts +682 -0
  242. package/dist/subscriptions/index.js +815 -0
  243. package/dist/tax/index.d.ts +76 -1
  244. package/dist/tax/index.js +50 -0
  245. package/dist/tenant/email-style.d.ts +102 -0
  246. package/dist/tenant/email-style.js +72 -0
  247. package/dist/tenant/email-templates.d.ts +66 -0
  248. package/dist/tenant/email-templates.js +54 -0
  249. package/dist/tenant/notifications.d.ts +23 -17
  250. package/dist/tenant/settings-sources.d.ts +1 -1
  251. package/dist/tenant/time-zone.d.ts +17 -0
  252. package/dist/tenant/time-zone.js +11 -0
  253. package/dist/types.d.ts +51 -4
  254. package/dist/users/index.d.ts +3 -0
  255. package/dist/users/index.js +2 -0
  256. package/dist/users/warehouses.d.ts +50 -0
  257. package/dist/users/warehouses.js +51 -0
  258. package/package.json +2 -2
@@ -0,0 +1,168 @@
1
+ import { BusinessRuleError, pageFromVendureList, readOffsetCursor, ValidationError, } from '@sixtyninecommerce/core';
2
+ import { fieldOf } from '../catalog/types.js';
3
+ /** The fields a list can be sorted by. */
4
+ export const STOCK_LOCATION_SORT_FIELDS = ['name', 'createdAt', 'updatedAt'];
5
+ const LOCATION_FIELDS = /* GraphQL */ `
6
+ id
7
+ name
8
+ description
9
+ createdAt
10
+ updatedAt
11
+ customFields {
12
+ isPublic
13
+ outOfStockThreshold
14
+ }
15
+ `;
16
+ export const STOCK_LOCATIONS_QUERY = /* GraphQL */ `
17
+ query StockLocations($options: StockLocationListOptions) {
18
+ stockLocations(options: $options) {
19
+ items { ${LOCATION_FIELDS} }
20
+ totalItems
21
+ }
22
+ }
23
+ `;
24
+ export const STOCK_LOCATION_QUERY = /* GraphQL */ `
25
+ query StockLocation($id: ID!) {
26
+ stockLocation(id: $id) { ${LOCATION_FIELDS} }
27
+ }
28
+ `;
29
+ export const CREATE_STOCK_LOCATION_MUTATION = /* GraphQL */ `
30
+ mutation CreateStockLocation($input: CreateStockLocationInput!) {
31
+ createStockLocation(input: $input) { ${LOCATION_FIELDS} }
32
+ }
33
+ `;
34
+ export const UPDATE_STOCK_LOCATION_MUTATION = /* GraphQL */ `
35
+ mutation UpdateStockLocation($input: UpdateStockLocationInput!) {
36
+ updateStockLocation(input: $input) { ${LOCATION_FIELDS} }
37
+ }
38
+ `;
39
+ export const DELETE_STOCK_LOCATION_MUTATION = /* GraphQL */ `
40
+ mutation DeleteStockLocation($input: DeleteStockLocationInput!) {
41
+ deleteStockLocation(input: $input) {
42
+ result
43
+ message
44
+ }
45
+ }
46
+ `;
47
+ const DEFAULT_PAGE_SIZE = 100;
48
+ function toLocation(wire) {
49
+ return {
50
+ id: wire.id,
51
+ name: wire.name,
52
+ description: wire.description ?? '',
53
+ createdAt: wire.createdAt,
54
+ updatedAt: wire.updatedAt,
55
+ // The column defaults: a row written before the field existed reads null.
56
+ isPublic: wire.customFields?.isPublic ?? true,
57
+ outOfStockThreshold: wire.customFields?.outOfStockThreshold ?? 0,
58
+ };
59
+ }
60
+ const invalidInput = (message) => new ValidationError({
61
+ code: 'STOCK_LOCATION_INPUT_INVALID',
62
+ message,
63
+ status: 400,
64
+ service: 'vendure',
65
+ });
66
+ function assertId(id, what = 'id') {
67
+ if (typeof id !== 'string' || id.trim() === '') {
68
+ throw invalidInput(`${what} must be a stock location id.`);
69
+ }
70
+ }
71
+ function assertName(name) {
72
+ if (typeof name !== 'string' || name.trim() === '') {
73
+ throw invalidInput('A stock location needs a name.');
74
+ }
75
+ }
76
+ /** The location's own custom fields, only the keys the caller set: never the sender fields. */
77
+ function customFieldsOf(input) {
78
+ const fields = {};
79
+ if (input.isPublic !== undefined)
80
+ fields.isPublic = input.isPublic;
81
+ if (input.outOfStockThreshold !== undefined)
82
+ fields.outOfStockThreshold = input.outOfStockThreshold;
83
+ return Object.keys(fields).length > 0 ? fields : undefined;
84
+ }
85
+ function listOptionsOf(skip, take, options) {
86
+ const term = options?.term?.trim() ?? '';
87
+ return {
88
+ skip,
89
+ take,
90
+ ...(term === ''
91
+ ? {}
92
+ : {
93
+ filter: { name: { contains: term }, description: { contains: term } },
94
+ filterOperator: 'OR',
95
+ }),
96
+ ...(options?.sort ? { sort: { [options.sort.field]: options.sort.direction } } : {}),
97
+ };
98
+ }
99
+ export function createStockLocationsModule(transport) {
100
+ const listPage = async (skip, take, options) => {
101
+ const list = await fieldOf(transport, STOCK_LOCATIONS_QUERY, 'stockLocations', { options: listOptionsOf(skip, take, options) }, options);
102
+ return pageFromVendureList({ items: list.items.map(toLocation), totalItems: list.totalItems }, skip, take, (cursor) => listPage(readOffsetCursor(cursor), take, options));
103
+ };
104
+ return {
105
+ list(options) {
106
+ if (options?.sort && !STOCK_LOCATION_SORT_FIELDS.includes(options.sort.field)) {
107
+ return Promise.reject(invalidInput(`sort.field must be one of ${STOCK_LOCATION_SORT_FIELDS.join(', ')}.`));
108
+ }
109
+ const take = options?.limit ?? DEFAULT_PAGE_SIZE;
110
+ const skip = options?.after === undefined ? 0 : readOffsetCursor(options.after);
111
+ return listPage(skip, take, options);
112
+ },
113
+ async get(id, options) {
114
+ assertId(id);
115
+ const wire = await fieldOf(transport, STOCK_LOCATION_QUERY, 'stockLocation', { id }, options);
116
+ return wire === null ? null : toLocation(wire);
117
+ },
118
+ async create(input, options) {
119
+ assertName(input?.name);
120
+ const customFields = customFieldsOf(input);
121
+ return toLocation(await fieldOf(transport, CREATE_STOCK_LOCATION_MUTATION, 'createStockLocation', {
122
+ input: {
123
+ name: input.name,
124
+ description: input.description ?? '',
125
+ ...(customFields ? { customFields } : {}),
126
+ },
127
+ }, options));
128
+ },
129
+ async update(id, input, options) {
130
+ assertId(id);
131
+ if (input?.name !== undefined)
132
+ assertName(input.name);
133
+ const customFields = customFieldsOf(input ?? {});
134
+ return toLocation(await fieldOf(transport, UPDATE_STOCK_LOCATION_MUTATION, 'updateStockLocation', {
135
+ input: {
136
+ id,
137
+ ...(input?.name !== undefined ? { name: input.name } : {}),
138
+ ...(input?.description !== undefined ? { description: input.description } : {}),
139
+ // Core applies customFields key by key: the sender fields are never named here.
140
+ ...(customFields ? { customFields } : {}),
141
+ },
142
+ }, options));
143
+ },
144
+ async delete(id, options) {
145
+ assertId(id);
146
+ if (options?.transferToLocationId !== undefined) {
147
+ assertId(options.transferToLocationId, 'transferToLocationId');
148
+ }
149
+ const response = await fieldOf(transport, DELETE_STOCK_LOCATION_MUTATION, 'deleteStockLocation', {
150
+ input: {
151
+ id,
152
+ ...(options?.transferToLocationId
153
+ ? { transferToLocationId: options.transferToLocationId }
154
+ : {}),
155
+ },
156
+ }, options);
157
+ if (response?.result === 'DELETED')
158
+ return;
159
+ // Answered at HTTP 200, so the transport never throws for it.
160
+ throw new BusinessRuleError({
161
+ code: 'STOCK_LOCATION_NOT_DELETED',
162
+ message: response?.message?.trim() || 'The stock location was not deleted.',
163
+ status: 422,
164
+ service: 'vendure',
165
+ });
166
+ },
167
+ };
168
+ }
@@ -1,9 +1,15 @@
1
1
  import { type Page, type Transport } from '@sixtyninecommerce/core';
2
2
  import { type MyparcelUnretractedShipment } from '../fulfillments/index.js';
3
+ import type { StockLocationAddress } from '../locations/index.js';
3
4
  import type { Call, ListOptions } from '../types.js';
4
5
  export type StockTransferState = 'draft' | 'in_transit' | 'received' | 'cancelled';
5
6
  /** A `transfer` moves stock between two locations; a `consumption` uses it up at one. */
6
7
  export type StockTransferKind = 'transfer' | 'consumption';
8
+ /**
9
+ * What `search` matches in `list`: the transfer code only (`code`, the engine's default), or the
10
+ * code or the label (`all`).
11
+ */
12
+ export type StockTransferSearchMode = 'code' | 'all';
7
13
  export interface StockTransferAddress {
8
14
  contactName: string | null;
9
15
  company: string | null;
@@ -31,6 +37,7 @@ export interface StockTransferLine {
31
37
  id: string;
32
38
  variantId: string;
33
39
  sku: string;
40
+ variantName: string;
34
41
  quantity: number;
35
42
  receivedQuantity: number;
36
43
  lostQuantity: number;
@@ -59,6 +66,10 @@ export interface StockTransfer {
59
66
  note: string | null;
60
67
  carrier: string | null;
61
68
  trackingCode: string | null;
69
+ /**
70
+ * A calendar DAY, though it is stored as an instant: the dashboard records the day picked as
71
+ * that day's 00:00 UTC, so read it as the UTC day (`slice(0, 10)`), never in a local zone.
72
+ */
62
73
  estimatedArrivalAt: string | null;
63
74
  shippedAt: string | null;
64
75
  receivedAt: string | null;
@@ -67,11 +78,89 @@ export interface StockTransfer {
67
78
  deliveryAddress: StockTransferAddress | null;
68
79
  createdAt: string;
69
80
  updatedAt: string;
81
+ /**
82
+ * Who created it. Null when the engine recorded nobody, or that administrator has since been
83
+ * deleted. An app or API key is not null here: it acts as its own administrator (see
84
+ * `StockTransferStaffRef`).
85
+ */
86
+ initiatedBy: StockTransferStaffRef | null;
70
87
  items: StockTransferLine[];
88
+ /** How many lines it has (`items.length`). */
89
+ totalLines: number;
71
90
  totalQuantity: number;
72
91
  totalReceivedQuantity: number;
73
92
  totalLostQuantity: number;
74
93
  }
94
+ /** A line as `get` and every write answer it: with its cost snapshot. */
95
+ export interface StockTransferDetailLine extends StockTransferLine {
96
+ /**
97
+ * The variant's standard cost per unit, in minor units of the store's currency, as posting a
98
+ * consumption snapshotted it. Null on a transfer's lines, and on a consumption line whose
99
+ * variant had no cost on file.
100
+ */
101
+ unitCost: number | null;
102
+ }
103
+ /**
104
+ * One transfer as `get` and every write answer it: the list's fields, plus who shipped and
105
+ * received it, its consumption value, its transfer note and how it was shipped.
106
+ */
107
+ export interface StockTransferDetail extends Omit<StockTransfer, 'destinationLocation' | 'items'> {
108
+ /**
109
+ * Null for a consumption. `address` is the location's own postal address as stored (every
110
+ * field optional, as `locations` reads it), null when it has none: a shipment goes there
111
+ * unless `deliveryAddress` names another place.
112
+ */
113
+ destinationLocation: {
114
+ id: string;
115
+ name: string;
116
+ address: StockLocationAddress | null;
117
+ } | null;
118
+ items: StockTransferDetailLine[];
119
+ /**
120
+ * Who shipped it, or posted the consumption. Null as `initiatedBy` is, and while it is not
121
+ * shipped (removing the shipment clears it).
122
+ */
123
+ shippedBy: StockTransferStaffRef | null;
124
+ /**
125
+ * Who completed it: the receipt that took it to `received`, a close, or the consumption's
126
+ * post. Null as `initiatedBy` is, and until then: a partial receipt records nobody.
127
+ */
128
+ receivedBy: StockTransferStaffRef | null;
129
+ /**
130
+ * A consumption's total standard-cost value, in minor units of the store's currency: the sum
131
+ * of its lines' `unitCost × quantity`, over the lines that have one. Null for a transfer. A
132
+ * draft consumption has no cost snapshot yet, so it reads 0 with `consumptionHasUnpricedLines`.
133
+ */
134
+ consumptionTotalValue: number | null;
135
+ /**
136
+ * True when a line has no cost (a draft, or a variant with no cost on file when it was
137
+ * posted), so `consumptionTotalValue` understates it. Null for a transfer.
138
+ */
139
+ consumptionHasUnpricedLines: boolean | null;
140
+ /** Where the transfer note PDF is stored; null until one was generated. */
141
+ pdfStorageKey: string | null;
142
+ /**
143
+ * The engine's fulfilment handler it shipped with (`manual-fulfillment`, `myparcel`,
144
+ * `hendriks-3pl`). Null while it is a draft. A cancelled transfer keeps it.
145
+ */
146
+ fulfillmentHandlerCode: string | null;
147
+ /**
148
+ * The handler arguments the ship was given, as the handler stores them: a key/value object, or
149
+ * the `{ name, value }` list the fulfilment forms send. The handler owns their meaning.
150
+ */
151
+ handlerArgs: Record<string, unknown> | StockTransferHandlerArg[] | null;
152
+ /** The first MyParcel parcel's shipment id; every parcel is on `parcels(id)`. */
153
+ myparcelShipmentId: number | null;
154
+ /** The first MyParcel parcel's barcode once it has one; every barcode is on `parcels(id)`. */
155
+ myparcelBarcode: string | null;
156
+ /** Where the Hendriks (3PL) export was uploaded; null until the export completed. */
157
+ hendriksRemotePath: string | null;
158
+ }
159
+ /** One handler argument in the list form the fulfilment forms send. */
160
+ export interface StockTransferHandlerArg {
161
+ name: string;
162
+ value: string;
163
+ }
75
164
  export interface StockTransferLineInput {
76
165
  variantId: string;
77
166
  quantity: number;
@@ -86,27 +175,32 @@ export interface CreateStockTransferInput {
86
175
  note?: string;
87
176
  lines: StockTransferLineInput[];
88
177
  }
89
- /** A draft's fields; an omitted field is left as it is. */
178
+ /** A draft's fields; an omitted field is left as it is, and `null` clears one. */
90
179
  export interface UpdateStockTransferInput {
91
180
  sourceLocationId?: string;
92
181
  destinationLocationId?: string;
93
- label?: string;
94
- note?: string;
182
+ label?: string | null;
183
+ note?: string | null;
95
184
  /** Replaces every line. */
96
185
  lines?: StockTransferLineInput[];
97
- carrier?: string;
98
- trackingCode?: string;
99
- /** ISO 8601 with an explicit offset. */
100
- estimatedArrivalAt?: string;
186
+ carrier?: string | null;
187
+ trackingCode?: string | null;
188
+ /** ISO 8601 with an explicit offset. A day is sent as its 00:00 UTC (see `estimatedArrivalAt`). */
189
+ estimatedArrivalAt?: string | null;
101
190
  }
191
+ /**
192
+ * `carrier`, `trackingCode` and `estimatedArrivalAt`: an omitted field keeps what the draft
193
+ * holds, and `null` clears it.
194
+ */
102
195
  export interface ShipStockTransferInput {
103
- carrier?: string;
104
- trackingCode?: string;
105
- /** ISO 8601 with an explicit offset. */
106
- estimatedArrivalAt?: string;
107
- /** The engine's fulfilment handler code; defaults to manual shipping. */
108
- fulfillmentHandlerCode?: string;
109
- handlerArgs?: Record<string, unknown>;
196
+ carrier?: string | null;
197
+ trackingCode?: string | null;
198
+ /** ISO 8601 with an explicit offset. A day is sent as its 00:00 UTC (see `estimatedArrivalAt`). */
199
+ estimatedArrivalAt?: string | null;
200
+ /** The engine's fulfilment handler code; omitted or null ships it by hand (manual). */
201
+ fulfillmentHandlerCode?: string | null;
202
+ /** The handler's arguments: a key/value object or the `{ name, value }` list; none when omitted. */
203
+ handlerArgs?: Record<string, unknown> | StockTransferHandlerArg[] | null;
110
204
  /** Ship somewhere other than the destination's own address; null re-addresses it there. */
111
205
  deliveryAddress?: StockTransferAddressInput | null;
112
206
  }
@@ -170,6 +264,8 @@ export interface StockTransferFilter extends ListOptions {
170
264
  /** ISO 8601 with an explicit offset. */
171
265
  dateTo?: string;
172
266
  search?: string;
267
+ /** What `search` matches; the engine's default (`code`) when omitted. */
268
+ searchMode?: StockTransferSearchMode;
173
269
  /** Only the returns of this transfer. Needs an engine with returns. */
174
270
  returnOfTransferId?: string;
175
271
  /**
@@ -235,7 +331,11 @@ export interface StockTransferReturns {
235
331
  */
236
332
  returnableLines: StockTransferReturnableLine[];
237
333
  }
238
- /** A member of staff who acted on a transfer. */
334
+ /**
335
+ * The administrator who acted on a transfer. Usually a member of staff; an app installation or
336
+ * an API key acts as its own administrator, so it appears here too, with `firstName` "App" or
337
+ * "API Token" and its own name as `lastName`.
338
+ */
239
339
  export interface StockTransferStaffRef {
240
340
  /** The administrator's id. */
241
341
  id: string;
@@ -341,7 +441,9 @@ export interface StockTransferLabel {
341
441
  * `stock.movements()`. Reads need `ReadStockLocation`; every write needs `AdjustStock`
342
442
  * (or, for credentials minted before it existed, `UpdateStockLocation` — a transition a
343
443
  * later release ends).
344
- * None of these writes takes an idempotency key yet.
444
+ * None of these writes takes an idempotency key yet, and the client never repeats one: a write
445
+ * whose answer was lost is read back with `get` before it is sent again (each method says what
446
+ * a repeat does).
345
447
  *
346
448
  * Every location and variant a transfer names must be the store's own:
347
449
  * another store's location (or an id that does not exist) is refused
@@ -377,46 +479,117 @@ export interface StockTransferLabel {
377
479
  * never by `get`: a caller ahead of the engine sees only those calls refused.
378
480
  */
379
481
  export interface StockTransfersModule {
482
+ /**
483
+ * The store's transfers and consumptions, newest first, a page at a time (`limit`, default
484
+ * 25; `after` from a previous page). `search` matches the code, or the code or the label with
485
+ * `searchMode: 'all'`. A list row carries no detail fields: `get` one for those.
486
+ *
487
+ * @effect read
488
+ * @permission ReadStockLocation
489
+ */
380
490
  list(filter?: StockTransferFilter): Promise<Page<StockTransfer>>;
381
- get(id: string, options?: Call): Promise<StockTransfer | null>;
382
- create(input: CreateStockTransferInput, options?: Call): Promise<StockTransfer>;
383
- /** Only a draft can be edited. */
384
- update(id: string, input: UpdateStockTransferInput, options?: Call): Promise<StockTransfer>;
491
+ /**
492
+ * One transfer with its detail fields, or `null` when this store has no such transfer.
493
+ *
494
+ * @effect read
495
+ * @permission ReadStockLocation
496
+ */
497
+ get(id: string, options?: Call): Promise<StockTransferDetail | null>;
498
+ /**
499
+ * A draft transfer or consumption. Moves no stock.
500
+ *
501
+ * @effect write
502
+ * @permission AdjustStock
503
+ */
504
+ create(input: CreateStockTransferInput, options?: Call): Promise<StockTransferDetail>;
505
+ /**
506
+ * Only a draft can be edited. Moves no stock.
507
+ *
508
+ * @effect write
509
+ * @permission AdjustStock
510
+ */
511
+ update(id: string, input: UpdateStockTransferInput, options?: Call): Promise<StockTransferDetail>;
385
512
  /**
386
513
  * Draft → in transit: the source is debited. A MyParcel ship books every
387
- * parcel at MyParcel before it answers, so it is allowed up to 120s; a
388
- * `REQUEST_TIMEOUT` does not mean it failed — `get` it before shipping again.
514
+ * parcel at MyParcel before it answers and buys their labels, so it is
515
+ * allowed up to 120s; a `REQUEST_TIMEOUT` does not mean it failed — `get` it
516
+ * before shipping again. Shipping a transfer already in transit answers it
517
+ * unchanged: nothing is debited or booked twice. A Hendriks (3PL) ship
518
+ * uploads its export, which a later cancel does not withdraw.
519
+ *
520
+ * Refused `FIELD_GROUP_LOCKED` (`BusinessRuleError`) while an app or API key
521
+ * owns the store's Stock. A member store's Stock owner never locks the hub's
522
+ * warehouse (ruling U8).
523
+ *
524
+ * @effect money
525
+ * @permission AdjustStock
526
+ */
527
+ ship(id: string, input?: ShipStockTransferInput, options?: Call): Promise<StockTransferDetail>;
528
+ /**
529
+ * Post a consumption: debit its location, snapshot each line's cost and
530
+ * complete the draft. Only a draft is posted, so a repeat is refused
531
+ * (`USER_INPUT_ERROR`, `ValidationError`) and debits nothing.
532
+ *
533
+ * Refused `FIELD_GROUP_LOCKED` (`BusinessRuleError`) while an app or API key
534
+ * owns the store's Stock. A member store's Stock owner never locks the hub's
535
+ * warehouse (ruling U8).
536
+ *
537
+ * @effect write
538
+ * @permission AdjustStock
539
+ */
540
+ postConsumption(id: string, options?: Call): Promise<StockTransferDetail>;
541
+ /**
542
+ * Credit the destination with what arrived, and write off what was lost, per line. The
543
+ * quantities are each line's running TOTALS, never increments: a repeat of the same call
544
+ * credits nothing again, and a total lower than the line's is refused.
545
+ *
546
+ * Refused `FIELD_GROUP_LOCKED` (`BusinessRuleError`) while an app or API key
547
+ * owns the store's Stock. A member store's Stock owner never locks the hub's
548
+ * warehouse (ruling U8).
549
+ *
550
+ * @effect write
551
+ * @permission AdjustStock
389
552
  */
390
- ship(id: string, input?: ShipStockTransferInput, options?: Call): Promise<StockTransfer>;
391
- /** Post a consumption: debit its location and complete the draft. */
392
- postConsumption(id: string, options?: Call): Promise<StockTransfer>;
393
- /** Credit the destination with what arrived, and write off what was lost, per line. */
394
- receive(id: string, lines: ReceiveStockTransferLineInput[], options?: Call): Promise<StockTransfer>;
553
+ receive(id: string, lines: ReceiveStockTransferLineInput[], options?: Call): Promise<StockTransferDetail>;
395
554
  /**
396
555
  * Close an in-transit transfer as received. Each line still short is settled
397
556
  * as `shortfall` names it — `LOST`, or `RETURN_TO_SOURCE` (credited back to
398
557
  * the source) — and a line it does not name is written off as lost only with
399
558
  * `acceptShortfallAsLost`; otherwise the close is refused. Refused too: a
400
559
  * line named twice, a line of another transfer, a line with nothing
401
- * outstanding. Each refusal is a `ValidationError` and changes nothing.
560
+ * outstanding. Each refusal is a `ValidationError` and changes nothing. A
561
+ * close that sends a line back to the source is refused `FIELD_GROUP_LOCKED`
562
+ * (`BusinessRuleError`) while an app or API key owns the store's Stock.
563
+ *
564
+ * @effect write
565
+ * @permission AdjustStock
402
566
  */
403
- close(id: string, options?: CloseStockTransferOptions): Promise<StockTransfer>;
567
+ close(id: string, options?: CloseStockTransferOptions): Promise<StockTransferDetail>;
404
568
  /**
405
569
  * Cancel a draft, or an in-transit transfer (unreceived stock returns to the
406
570
  * source). An in-transit MyParcel shipment's parcels are voided at MyParcel
407
- * inside the call, so it is allowed up to 120s.
571
+ * inside the call, so it is allowed up to 120s. A cancelled transfer is
572
+ * final: cancelling it again is refused (`ValidationError`) and restores
573
+ * nothing twice. An in-transit cancel is refused `FIELD_GROUP_LOCKED`
574
+ * (`BusinessRuleError`) while an app or API key owns the store's Stock.
575
+ *
576
+ * @effect destructive
577
+ * @permission AdjustStock
408
578
  */
409
579
  cancel(id: string, options?: Call & {
410
580
  reason?: string;
411
- }): Promise<StockTransfer>;
581
+ }): Promise<StockTransferDetail>;
412
582
  /**
413
583
  * Create a draft RETURN of transfer `id` (the original): its source is the
414
584
  * original's destination, its lines capped per variant at what the original
415
585
  * received minus its other returns that are not cancelled. Answers the
416
586
  * return; ship and receive it like any transfer. A restricted credential
417
587
  * must hold the return's source (the original's destination).
588
+ *
589
+ * @effect write
590
+ * @permission AdjustStock
418
591
  */
419
- createReturn(id: string, input: CreateStockTransferReturnInput, options?: Call): Promise<StockTransfer>;
592
+ createReturn(id: string, input: CreateStockTransferReturnInput, options?: Call): Promise<StockTransferDetail>;
420
593
  /**
421
594
  * How transfer `id` is linked to returns — the transfer it returns from, its
422
595
  * own returns, and what a new return may still take per variant — or null
@@ -488,22 +661,22 @@ export interface StockTransfersModule {
488
661
  */
489
662
  myparcelLabel(id: string, format: StockTransferLabelFormat, options?: Call): Promise<StockTransferLabel>;
490
663
  }
491
- export declare const STOCK_TRANSFERS_QUERY = "\n query StockTransfers($options: StockTransferListOptions) {\n stockTransfers(options: $options) { items { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n } totalItems }\n }\n";
492
- export declare const STOCK_TRANSFER_QUERY = "\n query StockTransfer($id: ID!) { stockTransfer(id: $id) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n } }\n";
493
- export declare const CREATE_STOCK_TRANSFER_MUTATION = "\n mutation CreateStockTransfer($input: CreateStockTransferInput!) {\n createStockTransfer(input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
494
- export declare const UPDATE_STOCK_TRANSFER_MUTATION = "\n mutation UpdateStockTransfer($id: ID!, $input: UpdateStockTransferInput!) {\n updateStockTransfer(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
495
- export declare const SHIP_STOCK_TRANSFER_MUTATION = "\n mutation ShipStockTransfer($id: ID!, $input: ShipStockTransferInput) {\n shipStockTransfer(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
496
- export declare const POST_STOCK_TRANSFER_CONSUMPTION_MUTATION = "\n mutation PostStockTransferConsumption($id: ID!) {\n postStockTransferConsumption(id: $id) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
497
- export declare const RECEIVE_STOCK_TRANSFER_LINES_MUTATION = "\n mutation ReceiveStockTransferLines($id: ID!, $lines: [ReceiveStockTransferLineInput!]!) {\n receiveStockTransferLines(id: $id, lines: $lines) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
498
- export declare const CLOSE_STOCK_TRANSFER_MUTATION = "\n mutation CloseStockTransfer($id: ID!, $acceptShortfallAsLost: Boolean) {\n closeStockTransfer(id: $id, acceptShortfallAsLost: $acceptShortfallAsLost) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
664
+ export declare const STOCK_TRANSFERS_QUERY = "\n query StockTransfers($options: StockTransferListOptions) {\n stockTransfers(options: $options) { items { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n } totalItems }\n }\n";
665
+ export declare const STOCK_TRANSFER_QUERY = "\n query StockTransfer($id: ID!) { stockTransfer(id: $id) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n } }\n";
666
+ export declare const CREATE_STOCK_TRANSFER_MUTATION = "\n mutation CreateStockTransfer($input: CreateStockTransferInput!) {\n createStockTransfer(input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
667
+ export declare const UPDATE_STOCK_TRANSFER_MUTATION = "\n mutation UpdateStockTransfer($id: ID!, $input: UpdateStockTransferInput!) {\n updateStockTransfer(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
668
+ export declare const SHIP_STOCK_TRANSFER_MUTATION = "\n mutation ShipStockTransfer($id: ID!, $input: ShipStockTransferInput) {\n shipStockTransfer(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
669
+ export declare const POST_STOCK_TRANSFER_CONSUMPTION_MUTATION = "\n mutation PostStockTransferConsumption($id: ID!) {\n postStockTransferConsumption(id: $id) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
670
+ export declare const RECEIVE_STOCK_TRANSFER_LINES_MUTATION = "\n mutation ReceiveStockTransferLines($id: ID!, $lines: [ReceiveStockTransferLineInput!]!) {\n receiveStockTransferLines(id: $id, lines: $lines) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
671
+ export declare const CLOSE_STOCK_TRANSFER_MUTATION = "\n mutation CloseStockTransfer($id: ID!, $acceptShortfallAsLost: Boolean) {\n closeStockTransfer(id: $id, acceptShortfallAsLost: $acceptShortfallAsLost) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
499
672
  /**
500
673
  * Its own document: it declares `$shortfall`, which an engine without per-line
501
674
  * dispositions refuses as a whole. A close without dispositions keeps sending
502
675
  * the document above.
503
676
  */
504
- export declare const CLOSE_STOCK_TRANSFER_WITH_SHORTFALL_MUTATION = "\n mutation CloseStockTransferWithShortfall(\n $id: ID!\n $acceptShortfallAsLost: Boolean\n $shortfall: [StockTransferShortfallLineInput!]!\n ) {\n closeStockTransfer(\n id: $id\n acceptShortfallAsLost: $acceptShortfallAsLost\n shortfall: $shortfall\n ) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
505
- export declare const CANCEL_STOCK_TRANSFER_MUTATION = "\n mutation CancelStockTransfer($id: ID!, $reason: String) {\n cancelStockTransfer(id: $id, reason: $reason) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
506
- export declare const CREATE_STOCK_TRANSFER_RETURN_MUTATION = "\n mutation CreateStockTransferReturn($id: ID!, $input: CreateStockTransferReturnInput!) {\n createStockTransferReturn(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n }\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
677
+ export declare const CLOSE_STOCK_TRANSFER_WITH_SHORTFALL_MUTATION = "\n mutation CloseStockTransferWithShortfall(\n $id: ID!\n $acceptShortfallAsLost: Boolean\n $shortfall: [StockTransferShortfallLineInput!]!\n ) {\n closeStockTransfer(\n id: $id\n acceptShortfallAsLost: $acceptShortfallAsLost\n shortfall: $shortfall\n ) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
678
+ export declare const CANCEL_STOCK_TRANSFER_MUTATION = "\n mutation CancelStockTransfer($id: ID!, $reason: String) {\n cancelStockTransfer(id: $id, reason: $reason) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
679
+ export declare const CREATE_STOCK_TRANSFER_RETURN_MUTATION = "\n mutation CreateStockTransferReturn($id: ID!, $input: CreateStockTransferReturnInput!) {\n createStockTransferReturn(id: $id, input: $input) { \n id\n code\n kind\n state\n sourceLocation { id name }\n destinationLocation { id name customFields { address } }\n label\n note\n carrier\n trackingCode\n estimatedArrivalAt\n shippedAt\n receivedAt\n cancelledAt\n cancelReason\n deliveryAddress {\n contactName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n countryCode\n phoneNumber\n }\n createdAt\n updatedAt\n initiatedBy { id firstName lastName }\n shippedBy { id firstName lastName }\n receivedBy { id firstName lastName }\n consumptionTotalValue\n consumptionHasUnpricedLines\n pdfStorageKey\n fulfillmentHandlerCode\n handlerArgs\n myparcelShipmentId\n myparcelBarcode\n hendriksRemotePath\n items {\n id\n productVariant { id name sku }\n quantity\n receivedQuantity\n lostQuantity\n outstandingQuantity\n unitCost\n }\n totalLines\n totalQuantity\n totalReceivedQuantity\n totalLostQuantity\n }\n }\n";
507
680
  export declare const STOCK_TRANSFER_RETURNS_QUERY = "\n query StockTransferReturns($id: ID!) {\n stockTransfer(id: $id) {\n returnOfTransferId\n returnOf { \n id\n code\n state\n label\n sourceLocation { id name }\n destinationLocation { id name }\n createdAt\n totalQuantity\n }\n returns { \n id\n code\n state\n label\n sourceLocation { id name }\n destinationLocation { id name }\n createdAt\n totalQuantity\n }\n returnableLines {\n productVariantId\n productVariant { name sku }\n receivedQuantity\n returnedQuantity\n returnableQuantity\n }\n }\n }\n";
508
681
  /** The per-line settlement fields, in a document of their own like the return fields. */
509
682
  export declare const STOCK_TRANSFER_SHORTFALL_QUERY = "\n query StockTransferShortfall($id: ID!) {\n stockTransfer(id: $id) {\n id\n state\n items {\n id\n productVariant { id sku }\n quantity\n receivedQuantity\n lostQuantity\n returnedToSourceQuantity\n outstandingQuantity\n }\n totalLostQuantity\n totalReturnedToSourceQuantity\n }\n }\n";