@sixtyninecommerce/admin 0.13.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/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/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
|
package/dist/pricing/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConflictError, createPage, errorFromErrorResult, isErrorResult, NotFoundError, UpstreamError, ValidationError, } from '@sixtyninecommerce/core';
|
|
2
2
|
import { fieldOf, vendureListPage, } from '../catalog/types.js';
|
|
3
3
|
import { createPricingBulkCouponsModule } from './bulk-coupons.js';
|
|
4
|
+
import { createPricingExchangeRatesModule, } from './exchange-rates.js';
|
|
4
5
|
import { createPricingPriceListsModule } from './price-lists.js';
|
|
5
6
|
import { createPricingVouchersModule } from './vouchers.js';
|
|
6
7
|
/**
|
|
@@ -491,6 +492,7 @@ export function createPricingModule(transport) {
|
|
|
491
492
|
},
|
|
492
493
|
vouchers: createPricingVouchersModule(transport),
|
|
493
494
|
priceLists: createPricingPriceListsModule(transport),
|
|
495
|
+
exchangeRates: createPricingExchangeRatesModule(transport),
|
|
494
496
|
coupons: {
|
|
495
497
|
bulk: createPricingBulkCouponsModule(transport),
|
|
496
498
|
async apply(orderId, couponCode, options) {
|
|
@@ -13,7 +13,7 @@ export type { PurchasingAlert, PurchasingAlertRecipients, PurchasingAlertRecipie
|
|
|
13
13
|
export type { BackorderReadyLine, BackordersReadyOptions, PurchasingBackordersModule, } from './backorders.js';
|
|
14
14
|
export type { OverrideVariantCostInput, PurchasingCostModule, VariantCost, VariantCostCause, VariantCostEntry, VariantCostEntryList, VariantCostHistoryOptions, } from './cost.js';
|
|
15
15
|
export type { BackToBackLinkQuantities, BackToBackLinkResult, CreateBackToBackLinkInput, DropShipShipmentFulfillment, DropShipShipmentResult, PurchaseOrderDropShip, PurchaseOrderDropShipLine, PurchaseOrderLink, PurchaseOrderLinkKind, PurchaseOrderLinkReleaseReason, PurchaseOrderLinkStatus, PurchasingBackToBackLinksModule, PurchasingDropShipLinksModule, PurchasingLinksModule, RecordDropShipShipmentInput, } from './links.js';
|
|
16
|
-
export type { CreatePurchaseOrderInput, PurchaseOrder, PurchaseOrderCancelOptions, PurchaseOrderConfirmation, PurchaseOrderConfirmationInput, PurchaseOrderDocumentOptions, PurchaseOrderDocumentUrl, PurchaseOrderHeaderFields, PurchaseOrderKeyedCall, PurchaseOrderLine, PurchaseOrderLineConfirmationInput, PurchaseOrderLineImportOptions, PurchaseOrderLineImportResult, PurchaseOrderLineImportRow, PurchaseOrderLineInput, PurchaseOrderLinesModule, PurchaseOrderListOptions, PurchaseOrderLocation, PurchaseOrderReasonOptions, PurchaseOrderRevision, PurchaseOrderRevisionInput, PurchaseOrderRevisionsModule, PurchaseOrderSendVia, PurchaseOrderStatus, PurchaseOrderStatusEntry, PurchaseOrderSupplier, PurchasingPurchaseOrdersModule, UpdatePurchaseOrderInput, UpdatePurchaseOrderLineInput, } from './purchase-orders.js';
|
|
16
|
+
export type { CreatePurchaseOrderInput, PurchaseOrder, PurchaseOrderCancelOptions, PurchaseOrderConfirmation, PurchaseOrderConfirmationInput, PurchaseOrderDocumentOptions, PurchaseOrderDocumentUrl, PurchaseOrderHeaderFields, PurchaseOrderKeyedCall, PurchaseOrderLine, PurchaseOrderLineConfirmationInput, PurchaseOrderLineImportOptions, PurchaseOrderLineImportResult, PurchaseOrderLineImportRow, PurchaseOrderLineInput, PurchaseOrderLinesModule, PurchaseOrderListOptions, PurchaseOrderLocation, PurchaseOrderReasonOptions, PurchaseOrderRevision, PurchaseOrderRevisionInput, PurchaseOrderRevisionsModule, PurchaseOrderSendCall, PurchaseOrderSendVia, PurchaseOrderStatus, PurchaseOrderStatusEntry, PurchaseOrderSupplier, PurchasingPurchaseOrdersModule, UpdatePurchaseOrderInput, UpdatePurchaseOrderLineInput, } from './purchase-orders.js';
|
|
17
17
|
export type { AddGoodsReceiptChargeInput, GoodsReceipt, GoodsReceiptChargesModule, GoodsReceiptDetail, GoodsReceiptKeyedCall, GoodsReceiptKind, GoodsReceiptLine, GoodsReceiptListOptions, GoodsReceiptReference, GoodsReceiptTraceability, GoodsReceiptTraceabilityInput, LandedCharge, LandedChargeAllocation, LandedChargeAllocationBasis, LandedChargeKind, PostGoodsReceiptInput, PostGoodsReceiptLineInput, PurchasingReceiptsModule, ReceivablePurchaseOrderLine, ReceivablePurchaseOrderLinesOptions, RemoveGoodsReceiptChargeInput, ReverseGoodsReceiptInput, } from './receipts.js';
|
|
18
18
|
export type { PurchasingReplenishmentModule, ReplenishmentComputeResult, ReplenishmentDraftLine, ReplenishmentDrafts, ReplenishmentLocation, ReplenishmentRule, ReplenishmentRuleFields, ReplenishmentRuleImportInput, ReplenishmentRuleImportResult, ReplenishmentRuleImportRow, ReplenishmentRuleListOptions, ReplenishmentRulesModule, ReplenishmentSuggestion, ReplenishmentSuggestionListOptions, ReplenishmentSuggestionsModule, ReplenishmentSupplier, ReplenishmentVariant, } from './replenishment.js';
|
|
19
19
|
export type { CreateSupplierReturnInput, PurchasingReturnsModule, ResolveSupplierReturnLineInput, ShipSupplierReturnInput, SupplierReturn, SupplierReturnCancelOptions, SupplierReturnDocumentUrl, SupplierReturnKeyedCall, SupplierReturnLine, SupplierReturnLineInput, SupplierReturnListOptions, SupplierReturnOrigin, SupplierReturnOutcome, SupplierReturnResolution, SupplierReturnStatus, SupplierReturnStatusEntry, UpdateSupplierReturnInput, } from './returns.js';
|
|
@@ -51,4 +51,4 @@ export interface PurchasingModule {
|
|
|
51
51
|
/** Customer order lines bought on purchase order lines: "Order from supplier" and its reads. */
|
|
52
52
|
links: PurchasingLinksModule;
|
|
53
53
|
}
|
|
54
|
-
export declare function createPurchasingModule(
|
|
54
|
+
export declare function createPurchasingModule(baseTransport: Transport): PurchasingModule;
|
package/dist/purchasing/index.js
CHANGED
|
@@ -2,13 +2,16 @@ import { createPurchasingAlertsModule } from './alerts.js';
|
|
|
2
2
|
import { createPurchasingBackordersModule } from './backorders.js';
|
|
3
3
|
import { createPurchasingCostModule } from './cost.js';
|
|
4
4
|
import { createPurchasingLinksModule } from './links.js';
|
|
5
|
-
import { createPurchasingPurchaseOrdersModule, } from './purchase-orders.js';
|
|
5
|
+
import { createPurchasingPurchaseOrdersModule, sentReferenceAware, } from './purchase-orders.js';
|
|
6
6
|
import { createPurchasingReceiptsModule } from './receipts.js';
|
|
7
7
|
import { createPurchasingReplenishmentModule, } from './replenishment.js';
|
|
8
8
|
import { createPurchasingReturnsModule } from './returns.js';
|
|
9
9
|
import { createPurchasingSettingsModule } from './settings.js';
|
|
10
10
|
import { createPurchasingSuppliersModule } from './suppliers.js';
|
|
11
|
-
export function createPurchasingModule(
|
|
11
|
+
export function createPurchasingModule(baseTransport) {
|
|
12
|
+
// One transport for every purchasing module: a document embedding PURCHASE_ORDER_FIELDS, in
|
|
13
|
+
// whichever module, is asked once more without `sentReference` by an engine before it.
|
|
14
|
+
const transport = sentReferenceAware(baseTransport);
|
|
12
15
|
return {
|
|
13
16
|
settings: createPurchasingSettingsModule(transport),
|
|
14
17
|
suppliers: createPurchasingSuppliersModule(transport),
|
|
@@ -175,10 +175,10 @@ export declare const PURCHASE_ORDER_LINK_FIELDS = "\n id\n kind\n status\n o
|
|
|
175
175
|
export declare const ORDER_PURCHASE_ORDER_LINKS_QUERY = "\n query OrderPurchaseOrderLinks($orderId: ID!) {\n orderPurchaseOrderLinks(orderId: $orderId) { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n }\n";
|
|
176
176
|
export declare const PURCHASE_ORDER_LINKS_QUERY = "\n query PurchaseOrderLinks($purchaseOrderId: ID!) {\n purchaseOrderLinks(purchaseOrderId: $purchaseOrderId) { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n }\n";
|
|
177
177
|
export declare const BACK_TO_BACK_LINK_QUANTITIES_QUERY = "\n query PurchaseOrderBackToBackLinkQuantities($orderLineId: ID!) {\n purchaseOrderBackToBackLinkQuantities(orderLineId: $orderLineId) {\n orderLineId\n openBaseQuantity\n linkedBaseQuantity\n maxBaseQuantity\n suggestedBaseQuantity\n }\n }\n";
|
|
178
|
-
export declare const CREATE_BACK_TO_BACK_LINK_MUTATION = "\n mutation CreatePurchaseOrderBackToBackLink(\n $input: CreatePurchaseOrderBackToBackLinkInput!\n $idempotencyKey: String\n ) {\n createPurchaseOrderBackToBackLink(input: $input, idempotencyKey: $idempotencyKey) {\n link { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n createdPurchaseOrder\n }\n }\n";
|
|
178
|
+
export declare const CREATE_BACK_TO_BACK_LINK_MUTATION = "\n mutation CreatePurchaseOrderBackToBackLink(\n $input: CreatePurchaseOrderBackToBackLinkInput!\n $idempotencyKey: String\n ) {\n createPurchaseOrderBackToBackLink(input: $input, idempotencyKey: $idempotencyKey) {\n link { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n createdPurchaseOrder\n }\n }\n";
|
|
179
179
|
export declare const REMOVE_BACK_TO_BACK_LINK_MUTATION = "\n mutation RemovePurchaseOrderBackToBackLink($id: ID!, $idempotencyKey: String) {\n removePurchaseOrderBackToBackLink(id: $id, idempotencyKey: $idempotencyKey) {\n \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n\n }\n }\n";
|
|
180
180
|
export declare const PURCHASE_ORDER_DROP_SHIP_QUERY = "\n query PurchaseOrderDropShip($purchaseOrderId: ID!) {\n purchaseOrderDropShip(purchaseOrderId: $purchaseOrderId) {\n purchaseOrderId\n purchaseOrderCode\n orderId\n orderCode\n address {\n fullName\n company\n streetLine1\n streetLine2\n city\n province\n postalCode\n country\n countryCode\n phoneNumber\n }\n lines {\n purchaseOrderLineId\n orderLineId\n sku\n orderedBaseQuantity\n shippedBaseQuantity\n toShipBaseQuantity\n }\n }\n }\n";
|
|
181
|
-
export declare const RECORD_DROP_SHIP_SHIPMENT_MUTATION = "\n mutation RecordPurchaseOrderDropShipShipment(\n $input: RecordDropShipShipmentInput!\n $idempotencyKey: String!\n ) {\n recordPurchaseOrderDropShipShipment(input: $input, idempotencyKey: $idempotencyKey) {\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n links { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n fulfillment {\n id\n state\n method\n trackingCode\n }\n closedPurchaseOrder\n }\n }\n";
|
|
181
|
+
export declare const RECORD_DROP_SHIP_SHIPMENT_MUTATION = "\n mutation RecordPurchaseOrderDropShipShipment(\n $input: RecordDropShipShipmentInput!\n $idempotencyKey: String!\n ) {\n recordPurchaseOrderDropShipShipment(input: $input, idempotencyKey: $idempotencyKey) {\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n links { \n id\n kind\n status\n orderId\n orderCode\n orderLineId\n productVariantId\n sku\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderStatus\n purchaseOrderLineId\n supplierId\n supplierName\n stockLocationId\n baseQuantity\n allocatedBaseQuantity\n shippedBaseQuantity\n expectedOn\n expectedOnConfirmed\n releasedAt\n releaseReason\n createdAt\n }\n fulfillment {\n id\n state\n method\n trackingCode\n }\n closedPurchaseOrder\n }\n }\n";
|
|
182
182
|
/**
|
|
183
183
|
* `admin.purchasing.links.backToBack` (purchase-orders spec §8.12.1, §10.1): "Order from supplier"
|
|
184
184
|
* on a customer order line. The received goods are allocated to the line first, at the purchase
|
|
@@ -260,4 +260,4 @@ export interface PurchasingLinksModule {
|
|
|
260
260
|
/** The links of a purchase order, oldest first, ended ones included. */
|
|
261
261
|
forPurchaseOrder(purchaseOrderId: string, call?: Call): Promise<PurchaseOrderLink[]>;
|
|
262
262
|
}
|
|
263
|
-
export declare function createPurchasingLinksModule(
|
|
263
|
+
export declare function createPurchasingLinksModule(baseTransport: Transport): PurchasingLinksModule;
|
package/dist/purchasing/links.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PURCHASE_ORDER_FIELDS, } from './purchase-orders.js';
|
|
1
|
+
import { PURCHASE_ORDER_FIELDS, sentReferenceAware, withSentReferences, } from './purchase-orders.js';
|
|
2
2
|
export const PURCHASE_ORDER_LINK_FIELDS = /* GraphQL */ `
|
|
3
3
|
id
|
|
4
4
|
kind
|
|
@@ -136,7 +136,10 @@ function picked(input, fields) {
|
|
|
136
136
|
}
|
|
137
137
|
return out;
|
|
138
138
|
}
|
|
139
|
-
export function createPurchasingLinksModule(
|
|
139
|
+
export function createPurchasingLinksModule(baseTransport) {
|
|
140
|
+
// `backToBack.create` and `dropShip.recordShipment` answer their purchase order through
|
|
141
|
+
// PURCHASE_ORDER_FIELDS (`sentReference`).
|
|
142
|
+
const transport = sentReferenceAware(baseTransport);
|
|
140
143
|
return {
|
|
141
144
|
backToBack: {
|
|
142
145
|
async create(input, call) {
|
|
@@ -148,7 +151,8 @@ export function createPurchasingLinksModule(transport) {
|
|
|
148
151
|
idempotencyKey: call?.idempotencyKey,
|
|
149
152
|
},
|
|
150
153
|
}, call);
|
|
151
|
-
|
|
154
|
+
const result = data.createPurchaseOrderBackToBackLink;
|
|
155
|
+
return { ...result, purchaseOrder: withSentReferences(result.purchaseOrder) };
|
|
152
156
|
},
|
|
153
157
|
async quantities(orderLineId, call) {
|
|
154
158
|
const data = await transport.graphql({ api: 'admin', query: BACK_TO_BACK_LINK_QUANTITIES_QUERY, variables: { orderLineId } }, call);
|
|
@@ -177,7 +181,8 @@ export function createPurchasingLinksModule(transport) {
|
|
|
177
181
|
idempotencyKey: call.idempotencyKey,
|
|
178
182
|
},
|
|
179
183
|
}, call);
|
|
180
|
-
|
|
184
|
+
const result = data.recordPurchaseOrderDropShipShipment;
|
|
185
|
+
return { ...result, purchaseOrder: withSentReferences(result.purchaseOrder) };
|
|
181
186
|
},
|
|
182
187
|
},
|
|
183
188
|
async forOrder(orderId, call) {
|
|
@@ -88,7 +88,11 @@ export interface PurchaseOrderStatusEntry {
|
|
|
88
88
|
createdAt: string;
|
|
89
89
|
}
|
|
90
90
|
/** How a purchase order reaches its supplier (D74): emailed by the platform, or by staff. */
|
|
91
|
-
|
|
91
|
+
/**
|
|
92
|
+
* How the order reaches its supplier: `email` (the platform mails the PDF), `manual` (staff send
|
|
93
|
+
* it) or `external` (an integration transmitted the order in the supplier's own format).
|
|
94
|
+
*/
|
|
95
|
+
export type PurchaseOrderSendVia = 'email' | 'manual' | 'external';
|
|
92
96
|
/**
|
|
93
97
|
* A numbered revision of a purchase order (purchase-orders spec §8.4.4). Revision 0 is the
|
|
94
98
|
* original as first sent; each later one is a change set of the sent order.
|
|
@@ -113,6 +117,12 @@ export interface PurchaseOrderRevision {
|
|
|
113
117
|
/** When its document went to the supplier; null until sent. */
|
|
114
118
|
sentAt: string | null;
|
|
115
119
|
sentVia: PurchaseOrderSendVia | (string & {}) | null;
|
|
120
|
+
/**
|
|
121
|
+
* The reference the integration stated when it sent THIS revision externally (`send(id,
|
|
122
|
+
* 'external', { externalReference })`, e.g. the lab's order number); null for an email or
|
|
123
|
+
* manual send, an external one that stated none, and on an engine before the field.
|
|
124
|
+
*/
|
|
125
|
+
sentReference: string | null;
|
|
116
126
|
}
|
|
117
127
|
/** A five-minute link to a purchase order's PDF. */
|
|
118
128
|
export interface PurchaseOrderDocumentUrl {
|
|
@@ -337,6 +347,17 @@ export interface PurchaseOrderLineImportResult {
|
|
|
337
347
|
export type PurchaseOrderKeyedCall = Call & {
|
|
338
348
|
idempotencyKey: string;
|
|
339
349
|
};
|
|
350
|
+
/**
|
|
351
|
+
* `send`'s call. With `via: 'external'` it may also state what the integration knows of the
|
|
352
|
+
* transmission: the supplier's (or the integration's) reference, kept as the sent revision's
|
|
353
|
+
* `sentReference` and becoming the order's `supplierReference` while it has none, and when it was
|
|
354
|
+
* handed over (default now; never in the future), the revision's `sentAt` (and on the first send
|
|
355
|
+
* the order's). Both are refused for `email` and `manual`.
|
|
356
|
+
*/
|
|
357
|
+
export type PurchaseOrderSendCall = PurchaseOrderKeyedCall & {
|
|
358
|
+
externalReference?: string;
|
|
359
|
+
transmittedAt?: Date | string;
|
|
360
|
+
};
|
|
340
361
|
export declare const PURCHASE_ORDER_LINE_FIELDS = "\n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n";
|
|
341
362
|
/**
|
|
342
363
|
* The header and lines, without the status history, which the engine reads per order: what the
|
|
@@ -347,33 +368,52 @@ export declare const PURCHASE_ORDER_SUMMARY_FIELDS = "\n id\n scopeId\n legal
|
|
|
347
368
|
* A whole purchase order, its status history and revisions included: what `get` and every write
|
|
348
369
|
* answer.
|
|
349
370
|
*/
|
|
350
|
-
export declare const PURCHASE_ORDER_FIELDS = "\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n";
|
|
371
|
+
export declare const PURCHASE_ORDER_FIELDS = "\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n";
|
|
372
|
+
/**
|
|
373
|
+
* The transport, sending a document that names `sentReference` once more without it when the
|
|
374
|
+
* engine refused it as unknown, and only then: any other refusal, or a document that does not name
|
|
375
|
+
* it, is thrown as it came. Safe for a mutation too: a refused document never ran.
|
|
376
|
+
* `createPurchasingModule` hands this transport to every purchasing module, so any document that
|
|
377
|
+
* embeds {@link PURCHASE_ORDER_FIELDS} (purchase orders, back-to-back links, replenishment drafts)
|
|
378
|
+
* gets the one retry; each factory that embeds it wraps again, which is a no-op on a wrapped one.
|
|
379
|
+
*/
|
|
380
|
+
export declare function sentReferenceAware(transport: Transport): Transport;
|
|
381
|
+
/**
|
|
382
|
+
* An order as answered, every revision with its `sentReference` (null from an older engine). Every
|
|
383
|
+
* method answering an order read through {@link PURCHASE_ORDER_FIELDS} passes it through this.
|
|
384
|
+
*/
|
|
385
|
+
export declare function withSentReferences(order: PurchaseOrder): PurchaseOrder;
|
|
351
386
|
export declare const PURCHASE_ORDERS_QUERY = "\n query PurchaseOrders($options: PurchaseOrderListOptions) {\n purchaseOrders(options: $options) {\n totalItems\n items { \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
352
|
-
export declare const PURCHASE_ORDER_QUERY = "\n query PurchaseOrder($id: ID!) {\n purchaseOrder(id: $id) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n";
|
|
353
|
-
export declare const CREATE_PURCHASE_ORDER_MUTATION = "\n mutation CreatePurchaseOrder($input: CreatePurchaseOrderInput!, $idempotencyKey: String) {\n createPurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
354
|
-
export declare const UPDATE_PURCHASE_ORDER_MUTATION = "\n mutation UpdatePurchaseOrder($input: UpdatePurchaseOrderInput!, $idempotencyKey: String) {\n updatePurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
355
|
-
export declare const ADD_PURCHASE_ORDER_LINES_MUTATION = "\n mutation AddPurchaseOrderLines(\n $purchaseOrderId: ID!\n $lines: [PurchaseOrderLineInput!]!\n $idempotencyKey: String\n ) {\n addPurchaseOrderLines(\n purchaseOrderId: $purchaseOrderId\n lines: $lines\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
356
|
-
export declare const UPDATE_PURCHASE_ORDER_LINE_MUTATION = "\n mutation UpdatePurchaseOrderLine(\n $input: UpdatePurchaseOrderLineInput!\n $idempotencyKey: String\n ) {\n updatePurchaseOrderLine(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
357
|
-
export declare const REMOVE_PURCHASE_ORDER_LINE_MUTATION = "\n mutation RemovePurchaseOrderLine($id: ID!, $idempotencyKey: String) {\n removePurchaseOrderLine(id: $id, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
358
|
-
export declare const SUBMIT_PURCHASE_ORDER_MUTATION = "\n mutation SubmitPurchaseOrder($id: ID!, $idempotencyKey: String) {\n submitPurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n";
|
|
359
|
-
export declare const APPROVE_PURCHASE_ORDER_MUTATION = "\n mutation ApprovePurchaseOrder($id: ID!, $idempotencyKey: String) {\n approvePurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n";
|
|
360
|
-
export declare const REJECT_PURCHASE_ORDER_MUTATION = "\n mutation RejectPurchaseOrder($id: ID!, $reason: String!, $idempotencyKey: String) {\n rejectPurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
361
|
-
export declare const CANCEL_PURCHASE_ORDER_MUTATION = "\n mutation CancelPurchaseOrder($id: ID!, $reason: String, $idempotencyKey: String) {\n cancelPurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
387
|
+
export declare const PURCHASE_ORDER_QUERY = "\n query PurchaseOrder($id: ID!) {\n purchaseOrder(id: $id) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n";
|
|
388
|
+
export declare const CREATE_PURCHASE_ORDER_MUTATION = "\n mutation CreatePurchaseOrder($input: CreatePurchaseOrderInput!, $idempotencyKey: String) {\n createPurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
389
|
+
export declare const UPDATE_PURCHASE_ORDER_MUTATION = "\n mutation UpdatePurchaseOrder($input: UpdatePurchaseOrderInput!, $idempotencyKey: String) {\n updatePurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
390
|
+
export declare const ADD_PURCHASE_ORDER_LINES_MUTATION = "\n mutation AddPurchaseOrderLines(\n $purchaseOrderId: ID!\n $lines: [PurchaseOrderLineInput!]!\n $idempotencyKey: String\n ) {\n addPurchaseOrderLines(\n purchaseOrderId: $purchaseOrderId\n lines: $lines\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
391
|
+
export declare const UPDATE_PURCHASE_ORDER_LINE_MUTATION = "\n mutation UpdatePurchaseOrderLine(\n $input: UpdatePurchaseOrderLineInput!\n $idempotencyKey: String\n ) {\n updatePurchaseOrderLine(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
392
|
+
export declare const REMOVE_PURCHASE_ORDER_LINE_MUTATION = "\n mutation RemovePurchaseOrderLine($id: ID!, $idempotencyKey: String) {\n removePurchaseOrderLine(id: $id, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
393
|
+
export declare const SUBMIT_PURCHASE_ORDER_MUTATION = "\n mutation SubmitPurchaseOrder($id: ID!, $idempotencyKey: String) {\n submitPurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n";
|
|
394
|
+
export declare const APPROVE_PURCHASE_ORDER_MUTATION = "\n mutation ApprovePurchaseOrder($id: ID!, $idempotencyKey: String) {\n approvePurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n";
|
|
395
|
+
export declare const REJECT_PURCHASE_ORDER_MUTATION = "\n mutation RejectPurchaseOrder($id: ID!, $reason: String!, $idempotencyKey: String) {\n rejectPurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
396
|
+
export declare const CANCEL_PURCHASE_ORDER_MUTATION = "\n mutation CancelPurchaseOrder($id: ID!, $reason: String, $idempotencyKey: String) {\n cancelPurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
362
397
|
/**
|
|
363
398
|
* The cancel that states whether the supplier is emailed: sent only when `notifySupplier` is
|
|
364
399
|
* given, so a cancel without it still reaches an engine from before the cancellation email.
|
|
365
400
|
*/
|
|
366
|
-
export declare const CANCEL_PURCHASE_ORDER_NOTIFYING_MUTATION = "\n mutation CancelPurchaseOrderNotifying(\n $id: ID!\n $reason: String\n $notifySupplier: Boolean\n $idempotencyKey: String\n ) {\n cancelPurchaseOrder(\n id: $id\n reason: $reason\n notifySupplier: $notifySupplier\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
367
|
-
export declare const SEND_PURCHASE_ORDER_MUTATION = "\n mutation SendPurchaseOrder($id: ID!, $via: String!, $idempotencyKey: String) {\n sendPurchaseOrder(id: $id, via: $via, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
export declare const
|
|
401
|
+
export declare const CANCEL_PURCHASE_ORDER_NOTIFYING_MUTATION = "\n mutation CancelPurchaseOrderNotifying(\n $id: ID!\n $reason: String\n $notifySupplier: Boolean\n $idempotencyKey: String\n ) {\n cancelPurchaseOrder(\n id: $id\n reason: $reason\n notifySupplier: $notifySupplier\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
402
|
+
export declare const SEND_PURCHASE_ORDER_MUTATION = "\n mutation SendPurchaseOrder($id: ID!, $via: String!, $idempotencyKey: String) {\n sendPurchaseOrder(id: $id, via: $via, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
403
|
+
/**
|
|
404
|
+
* The external send with what the integration knows (engine with `via: 'external'`); sent only
|
|
405
|
+
* when the caller states one, so a plain send keeps working against an older engine.
|
|
406
|
+
*/
|
|
407
|
+
export declare const SEND_PURCHASE_ORDER_EXTERNAL_MUTATION = "\n mutation SendPurchaseOrderExternal(\n $id: ID!\n $via: String!\n $idempotencyKey: String\n $externalReference: String\n $transmittedAt: DateTime\n ) {\n sendPurchaseOrder(\n id: $id\n via: $via\n idempotencyKey: $idempotencyKey\n externalReference: $externalReference\n transmittedAt: $transmittedAt\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
408
|
+
export declare const REVISE_PURCHASE_ORDER_MUTATION = "\n mutation RevisePurchaseOrder($input: RevisePurchaseOrderInput!, $idempotencyKey: String) {\n revisePurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
409
|
+
export declare const APPROVE_PURCHASE_ORDER_REVISION_MUTATION = "\n mutation ApprovePurchaseOrderRevision($purchaseOrderId: ID!, $idempotencyKey: String) {\n approvePurchaseOrderRevision(\n purchaseOrderId: $purchaseOrderId\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
410
|
+
export declare const DISCARD_PURCHASE_ORDER_REVISION_MUTATION = "\n mutation DiscardPurchaseOrderRevision(\n $purchaseOrderId: ID!\n $reason: String\n $idempotencyKey: String\n ) {\n discardPurchaseOrderRevision(\n purchaseOrderId: $purchaseOrderId\n reason: $reason\n idempotencyKey: $idempotencyKey\n ) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
411
|
+
export declare const CLOSE_PURCHASE_ORDER_MUTATION = "\n mutation ClosePurchaseOrder($id: ID!, $reason: String!, $idempotencyKey: String) {\n closePurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
412
|
+
export declare const REOPEN_PURCHASE_ORDER_MUTATION = "\n mutation ReopenPurchaseOrder($id: ID!, $reason: String, $idempotencyKey: String) {\n reopenPurchaseOrder(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
373
413
|
export declare const CREATE_PURCHASE_ORDER_DOCUMENT_URL_MUTATION = "\n mutation CreatePurchaseOrderDocumentUrl($purchaseOrderId: ID!, $revision: Int) {\n createPurchaseOrderDocumentUrl(purchaseOrderId: $purchaseOrderId, revision: $revision) {\n url\n expiresAt\n filename\n revision\n }\n }\n";
|
|
374
|
-
export declare const CONFIRM_PURCHASE_ORDER_MUTATION = "\n mutation ConfirmPurchaseOrder($input: ConfirmPurchaseOrderInput!, $idempotencyKey: String) {\n confirmPurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n\n }\n }\n";
|
|
375
|
-
export declare const DUPLICATE_PURCHASE_ORDER_MUTATION = "\n mutation DuplicatePurchaseOrder($id: ID!, $idempotencyKey: String) {\n duplicatePurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n";
|
|
376
|
-
export declare const IMPORT_PURCHASE_ORDER_LINES_MUTATION = "\n mutation ImportPurchaseOrderLines(\n $input: ImportPurchaseOrderLinesInput!\n $idempotencyKey: String\n ) {\n importPurchaseOrderLines(input: $input, idempotencyKey: $idempotencyKey) {\n dryRun\n contentHash\n ignoredColumns\n totalRows\n created\n updated\n unchanged\n failed\n rows { row sku supplierSku outcome lineId errorCode message }\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n }\n";
|
|
414
|
+
export declare const CONFIRM_PURCHASE_ORDER_MUTATION = "\n mutation ConfirmPurchaseOrder($input: ConfirmPurchaseOrderInput!, $idempotencyKey: String) {\n confirmPurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {\n \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n\n }\n }\n";
|
|
415
|
+
export declare const DUPLICATE_PURCHASE_ORDER_MUTATION = "\n mutation DuplicatePurchaseOrder($id: ID!, $idempotencyKey: String) {\n duplicatePurchaseOrder(id: $id, idempotencyKey: $idempotencyKey) { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n";
|
|
416
|
+
export declare const IMPORT_PURCHASE_ORDER_LINES_MUTATION = "\n mutation ImportPurchaseOrderLines(\n $input: ImportPurchaseOrderLinesInput!\n $idempotencyKey: String\n ) {\n importPurchaseOrderLines(input: $input, idempotencyKey: $idempotencyKey) {\n dryRun\n contentHash\n ignoredColumns\n totalRows\n created\n updated\n unchanged\n failed\n rows { row sku supplierSku outcome lineId errorCode message }\n purchaseOrder { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n }\n";
|
|
377
417
|
/** A draft's lines. Each write needs `UpdatePurchaseOrder` on every store of the legal entity. */
|
|
378
418
|
export interface PurchaseOrderLinesModule {
|
|
379
419
|
/**
|
|
@@ -487,15 +527,19 @@ export interface PurchasingPurchaseOrdersModule {
|
|
|
487
527
|
/**
|
|
488
528
|
* Sends the order to its supplier (`UpdatePurchaseOrder`; spec §8.4.1, D74, D75). `email`: the
|
|
489
529
|
* platform emails the PDF to the supplier's order contact, else its order email; `manual`:
|
|
490
|
-
* marked sent without email, staff send the PDF themselves (`document`)
|
|
491
|
-
*
|
|
492
|
-
*
|
|
530
|
+
* marked sent without email, staff send the PDF themselves (`document`); `external`: an
|
|
531
|
+
* integration transmitted the order in the supplier's own format, nothing is mailed and the PDF
|
|
532
|
+
* is only the order's record (`call.externalReference` and `call.transmittedAt` record what the
|
|
533
|
+
* integration knows; an engine before `external` answers `PURCHASE_ORDER_INVALID`). An approved
|
|
534
|
+
* order moves to `sent`; on a sent order it sends the revision applied since the last send, or
|
|
535
|
+
* emails the current one again (`manual` and `external` then change nothing). Refusals, before
|
|
536
|
+
* anything changes:
|
|
493
537
|
* `SUPPLIER_HAS_NO_ORDER_EMAIL` and `SUPPLIER_EMAIL_UNDELIVERABLE` (422, by email: the store's
|
|
494
538
|
* "Purchase Order Sent" email is off or has no recipient), `PRIVATE_STORAGE_UNCONFIGURED`
|
|
495
539
|
* (422, the deployment cannot store the PDF), `PURCHASE_ORDER_INVALID_TRANSITION` (422).
|
|
496
540
|
* The key is required (spec §10.1).
|
|
497
541
|
*/
|
|
498
|
-
send(id: string, via: PurchaseOrderSendVia, call:
|
|
542
|
+
send(id: string, via: PurchaseOrderSendVia, call: PurchaseOrderSendCall): Promise<PurchaseOrder>;
|
|
499
543
|
/**
|
|
500
544
|
* Revises a SENT order (`UpdatePurchaseOrder`; spec §8.3, §8.4.4): within the approved amount
|
|
501
545
|
* the revision applies at once; above it the threshold decides again (a foreign currency at the
|
|
@@ -548,4 +592,4 @@ export interface PurchasingPurchaseOrdersModule {
|
|
|
548
592
|
*/
|
|
549
593
|
document(id: string, options?: PurchaseOrderDocumentOptions): Promise<PurchaseOrderDocumentUrl>;
|
|
550
594
|
}
|
|
551
|
-
export declare function createPurchasingPurchaseOrdersModule(
|
|
595
|
+
export declare function createPurchasingPurchaseOrdersModule(baseTransport: Transport): PurchasingPurchaseOrdersModule;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { pageFromVendureList, readOffsetCursor, } from '@sixtyninecommerce/core';
|
|
2
|
+
import { isUnknownFieldRejection } from '../payments/store-credit-fields.js';
|
|
2
3
|
export const PURCHASE_ORDER_LINE_FIELDS = /* GraphQL */ `
|
|
3
4
|
id
|
|
4
5
|
purchaseOrderId
|
|
@@ -85,8 +86,67 @@ export const PURCHASE_ORDER_FIELDS = /* GraphQL */ `
|
|
|
85
86
|
appliedAt
|
|
86
87
|
sentAt
|
|
87
88
|
sentVia
|
|
89
|
+
sentReference
|
|
88
90
|
}
|
|
89
91
|
`;
|
|
92
|
+
/**
|
|
93
|
+
* `PurchaseOrderRevision.sentReference` (the external send's reference, per revision): an engine
|
|
94
|
+
* before it refuses every document naming it, before it runs. The same document without it reads
|
|
95
|
+
* as it did then, and each revision answers `sentReference: null`.
|
|
96
|
+
*/
|
|
97
|
+
function withoutSentReference(document) {
|
|
98
|
+
return document.replace(/\bsentReference\b/g, '');
|
|
99
|
+
}
|
|
100
|
+
/** The transports {@link sentReferenceAware} made, so wrapping one again never retries twice. */
|
|
101
|
+
const SENT_REFERENCE_AWARE = new WeakSet();
|
|
102
|
+
/**
|
|
103
|
+
* The transport, sending a document that names `sentReference` once more without it when the
|
|
104
|
+
* engine refused it as unknown, and only then: any other refusal, or a document that does not name
|
|
105
|
+
* it, is thrown as it came. Safe for a mutation too: a refused document never ran.
|
|
106
|
+
* `createPurchasingModule` hands this transport to every purchasing module, so any document that
|
|
107
|
+
* embeds {@link PURCHASE_ORDER_FIELDS} (purchase orders, back-to-back links, replenishment drafts)
|
|
108
|
+
* gets the one retry; each factory that embeds it wraps again, which is a no-op on a wrapped one.
|
|
109
|
+
*/
|
|
110
|
+
export function sentReferenceAware(transport) {
|
|
111
|
+
if (SENT_REFERENCE_AWARE.has(transport))
|
|
112
|
+
return transport;
|
|
113
|
+
const aware = {
|
|
114
|
+
async graphql(call, options) {
|
|
115
|
+
try {
|
|
116
|
+
return await transport.graphql(call, options);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const legacy = withoutSentReference(call.query);
|
|
120
|
+
if (legacy === call.query || !isUnknownFieldRejection(error))
|
|
121
|
+
throw error;
|
|
122
|
+
return transport.graphql({ ...call, query: legacy }, options);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
rest: (service, call, options) => transport.rest(service, call, options),
|
|
126
|
+
get rateLimit() {
|
|
127
|
+
return transport.rateLimit;
|
|
128
|
+
},
|
|
129
|
+
tenant: () => transport.tenant(),
|
|
130
|
+
channel: () => transport.channel(),
|
|
131
|
+
};
|
|
132
|
+
SENT_REFERENCE_AWARE.add(aware);
|
|
133
|
+
return aware;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* An order as answered, every revision with its `sentReference` (null from an older engine). Every
|
|
137
|
+
* method answering an order read through {@link PURCHASE_ORDER_FIELDS} passes it through this.
|
|
138
|
+
*/
|
|
139
|
+
export function withSentReferences(order) {
|
|
140
|
+
if (!Array.isArray(order?.revisions))
|
|
141
|
+
return order;
|
|
142
|
+
return {
|
|
143
|
+
...order,
|
|
144
|
+
revisions: order.revisions.map((revision) => ({
|
|
145
|
+
...revision,
|
|
146
|
+
sentReference: revision.sentReference ?? null,
|
|
147
|
+
})),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
90
150
|
export const PURCHASE_ORDERS_QUERY = /* GraphQL */ `
|
|
91
151
|
query PurchaseOrders($options: PurchaseOrderListOptions) {
|
|
92
152
|
purchaseOrders(options: $options) {
|
|
@@ -198,6 +258,29 @@ export const SEND_PURCHASE_ORDER_MUTATION = /* GraphQL */ `
|
|
|
198
258
|
}
|
|
199
259
|
}
|
|
200
260
|
`;
|
|
261
|
+
/**
|
|
262
|
+
* The external send with what the integration knows (engine with `via: 'external'`); sent only
|
|
263
|
+
* when the caller states one, so a plain send keeps working against an older engine.
|
|
264
|
+
*/
|
|
265
|
+
export const SEND_PURCHASE_ORDER_EXTERNAL_MUTATION = /* GraphQL */ `
|
|
266
|
+
mutation SendPurchaseOrderExternal(
|
|
267
|
+
$id: ID!
|
|
268
|
+
$via: String!
|
|
269
|
+
$idempotencyKey: String
|
|
270
|
+
$externalReference: String
|
|
271
|
+
$transmittedAt: DateTime
|
|
272
|
+
) {
|
|
273
|
+
sendPurchaseOrder(
|
|
274
|
+
id: $id
|
|
275
|
+
via: $via
|
|
276
|
+
idempotencyKey: $idempotencyKey
|
|
277
|
+
externalReference: $externalReference
|
|
278
|
+
transmittedAt: $transmittedAt
|
|
279
|
+
) {
|
|
280
|
+
${PURCHASE_ORDER_FIELDS}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
`;
|
|
201
284
|
export const REVISE_PURCHASE_ORDER_MUTATION = /* GraphQL */ `
|
|
202
285
|
mutation RevisePurchaseOrder($input: RevisePurchaseOrderInput!, $idempotencyKey: String) {
|
|
203
286
|
revisePurchaseOrder(input: $input, idempotencyKey: $idempotencyKey) {
|
|
@@ -334,7 +417,8 @@ function picked(input, fields) {
|
|
|
334
417
|
function linesOf(lines) {
|
|
335
418
|
return lines.map((line) => picked(line, LINE_INPUT_FIELDS));
|
|
336
419
|
}
|
|
337
|
-
export function createPurchasingPurchaseOrdersModule(
|
|
420
|
+
export function createPurchasingPurchaseOrdersModule(baseTransport) {
|
|
421
|
+
const transport = sentReferenceAware(baseTransport);
|
|
338
422
|
const listPage = async (skip, take, options) => {
|
|
339
423
|
const filters = options ? picked(options, LIST_FILTERS) : {};
|
|
340
424
|
const data = await transport.graphql({
|
|
@@ -351,7 +435,7 @@ export function createPurchasingPurchaseOrdersModule(transport) {
|
|
|
351
435
|
};
|
|
352
436
|
const mutate = async (field, query, variables, call) => {
|
|
353
437
|
const data = await transport.graphql({ api: 'admin', query, variables: { ...variables, idempotencyKey: call?.idempotencyKey } }, call);
|
|
354
|
-
return data[field];
|
|
438
|
+
return withSentReferences(data[field]);
|
|
355
439
|
};
|
|
356
440
|
return {
|
|
357
441
|
async list(options) {
|
|
@@ -361,7 +445,7 @@ export function createPurchasingPurchaseOrdersModule(transport) {
|
|
|
361
445
|
},
|
|
362
446
|
async get(id, call) {
|
|
363
447
|
const data = await transport.graphql({ api: 'admin', query: PURCHASE_ORDER_QUERY, variables: { id } }, call);
|
|
364
|
-
return data.purchaseOrder;
|
|
448
|
+
return data.purchaseOrder && withSentReferences(data.purchaseOrder);
|
|
365
449
|
},
|
|
366
450
|
create(input, call) {
|
|
367
451
|
const fields = {
|
|
@@ -407,7 +491,8 @@ export function createPurchasingPurchaseOrdersModule(transport) {
|
|
|
407
491
|
idempotencyKey: options?.idempotencyKey,
|
|
408
492
|
},
|
|
409
493
|
}, options);
|
|
410
|
-
|
|
494
|
+
const result = data.importPurchaseOrderLines;
|
|
495
|
+
return { ...result, purchaseOrder: withSentReferences(result.purchaseOrder) };
|
|
411
496
|
},
|
|
412
497
|
},
|
|
413
498
|
submit(id, call) {
|
|
@@ -428,7 +513,16 @@ export function createPurchasingPurchaseOrdersModule(transport) {
|
|
|
428
513
|
}, options);
|
|
429
514
|
},
|
|
430
515
|
send(id, via, call) {
|
|
431
|
-
|
|
516
|
+
const { externalReference, transmittedAt, ...rest } = call;
|
|
517
|
+
if (externalReference === undefined && transmittedAt === undefined) {
|
|
518
|
+
return mutate('sendPurchaseOrder', SEND_PURCHASE_ORDER_MUTATION, { id, via }, rest);
|
|
519
|
+
}
|
|
520
|
+
return mutate('sendPurchaseOrder', SEND_PURCHASE_ORDER_EXTERNAL_MUTATION, {
|
|
521
|
+
id,
|
|
522
|
+
via,
|
|
523
|
+
externalReference: externalReference ?? null,
|
|
524
|
+
transmittedAt: transmittedAt instanceof Date ? transmittedAt.toISOString() : (transmittedAt ?? null),
|
|
525
|
+
}, rest);
|
|
432
526
|
},
|
|
433
527
|
revise(id, input, call) {
|
|
434
528
|
const fields = {
|
|
@@ -205,7 +205,7 @@ export declare const DELETE_REPLENISHMENT_RULE_MUTATION = "\n mutation DeleteRe
|
|
|
205
205
|
export declare const REPLENISHMENT_SUGGESTIONS_QUERY = "\n query ReplenishmentSuggestions($options: ReplenishmentSuggestionListOptions) {\n replenishmentSuggestions(options: $options) {\n totalItems\n items { \n id\n scopeId\n legalEntityId\n stockLocationId\n stockLocation { id name }\n productVariantId\n productVariant { id sku name }\n supplierId\n supplier { id code name status currencyCode }\n supplierItemId\n method\n available\n onOrder\n backordered\n inDraft\n target\n suggestedBaseQuantity\n suggestedPurchaseQuantity\n explanation\n isNew\n computedAt\n dismissedUntil\n }\n }\n }\n";
|
|
206
206
|
export declare const COMPUTE_REPLENISHMENT_SUGGESTIONS_MUTATION = "\n mutation ComputeReplenishmentSuggestions($idempotencyKey: String) {\n computeReplenishmentSuggestions(idempotencyKey: $idempotencyKey) {\n computedAt\n localDay\n timeZone\n locations\n suggestions\n newSuggestions\n dismissed\n skippedLocations { stockLocationId reason }\n }\n }\n";
|
|
207
207
|
export declare const DISMISS_REPLENISHMENT_SUGGESTION_MUTATION = "\n mutation DismissReplenishmentSuggestion($id: ID!, $until: String, $idempotencyKey: String) {\n dismissReplenishmentSuggestion(id: $id, until: $until, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n stockLocationId\n stockLocation { id name }\n productVariantId\n productVariant { id sku name }\n supplierId\n supplier { id code name status currencyCode }\n supplierItemId\n method\n available\n onOrder\n backordered\n inDraft\n target\n suggestedBaseQuantity\n suggestedPurchaseQuantity\n explanation\n isNew\n computedAt\n dismissedUntil\n\n }\n }\n";
|
|
208
|
-
export declare const CREATE_REPLENISHMENT_DRAFTS_MUTATION = "\n mutation CreateReplenishmentDrafts(\n $input: CreateReplenishmentDraftsInput!\n $idempotencyKey: String\n ) {\n createReplenishmentDrafts(input: $input, idempotencyKey: $idempotencyKey) {\n lines\n purchaseOrders { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n }\n }\n }\n }\n";
|
|
208
|
+
export declare const CREATE_REPLENISHMENT_DRAFTS_MUTATION = "\n mutation CreateReplenishmentDrafts(\n $input: CreateReplenishmentDraftsInput!\n $idempotencyKey: String\n ) {\n createReplenishmentDrafts(input: $input, idempotencyKey: $idempotencyKey) {\n lines\n purchaseOrders { \n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n kind\n status\n supplierId\n supplier { id code name status }\n destinationStockLocationId\n destinationStockLocation { id name }\n currencyCode\n revision\n approvedRevision\n approvedAmount\n requestedDeliveryOn\n supplierReference\n notesToSupplier\n internalNotes\n managedBy\n externalId\n externalNumber\n externalApprovalStatus\n sentAt\n closedAt\n closeReason\n createdByRef\n total\n lineCount\n confirmation\n lines { \n id\n purchaseOrderId\n position\n productVariantId\n supplierItemId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n orderedQuantity\n orderedBaseQuantity\n cancelledBaseQuantity\n receivedBaseQuantity\n returnedForReplacementBaseQuantity\n unitPrice\n discountBps\n priceSource\n vatRateBps\n lineTotal\n requestedOn\n confirmedBaseQuantity\n confirmedOn\n confirmedAt\n externalLineId\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n revisions {\n id\n revision\n state\n diff\n totalAfter\n createdByRef\n createdAt\n appliedAt\n sentAt\n sentVia\n sentReference\n }\n }\n }\n }\n";
|
|
209
209
|
export declare const IMPORT_REPLENISHMENT_RULES_MUTATION = "\n mutation ImportReplenishmentRules(\n $input: ImportReplenishmentRulesInput!\n $idempotencyKey: String\n ) {\n importReplenishmentRules(input: $input, idempotencyKey: $idempotencyKey) {\n dryRun\n contentHash\n ignoredColumns\n totalRows\n created\n updated\n unchanged\n failed\n rows { row sku location outcome ruleId errorCode message }\n }\n }\n";
|
|
210
210
|
export interface ReplenishmentRulesModule {
|
|
211
211
|
/**
|
|
@@ -278,4 +278,4 @@ export interface PurchasingReplenishmentModule {
|
|
|
278
278
|
rules: ReplenishmentRulesModule;
|
|
279
279
|
suggestions: ReplenishmentSuggestionsModule;
|
|
280
280
|
}
|
|
281
|
-
export declare function createPurchasingReplenishmentModule(
|
|
281
|
+
export declare function createPurchasingReplenishmentModule(baseTransport: Transport): PurchasingReplenishmentModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pageFromVendureList, readOffsetCursor, } from '@sixtyninecommerce/core';
|
|
2
|
-
import { PURCHASE_ORDER_FIELDS } from './purchase-orders.js';
|
|
2
|
+
import { PURCHASE_ORDER_FIELDS, sentReferenceAware, withSentReferences, } from './purchase-orders.js';
|
|
3
3
|
export const REPLENISHMENT_RULE_FIELDS = /* GraphQL */ `
|
|
4
4
|
id
|
|
5
5
|
scopeId
|
|
@@ -135,7 +135,9 @@ function picked(input, fields) {
|
|
|
135
135
|
}
|
|
136
136
|
return out;
|
|
137
137
|
}
|
|
138
|
-
export function createPurchasingReplenishmentModule(
|
|
138
|
+
export function createPurchasingReplenishmentModule(baseTransport) {
|
|
139
|
+
// `suggestions.createDrafts` answers its drafts through PURCHASE_ORDER_FIELDS (`sentReference`).
|
|
140
|
+
const transport = sentReferenceAware(baseTransport);
|
|
139
141
|
const rulesPage = async (skip, take, options) => {
|
|
140
142
|
const filters = options ? picked(options, RULE_FILTERS) : {};
|
|
141
143
|
const data = await transport.graphql({
|
|
@@ -233,7 +235,8 @@ export function createPurchasingReplenishmentModule(transport) {
|
|
|
233
235
|
idempotencyKey: call?.idempotencyKey,
|
|
234
236
|
},
|
|
235
237
|
}, call);
|
|
236
|
-
|
|
238
|
+
const drafts = data.createReplenishmentDrafts;
|
|
239
|
+
return { ...drafts, purchaseOrders: drafts.purchaseOrders.map(withSentReferences) };
|
|
237
240
|
},
|
|
238
241
|
},
|
|
239
242
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixtyninecommerce/admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Back-office SDK for sixtynine-commerce: every capability of the platform as a method",
|
|
5
5
|
"homepage": "https://github.com/SIXTYNINE-digital/sixtynine-commerce-engine/tree/main/packages/admin-client#readme",
|
|
6
6
|
"repository": {
|