@sixtyninecommerce/admin 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4347 -171
- package/dist/catalog/assets.d.ts +120 -8
- package/dist/catalog/assets.js +98 -12
- package/dist/catalog/collections.d.ts +279 -14
- package/dist/catalog/collections.js +246 -15
- package/dist/catalog/index.d.ts +9 -2
- package/dist/catalog/index.js +4 -0
- package/dist/catalog/products.d.ts +159 -19
- package/dist/catalog/products.js +88 -13
- package/dist/catalog/properties.d.ts +102 -14
- package/dist/catalog/properties.js +13 -0
- package/dist/catalog/recommendations.d.ts +261 -0
- package/dist/catalog/recommendations.js +145 -0
- package/dist/catalog/reviews.d.ts +368 -0
- package/dist/catalog/reviews.js +318 -0
- package/dist/catalog/types.d.ts +17 -1
- package/dist/catalog/types.js +10 -0
- package/dist/catalog/variant-find.d.ts +136 -0
- package/dist/catalog/variant-find.js +239 -0
- package/dist/catalog/variants.d.ts +233 -26
- package/dist/catalog/variants.js +125 -7
- package/dist/catalog/visibility.d.ts +20 -5
- package/dist/catalog/visibility.js +19 -1
- package/dist/client.d.ts +95 -9
- package/dist/client.js +35 -7
- package/dist/content/assets.d.ts +286 -0
- package/dist/content/assets.js +181 -0
- package/dist/content/items.d.ts +269 -0
- package/dist/content/items.js +170 -0
- package/dist/content/types.d.ts +282 -0
- package/dist/content/types.js +100 -0
- package/dist/customers/age-verification.d.ts +66 -0
- package/dist/customers/age-verification.js +79 -0
- package/dist/customers/credit.d.ts +263 -0
- package/dist/customers/credit.js +244 -0
- package/dist/customers/delivery-preferences.d.ts +120 -0
- package/dist/customers/delivery-preferences.js +97 -0
- package/dist/customers/groups.d.ts +207 -0
- package/dist/customers/groups.js +438 -0
- package/dist/customers/index.d.ts +447 -37
- package/dist/customers/index.js +313 -40
- package/dist/customers/invitation-status.d.ts +57 -0
- package/dist/customers/invitation-status.js +21 -0
- package/dist/customers/notes.d.ts +67 -0
- package/dist/customers/notes.js +51 -0
- package/dist/customers/notification-recipients.d.ts +97 -0
- package/dist/customers/notification-recipients.js +84 -0
- package/dist/customers/saved-lists.d.ts +42 -0
- package/dist/customers/saved-lists.js +61 -0
- package/dist/customers/vat.d.ts +83 -0
- package/dist/customers/vat.js +46 -0
- package/dist/customers/wire.d.ts +20 -0
- package/dist/customers/wire.js +35 -0
- package/dist/documents/ar.d.ts +307 -0
- package/dist/documents/ar.js +254 -0
- package/dist/documents/index.d.ts +731 -21
- package/dist/documents/index.js +436 -24
- package/dist/documents/pdf.d.ts +2 -0
- package/dist/documents/pdf.js +11 -0
- package/dist/fulfillments/create.d.ts +167 -0
- package/dist/fulfillments/create.js +216 -0
- package/dist/fulfillments/index.d.ts +44 -10
- package/dist/fulfillments/index.js +11 -2
- package/dist/fulfillments/payment-policy.d.ts +64 -0
- package/dist/fulfillments/payment-policy.js +140 -0
- package/dist/fulfillments/warehouse.d.ts +724 -0
- package/dist/fulfillments/warehouse.js +914 -0
- package/dist/geo/index.d.ts +119 -0
- package/dist/geo/index.js +107 -0
- package/dist/index.d.ts +123 -35
- package/dist/index.js +45 -12
- package/dist/integrations/afas-actions.d.ts +234 -0
- package/dist/integrations/afas-actions.js +310 -0
- package/dist/integrations/afas-types.d.ts +483 -0
- package/dist/integrations/afas-types.js +5 -0
- package/dist/integrations/afas.d.ts +234 -0
- package/dist/integrations/afas.js +290 -0
- package/dist/integrations/connections.d.ts +103 -0
- package/dist/integrations/connections.js +55 -0
- package/dist/integrations/esp.d.ts +313 -0
- package/dist/integrations/esp.js +169 -0
- package/dist/integrations/exact-online-types.d.ts +423 -0
- package/dist/integrations/exact-online-types.js +6 -0
- package/dist/integrations/exact-online.d.ts +248 -0
- package/dist/integrations/exact-online.js +376 -0
- package/dist/integrations/index.d.ts +29 -3
- package/dist/integrations/index.js +18 -3
- package/dist/integrations/pipeline-keys.d.ts +13 -0
- package/dist/integrations/pipeline-keys.js +22 -0
- package/dist/integrations/pipelines.d.ts +15 -14
- package/dist/integrations/pipelines.js +6 -22
- package/dist/integrations/types.d.ts +146 -0
- package/dist/locations/index.d.ts +66 -0
- package/dist/locations/index.js +31 -0
- package/dist/meta/index.d.ts +162 -0
- package/dist/orders/cancel-with-money.d.ts +227 -0
- package/dist/orders/cancel-with-money.js +153 -0
- package/dist/orders/commit-edit.d.ts +7 -1
- package/dist/orders/commit-edit.js +5 -1
- package/dist/orders/drafts.d.ts +800 -0
- package/dist/orders/drafts.js +771 -0
- package/dist/orders/fields.d.ts +245 -0
- package/dist/orders/fields.js +188 -0
- package/dist/orders/get.d.ts +29 -19
- package/dist/orders/get.js +17 -8
- package/dist/orders/index.d.ts +49 -9
- package/dist/orders/index.js +22 -2
- package/dist/orders/lifecycle.d.ts +128 -0
- package/dist/orders/lifecycle.js +158 -0
- package/dist/orders/line-price-preview.d.ts +7 -2
- package/dist/orders/list.d.ts +222 -0
- package/dist/orders/list.js +377 -0
- package/dist/orders/manual-pricing.d.ts +5 -0
- package/dist/orders/order-entry.d.ts +20 -7
- package/dist/orders/plan-edit.d.ts +1 -1
- package/dist/orders/plan-edit.js +4 -1
- package/dist/orders/settings.d.ts +201 -0
- package/dist/orders/settings.js +325 -0
- package/dist/orders/status.d.ts +159 -13
- package/dist/orders/status.js +21 -0
- package/dist/orders/surcharges.d.ts +8 -1
- package/dist/orders/surcharges.js +3 -2
- package/dist/payments/account-credit.d.ts +30 -0
- package/dist/payments/account-credit.js +19 -0
- package/dist/payments/ar.d.ts +292 -0
- package/dist/payments/ar.js +223 -0
- package/dist/payments/connected-account.d.ts +47 -0
- package/dist/payments/connected-account.js +61 -0
- package/dist/payments/credit-noted-fields.d.ts +12 -0
- package/dist/payments/credit-noted-fields.js +37 -0
- package/dist/payments/index.d.ts +257 -11
- package/dist/payments/index.js +131 -1
- package/dist/payments/methods.d.ts +303 -8
- package/dist/payments/methods.js +337 -7
- package/dist/payments/mollie-methods.d.ts +159 -0
- package/dist/payments/mollie-methods.js +141 -0
- package/dist/payments/payment-links.d.ts +180 -0
- package/dist/payments/payment-links.js +97 -0
- package/dist/payments/provider-keys.d.ts +150 -0
- package/dist/payments/provider-keys.js +118 -0
- package/dist/payments/providers.d.ts +86 -11
- package/dist/payments/providers.js +29 -0
- package/dist/payments/requests.d.ts +144 -0
- package/dist/payments/requests.js +92 -0
- package/dist/payments/store-credit-fields.d.ts +15 -0
- package/dist/payments/store-credit-fields.js +51 -0
- package/dist/pickups/index.d.ts +104 -0
- package/dist/pickups/index.js +105 -0
- package/dist/platform/channels.d.ts +132 -0
- package/dist/platform/channels.js +128 -0
- package/dist/platform/geo.d.ts +123 -0
- package/dist/platform/geo.js +144 -0
- package/dist/platform/tax.d.ts +154 -0
- package/dist/platform/tax.js +139 -0
- package/dist/pos/anomalies.d.ts +158 -0
- package/dist/pos/anomalies.js +64 -0
- package/dist/pos/assisted-selling.d.ts +79 -0
- package/dist/pos/assisted-selling.js +38 -0
- package/dist/pos/exchanges.d.ts +103 -0
- package/dist/pos/exchanges.js +22 -0
- package/dist/pos/gift-cards.d.ts +135 -0
- package/dist/pos/gift-cards.js +47 -0
- package/dist/pos/index.d.ts +2125 -32
- package/dist/pos/index.js +742 -4
- package/dist/pos/no-receipt.d.ts +94 -0
- package/dist/pos/no-receipt.js +25 -0
- package/dist/pos/offline-sales.d.ts +187 -0
- package/dist/pos/offline-sales.js +116 -0
- package/dist/pos/pay-by-link.d.ts +143 -0
- package/dist/pos/pay-by-link.js +57 -0
- package/dist/pos/quick-keys.d.ts +103 -0
- package/dist/pos/quick-keys.js +45 -0
- package/dist/pos/reports.d.ts +360 -0
- package/dist/pos/reports.js +62 -0
- package/dist/pos/returns.d.ts +217 -0
- package/dist/pos/returns.js +53 -0
- package/dist/pricing/bulk-coupons.d.ts +139 -0
- package/dist/pricing/bulk-coupons.js +112 -0
- package/dist/pricing/index.d.ts +174 -4
- package/dist/pricing/index.js +174 -1
- package/dist/pricing/price-lists.d.ts +604 -0
- package/dist/pricing/price-lists.js +600 -0
- package/dist/purchasing/alerts.d.ts +89 -0
- package/dist/purchasing/alerts.js +62 -0
- package/dist/purchasing/cost.d.ts +110 -0
- package/dist/purchasing/cost.js +86 -0
- package/dist/purchasing/index.d.ts +36 -0
- package/dist/purchasing/index.js +16 -0
- package/dist/purchasing/purchase-orders.d.ts +548 -0
- package/dist/purchasing/purchase-orders.js +491 -0
- package/dist/purchasing/replenishment.d.ts +281 -0
- package/dist/purchasing/replenishment.js +240 -0
- package/dist/purchasing/settings.d.ts +152 -0
- package/dist/purchasing/settings.js +181 -0
- package/dist/purchasing/suppliers.d.ts +476 -0
- package/dist/purchasing/suppliers.js +438 -0
- package/dist/quotes/index.d.ts +501 -0
- package/dist/quotes/index.js +439 -0
- package/dist/reports/index.d.ts +71 -8
- package/dist/reports/index.js +74 -11
- package/dist/returns/index.d.ts +614 -21
- package/dist/returns/index.js +695 -11
- package/dist/search/index.d.ts +76 -1
- package/dist/search/index.js +63 -0
- package/dist/shipping/definitions.d.ts +29 -0
- package/dist/shipping/definitions.js +47 -0
- package/dist/shipping/fulfillment-profiles.d.ts +174 -0
- package/dist/shipping/fulfillment-profiles.js +104 -0
- package/dist/shipping/hendriks.d.ts +97 -0
- package/dist/shipping/hendriks.js +50 -0
- package/dist/shipping/index.d.ts +48 -0
- package/dist/shipping/index.js +25 -0
- package/dist/shipping/methods.d.ts +198 -0
- package/dist/shipping/methods.js +240 -0
- package/dist/shipping/myparcel.d.ts +254 -0
- package/dist/shipping/myparcel.js +178 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
- package/dist/shipping/parcel-rule.d.ts +6 -5
- package/dist/shipping/parcel-rule.js +21 -23
- package/dist/shipping/rate-tables.d.ts +179 -0
- package/dist/shipping/rate-tables.js +184 -0
- package/dist/stock/index.d.ts +10 -3
- package/dist/stock/index.js +3 -0
- package/dist/stock/locations.d.ts +144 -0
- package/dist/stock/locations.js +168 -0
- package/dist/stock/transfers.d.ts +216 -43
- package/dist/stock/transfers.js +140 -13
- package/dist/stored-value/index.d.ts +214 -4
- package/dist/stored-value/index.js +152 -0
- package/dist/subscriptions/index.d.ts +682 -0
- package/dist/subscriptions/index.js +815 -0
- package/dist/tax/index.d.ts +76 -1
- package/dist/tax/index.js +50 -0
- package/dist/tenant/email-style.d.ts +102 -0
- package/dist/tenant/email-style.js +72 -0
- package/dist/tenant/email-templates.d.ts +66 -0
- package/dist/tenant/email-templates.js +54 -0
- package/dist/tenant/notifications.d.ts +23 -17
- package/dist/tenant/settings-sources.d.ts +1 -1
- package/dist/tenant/time-zone.d.ts +17 -0
- package/dist/tenant/time-zone.js +11 -0
- package/dist/types.d.ts +50 -3
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +2 -0
- package/dist/users/warehouses.d.ts +50 -0
- package/dist/users/warehouses.js +51 -0
- package/package.json +2 -2
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A weight-zone rate table: what the `weight-zone-calculator` of a shipping method prices with.
|
|
5
|
+
* The engine calls it a `ShippingZoneConfig`; a method names it in its calculator argument
|
|
6
|
+
* `shippingZoneConfigId`.
|
|
7
|
+
*/
|
|
8
|
+
export interface RateTableSummary {
|
|
9
|
+
id: string;
|
|
10
|
+
/** Unique within the store. */
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Turns a variant's package dimensions into a volumetric weight: length × width × height in cm,
|
|
14
|
+
* divided by this, is kilograms. An order is charged for the greater of its actual and its
|
|
15
|
+
* volumetric weight. `0` prices by actual weight only.
|
|
16
|
+
*/
|
|
17
|
+
volumetricDivisor: number;
|
|
18
|
+
/** Grams a line weighs when its variant has no package weight; null weighs it as nothing. */
|
|
19
|
+
defaultWeightGrams: number | null;
|
|
20
|
+
/** A switched-off table prices nothing: every method using it quotes nothing. */
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
/** ISO-8601, UTC. */
|
|
23
|
+
createdAt: string;
|
|
24
|
+
/** ISO-8601, UTC. */
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
}
|
|
27
|
+
/** A place a domestic zone matches by postal code, or an international zone by country. */
|
|
28
|
+
export interface RateTableZoneMember {
|
|
29
|
+
id: string;
|
|
30
|
+
/** ISO 3166-1 alpha-2; an international zone's member. */
|
|
31
|
+
countryCode: string | null;
|
|
32
|
+
/** First digits of a postal code, start of the range; a domestic zone's member. */
|
|
33
|
+
postalCodeFrom: string | null;
|
|
34
|
+
/** End of the range, inclusive. */
|
|
35
|
+
postalCodeTo: string | null;
|
|
36
|
+
}
|
|
37
|
+
/** One weight tier's price in one currency. */
|
|
38
|
+
export interface RateTableRate {
|
|
39
|
+
id: string;
|
|
40
|
+
/** Inclusive. */
|
|
41
|
+
minWeightGrams: number;
|
|
42
|
+
/** Exclusive: the tier covers weights from its start up to, not including, this. */
|
|
43
|
+
maxWeightGrams: number;
|
|
44
|
+
/** In MINOR units of {@link currencyCode}, in the tax basis the method's calculator says. */
|
|
45
|
+
price: number;
|
|
46
|
+
/** ISO 4217. */
|
|
47
|
+
currencyCode: string;
|
|
48
|
+
}
|
|
49
|
+
/** One zone of a rate table. */
|
|
50
|
+
export interface RateTableZone {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
/**
|
|
54
|
+
* `domestic` matches its members' postal-code ranges, `international` their countries. A zone
|
|
55
|
+
* stored before the engine judged the type may hold another word, which prices as
|
|
56
|
+
* `international`.
|
|
57
|
+
*/
|
|
58
|
+
type: string;
|
|
59
|
+
/** Zones are matched in position order; the first that matches the address prices the order. */
|
|
60
|
+
position: number;
|
|
61
|
+
members: RateTableZoneMember[];
|
|
62
|
+
/**
|
|
63
|
+
* In start-weight order. An order is priced with the tier of its own currency that covers its
|
|
64
|
+
* weight; without one, with the store's default-currency tier converted at the checkout's
|
|
65
|
+
* exchange rate; without either, the method quotes nothing.
|
|
66
|
+
*/
|
|
67
|
+
rates: RateTableRate[];
|
|
68
|
+
/** ISO-8601, UTC. */
|
|
69
|
+
createdAt: string;
|
|
70
|
+
/** ISO-8601, UTC. */
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
/** A rate table with its zones, as {@link RateTablesModule.get} reads it. */
|
|
74
|
+
export interface RateTable extends RateTableSummary {
|
|
75
|
+
/** In position order. */
|
|
76
|
+
zones: RateTableZone[];
|
|
77
|
+
}
|
|
78
|
+
/** A new rate table, as {@link RateTablesModule.create} takes it. It starts switched on. */
|
|
79
|
+
export interface CreateRateTableInput {
|
|
80
|
+
/** Trimmed; at most 255 characters. */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Left out: 5000. See {@link RateTableSummary.volumetricDivisor}. */
|
|
83
|
+
volumetricDivisor?: number;
|
|
84
|
+
/** Left out or null: none. See {@link RateTableSummary.defaultWeightGrams}. */
|
|
85
|
+
defaultWeightGrams?: number | null;
|
|
86
|
+
}
|
|
87
|
+
/** A change to a rate table: a field left out keeps what the table has. */
|
|
88
|
+
export interface UpdateRateTableInput {
|
|
89
|
+
name?: string;
|
|
90
|
+
volumetricDivisor?: number;
|
|
91
|
+
/** `null` clears it. */
|
|
92
|
+
defaultWeightGrams?: number | null;
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* `admin.shipping.rateTables`: the store's weight-zone rate tables (headless spec §9.2
|
|
97
|
+
* `shipping`, "zones, calculator config"). Scoped to the store the client is on: another
|
|
98
|
+
* store's table is not listed, reads as null and is refused as not found, whatever its id.
|
|
99
|
+
*
|
|
100
|
+
* Every refusal of the engine's rate-table doors carries a code:
|
|
101
|
+
*
|
|
102
|
+
* - `SHIPPING_ZONE_INPUT_INVALID` (`ValidationError`, 400): what was sent cannot be stored.
|
|
103
|
+
* `error.details[]` names EVERY problem of the save at once, each with `field`, a JSON Pointer
|
|
104
|
+
* into the arguments (`/input/name`, `/input/volumetricDivisor`), and `code`, the rule broken
|
|
105
|
+
* (`required`, `type`, `minimum`, `maximum`, `maxLength`). The SDK raises the same code, with
|
|
106
|
+
* the same pointers, for a value it cannot send at all (not a string, not a whole number
|
|
107
|
+
* GraphQL's `Int` carries), before anything leaves.
|
|
108
|
+
* - `SHIPPING_ZONE_CONFIG_NAME_TAKEN` (`ConflictError`, 409): another table of this store has
|
|
109
|
+
* the name (`details[0].field` is `/input/name`). Another store's names are free.
|
|
110
|
+
* - `SHIPPING_ZONE_CONFIG_IN_USE` (`BusinessRuleError`, 422): a delete of a table a shipping
|
|
111
|
+
* method of this store prices with. The message names the methods (three, then "and N more");
|
|
112
|
+
* the engine also lists them as `extensions.shippingMethods` (`{ id, code, name }`), which this
|
|
113
|
+
* SDK does not lift onto the error. Nothing is deleted.
|
|
114
|
+
* - `ENTITY_NOT_FOUND` (`NotFoundError`, 404): an update of a table the store does not have (a
|
|
115
|
+
* missing, malformed or another store's id read alike).
|
|
116
|
+
* - `FORBIDDEN` (`PermissionDeniedError`, 403): reads need `ReadSettings`, writes
|
|
117
|
+
* `UpdateSettings` (a create and a delete too).
|
|
118
|
+
*
|
|
119
|
+
* Every write runs in one transaction: a refused write changes nothing.
|
|
120
|
+
*/
|
|
121
|
+
export interface RateTablesModule {
|
|
122
|
+
/**
|
|
123
|
+
* Every rate table of the store, switched off or not, newest first. Not paged: a store has a
|
|
124
|
+
* handful.
|
|
125
|
+
*
|
|
126
|
+
* @effect read
|
|
127
|
+
* @permission ReadSettings
|
|
128
|
+
*/
|
|
129
|
+
list(options?: Call): Promise<RateTableSummary[]>;
|
|
130
|
+
/**
|
|
131
|
+
* One rate table with its zones, their members and rates, or `null` when the store has no
|
|
132
|
+
* such table (a missing, malformed or another store's id read alike).
|
|
133
|
+
*
|
|
134
|
+
* @effect read
|
|
135
|
+
* @permission ReadSettings
|
|
136
|
+
*/
|
|
137
|
+
get(id: string, options?: Call): Promise<RateTable | null>;
|
|
138
|
+
/**
|
|
139
|
+
* Add a rate table to the store, switched on and with no zones, and answer it as {@link get}
|
|
140
|
+
* reads it. Refused `SHIPPING_ZONE_INPUT_INVALID` (a blank or too long name, a negative
|
|
141
|
+
* divisor or default weight) or `SHIPPING_ZONE_CONFIG_NAME_TAKEN`.
|
|
142
|
+
*
|
|
143
|
+
* @effect write
|
|
144
|
+
* @permission UpdateSettings
|
|
145
|
+
*/
|
|
146
|
+
create(input: CreateRateTableInput, options?: Call): Promise<RateTable>;
|
|
147
|
+
/**
|
|
148
|
+
* Change a rate table, and answer it as {@link get} reads it. Every method pricing with it
|
|
149
|
+
* quotes by the change from the next quote on, and switching it off makes them quote nothing
|
|
150
|
+
* (allowed: it is the switch's purpose, and it is undone by switching it back on).
|
|
151
|
+
*
|
|
152
|
+
* Refused `SHIPPING_ZONE_INPUT_INVALID` (as {@link create}, and `null` for the name, the
|
|
153
|
+
* divisor or `enabled`, which cannot be cleared), `SHIPPING_ZONE_CONFIG_NAME_TAKEN` or
|
|
154
|
+
* `ENTITY_NOT_FOUND`.
|
|
155
|
+
*
|
|
156
|
+
* @effect write
|
|
157
|
+
* @permission UpdateSettings
|
|
158
|
+
*/
|
|
159
|
+
update(id: string, patch: UpdateRateTableInput, options?: Call): Promise<RateTable>;
|
|
160
|
+
/**
|
|
161
|
+
* Delete a rate table with its zones, members and rates. Refused
|
|
162
|
+
* `SHIPPING_ZONE_CONFIG_IN_USE` while a shipping method of this store prices with it (give the
|
|
163
|
+
* method another table, or delete it, first).
|
|
164
|
+
*
|
|
165
|
+
* The engine answers a table the store does not have (a missing, malformed or another store's
|
|
166
|
+
* id, or one already deleted) as a result rather than an error; this SDK raises it as
|
|
167
|
+
* `SHIPPING_ZONE_CONFIG_NOT_DELETED` (`ConflictError`, 409) with the engine's reason.
|
|
168
|
+
*
|
|
169
|
+
* @effect destructive
|
|
170
|
+
* @permission UpdateSettings
|
|
171
|
+
*/
|
|
172
|
+
delete(id: string, options?: Call): Promise<void>;
|
|
173
|
+
}
|
|
174
|
+
export declare const RATE_TABLES_QUERY = "\n query StoreRateTables {\n shippingZoneConfigs { \n id\n name\n volumetricDivisor\n defaultWeightGrams\n enabled\n createdAt\n updatedAt\n }\n }\n";
|
|
175
|
+
export declare const RATE_TABLE_QUERY = "\n query StoreRateTable($id: ID!) {\n shippingZoneConfig(id: $id) { \n \n id\n name\n volumetricDivisor\n defaultWeightGrams\n enabled\n createdAt\n updatedAt\n\n zones {\n id\n name\n type\n position\n members {\n id\n countryCode\n postalCodeFrom\n postalCodeTo\n }\n rates {\n id\n minWeightGrams\n maxWeightGrams\n price\n currencyCode\n }\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
176
|
+
export declare const CREATE_RATE_TABLE_MUTATION = "\n mutation CreateStoreRateTable($input: CreateShippingZoneConfigInput!) {\n createShippingZoneConfig(input: $input) { \n \n id\n name\n volumetricDivisor\n defaultWeightGrams\n enabled\n createdAt\n updatedAt\n\n zones {\n id\n name\n type\n position\n members {\n id\n countryCode\n postalCodeFrom\n postalCodeTo\n }\n rates {\n id\n minWeightGrams\n maxWeightGrams\n price\n currencyCode\n }\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
177
|
+
export declare const UPDATE_RATE_TABLE_MUTATION = "\n mutation UpdateStoreRateTable($id: ID!, $input: UpdateShippingZoneConfigInput!) {\n updateShippingZoneConfig(id: $id, input: $input) { \n \n id\n name\n volumetricDivisor\n defaultWeightGrams\n enabled\n createdAt\n updatedAt\n\n zones {\n id\n name\n type\n position\n members {\n id\n countryCode\n postalCodeFrom\n postalCodeTo\n }\n rates {\n id\n minWeightGrams\n maxWeightGrams\n price\n currencyCode\n }\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
178
|
+
export declare const DELETE_RATE_TABLE_MUTATION = "\n mutation DeleteStoreRateTable($id: ID!) {\n deleteShippingZoneConfig(id: $id) {\n result\n message\n }\n }\n";
|
|
179
|
+
export declare function createRateTablesModule(transport: Transport): RateTablesModule;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { ValidationError } from '@sixtyninecommerce/core';
|
|
2
|
+
import { assertDeleted, fieldOf } from '../catalog/types.js';
|
|
3
|
+
const SUMMARY_FIELDS = /* GraphQL */ `
|
|
4
|
+
id
|
|
5
|
+
name
|
|
6
|
+
volumetricDivisor
|
|
7
|
+
defaultWeightGrams
|
|
8
|
+
enabled
|
|
9
|
+
createdAt
|
|
10
|
+
updatedAt
|
|
11
|
+
`;
|
|
12
|
+
/** One selection for the single read and both writes, so all three answer the same table. */
|
|
13
|
+
const TABLE_FIELDS = /* GraphQL */ `
|
|
14
|
+
${SUMMARY_FIELDS}
|
|
15
|
+
zones {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
type
|
|
19
|
+
position
|
|
20
|
+
members {
|
|
21
|
+
id
|
|
22
|
+
countryCode
|
|
23
|
+
postalCodeFrom
|
|
24
|
+
postalCodeTo
|
|
25
|
+
}
|
|
26
|
+
rates {
|
|
27
|
+
id
|
|
28
|
+
minWeightGrams
|
|
29
|
+
maxWeightGrams
|
|
30
|
+
price
|
|
31
|
+
currencyCode
|
|
32
|
+
}
|
|
33
|
+
createdAt
|
|
34
|
+
updatedAt
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const RATE_TABLES_QUERY = /* GraphQL */ `
|
|
38
|
+
query StoreRateTables {
|
|
39
|
+
shippingZoneConfigs { ${SUMMARY_FIELDS} }
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
export const RATE_TABLE_QUERY = /* GraphQL */ `
|
|
43
|
+
query StoreRateTable($id: ID!) {
|
|
44
|
+
shippingZoneConfig(id: $id) { ${TABLE_FIELDS} }
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export const CREATE_RATE_TABLE_MUTATION = /* GraphQL */ `
|
|
48
|
+
mutation CreateStoreRateTable($input: CreateShippingZoneConfigInput!) {
|
|
49
|
+
createShippingZoneConfig(input: $input) { ${TABLE_FIELDS} }
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
export const UPDATE_RATE_TABLE_MUTATION = /* GraphQL */ `
|
|
53
|
+
mutation UpdateStoreRateTable($id: ID!, $input: UpdateShippingZoneConfigInput!) {
|
|
54
|
+
updateShippingZoneConfig(id: $id, input: $input) { ${TABLE_FIELDS} }
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
export const DELETE_RATE_TABLE_MUTATION = /* GraphQL */ `
|
|
58
|
+
mutation DeleteStoreRateTable($id: ID!) {
|
|
59
|
+
deleteShippingZoneConfig(id: $id) {
|
|
60
|
+
result
|
|
61
|
+
message
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
/** GraphQL's `Int`: a 32-bit signed integer. A wider number cannot be sent at all. */
|
|
66
|
+
const INT_MIN = -2_147_483_648;
|
|
67
|
+
const INT_MAX = 2_147_483_647;
|
|
68
|
+
/**
|
|
69
|
+
* Collects every problem of one call, and refuses them in ONE error with the engine's code and
|
|
70
|
+
* JSON Pointers, so a caller marks each field the same way whichever side refused.
|
|
71
|
+
*/
|
|
72
|
+
class Problems {
|
|
73
|
+
details = [];
|
|
74
|
+
add(field, code, message) {
|
|
75
|
+
this.details.push({ field, code, message });
|
|
76
|
+
}
|
|
77
|
+
throwIfAny() {
|
|
78
|
+
const [first, ...rest] = this.details;
|
|
79
|
+
if (!first)
|
|
80
|
+
return;
|
|
81
|
+
const more = rest.length;
|
|
82
|
+
throw new ValidationError({
|
|
83
|
+
code: 'SHIPPING_ZONE_INPUT_INVALID',
|
|
84
|
+
message: more === 0
|
|
85
|
+
? first.message
|
|
86
|
+
: `${first.message} ${String(more)} more ${more === 1 ? 'problem' : 'problems'} with this save.`,
|
|
87
|
+
status: 400,
|
|
88
|
+
service: 'vendure',
|
|
89
|
+
details: this.details,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
94
|
+
/**
|
|
95
|
+
* A whole number GraphQL's `Int` carries. Whether it is a sensible value (not negative) is the
|
|
96
|
+
* engine's to judge, so this refuses only what could not be sent.
|
|
97
|
+
*/
|
|
98
|
+
function intInput(problems, field, label, value) {
|
|
99
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value)) {
|
|
100
|
+
problems.add(field, 'type', `${label} must be a whole number.`);
|
|
101
|
+
}
|
|
102
|
+
else if (value > INT_MAX) {
|
|
103
|
+
problems.add(field, 'maximum', `${label} must be at most ${String(INT_MAX)}.`);
|
|
104
|
+
}
|
|
105
|
+
else if (value < INT_MIN) {
|
|
106
|
+
problems.add(field, 'minimum', `${label} cannot be negative.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The input as the engine takes it, with only the fields the caller named. An explicit `null`
|
|
111
|
+
* goes through as sent: the engine says which field cannot be cleared.
|
|
112
|
+
*/
|
|
113
|
+
function tableInput(input, mode) {
|
|
114
|
+
const problems = new Problems();
|
|
115
|
+
if (!isObject(input)) {
|
|
116
|
+
problems.add('/input', 'type', mode === 'create'
|
|
117
|
+
? 'A new rate table must be an object.'
|
|
118
|
+
: 'The change to a rate table must be an object.');
|
|
119
|
+
problems.throwIfAny();
|
|
120
|
+
}
|
|
121
|
+
const fields = input;
|
|
122
|
+
const out = {};
|
|
123
|
+
// A create's name is `String!`: null cannot be sent at all (only an update may send null, which
|
|
124
|
+
// the engine refuses as "cannot be cleared").
|
|
125
|
+
if (fields.name == null && mode === 'create') {
|
|
126
|
+
problems.add('/input/name', 'required', 'Give the rate table a name.');
|
|
127
|
+
}
|
|
128
|
+
else if (fields.name !== undefined) {
|
|
129
|
+
if (fields.name !== null && typeof fields.name !== 'string') {
|
|
130
|
+
problems.add('/input/name', 'type', 'The rate table name must be text.');
|
|
131
|
+
}
|
|
132
|
+
out.name = fields.name;
|
|
133
|
+
}
|
|
134
|
+
const numbers = [
|
|
135
|
+
['volumetricDivisor', 'The volumetric divisor'],
|
|
136
|
+
['defaultWeightGrams', 'The default weight'],
|
|
137
|
+
];
|
|
138
|
+
for (const [key, label] of numbers) {
|
|
139
|
+
const value = fields[key];
|
|
140
|
+
if (value === undefined)
|
|
141
|
+
continue;
|
|
142
|
+
if (value !== null)
|
|
143
|
+
intInput(problems, `/input/${key}`, label, value);
|
|
144
|
+
out[key] = value;
|
|
145
|
+
}
|
|
146
|
+
if (mode === 'update' && fields.enabled !== undefined) {
|
|
147
|
+
if (fields.enabled !== null && typeof fields.enabled !== 'boolean') {
|
|
148
|
+
problems.add('/input/enabled', 'type', 'Enabled must be true or false.');
|
|
149
|
+
}
|
|
150
|
+
out.enabled = fields.enabled;
|
|
151
|
+
}
|
|
152
|
+
problems.throwIfAny();
|
|
153
|
+
return out;
|
|
154
|
+
}
|
|
155
|
+
const requireId = (id) => {
|
|
156
|
+
if (typeof id !== 'string' || id === '') {
|
|
157
|
+
const problems = new Problems();
|
|
158
|
+
problems.add('/id', 'type', 'id must be a rate table id.');
|
|
159
|
+
problems.throwIfAny();
|
|
160
|
+
}
|
|
161
|
+
return id;
|
|
162
|
+
};
|
|
163
|
+
export function createRateTablesModule(transport) {
|
|
164
|
+
return {
|
|
165
|
+
async list(options) {
|
|
166
|
+
return fieldOf(transport, RATE_TABLES_QUERY, 'shippingZoneConfigs', {}, options);
|
|
167
|
+
},
|
|
168
|
+
async get(id, options) {
|
|
169
|
+
return fieldOf(transport, RATE_TABLE_QUERY, 'shippingZoneConfig', { id: requireId(id) }, options);
|
|
170
|
+
},
|
|
171
|
+
async create(input, options) {
|
|
172
|
+
return fieldOf(transport, CREATE_RATE_TABLE_MUTATION, 'createShippingZoneConfig', { input: tableInput(input, 'create') }, options);
|
|
173
|
+
},
|
|
174
|
+
async update(id, patch, options) {
|
|
175
|
+
const tableId = requireId(id);
|
|
176
|
+
return fieldOf(transport, UPDATE_RATE_TABLE_MUTATION, 'updateShippingZoneConfig', { id: tableId, input: tableInput(patch, 'update') }, options);
|
|
177
|
+
},
|
|
178
|
+
async delete(id, options) {
|
|
179
|
+
assertDeleted('SHIPPING_ZONE_CONFIG_NOT_DELETED', [
|
|
180
|
+
await fieldOf(transport, DELETE_RATE_TABLE_MUTATION, 'deleteShippingZoneConfig', { id: requireId(id) }, options),
|
|
181
|
+
]);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
package/dist/stock/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
2
|
import type { Call, ListOptions } from '../types.js';
|
|
3
|
+
import { type StockLocationsModule } from './locations.js';
|
|
3
4
|
import { type StockTransfersModule } from './transfers.js';
|
|
4
5
|
/**
|
|
5
6
|
* One variant's stock at one location, in integer units.
|
|
@@ -14,7 +15,10 @@ import { type StockTransfersModule } from './transfers.js';
|
|
|
14
15
|
* allocates past on-hand, and that shortfall shows as a negative figure. A
|
|
15
16
|
* negative threshold (an oversell allowance) raises it above
|
|
16
17
|
* `onHand − allocated`.
|
|
17
|
-
* - `incoming` — open units expected at this location (purchase orders)
|
|
18
|
+
* - `incoming` — open units expected at this location (purchase orders), customer-facing: a
|
|
19
|
+
* purchase order counts only what its supplier confirmed.
|
|
20
|
+
* - `onOrder` — units ordered from suppliers and still to come at this location, confirmed or
|
|
21
|
+
* not: the remainders of sent purchase orders plus the open lines an ERP mirrors. Internal.
|
|
18
22
|
* - `trackInventory: false` — the variant does not track stock, so none of
|
|
19
23
|
* these figures gates a sale.
|
|
20
24
|
*/
|
|
@@ -25,6 +29,7 @@ export interface StockPosition {
|
|
|
25
29
|
allocated: number;
|
|
26
30
|
available: number;
|
|
27
31
|
incoming: number;
|
|
32
|
+
onOrder: number;
|
|
28
33
|
reserved: number;
|
|
29
34
|
trackInventory: boolean;
|
|
30
35
|
}
|
|
@@ -158,9 +163,11 @@ export interface StockModule {
|
|
|
158
163
|
/** Stock transfers between this store's locations, and consumptions at one. */
|
|
159
164
|
transfers: StockTransfersModule;
|
|
160
165
|
allocations: StockAllocationsModule;
|
|
166
|
+
/** The store's stock locations themselves: list, read, create, change, delete. */
|
|
167
|
+
locations: StockLocationsModule;
|
|
161
168
|
}
|
|
162
|
-
export declare const STOCK_POSITION_QUERY = "\n query StockPosition($variantId: ID!, $locationId: ID) {\n stockPosition(variantId: $variantId, locationId: $locationId) { \n locationId\n locationName\n onHand\n allocated\n available\n incoming\n reserved\n trackInventory\n }\n }\n";
|
|
169
|
+
export declare const STOCK_POSITION_QUERY = "\n query StockPosition($variantId: ID!, $locationId: ID) {\n stockPosition(variantId: $variantId, locationId: $locationId) { \n locationId\n locationName\n onHand\n allocated\n available\n incoming\n onOrder\n reserved\n trackInventory\n }\n }\n";
|
|
163
170
|
export declare const STOCK_MOVEMENTS_QUERY: string;
|
|
164
|
-
export declare const ADJUST_STOCK_MUTATION = "\n mutation AdjustStock($input: AdjustStockInput!, $idempotencyKey: String) {\n adjustStock(input: $input, idempotencyKey: $idempotencyKey) { \n locationId\n locationName\n onHand\n allocated\n available\n incoming\n reserved\n trackInventory\n }\n }\n";
|
|
171
|
+
export declare const ADJUST_STOCK_MUTATION = "\n mutation AdjustStock($input: AdjustStockInput!, $idempotencyKey: String) {\n adjustStock(input: $input, idempotencyKey: $idempotencyKey) { \n locationId\n locationName\n onHand\n allocated\n available\n incoming\n onOrder\n reserved\n trackInventory\n }\n }\n";
|
|
165
172
|
export declare const RELEASE_ORDER_ALLOCATION_MUTATION = "\n mutation ReleaseOrderAllocation($orderId: ID!) {\n releaseOrderAllocation(orderId: $orderId) {\n __typename\n ... on ReleaseOrderAllocationSuccess { orderId releasedQuantity }\n ... on ErrorResult { errorCode message }\n }\n }\n";
|
|
166
173
|
export declare function createStockModule(transport: Transport): StockModule;
|
package/dist/stock/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { errorFromErrorResult, isErrorResult, pageFromVendureList, readOffsetCursor, } from '@sixtyninecommerce/core';
|
|
2
|
+
import { createStockLocationsModule } from './locations.js';
|
|
2
3
|
import { createStockTransfersModule } from './transfers.js';
|
|
3
4
|
const POSITION_FIELDS = /* GraphQL */ `
|
|
4
5
|
locationId
|
|
@@ -7,6 +8,7 @@ const POSITION_FIELDS = /* GraphQL */ `
|
|
|
7
8
|
allocated
|
|
8
9
|
available
|
|
9
10
|
incoming
|
|
11
|
+
onOrder
|
|
10
12
|
reserved
|
|
11
13
|
trackInventory
|
|
12
14
|
`;
|
|
@@ -101,6 +103,7 @@ export function createStockModule(transport) {
|
|
|
101
103
|
return data.adjustStock;
|
|
102
104
|
},
|
|
103
105
|
transfers: createStockTransfersModule(transport),
|
|
106
|
+
locations: createStockLocationsModule(transport),
|
|
104
107
|
allocations: {
|
|
105
108
|
async release(orderId, options) {
|
|
106
109
|
const data = await transport.graphql({ api: 'admin', query: RELEASE_ORDER_ALLOCATION_MUTATION, variables: { orderId } }, options);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call, ListOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* One stock location (warehouse, shop, back room) of the store the client is on.
|
|
5
|
+
*
|
|
6
|
+
* The parcel sender (`address`, the default sender) is not here: it has its own door
|
|
7
|
+
* (`locations.upsert` for the address, MyParcel's sender card for the default), with rules
|
|
8
|
+
* these methods cannot apply.
|
|
9
|
+
*/
|
|
10
|
+
export interface StockLocation {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
/** Empty when none was given. */
|
|
14
|
+
description: string;
|
|
15
|
+
/** ISO 8601, UTC. */
|
|
16
|
+
createdAt: string;
|
|
17
|
+
/** ISO 8601, UTC. */
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether shoppers see this location's stock (the Shop API's per-variant availability). True
|
|
21
|
+
* unless set off, for a back room or a staging area.
|
|
22
|
+
*/
|
|
23
|
+
isPublic: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* This location's own out-of-stock threshold, in units: non-zero replaces the variant's (or the
|
|
26
|
+
* store's) threshold for stock held here. Negative lets it sell that many below zero, positive
|
|
27
|
+
* holds a buffer back from sale; 0 uses the variant's or the store's.
|
|
28
|
+
*/
|
|
29
|
+
outOfStockThreshold: number;
|
|
30
|
+
}
|
|
31
|
+
/** The fields a list can be sorted by. */
|
|
32
|
+
export declare const STOCK_LOCATION_SORT_FIELDS: readonly ["name", "createdAt", "updatedAt"];
|
|
33
|
+
export type StockLocationSortField = (typeof STOCK_LOCATION_SORT_FIELDS)[number];
|
|
34
|
+
export interface StockLocationListOptions extends ListOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Locations whose name OR description contains this, ignoring case (the engine's list filter;
|
|
37
|
+
* the search index is not used). Blank or omitted: every location.
|
|
38
|
+
*/
|
|
39
|
+
term?: string;
|
|
40
|
+
/** One key. Omitted: the engine's own order. */
|
|
41
|
+
sort?: {
|
|
42
|
+
field: StockLocationSortField;
|
|
43
|
+
direction: 'ASC' | 'DESC';
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface CreateStockLocationInput {
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
/** On (shoppers see its stock) when omitted. */
|
|
50
|
+
isPublic?: boolean;
|
|
51
|
+
/** 0 (use the variant's or the store's threshold) when omitted. */
|
|
52
|
+
outOfStockThreshold?: number;
|
|
53
|
+
}
|
|
54
|
+
/** A PATCH: an absent field keeps what the location has. */
|
|
55
|
+
export interface UpdateStockLocationInput {
|
|
56
|
+
name?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
isPublic?: boolean;
|
|
59
|
+
outOfStockThreshold?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface DeleteStockLocationOptions extends Call {
|
|
62
|
+
/**
|
|
63
|
+
* Another location of this store that takes over the deleted location's stock levels. Omitted:
|
|
64
|
+
* the levels go with the location.
|
|
65
|
+
*/
|
|
66
|
+
transferToLocationId?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `admin.stock.locations`: the store's stock locations themselves (spec §9.2 `stock`, §8.7). A
|
|
70
|
+
* location's profile (code, time zone, opening hours, address) is `admin.locations`; its pickup
|
|
71
|
+
* settings are `admin.locations.pickup`.
|
|
72
|
+
*
|
|
73
|
+
* Scoped to the store the client is on: another store's location is not listed, `get` answers
|
|
74
|
+
* `null` for it, and `update`/`delete` refuse it `ENTITY_NOT_FOUND` (`NotFoundError`), the same
|
|
75
|
+
* answer as for an id that does not exist. A location SHARED with another store is changed or
|
|
76
|
+
* deleted only by a caller who may do so in every store holding it (`ENTITY_NOT_FOUND` too
|
|
77
|
+
* otherwise).
|
|
78
|
+
*
|
|
79
|
+
* A hub-owned location (multi-region phase 5) will be refused `MANAGED_BY_ORGANIZATION`
|
|
80
|
+
* (`BusinessRuleError`) by `update` and `delete` from a member store; no location is hub-owned
|
|
81
|
+
* yet. A member store's Stock owner (an app or API token owning the Stock field group) never
|
|
82
|
+
* locks the hub's warehouse (ruling U8).
|
|
83
|
+
*/
|
|
84
|
+
export interface StockLocationsModule {
|
|
85
|
+
/**
|
|
86
|
+
* The store's locations, a page at a time (`options.limit`, default 100, at most 1,000; and
|
|
87
|
+
* `options.after` from a previous page); `for await (const location of page)` walks them all.
|
|
88
|
+
* An API token or app restricted with `locationIds` still lists every location of the store.
|
|
89
|
+
*
|
|
90
|
+
* @effect read
|
|
91
|
+
* @permission ReadStockLocation
|
|
92
|
+
*/
|
|
93
|
+
list(options?: StockLocationListOptions): Promise<Page<StockLocation>>;
|
|
94
|
+
/**
|
|
95
|
+
* One location by id, or `null` when the store has no such location (one only another store
|
|
96
|
+
* holds reads the same).
|
|
97
|
+
*
|
|
98
|
+
* @effect read
|
|
99
|
+
* @permission ReadStockLocation
|
|
100
|
+
*/
|
|
101
|
+
get(id: string, options?: Call): Promise<StockLocation | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Create a location in this store. `name` must not be blank (`STOCK_LOCATION_INPUT_INVALID`,
|
|
104
|
+
* `ValidationError`, before anything is sent).
|
|
105
|
+
*
|
|
106
|
+
* @effect write
|
|
107
|
+
* @permission CreateStockLocation
|
|
108
|
+
*/
|
|
109
|
+
create(input: CreateStockLocationInput, options?: Call): Promise<StockLocation>;
|
|
110
|
+
/**
|
|
111
|
+
* Change a location's name, description, `isPublic` or threshold. Moves no stock, so a
|
|
112
|
+
* credential restricted with `locationIds` may change any location of the store. A blank
|
|
113
|
+
* `name` is `STOCK_LOCATION_INPUT_INVALID` (`ValidationError`, nothing sent). The engine also
|
|
114
|
+
* refuses `STOCK_LOCATION_SENDER_READ_ONLY` (`BusinessRuleError`) a change to the parcel sender,
|
|
115
|
+
* which this method never sends.
|
|
116
|
+
*
|
|
117
|
+
* @effect write
|
|
118
|
+
* @permission UpdateStockLocation
|
|
119
|
+
*/
|
|
120
|
+
update(id: string, input: UpdateStockLocationInput, options?: Call): Promise<StockLocation>;
|
|
121
|
+
/**
|
|
122
|
+
* Delete a location. Its stock levels move to `options.transferToLocationId`, or are deleted
|
|
123
|
+
* with it: there is no undo.
|
|
124
|
+
*
|
|
125
|
+
* Refused:
|
|
126
|
+
* - `STOCK_LOCATION_NOT_DELETED` (`BusinessRuleError`), in the engine's words, when the engine
|
|
127
|
+
* keeps it (the store's last location, for one);
|
|
128
|
+
* - `LOCATION_NOT_ALLOWED` (`PermissionDeniedError`) to a credential restricted with
|
|
129
|
+
* `locationIds` that does not hold the location and the transfer target;
|
|
130
|
+
* - `FIELD_GROUP_LOCKED` (`BusinessRuleError`) while an app or API token owns the store's Stock
|
|
131
|
+
* and the location holds stock;
|
|
132
|
+
* - `ENTITY_NOT_FOUND` (`NotFoundError`) for another store's location or the transfer target.
|
|
133
|
+
*
|
|
134
|
+
* @effect destructive
|
|
135
|
+
* @permission DeleteStockLocation
|
|
136
|
+
*/
|
|
137
|
+
delete(id: string, options?: DeleteStockLocationOptions): Promise<void>;
|
|
138
|
+
}
|
|
139
|
+
export declare const STOCK_LOCATIONS_QUERY = "\n query StockLocations($options: StockLocationListOptions) {\n stockLocations(options: $options) {\n items { \n id\n name\n description\n createdAt\n updatedAt\n customFields {\n isPublic\n outOfStockThreshold\n }\n }\n totalItems\n }\n }\n";
|
|
140
|
+
export declare const STOCK_LOCATION_QUERY = "\n query StockLocation($id: ID!) {\n stockLocation(id: $id) { \n id\n name\n description\n createdAt\n updatedAt\n customFields {\n isPublic\n outOfStockThreshold\n }\n }\n }\n";
|
|
141
|
+
export declare const CREATE_STOCK_LOCATION_MUTATION = "\n mutation CreateStockLocation($input: CreateStockLocationInput!) {\n createStockLocation(input: $input) { \n id\n name\n description\n createdAt\n updatedAt\n customFields {\n isPublic\n outOfStockThreshold\n }\n }\n }\n";
|
|
142
|
+
export declare const UPDATE_STOCK_LOCATION_MUTATION = "\n mutation UpdateStockLocation($input: UpdateStockLocationInput!) {\n updateStockLocation(input: $input) { \n id\n name\n description\n createdAt\n updatedAt\n customFields {\n isPublic\n outOfStockThreshold\n }\n }\n }\n";
|
|
143
|
+
export declare const DELETE_STOCK_LOCATION_MUTATION = "\n mutation DeleteStockLocation($input: DeleteStockLocationInput!) {\n deleteStockLocation(input: $input) {\n result\n message\n }\n }\n";
|
|
144
|
+
export declare function createStockLocationsModule(transport: Transport): StockLocationsModule;
|