@sixtyninecommerce/admin 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/customers/groups.d.ts +16 -5
- package/dist/customers/groups.js +6 -2
- package/dist/documents/emails.d.ts +5 -1
- package/dist/fulfillments/create.d.ts +1 -1
- package/dist/fulfillments/create.js +5 -2
- package/dist/fulfillments/warehouse.d.ts +29 -17
- package/dist/fulfillments/warehouse.js +32 -1
- package/dist/index.d.ts +2 -1
- package/dist/pricing/exchange-rates.d.ts +91 -0
- package/dist/pricing/exchange-rates.js +60 -0
- package/dist/pricing/index.d.ts +6 -0
- package/dist/pricing/index.js +2 -0
- package/dist/purchasing/index.d.ts +2 -2
- package/dist/purchasing/index.js +5 -2
- package/dist/purchasing/links.d.ts +3 -3
- package/dist/purchasing/links.js +9 -4
- package/dist/purchasing/purchase-orders.d.ts +71 -27
- package/dist/purchasing/purchase-orders.js +99 -5
- package/dist/purchasing/replenishment.d.ts +2 -2
- package/dist/purchasing/replenishment.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3953,7 +3953,7 @@ const page = await admin.customers.groups.list({
|
|
|
3953
3953
|
include: ['memberCount'],
|
|
3954
3954
|
take: 50,
|
|
3955
3955
|
});
|
|
3956
|
-
page.items[0]; // { id, name, createdAt, updatedAt, canViewIncomingStock, canBackorder, memberCount }
|
|
3956
|
+
page.items[0]; // { id, name, createdAt, updatedAt, canViewIncomingStock, canBackorder, viewOnly, memberCount }
|
|
3957
3957
|
|
|
3958
3958
|
const vip = await admin.customers.groups.create({ name: 'VIP', canBackorder: true });
|
|
3959
3959
|
await admin.customers.groups.add(vip.id, [customerId]);
|
|
@@ -3981,7 +3981,7 @@ await admin.customers.groups.b2b.set([...trade.map((group) => group.id), wholesa
|
|
|
3981
3981
|
group holds. Anything else, and a `take` outside 1 to 1000, is refused
|
|
3982
3982
|
`INVALID_CUSTOMER_GROUP_LIST_OPTIONS` (`ValidationError`) before anything is sent. To search by
|
|
3983
3983
|
text, take ids from `search.index('customer_groups', …)` and list them with `filter: { ids }`.
|
|
3984
|
-
- **`get`** answers the group, its
|
|
3984
|
+
- **`get`** answers the group, its three flags and whose it is (`catalogueOwnership`), or `null` for a
|
|
3985
3985
|
group the store does not hold. With `members` it adds one page of the group's members in this
|
|
3986
3986
|
store and their count, in one fixed order (by id, so pages never overlap);
|
|
3987
3987
|
`members.filter.ids` narrows the page to those customers, so the answer says which of them are
|
|
@@ -3995,8 +3995,11 @@ await admin.customers.groups.b2b.set([...trade.map((group) => group.id), wholesa
|
|
|
3995
3995
|
small the page. Ask for `memberCount` only where you show it, and expect a large group to be
|
|
3996
3996
|
slow.
|
|
3997
3997
|
- **`create` and `update`** send only what you name: a flag left out is not touched. The flags are
|
|
3998
|
-
`canViewIncomingStock` (members see incoming stock on the storefront)
|
|
3999
|
-
may order more than is in stock, within the store's backorder policy)
|
|
3998
|
+
`canViewIncomingStock` (members see incoming stock on the storefront), `canBackorder` (members
|
|
3999
|
+
may order more than is in stock, within the store's backorder policy) and `viewOnly` (signed-in
|
|
4000
|
+
members see the store's retail prices incl. VAT and fill a basket, but checkout, payments and
|
|
4001
|
+
quote requests are refused `VIEW_ONLY_ACCOUNT`; staff can still order for them). `viewOnly` needs
|
|
4002
|
+
a platform release that has it: an older engine refuses the whole document.
|
|
4000
4003
|
- **A group is one row for every store that holds it.** `update`, `delete` and `deleteMany` are
|
|
4001
4004
|
refused `MANAGED_BY_ORGANIZATION` (`BusinessRuleError`) for a group the store holds from its
|
|
4002
4005
|
organization, and `SHARED_CUSTOMER_GROUP_NOT_ALLOWED` (`PermissionDeniedError`) for one other
|
|
@@ -7178,7 +7181,7 @@ reads it by id:
|
|
|
7178
7181
|
|
|
7179
7182
|
```ts
|
|
7180
7183
|
const group = await admin.customers.groups.get(groupId);
|
|
7181
|
-
// { id, createdAt, updatedAt, name, externalKey, canViewIncomingStock, canBackorder,
|
|
7184
|
+
// { id, createdAt, updatedAt, name, externalKey, canViewIncomingStock, canBackorder, viewOnly,
|
|
7182
7185
|
// catalogueOwnership }, or null
|
|
7183
7186
|
```
|
|
7184
7187
|
|
|
@@ -25,6 +25,13 @@ export interface CustomerGroup {
|
|
|
25
25
|
canViewIncomingStock: boolean;
|
|
26
26
|
/** Members may order more than is in stock, within the store's or the variant's backorder policy. */
|
|
27
27
|
canBackorder: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* "View only": signed-in members see the store's retail prices including VAT (the prices an
|
|
30
|
+
* anonymous shopper sees, never a price list's) and can fill a basket on the storefront, but
|
|
31
|
+
* checkout, payments and quote requests are refused (`VIEW_ONLY_ACCOUNT`). Staff can still
|
|
32
|
+
* place orders for them. The Exact customer import never links a customer to such a group.
|
|
33
|
+
*/
|
|
34
|
+
viewOnly: boolean;
|
|
28
35
|
/**
|
|
29
36
|
* The store's own group, or its organization's (shared while the organization shares
|
|
30
37
|
* `customer_groups`); see {@link CatalogueOwnership}. `editableHere` false: rename it, change
|
|
@@ -91,6 +98,7 @@ export interface CustomerGroupListItem {
|
|
|
91
98
|
name: string;
|
|
92
99
|
canViewIncomingStock: boolean;
|
|
93
100
|
canBackorder: boolean;
|
|
101
|
+
viewOnly: boolean;
|
|
94
102
|
/**
|
|
95
103
|
* How many of the store's customers are in the group, present only when the call asked for
|
|
96
104
|
* `include: ['memberCount']`.
|
|
@@ -134,12 +142,15 @@ export interface CreateCustomerGroupInput {
|
|
|
134
142
|
canViewIncomingStock?: boolean;
|
|
135
143
|
/** See {@link CustomerGroup.canBackorder}. Off when omitted. */
|
|
136
144
|
canBackorder?: boolean;
|
|
145
|
+
/** See {@link CustomerGroup.viewOnly}. Off when omitted. */
|
|
146
|
+
viewOnly?: boolean;
|
|
137
147
|
}
|
|
138
148
|
/** A PATCH: an absent field keeps what the group has. */
|
|
139
149
|
export interface UpdateCustomerGroupInput {
|
|
140
150
|
name?: string;
|
|
141
151
|
canViewIncomingStock?: boolean;
|
|
142
152
|
canBackorder?: boolean;
|
|
153
|
+
viewOnly?: boolean;
|
|
143
154
|
}
|
|
144
155
|
/** A group by id and name. */
|
|
145
156
|
export interface CustomerGroupRef {
|
|
@@ -168,9 +179,9 @@ export interface CustomerB2BGroupsModule {
|
|
|
168
179
|
set(groupIds: readonly string[], options?: Call): Promise<CustomerGroupRef[]>;
|
|
169
180
|
}
|
|
170
181
|
/** A customer group as `get`, `create` and `update` read it. */
|
|
171
|
-
export declare const CUSTOMER_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n";
|
|
172
|
-
export declare const CUSTOMER_GROUP_QUERY = "\n query CustomerGroup($id: ID!) {\n customerGroup(id: $id) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
173
|
-
export declare const CUSTOMER_GROUP_MEMBERS_QUERY = "\n query CustomerGroupWithMembers($id: ID!, $members: CustomerListOptions) {\n customerGroup(id: $id) {\n \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n\n customers(options: $members) {\n items {\n id\n createdAt\n firstName\n lastName\n emailAddress\n addresses {\n company\n defaultBillingAddress\n defaultShippingAddress\n }\n }\n totalItems\n }\n }\n }\n";
|
|
182
|
+
export declare const CUSTOMER_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n viewOnly\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n";
|
|
183
|
+
export declare const CUSTOMER_GROUP_QUERY = "\n query CustomerGroup($id: ID!) {\n customerGroup(id: $id) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n viewOnly\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
184
|
+
export declare const CUSTOMER_GROUP_MEMBERS_QUERY = "\n query CustomerGroupWithMembers($id: ID!, $members: CustomerListOptions) {\n customerGroup(id: $id) {\n \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n viewOnly\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n\n customers(options: $members) {\n items {\n id\n createdAt\n firstName\n lastName\n emailAddress\n addresses {\n company\n defaultBillingAddress\n defaultShippingAddress\n }\n }\n totalItems\n }\n }\n }\n";
|
|
174
185
|
/**
|
|
175
186
|
* The list document for a set of blocks. The member count is the `totalItems` of a one-row page
|
|
176
187
|
* of the group's customers: a `take` of 0 would make that page every member.
|
|
@@ -184,8 +195,8 @@ export declare const CUSTOMER_GROUP_MEMBERS_QUERY = "\n query CustomerGroupWith
|
|
|
184
195
|
* fix is `omit: ['customers']` on those two resolvers, which this package cannot make.
|
|
185
196
|
*/
|
|
186
197
|
export declare function customerGroupListQuery(include: readonly CustomerGroupListInclude[]): string;
|
|
187
|
-
export declare const CREATE_CUSTOMER_GROUP_MUTATION = "\n mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) {\n createCustomerGroup(input: $input) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
188
|
-
export declare const UPDATE_CUSTOMER_GROUP_MUTATION = "\n mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {\n updateCustomerGroup(input: $input) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
198
|
+
export declare const CREATE_CUSTOMER_GROUP_MUTATION = "\n mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) {\n createCustomerGroup(input: $input) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n viewOnly\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
199
|
+
export declare const UPDATE_CUSTOMER_GROUP_MUTATION = "\n mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {\n updateCustomerGroup(input: $input) { \n id\n createdAt\n updatedAt\n name\n externalKey\n \n customFields {\n canViewIncomingStock\n canBackorder\n viewOnly\n }\n\n \n catalogueOwnership {\n state\n organizationName\n editableHere\n }\n\n }\n }\n";
|
|
189
200
|
export declare const DELETE_CUSTOMER_GROUP_MUTATION = "\n mutation DeleteCustomerGroup($id: ID!) {\n deleteCustomerGroup(id: $id) { \n result\n message\n }\n }\n";
|
|
190
201
|
export declare const DELETE_CUSTOMER_GROUPS_MUTATION = "\n mutation DeleteCustomerGroups($ids: [ID!]!) {\n deleteCustomerGroups(ids: $ids) { \n result\n message\n }\n }\n";
|
|
191
202
|
export declare const B2B_CUSTOMER_GROUPS_QUERY = "\n query CustomerGroupRefs {\n b2bCustomerGroups {\n id\n name\n }\n }\n";
|
package/dist/customers/groups.js
CHANGED
|
@@ -16,10 +16,13 @@ export const MAX_CUSTOMER_GROUP_LIST_TAKE = 1000;
|
|
|
16
16
|
export const CUSTOMER_GROUP_LIST_SORT_FIELDS = ['name', 'createdAt', 'updatedAt'];
|
|
17
17
|
/** The blocks a list row can add: `memberCount`, how many of the store's customers are in it. */
|
|
18
18
|
export const CUSTOMER_GROUP_LIST_INCLUDES = ['memberCount'];
|
|
19
|
+
/** The group's boolean flags, each a `CustomerGroup.customFields` field of the same name. */
|
|
20
|
+
const GROUP_FLAGS = ['canViewIncomingStock', 'canBackorder', 'viewOnly'];
|
|
19
21
|
const GROUP_FLAG_FIELDS = /* GraphQL */ `
|
|
20
22
|
customFields {
|
|
21
23
|
canViewIncomingStock
|
|
22
24
|
canBackorder
|
|
25
|
+
viewOnly
|
|
23
26
|
}
|
|
24
27
|
`;
|
|
25
28
|
/** A customer group as `get`, `create` and `update` read it. */
|
|
@@ -144,11 +147,12 @@ const isPageSize = (take) => typeof take === 'number' &&
|
|
|
144
147
|
take >= 1 &&
|
|
145
148
|
take <= MAX_CUSTOMER_GROUP_LIST_TAKE;
|
|
146
149
|
const isOffset = (skip) => typeof skip === 'number' && Number.isInteger(skip) && skip >= 0;
|
|
147
|
-
/**
|
|
150
|
+
/** Every flag is `false` unless the engine answers `true`: a group has no third state. */
|
|
148
151
|
function flagsOf(wire) {
|
|
149
152
|
return {
|
|
150
153
|
canViewIncomingStock: wire.customFields?.canViewIncomingStock === true,
|
|
151
154
|
canBackorder: wire.customFields?.canBackorder === true,
|
|
155
|
+
viewOnly: wire.customFields?.viewOnly === true,
|
|
152
156
|
};
|
|
153
157
|
}
|
|
154
158
|
function toCustomerGroup(wire) {
|
|
@@ -341,7 +345,7 @@ export async function listCustomerGroups(transport, options) {
|
|
|
341
345
|
/** Only the flags the caller set travel: an omitted flag is never sent as `null`. */
|
|
342
346
|
function flagFields(input) {
|
|
343
347
|
const customFields = {};
|
|
344
|
-
for (const flag of
|
|
348
|
+
for (const flag of GROUP_FLAGS) {
|
|
345
349
|
const value = input[flag];
|
|
346
350
|
if (value === undefined)
|
|
347
351
|
continue;
|
|
@@ -32,7 +32,11 @@ export interface EmailDelivery {
|
|
|
32
32
|
attempt: number;
|
|
33
33
|
/** The mail provider's message id, when it took the email. */
|
|
34
34
|
messageId: string | null;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Why the last attempt failed, as a coded sentence: `CODE: not sent (facts). Plain sentence.`
|
|
37
|
+
* (`SMTP_SEND_FAILED: not sent (code=EAUTH step=AUTH PLAIN reply=535). …`). Never the
|
|
38
|
+
* provider's or the mail server's own words, which can quote the gateway's user name or hosts.
|
|
39
|
+
*/
|
|
36
40
|
error: string | null;
|
|
37
41
|
durationMs: number | null;
|
|
38
42
|
/** The ids the email was rendered from (`orderId`, `invoiceId`, …) and other send facts. */
|
|
@@ -162,6 +162,6 @@ export interface FulfillmentCreateMethods {
|
|
|
162
162
|
*/
|
|
163
163
|
profileChargePreview(input: FulfillmentProfileChargePreviewInput, options?: Call): Promise<FulfillmentProfileChargePreview>;
|
|
164
164
|
}
|
|
165
|
-
export declare const CREATE_WAREHOUSE_FULFILLMENTS_MUTATION = "\n mutation CreateWarehouseFulfillments(\n $input: CreateWarehouseFulfillmentsInput!\n $idempotencyKey: String\n ) {\n createWarehouseFulfillments(input: $input, idempotencyKey: $idempotencyKey) {\n __typename\n ... on WarehouseCreateResult {\n created\n failed\n results {\n index\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 claimError {\n code\n message\n field\n }\n }\n }\n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n }\n }\n";
|
|
165
|
+
export declare const CREATE_WAREHOUSE_FULFILLMENTS_MUTATION = "\n mutation CreateWarehouseFulfillments(\n $input: CreateWarehouseFulfillmentsInput!\n $idempotencyKey: String\n ) {\n createWarehouseFulfillments(input: $input, idempotencyKey: $idempotencyKey) {\n __typename\n ... on WarehouseCreateResult {\n created\n failed\n results {\n index\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 claimError {\n code\n message\n field\n }\n }\n }\n ... on WarehouseError {\n errorCode\n code\n message\n field\n }\n }\n }\n";
|
|
166
166
|
export declare const FULFILLMENT_PROFILE_CHARGE_PREVIEW_QUERY = "\n query FulfillmentProfileChargePreview($input: FulfillmentProfileChargePreviewInput!) {\n fulfillmentProfileChargePreview(input: $input) {\n profileName\n currencyCode\n minOrder\n selectedNet\n shortfall\n deliveryCharge\n deliveryChargeIncludesTax\n settled\n handedOver\n }\n }\n";
|
|
167
167
|
export declare function createFulfillmentCreateMethods(transport: Transport): FulfillmentCreateMethods;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 400, never a 422). Each group's own refusal is data in `results[].error`.
|
|
10
10
|
*/
|
|
11
11
|
import { idempotencyKey as mintIdempotencyKey, ValidationError, } from '@sixtyninecommerce/core';
|
|
12
|
-
import { assertId, FULFILLMENT_FIELDS, invalid, isWarehouseErrorMember, toFulfillment, toRefusal, warehouseRefusalError, withAttemptKey, } from './warehouse.js';
|
|
12
|
+
import { assertId, dropShipSupplierAware, FULFILLMENT_FIELDS, invalid, isWarehouseErrorMember, toFulfillment, toRefusal, warehouseRefusalError, withAttemptKey, } from './warehouse.js';
|
|
13
13
|
export const CREATE_WAREHOUSE_FULFILLMENTS_MUTATION = /* GraphQL */ `
|
|
14
14
|
mutation CreateWarehouseFulfillments(
|
|
15
15
|
$input: CreateWarehouseFulfillmentsInput!
|
|
@@ -134,12 +134,15 @@ function assertPreviewInput(input) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
export function createFulfillmentCreateMethods(transport) {
|
|
137
|
+
// The create answers the warehouse's fulfilment fields, `dropShipSupplierName` among them: an
|
|
138
|
+
// engine before purchase-orders step 5.5 refuses that field before the mutation runs.
|
|
139
|
+
const engine = dropShipSupplierAware(transport);
|
|
137
140
|
return {
|
|
138
141
|
async create(input, options) {
|
|
139
142
|
assertCreateInput(input);
|
|
140
143
|
const key = options?.idempotencyKey ?? mintIdempotencyKey();
|
|
141
144
|
try {
|
|
142
|
-
const data = await
|
|
145
|
+
const data = await engine.graphql({
|
|
143
146
|
api: 'admin',
|
|
144
147
|
query: CREATE_WAREHOUSE_FULFILLMENTS_MUTATION,
|
|
145
148
|
variables: {
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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]);
|
package/dist/index.d.ts
CHANGED
|
@@ -212,13 +212,14 @@ export type { PosReportCashier, PosReportCashierActivity, PosReportCashiers, Pos
|
|
|
212
212
|
export { POS_REPORT_PRODUCTS_DEFAULT_PAGE, POS_REPORT_PRODUCTS_MAX_PAGE, } from './pos/reports.js';
|
|
213
213
|
export type { PosOnlineOrder, PosOnlineOrderRef, PosOnlineReturnInput, PosOnlineReturnQuote, PosReturnCreateInput, PosReturnKind, PosReturnLeg, PosReturnLineInput, PosReturnPayout, PosReturnQuote, PosReturnQuoteInput, PosReturnQuoteLine, PosReturnRefund, PosReturnResult, PosReturnStoredValueCredit, PosReturnStoredValuePayout, PosReturnsModule, PosVoidInput, } from './pos/returns.js';
|
|
214
214
|
export type { BulkCouponCode, BulkCouponGroup, GenerateBulkCouponsInput, PricingBulkCouponsModule, } from './pricing/bulk-coupons.js';
|
|
215
|
+
export type { PricingExchangeRatesModule, StoreExchangeRate, StoreExchangeRateSource, } from './pricing/exchange-rates.js';
|
|
215
216
|
export type { ActivePromotion, ActivePromotionsFilter, CreatePromotionInput, DiscountedOrderLine, LocalTime, OrderDiscount, OrderDiscounts, OrderPackage, PricingCouponsModule, PricingModule, PricingPromotion, PricingPromotionsModule, PromotionDetail, PromotionListItem, PromotionListOptions, PromotionOperationSummary, PromotionSortField, PromotionTranslationInput, SetComponent, UpdatePromotionInput, Weekday, } from './pricing/index.js';
|
|
216
217
|
export { PROMOTION_SORT_FIELDS, promotionActions, promotionConditions, } from './pricing/index.js';
|
|
217
218
|
export { type AssignPriceListTarget, type CreatePriceListInput, type CustomerPriceList, type CustomerPriceListAssignmentType, type CustomerPriceListsOptions, MAX_BULK_PRICE_LISTS, MAX_CUSTOMER_PRICE_LIST_ENTRIES, MAX_PRICE_LIST_ENTRY_EXPORT, MAX_PRICE_LIST_ENTRY_TAKE, MAX_PRICE_LIST_LIST_TAKE, PRICE_LIST_BULK_ACTIONS, PRICE_LIST_ENTRY_SEARCH_MODES, PRICE_LIST_SEARCH_MIN_TERM_LENGTH, PRICE_LIST_SEARCH_MODES, type PriceList, type PriceListAssignedTo, type PriceListAssignment, type PriceListAssignmentCustomer, type PriceListAssignmentGroup, type PriceListAssignmentRef, type PriceListBulkAction, type PriceListBulkInput, type PriceListBulkOutcome, type PriceListDiscountType, type PriceListEntry, type PriceListEntryFacetCount, type PriceListEntryFacets, type PriceListEntryFilter, type PriceListEntryListOptions, type PriceListEntrySearchMode, type PriceListEntryWrite, type PriceListFields, type PriceListListItem, type PriceListListOptions, type PriceListMinOrderAmountBasis, type PriceListOrderRule, type PriceListOrderRuleConditionType, type PriceListOrderRuleDiscountType, type PriceListSearchMatch, type PriceListSearchMode, type PriceListTargetType, type PricingPriceListEntriesModule, type PricingPriceListOrderRulesModule, type PricingPriceListsModule, type SetPriceListEntryInput, type SetPriceListOrderRuleInput, type UpdatePriceListInput, } from './pricing/price-lists.js';
|
|
218
219
|
export type { IssuedVoucher, IssueVoucherInput, IssueVouchersInput, IssueVouchersItem, PricingVouchersModule, Voucher, VoucherCustomer, VoucherStatus, VoucherTemplate, } from './pricing/vouchers.js';
|
|
219
220
|
export type { EntityProvenance, ProvenanceActor, ProvenanceEntityType, ProvenanceFieldGroup, ProvenanceManagedBy, ProvenanceModule, } from './provenance/index.js';
|
|
220
221
|
export { PROVENANCE_MAX_IDS } from './provenance/index.js';
|
|
221
|
-
export type { AddGoodsReceiptChargeInput, BackorderReadyLine, BackordersReadyOptions, BackToBackLinkQuantities, BackToBackLinkResult, CreateBackToBackLinkInput, CreatePurchaseOrderInput, CreateSupplierContactInput, CreateSupplierInput, CreateSupplierReturnInput, DropShipShipmentFulfillment, DropShipShipmentResult, GoodsReceipt, GoodsReceiptChargesModule, GoodsReceiptDetail, GoodsReceiptKeyedCall, GoodsReceiptKind, GoodsReceiptLine, GoodsReceiptListOptions, GoodsReceiptReference, GoodsReceiptTraceability, GoodsReceiptTraceabilityInput, LandedCharge, LandedChargeAllocation, LandedChargeAllocationBasis, LandedChargeKind, OverrideVariantCostInput, PostGoodsReceiptInput, PostGoodsReceiptLineInput, PurchaseOrder, PurchaseOrderCancelOptions, PurchaseOrderConfirmation, PurchaseOrderConfirmationInput, PurchaseOrderDocumentOptions, PurchaseOrderDocumentUrl, PurchaseOrderDropShip, PurchaseOrderDropShipLine, PurchaseOrderHeaderFields, PurchaseOrderKeyedCall, PurchaseOrderLine, PurchaseOrderLineConfirmationInput, PurchaseOrderLineImportOptions, PurchaseOrderLineImportResult, PurchaseOrderLineImportRow, PurchaseOrderLineInput, PurchaseOrderLinesModule, PurchaseOrderLink, PurchaseOrderLinkKind, PurchaseOrderLinkReleaseReason, PurchaseOrderLinkStatus, PurchaseOrderListOptions, PurchaseOrderLocation, PurchaseOrderReasonOptions, PurchaseOrderRevision, PurchaseOrderRevisionInput, PurchaseOrderRevisionsModule, PurchaseOrderSendVia, PurchaseOrderStatus, PurchaseOrderStatusEntry, PurchaseOrderSupplier, PurchasingAlert, PurchasingAlertRecipients, PurchasingAlertRecipientsInput, PurchasingAlertRecipientsModule, PurchasingAlertSummary, PurchasingAlertsModule, PurchasingBackordersModule, PurchasingBackToBackLinksModule, PurchasingCostModule, PurchasingDropShipLinksModule, PurchasingLinksModule, PurchasingModule, PurchasingNumbering, PurchasingNumberingKind, PurchasingNumberingModule, PurchasingPurchaseOrdersModule, PurchasingReceiptsModule, PurchasingReplenishmentModule, PurchasingReturnsModule, PurchasingSettings, PurchasingSettingsModule, PurchasingSuppliersModule, ReceivablePurchaseOrderLine, ReceivablePurchaseOrderLinesOptions, RecordDropShipShipmentInput, RemoveGoodsReceiptChargeInput, ReplenishmentComputeResult, ReplenishmentDraftLine, ReplenishmentDrafts, ReplenishmentLocation, ReplenishmentRule, ReplenishmentRuleFields, ReplenishmentRuleImportInput, ReplenishmentRuleImportResult, ReplenishmentRuleImportRow, ReplenishmentRuleListOptions, ReplenishmentRulesModule, ReplenishmentSuggestion, ReplenishmentSuggestionListOptions, ReplenishmentSuggestionsModule, ReplenishmentSupplier, ReplenishmentVariant, ResolveSupplierReturnLineInput, ReverseGoodsReceiptInput, ShipSupplierReturnInput, Supplier, SupplierAddress, SupplierAddressInput, SupplierContact, SupplierContactFields, SupplierContactsModule, SupplierFields, SupplierItem, SupplierItemFields, SupplierItemImportResult, SupplierItemImportRowResult, SupplierItemListOptions, SupplierItemPrice, SupplierItemPriceInput, SupplierItemPricesModule, SupplierItemPricesOptions, SupplierItemRow, SupplierItemSupplier, SupplierItemsBulkUpsertInput, SupplierItemsModule, SupplierItemVariant, SupplierListOptions, SupplierPriceListImportInput, SupplierReturn, SupplierReturnCancelOptions, SupplierReturnDocumentUrl, SupplierReturnKeyedCall, SupplierReturnLine, SupplierReturnLineInput, SupplierReturnListOptions, SupplierReturnOrigin, SupplierReturnOutcome, SupplierReturnResolution, SupplierReturnStatus, SupplierReturnStatusEntry, SupplierStatusOptions, UpdatePurchaseOrderInput, UpdatePurchaseOrderLineInput, UpdatePurchasingNumberingInput, UpdatePurchasingSettingsInput, UpdateSupplierContactInput, UpdateSupplierInput, UpdateSupplierReturnInput, VariantCost, VariantCostCause, VariantCostEntry, VariantCostEntryList, VariantCostHistoryOptions, } from './purchasing/index.js';
|
|
222
|
+
export type { AddGoodsReceiptChargeInput, BackorderReadyLine, BackordersReadyOptions, BackToBackLinkQuantities, BackToBackLinkResult, CreateBackToBackLinkInput, CreatePurchaseOrderInput, CreateSupplierContactInput, CreateSupplierInput, CreateSupplierReturnInput, DropShipShipmentFulfillment, DropShipShipmentResult, GoodsReceipt, GoodsReceiptChargesModule, GoodsReceiptDetail, GoodsReceiptKeyedCall, GoodsReceiptKind, GoodsReceiptLine, GoodsReceiptListOptions, GoodsReceiptReference, GoodsReceiptTraceability, GoodsReceiptTraceabilityInput, LandedCharge, LandedChargeAllocation, LandedChargeAllocationBasis, LandedChargeKind, OverrideVariantCostInput, PostGoodsReceiptInput, PostGoodsReceiptLineInput, PurchaseOrder, PurchaseOrderCancelOptions, PurchaseOrderConfirmation, PurchaseOrderConfirmationInput, PurchaseOrderDocumentOptions, PurchaseOrderDocumentUrl, PurchaseOrderDropShip, PurchaseOrderDropShipLine, PurchaseOrderHeaderFields, PurchaseOrderKeyedCall, PurchaseOrderLine, PurchaseOrderLineConfirmationInput, PurchaseOrderLineImportOptions, PurchaseOrderLineImportResult, PurchaseOrderLineImportRow, PurchaseOrderLineInput, PurchaseOrderLinesModule, PurchaseOrderLink, PurchaseOrderLinkKind, PurchaseOrderLinkReleaseReason, PurchaseOrderLinkStatus, PurchaseOrderListOptions, PurchaseOrderLocation, PurchaseOrderReasonOptions, PurchaseOrderRevision, PurchaseOrderRevisionInput, PurchaseOrderRevisionsModule, PurchaseOrderSendCall, PurchaseOrderSendVia, PurchaseOrderStatus, PurchaseOrderStatusEntry, PurchaseOrderSupplier, PurchasingAlert, PurchasingAlertRecipients, PurchasingAlertRecipientsInput, PurchasingAlertRecipientsModule, PurchasingAlertSummary, PurchasingAlertsModule, PurchasingBackordersModule, PurchasingBackToBackLinksModule, PurchasingCostModule, PurchasingDropShipLinksModule, PurchasingLinksModule, PurchasingModule, PurchasingNumbering, PurchasingNumberingKind, PurchasingNumberingModule, PurchasingPurchaseOrdersModule, PurchasingReceiptsModule, PurchasingReplenishmentModule, PurchasingReturnsModule, PurchasingSettings, PurchasingSettingsModule, PurchasingSuppliersModule, ReceivablePurchaseOrderLine, ReceivablePurchaseOrderLinesOptions, RecordDropShipShipmentInput, RemoveGoodsReceiptChargeInput, ReplenishmentComputeResult, ReplenishmentDraftLine, ReplenishmentDrafts, ReplenishmentLocation, ReplenishmentRule, ReplenishmentRuleFields, ReplenishmentRuleImportInput, ReplenishmentRuleImportResult, ReplenishmentRuleImportRow, ReplenishmentRuleListOptions, ReplenishmentRulesModule, ReplenishmentSuggestion, ReplenishmentSuggestionListOptions, ReplenishmentSuggestionsModule, ReplenishmentSupplier, ReplenishmentVariant, ResolveSupplierReturnLineInput, ReverseGoodsReceiptInput, ShipSupplierReturnInput, Supplier, SupplierAddress, SupplierAddressInput, SupplierContact, SupplierContactFields, SupplierContactsModule, SupplierFields, SupplierItem, SupplierItemFields, SupplierItemImportResult, SupplierItemImportRowResult, SupplierItemListOptions, SupplierItemPrice, SupplierItemPriceInput, SupplierItemPricesModule, SupplierItemPricesOptions, SupplierItemRow, SupplierItemSupplier, SupplierItemsBulkUpsertInput, SupplierItemsModule, SupplierItemVariant, SupplierListOptions, SupplierPriceListImportInput, SupplierReturn, SupplierReturnCancelOptions, SupplierReturnDocumentUrl, SupplierReturnKeyedCall, SupplierReturnLine, SupplierReturnLineInput, SupplierReturnListOptions, SupplierReturnOrigin, SupplierReturnOutcome, SupplierReturnResolution, SupplierReturnStatus, SupplierReturnStatusEntry, SupplierStatusOptions, UpdatePurchaseOrderInput, UpdatePurchaseOrderLineInput, UpdatePurchasingNumberingInput, UpdatePurchasingSettingsInput, UpdateSupplierContactInput, UpdateSupplierInput, UpdateSupplierReturnInput, VariantCost, VariantCostCause, VariantCostEntry, VariantCostEntryList, VariantCostHistoryOptions, } from './purchasing/index.js';
|
|
222
223
|
export type { AddQuoteLineInput, ConvertedQuoteOrder, CreateDraftQuoteInput, ExtendQuoteValidityInput, KeyedQuoteCall, Quote, QuoteConfig, QuoteConfigModule, QuoteDocument, QuoteLine, QuoteLineDiscountType, QuoteLinesModule, QuoteLineVariant, QuoteList, QuoteListOptions, QuoteSalesRepresentative, QuoteSettings, QuoteSettingsModule, QuoteStatus, QuoteStatusLogEntry, QuotesModule, SetQuotePricingInput, UpdateQuoteConfigInput, UpdateQuoteLineInput, } from './quotes/index.js';
|
|
223
224
|
export { QUOTE_STATUSES } from './quotes/index.js';
|
|
224
225
|
export type { ArAgingRow, LowStockInput, LowStockVariant, PopularVariant, PopularVariantsInput, ReportDay, ReportExport, ReportExportFilter, ReportExportKind, ReportLastDays, ReportOverview, ReportOverviewInput, ReportPeriod, ReportsModule, ReportTotals, } from './reports/index.js';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call } from '../types.js';
|
|
3
|
+
/** Where a currency's effective rate comes from. */
|
|
4
|
+
export type StoreExchangeRateSource = 'OVERRIDE' | 'SYNCED' | 'NONE';
|
|
5
|
+
/**
|
|
6
|
+
* One currency the active store sells besides its default, as the engine reads it.
|
|
7
|
+
*
|
|
8
|
+
* Every rate is FROM the store's default currency TO `currencyCode` (1 unit of the default buys
|
|
9
|
+
* `rate` units of the currency), written as an exact decimal STRING, never a float. Parse it only
|
|
10
|
+
* to convert: `Number(effectiveRate)` is exactly the number the engine converts with. On a store
|
|
11
|
+
* whose default is EUR an override or a synced rate comes back as stored; on any other store a
|
|
12
|
+
* rate is the converters' cross rate, the shortest string that reads back as that number, so it
|
|
13
|
+
* may carry up to 17 significant digits (an override `"1.47"` can read `"1.4700000000000002"`).
|
|
14
|
+
*/
|
|
15
|
+
export interface StoreExchangeRate {
|
|
16
|
+
/** ISO 4217, upper case. */
|
|
17
|
+
currencyCode: string;
|
|
18
|
+
/**
|
|
19
|
+
* The store's default currency every rate of this row is quoted FROM. A client that keeps rows
|
|
20
|
+
* (a cache) prices only with a row quoted from the default it prices from now: after the store's
|
|
21
|
+
* default changes, an older row is no rate.
|
|
22
|
+
*/
|
|
23
|
+
fromCurrencyCode: string;
|
|
24
|
+
/** The synced market rate; null when the feed has none for this currency or the default. */
|
|
25
|
+
syncedRate: string | null;
|
|
26
|
+
/** The store's override as stored, whether or not it applies; null when none is stored. */
|
|
27
|
+
override: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The stored override is what this currency converts at. False for an override written before
|
|
30
|
+
* the write rule that is not a usable rate, and for EUR (the base every rate is quoted against,
|
|
31
|
+
* never overridden): those convert at the synced rate. False too for every override on a store
|
|
32
|
+
* whose default currency has no synced rate: the engine cannot convert there at all
|
|
33
|
+
* (`effectiveRate` null).
|
|
34
|
+
*/
|
|
35
|
+
honoured: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The rate this currency converts at TODAY, everywhere the store converts money (prices,
|
|
38
|
+
* checkout, minimums, shipping, promotions, feeds), read from the converters themselves: from
|
|
39
|
+
* the honoured override, else the synced rate; null when the store cannot convert the currency.
|
|
40
|
+
* A placed order keeps the rate it was placed at.
|
|
41
|
+
*/
|
|
42
|
+
effectiveRate: string | null;
|
|
43
|
+
source: StoreExchangeRateSource;
|
|
44
|
+
/** ISO-8601 UTC as-of of the synced rate (the older of its two legs for a cross rate). */
|
|
45
|
+
rateDate: string | null;
|
|
46
|
+
/** The synced rate's provider (`ecb`, `fixer`, …). */
|
|
47
|
+
provider: string | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The ACTIVE store's exchange rates (`admin.pricing.exchangeRates`). Reading needs staff access
|
|
51
|
+
* to the store (any permission there); writing needs `UpdateChannel` (overrides are stored on the
|
|
52
|
+
* channel and written through core `updateChannel`).
|
|
53
|
+
*
|
|
54
|
+
* The engine owns the rule: which override applies and what rate a currency converts at are never
|
|
55
|
+
* worked out in the client.
|
|
56
|
+
*/
|
|
57
|
+
export interface PricingExchangeRatesModule {
|
|
58
|
+
/**
|
|
59
|
+
* One row per currency the store sells besides its default, in the store's own order.
|
|
60
|
+
*
|
|
61
|
+
* @effect read
|
|
62
|
+
*/
|
|
63
|
+
list(options?: Call): Promise<StoreExchangeRate[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Replace ALL of the store's overrides with `overrides` (currency code → rate), and answer the
|
|
66
|
+
* rates as the engine now reads them. An empty map clears every override. Read with
|
|
67
|
+
* {@link list}, change what you mean to, send the whole map back.
|
|
68
|
+
*
|
|
69
|
+
* An override changes what customers are charged in that currency from the moment it is saved.
|
|
70
|
+
*
|
|
71
|
+
* Refused, with nothing written, `EXCHANGE_RATE_OVERRIDE_INVALID` (`ValidationError`, 400), one
|
|
72
|
+
* `details[]` entry per refused currency, `field` = `exchangeRateOverrides.<CODE>` and `code`
|
|
73
|
+
* one of:
|
|
74
|
+
* - `INVALID_RATE`: not a positive decimal written with a dot and at most 8 decimals
|
|
75
|
+
* (`"1.2500"`; never `1e2`, `-1`, `0`);
|
|
76
|
+
* - `INVALID_CURRENCY_CODE`: not a three-letter upper-case code;
|
|
77
|
+
* - `NOT_OFFERED`: a currency the store does not sell;
|
|
78
|
+
* - `DEFAULT_CURRENCY`: the store's default (every rate is quoted from it);
|
|
79
|
+
* - `BASE_CURRENCY`: EUR, the base every rate is quoted against.
|
|
80
|
+
*
|
|
81
|
+
* `FORBIDDEN` without `UpdateChannel`.
|
|
82
|
+
*
|
|
83
|
+
* @effect money
|
|
84
|
+
*/
|
|
85
|
+
setOverrides(overrides: Readonly<Record<string, string>>, options?: Call): Promise<StoreExchangeRate[]>;
|
|
86
|
+
}
|
|
87
|
+
export declare const STORE_EXCHANGE_RATES_QUERY = "\n query StoreExchangeRates {\n storeExchangeRates {\n currencyCode\n fromCurrencyCode\n syncedRate\n override\n honoured\n effectiveRate\n source\n rateDate\n provider\n }\n }\n";
|
|
88
|
+
/** The save's first step: the channel `updateChannel` must be given, in the save's own call. */
|
|
89
|
+
export declare const EXCHANGE_RATE_OVERRIDES_TARGET_QUERY = "\n query ExchangeRateOverridesTarget {\n activeChannel { id }\n }\n";
|
|
90
|
+
export declare const SET_EXCHANGE_RATE_OVERRIDES_MUTATION = "\n mutation SetExchangeRateOverrides($input: UpdateChannelInput!) {\n updateChannel(input: $input) {\n ... on Channel { id }\n ... on ErrorResult { errorCode message }\n }\n }\n";
|
|
91
|
+
export declare function createPricingExchangeRatesModule(transport: Transport): PricingExchangeRatesModule;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { errorFromErrorResult, isErrorResult, } from '@sixtyninecommerce/core';
|
|
2
|
+
export const STORE_EXCHANGE_RATES_QUERY = /* GraphQL */ `
|
|
3
|
+
query StoreExchangeRates {
|
|
4
|
+
storeExchangeRates {
|
|
5
|
+
currencyCode
|
|
6
|
+
fromCurrencyCode
|
|
7
|
+
syncedRate
|
|
8
|
+
override
|
|
9
|
+
honoured
|
|
10
|
+
effectiveRate
|
|
11
|
+
source
|
|
12
|
+
rateDate
|
|
13
|
+
provider
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
/** The save's first step: the channel `updateChannel` must be given, in the save's own call. */
|
|
18
|
+
export const EXCHANGE_RATE_OVERRIDES_TARGET_QUERY = /* GraphQL */ `
|
|
19
|
+
query ExchangeRateOverridesTarget {
|
|
20
|
+
activeChannel { id }
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
export const SET_EXCHANGE_RATE_OVERRIDES_MUTATION = /* GraphQL */ `
|
|
24
|
+
mutation SetExchangeRateOverrides($input: UpdateChannelInput!) {
|
|
25
|
+
updateChannel(input: $input) {
|
|
26
|
+
... on Channel { id }
|
|
27
|
+
... on ErrorResult { errorCode message }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
export function createPricingExchangeRatesModule(transport) {
|
|
32
|
+
const list = async (options) => {
|
|
33
|
+
const data = await transport.graphql({ api: 'admin', query: STORE_EXCHANGE_RATES_QUERY }, options);
|
|
34
|
+
return data.storeExchangeRates;
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
list,
|
|
38
|
+
async setOverrides(overrides, options) {
|
|
39
|
+
// Sent as given: the engine judges every entry and names each one it refuses.
|
|
40
|
+
const entries = Object.entries(overrides);
|
|
41
|
+
const target = await transport.graphql({ api: 'admin', query: EXCHANGE_RATE_OVERRIDES_TARGET_QUERY }, options);
|
|
42
|
+
const data = await transport.graphql({
|
|
43
|
+
api: 'admin',
|
|
44
|
+
query: SET_EXCHANGE_RATE_OVERRIDES_MUTATION,
|
|
45
|
+
variables: {
|
|
46
|
+
input: {
|
|
47
|
+
id: target.activeChannel.id,
|
|
48
|
+
customFields: {
|
|
49
|
+
// `null` is the column's "none"; the engine reads `{}` the same way.
|
|
50
|
+
exchangeRateOverrides: entries.length === 0 ? null : JSON.stringify(Object.fromEntries(entries)),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}, options);
|
|
55
|
+
if (isErrorResult(data.updateChannel))
|
|
56
|
+
throw errorFromErrorResult(data.updateChannel);
|
|
57
|
+
return list(options);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
package/dist/pricing/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
|
2
2
|
import { type ConfigurableOperation, type ConfigurableOperationInput, type LanguageCode } from '../catalog/types.js';
|
|
3
3
|
import type { Call, ConfigurableOperationDefinition, ListOptions } from '../types.js';
|
|
4
4
|
import { type PricingBulkCouponsModule } from './bulk-coupons.js';
|
|
5
|
+
import { type PricingExchangeRatesModule } from './exchange-rates.js';
|
|
5
6
|
import { type PricingPriceListsModule } from './price-lists.js';
|
|
6
7
|
import { type PricingVouchersModule } from './vouchers.js';
|
|
7
8
|
/**
|
|
@@ -43,6 +44,11 @@ export interface PricingModule {
|
|
|
43
44
|
* bulk enable/disable/delete (`./price-lists.ts`).
|
|
44
45
|
*/
|
|
45
46
|
priceLists: PricingPriceListsModule;
|
|
47
|
+
/**
|
|
48
|
+
* The store's exchange rates and its overrides, as the engine reads them
|
|
49
|
+
* (`./exchange-rates.ts`).
|
|
50
|
+
*/
|
|
51
|
+
exchangeRates: PricingExchangeRatesModule;
|
|
46
52
|
/**
|
|
47
53
|
* The order's discounts as they stand: its coupon codes, the order-level
|
|
48
54
|
* discounts, and each line's discounts, every one naming the promotion it came
|