@sixtyninecommerce/admin 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +294 -0
  2. package/dist/catalog/products.d.ts +162 -1
  3. package/dist/catalog/products.js +94 -1
  4. package/dist/catalog/variants.d.ts +50 -0
  5. package/dist/catalog/variants.js +48 -18
  6. package/dist/client.d.ts +21 -0
  7. package/dist/client.js +6 -0
  8. package/dist/fulfillments/index.d.ts +77 -0
  9. package/dist/fulfillments/index.js +109 -0
  10. package/dist/index.d.ts +15 -4
  11. package/dist/index.js +5 -0
  12. package/dist/integrations/index.d.ts +14 -0
  13. package/dist/integrations/index.js +9 -0
  14. package/dist/integrations/pipelines.d.ts +113 -0
  15. package/dist/integrations/pipelines.js +62 -0
  16. package/dist/integrations/types.d.ts +176 -0
  17. package/dist/integrations/types.js +8 -0
  18. package/dist/jobs/bulk-action-run.d.ts +11 -2
  19. package/dist/jobs/bulk-action-run.js +4 -5
  20. package/dist/orders/bulk.d.ts +75 -0
  21. package/dist/orders/bulk.js +150 -0
  22. package/dist/orders/deposit-policy.d.ts +103 -0
  23. package/dist/orders/deposit-policy.js +202 -0
  24. package/dist/orders/index.d.ts +80 -0
  25. package/dist/orders/index.js +13 -0
  26. package/dist/orders/manual-discounts.d.ts +11 -2
  27. package/dist/orders/manual-discounts.js +2 -0
  28. package/dist/payments/index.d.ts +7 -0
  29. package/dist/payments/index.js +2 -0
  30. package/dist/payments/methods.d.ts +37 -0
  31. package/dist/payments/methods.js +33 -0
  32. package/dist/pricing/index.d.ts +3 -0
  33. package/dist/pricing/index.js +2 -0
  34. package/dist/pricing/vouchers.d.ts +103 -0
  35. package/dist/pricing/vouchers.js +69 -0
  36. package/dist/returns/index.d.ts +225 -0
  37. package/dist/returns/index.js +160 -0
  38. package/dist/search/index.d.ts +99 -0
  39. package/dist/search/index.js +62 -0
  40. package/dist/types.d.ts +2 -2
  41. package/package.json +1 -1
@@ -19,6 +19,17 @@ export type InventoryFlag = 'TRUE' | 'FALSE' | 'INHERIT';
19
19
  * `parcelCapacity` is set), `none` never adds one.
20
20
  */
21
21
  export type ParcelPacking = 'shared' | 'separate' | 'none';
22
+ /**
23
+ * A variant's backorder rule: `inherit` follows the store's, `deny` sells nothing below zero,
24
+ * `incoming` sells up to the stock on its way, `limited` up to `backorderLimit` below zero, and
25
+ * `unlimited` without a bound.
26
+ */
27
+ export type VariantBackorderPolicy = 'inherit' | 'deny' | 'incoming' | 'limited' | 'unlimited';
28
+ /** One currency's price of a variant: integer minor units, on the write's `priceBasis`. */
29
+ export interface VariantPriceInput {
30
+ currencyCode: string;
31
+ price: number;
32
+ }
22
33
  /**
23
34
  * A product variant — the thing that has a SKU, a price and stock.
24
35
  *
@@ -128,6 +139,27 @@ interface VariantFields extends AvailabilityInput<VariantAvailabilityState> {
128
139
  * (`INVALID_PARCEL_PACKING`).
129
140
  */
130
141
  parcelPacking?: ParcelPacking | null;
142
+ /** The fewest units one order line may carry; null for no minimum. */
143
+ minOrderQuantity?: number | null;
144
+ /** The units a line's quantity moves in (6: 6, 12, 18 …); null for one. */
145
+ salesUnit?: number | null;
146
+ /** What one unit costs the store, integer minor units of its default currency; null clears it. */
147
+ cost?: number | null;
148
+ packageWeightGrams?: number | null;
149
+ packageLengthCm?: number | null;
150
+ packageWidthCm?: number | null;
151
+ packageHeightCm?: number | null;
152
+ /** Null: `inherit`. */
153
+ backorderPolicy?: VariantBackorderPolicy | null;
154
+ /** The units a `limited` variant may sell below zero. */
155
+ backorderLimit?: number | null;
156
+ /**
157
+ * GS1 barcode: 8, 12, 13 or 14 digits when new or changed (`FEED_IDENTIFIER_INVALID`
158
+ * otherwise); null or blank clears it. A stored value sent back unchanged is never judged.
159
+ */
160
+ gtin?: string | null;
161
+ /** Manufacturer part number; null or blank clears it. */
162
+ mpn?: string | null;
131
163
  stockLevels?: StockLevelInput[];
132
164
  trackInventory?: InventoryFlag;
133
165
  outOfStockThreshold?: number;
@@ -179,6 +211,12 @@ export interface CreateProductVariantInput extends VariantFields {
179
211
  export interface UpdateProductVariantInput extends VariantFields {
180
212
  id: string;
181
213
  sku?: string;
214
+ /**
215
+ * The price in each named currency, integer minor units on `priceBasis` (required beside it,
216
+ * as for `price`). A currency left out keeps its price. Update only: the engine's create takes
217
+ * `price` alone and would drop this list without a word.
218
+ */
219
+ prices?: VariantPriceInput[];
182
220
  }
183
221
  /**
184
222
  * Variant writes. Reading needs `ReadCatalog`, creating `CreateCatalog`,
@@ -270,5 +308,17 @@ interface WireVariant extends Omit<ProductVariant, keyof Availability<string> |
270
308
  }) | null;
271
309
  }
272
310
  export declare function toVariant(wire: WireVariant): ProductVariant;
311
+ /** A write's prices and the basis it states them on. */
312
+ export interface PricedInput {
313
+ price?: number;
314
+ prices?: readonly VariantPriceInput[];
315
+ priceBasis?: PriceBasis;
316
+ }
317
+ /**
318
+ * Every priced input (`price`, or any `prices` entry) must be whole minor units and state its
319
+ * basis, and the basis must be the store's. Read per call, with the call's own options, so a
320
+ * per-call tenant is checked against ITS store rather than the client's default one.
321
+ */
322
+ export declare function assertPricesStateBasis(transport: Transport, inputs: readonly PricedInput[], options?: Call): Promise<void>;
273
323
  export declare function createVariantsModule(transport: Transport): VariantsModule;
274
324
  export {};
@@ -144,13 +144,30 @@ function assertParcelRule(input) {
144
144
  }
145
145
  }
146
146
  function toWireInput(input) {
147
- const { availabilityState, availableFrom, preorderLimit, taxClassKey, parcelCapacity, parcelPacking, priceBasis, ...rest } = input;
147
+ const { availabilityState, availableFrom, preorderLimit, taxClassKey, parcelCapacity, parcelPacking, priceBasis, minOrderQuantity, salesUnit, cost, packageWeightGrams, packageLengthCm, packageWidthCm, packageHeightCm, backorderPolicy, backorderLimit, gtin, mpn, ...rest } = input;
148
148
  void priceBasis;
149
149
  const customFields = availabilityCustomFields({
150
150
  availabilityState,
151
151
  availableFrom,
152
152
  preorderLimit,
153
153
  });
154
+ const fields = {
155
+ minOrderQuantity,
156
+ salesUnit,
157
+ cost,
158
+ packageWeightGrams,
159
+ packageLengthCm,
160
+ packageWidthCm,
161
+ packageHeightCm,
162
+ backorderPolicy,
163
+ backorderLimit,
164
+ gtin,
165
+ mpn,
166
+ };
167
+ for (const [key, value] of Object.entries(fields)) {
168
+ if (value !== undefined)
169
+ customFields[key] = value;
170
+ }
154
171
  if (taxClassKey !== undefined)
155
172
  customFields.taxClassKey = taxClassKey;
156
173
  if (parcelCapacity !== undefined)
@@ -163,6 +180,35 @@ function toWireInput(input) {
163
180
  function refuse(code, message) {
164
181
  return new ValidationError({ code, message, status: 400, service: 'vendure' });
165
182
  }
183
+ /**
184
+ * Every priced input (`price`, or any `prices` entry) must be whole minor units and state its
185
+ * basis, and the basis must be the store's. Read per call, with the call's own options, so a
186
+ * per-call tenant is checked against ITS store rather than the client's default one.
187
+ */
188
+ export async function assertPricesStateBasis(transport, inputs, options) {
189
+ const priced = inputs.filter((input) => input.price !== undefined || input.prices !== undefined);
190
+ if (priced.length === 0)
191
+ return;
192
+ for (const input of priced) {
193
+ const amounts = [
194
+ ...(input.price !== undefined ? [input.price] : []),
195
+ ...(input.prices ?? []).map((entry) => entry.price),
196
+ ];
197
+ const fractional = amounts.find((amount) => !Number.isInteger(amount));
198
+ if (fractional !== undefined) {
199
+ throw refuse('INVALID_PRICE', `price must be a whole number of minor units; got ${String(fractional)}.`);
200
+ }
201
+ if (input.priceBasis !== 'net' && input.priceBasis !== 'gross') {
202
+ throw refuse('PRICE_BASIS_REQUIRED', 'A variant price must state its basis: priceBasis "net" or "gross".');
203
+ }
204
+ }
205
+ const channel = await fieldOf(transport, PRICE_BASIS_QUERY, 'activeChannel', {}, options);
206
+ const storeBasis = channel.pricesIncludeTax ? 'gross' : 'net';
207
+ const wrong = priced.find((input) => input.priceBasis !== storeBasis);
208
+ if (wrong) {
209
+ throw refuse('PRICE_BASIS_MISMATCH', `This store states prices ${storeBasis === 'gross' ? 'including' : 'excluding'} tax, so a price must be sent with priceBasis "${storeBasis}"; got "${String(wrong.priceBasis)}". Convert it before sending — the SDK does not, because the rate depends on each order's zone.`);
210
+ }
211
+ }
166
212
  export function createVariantsModule(transport) {
167
213
  /**
168
214
  * Every priced input must state its basis, and the basis must be the store's.
@@ -170,23 +216,7 @@ export function createVariantsModule(transport) {
170
216
  * against ITS store rather than the client's default one.
171
217
  */
172
218
  const assertPriceBasis = async (inputs, options) => {
173
- const priced = inputs.filter((input) => input.price !== undefined);
174
- if (priced.length === 0)
175
- return;
176
- for (const input of priced) {
177
- if (!Number.isInteger(input.price)) {
178
- throw refuse('INVALID_PRICE', `price must be a whole number of minor units; got ${String(input.price)}.`);
179
- }
180
- if (input.priceBasis !== 'net' && input.priceBasis !== 'gross') {
181
- throw refuse('PRICE_BASIS_REQUIRED', 'A variant price must state its basis: priceBasis "net" or "gross".');
182
- }
183
- }
184
- const channel = await fieldOf(transport, PRICE_BASIS_QUERY, 'activeChannel', {}, options);
185
- const storeBasis = channel.pricesIncludeTax ? 'gross' : 'net';
186
- const wrong = priced.find((input) => input.priceBasis !== storeBasis);
187
- if (wrong) {
188
- throw refuse('PRICE_BASIS_MISMATCH', `This store states prices ${storeBasis === 'gross' ? 'including' : 'excluding'} tax, so a price must be sent with priceBasis "${storeBasis}"; got "${String(wrong.priceBasis)}". Convert it before sending — the SDK does not, because the rate depends on each order's zone.`);
189
- }
219
+ await assertPricesStateBasis(transport, inputs, options);
190
220
  };
191
221
  const mapAll = (rows, what) => rows.map((row) => {
192
222
  if (row === null) {
package/dist/client.d.ts CHANGED
@@ -19,6 +19,7 @@ import { type FeedsModule } from './feeds/index.js';
19
19
  import { type FulfillmentsModule } from './fulfillments/index.js';
20
20
  import { type HeadsModule } from './heads/index.js';
21
21
  import { type HooksModule } from './hooks/index.js';
22
+ import { type IntegrationsModule } from './integrations/index.js';
22
23
  import { type JobsModule } from './jobs/index.js';
23
24
  import { type LocationsModule } from './locations/index.js';
24
25
  import { type MetaModule } from './meta/index.js';
@@ -37,6 +38,8 @@ import { type PosModule } from './pos/index.js';
37
38
  import { type PricingModule } from './pricing/index.js';
38
39
  import { type ProvenanceModule } from './provenance/index.js';
39
40
  import { type ReportsModule } from './reports/index.js';
41
+ import { type ReturnsModule } from './returns/index.js';
42
+ import { type SearchModule } from './search/index.js';
40
43
  import { type RedirectsModule } from './seo/redirects.js';
41
44
  import { type ParcelCountSuggestionMethod } from './shipping/parcel-count-suggestion.js';
42
45
  import { type ShippingModule } from './shipping/parcel-rule.js';
@@ -141,6 +144,12 @@ export interface AdminClient {
141
144
  * the store's tax, payment or fulfillment provider; `ping` tests one hook.
142
145
  */
143
146
  hooks: HooksModule;
147
+ /**
148
+ * The store's connections to other systems (spec §9.2). `pipelines.drafts` keeps a
149
+ * half-finished import or export set-up on the server for 7 days after its last change, for any
150
+ * admin of the store with pipeline rights, and never holds a credential.
151
+ */
152
+ integrations: IntegrationsModule;
144
153
  /**
145
154
  * Platform events (spec §6.9): `poll`/`pollAll`/`replay`/`head` over the event log (a
146
155
  * machine credential with `ReadPlatformEvents`), `subscribe` to build a typed webhook
@@ -217,6 +226,18 @@ export interface AdminClient {
217
226
  provenance: ProvenanceModule;
218
227
  /** Tenant reporting in minor units and ISO-8601 UTC (spec §9.2 `reports`, §9.3). */
219
228
  reports: ReportsModule;
229
+ /**
230
+ * Order returns (RMA): one return, an order's returns, what of an order can
231
+ * still be returned, and the plan for settling a return (headless W9-47). The
232
+ * list and the writes are phase 7.
233
+ */
234
+ returns: ReturnsModule;
235
+ /**
236
+ * One search across the store (spec §7 `search.entities`): products, orders, customers and
237
+ * content in one call, each type's best matches already loaded, in relevance order. A type
238
+ * the credential may not read is skipped and named, never refused.
239
+ */
240
+ search: SearchModule;
220
241
  seo: {
221
242
  redirects: RedirectsModule;
222
243
  };
package/dist/client.js CHANGED
@@ -19,6 +19,7 @@ import { createFeedsModule } from './feeds/index.js';
19
19
  import { createFulfillmentsModule } from './fulfillments/index.js';
20
20
  import { createHeadsModule } from './heads/index.js';
21
21
  import { createHooksModule } from './hooks/index.js';
22
+ import { createIntegrationsModule } from './integrations/index.js';
22
23
  import { createJobsModule } from './jobs/index.js';
23
24
  import { createLocationsModule } from './locations/index.js';
24
25
  import { createMetaModule } from './meta/index.js';
@@ -37,6 +38,8 @@ import { createPosModule } from './pos/index.js';
37
38
  import { createPricingModule } from './pricing/index.js';
38
39
  import { createProvenanceModule } from './provenance/index.js';
39
40
  import { createReportsModule } from './reports/index.js';
41
+ import { createReturnsModule } from './returns/index.js';
42
+ import { createSearchModule } from './search/index.js';
40
43
  import { createRedirectsModule } from './seo/redirects.js';
41
44
  import { createParcelCountSuggestion, } from './shipping/parcel-count-suggestion.js';
42
45
  import { createShippingModule } from './shipping/parcel-rule.js';
@@ -406,12 +409,15 @@ function buildClient(config, overrides, resolver, shared, credential) {
406
409
  pricing: createPricingModule(transport),
407
410
  provenance: createProvenanceModule(transport),
408
411
  reports: createReportsModule(transport, bulkModule, jobsModule, () => tenant.location),
412
+ returns: createReturnsModule(transport),
409
413
  documents: createDocumentsModule(transport),
410
414
  hooks: createHooksModule(transport),
415
+ integrations: createIntegrationsModule(transport),
411
416
  events: createEventsModule(transport),
412
417
  customers: createCustomersModule(transport),
413
418
  compliance: createComplianceModule(transport),
414
419
  feeds: createFeedsModule(transport),
420
+ search: createSearchModule(transport),
415
421
  seo: { redirects: createRedirectsModule(transport) },
416
422
  shipping: {
417
423
  ...createShippingModule(transport),
@@ -211,6 +211,53 @@ export interface CancelledFulfillment {
211
211
  */
212
212
  settlements: FulfillmentCancelSettlement[];
213
213
  }
214
+ /** Why an order that is not paid in full may still be handed over. */
215
+ export type FulfillmentCoverageExemption = 'NET_TERMS' | 'EXEMPT_METHOD';
216
+ /** Who granted a coverage override, as the platform names principals. */
217
+ export type FulfillmentCoverageActorKind = 'user' | 'api_token' | 'app_installation';
218
+ /**
219
+ * A recorded decision to hand an order's goods over before it is paid in full. The latest one
220
+ * of an order holds while the order owes no more than `outstandingAtGrant`, in the same currency.
221
+ * Money is integer MINOR UNITS.
222
+ */
223
+ export interface FulfillmentCoverageOverride {
224
+ id: string;
225
+ orderId: string;
226
+ reason: string;
227
+ actorKind: FulfillmentCoverageActorKind;
228
+ /** The user, API token or app installation id. */
229
+ actorId: string;
230
+ outstandingAtGrant: number;
231
+ currencyCode: string;
232
+ /** ISO-8601 UTC. */
233
+ createdAt: string;
234
+ /** Whether it still allows a hand-over now. */
235
+ active: boolean;
236
+ }
237
+ /**
238
+ * Whether an order's goods may be handed over now under the store's fulfilment payment policy
239
+ * (Channel `fulfillmentPaymentPolicy`). Collected money is settled or held by a payment provider;
240
+ * an offline authorization (bank transfer, invoice, cash on delivery) does not count.
241
+ */
242
+ export interface OrderFulfillmentCoverage {
243
+ orderId: string;
244
+ orderCode: string;
245
+ currencyCode: string;
246
+ /** The store requires full payment before a fulfilment is created, extended or shipped. */
247
+ policyActive: boolean;
248
+ /** The collected money covers what the order bills. */
249
+ covered: boolean;
250
+ /** What is still to collect, minor units. */
251
+ outstanding: number;
252
+ exempt: boolean;
253
+ exemptReason: FulfillmentCoverageExemption | null;
254
+ /** A fulfilment may be created, extended and shipped now. */
255
+ allowed: boolean;
256
+ /** The order's latest override, whether or not it still holds. */
257
+ override: FulfillmentCoverageOverride | null;
258
+ }
259
+ /** The longest override reason the engine stores. */
260
+ export declare const FULFILLMENT_COVERAGE_REASON_MAX_LENGTH = 500;
214
261
  /**
215
262
  * Fulfillment parcels (multi-parcel shipments). Each method is its own request
216
263
  * on purpose: a caller deployed ahead of an engine without these fields sees
@@ -316,6 +363,32 @@ export interface FulfillmentsModule {
316
363
  cancel(fulfillmentId: string, input?: CancelFulfillmentInput, options?: Call & {
317
364
  idempotencyKey?: string;
318
365
  }): Promise<CancelledFulfillment>;
366
+ /**
367
+ * Whether the order's goods may be handed over now under the store's fulfilment payment
368
+ * policy, and why: covered, exempt (net terms, an exempt method), or an override that still
369
+ * holds. Needs `ReadOrder`. Another store's order is a `NotFoundError`
370
+ * (`FULFILLMENT_COVERAGE_ORDER_NOT_FOUND`).
371
+ *
372
+ * On a store that requires full payment, creating, extending or shipping a fulfilment of an
373
+ * uncovered order is refused `ORDER_NOT_COVERED` (→ `BusinessRuleError`; the GraphQL error's
374
+ * `extensions` carry `orderId`, `orderCode`, `outstanding` and `currencyCode`, and this call
375
+ * reads the same facts); a warehouse API call answers it as
376
+ * `WarehouseError { code: ORDER_NOT_COVERED }`.
377
+ */
378
+ coverage(orderId: string, options?: Call): Promise<OrderFulfillmentCoverage>;
379
+ /**
380
+ * Record that the order may be handed over before it is paid in full, while it owes no more
381
+ * than it does now. Needs `OverrideFulfillmentPaymentCoverage`. Append-only: a later grant
382
+ * supersedes the earlier ones. The order's history gets a private entry and the audit trail
383
+ * an event.
384
+ *
385
+ * A blank reason, or one over 500 characters, is refused before any request
386
+ * (`FULFILLMENT_COVERAGE_OVERRIDE_INVALID`, → `ValidationError`), as the engine would.
387
+ * `options.idempotencyKey`: a repeat under it answers the first grant, never a second one.
388
+ */
389
+ allowUncovered(orderId: string, reason: string, options?: Call & {
390
+ idempotencyKey?: string;
391
+ }): Promise<FulfillmentCoverageOverride>;
319
392
  }
320
393
  /**
321
394
  * Its own document, like every call here: on an engine without the query this call alone fails
@@ -324,6 +397,10 @@ export interface FulfillmentsModule {
324
397
  export declare const FULFILLMENT_CANCEL_PREVIEW_QUERY = "\n query FulfillmentCancelPreview($fulfillmentId: ID!) {\n fulfillmentCancelPreview(fulfillmentId: $fulfillmentId) {\n fulfillmentId\n overpayments {\n orderId\n orderCode\n amount\n currencyCode\n refund { \n available\n code\n message\n }\n accountCredit { \n available\n code\n message\n }\n }\n }\n }\n";
325
398
  /** `$overpayment` and `$idempotencyKey` are optional and left out of the variables when not given. */
326
399
  export declare const CANCEL_FULFILLMENT_MUTATION = "\n mutation CancelFulfillment(\n $fulfillmentId: ID!\n $overpayment: [FulfillmentCancelOverpaymentInput!]\n $idempotencyKey: String\n ) {\n cancelFulfillment(\n fulfillmentId: $fulfillmentId\n overpayment: $overpayment\n idempotencyKey: $idempotencyKey\n ) {\n fulfillment {\n id\n state\n }\n settlements {\n orderId\n orderCode\n amount\n currencyCode\n choice\n }\n }\n }\n";
400
+ /** Its own document: on an engine without the query this call alone fails validation. */
401
+ export declare const ORDER_FULFILLMENT_COVERAGE_QUERY = "\n query OrderFulfillmentCoverage($orderId: ID!) {\n orderFulfillmentCoverage(orderId: $orderId) {\n orderId\n orderCode\n currencyCode\n policyActive\n covered\n outstanding\n exempt\n exemptReason\n allowed\n override { \n id\n orderId\n reason\n actorKind\n actorId\n outstandingAtGrant\n currencyCode\n createdAt\n active\n }\n }\n }\n";
402
+ /** `$idempotencyKey` is optional and left out of the variables when not given. */
403
+ export declare const ALLOW_UNCOVERED_FULFILLMENT_MUTATION = "\n mutation AllowUncoveredFulfillment($orderId: ID!, $reason: String!, $idempotencyKey: String) {\n allowUncoveredFulfillment(orderId: $orderId, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n id\n orderId\n reason\n actorKind\n actorId\n outstandingAtGrant\n currencyCode\n createdAt\n active\n\n }\n }\n";
327
404
  export declare const REPORT_APP_FULFILLMENT_MUTATION = "\n mutation ReportAppFulfillment(\n $fulfillmentId: ID!\n $input: ReportAppFulfillmentInput!\n $idempotencyKey: String\n ) {\n reportAppFulfillment(\n fulfillmentId: $fulfillmentId\n input: $input\n idempotencyKey: $idempotencyKey\n ) {\n id\n state\n trackingCode\n method\n }\n }\n";
328
405
  export declare const ORDER_FULFILLMENT_PARCELS_QUERY = "\n query OrderFulfillmentParcels($id: ID!) {\n order(id: $id) {\n id\n fulfillments {\n id\n trackingCode\n customFields {\n myparcelShipmentId\n myparcelShipmentIds\n parcelCount\n trackingCodes\n }\n }\n }\n }\n";
329
406
  /** Every field of `MyparcelUnretractedShipment`, shared with the stock-transfer twin. */
@@ -1,4 +1,6 @@
1
1
  import { errorFromErrorResult, isErrorResult, NotFoundError, ValidationError, } from '@sixtyninecommerce/core';
2
+ /** The longest override reason the engine stores. */
3
+ export const FULFILLMENT_COVERAGE_REASON_MAX_LENGTH = 500;
2
4
  /** Every field of `OrderOverpaymentOption`. */
3
5
  const OVERPAYMENT_OPTION_FIELDS = /* GraphQL */ `
4
6
  available
@@ -50,6 +52,81 @@ export const CANCEL_FULFILLMENT_MUTATION = /* GraphQL */ `
50
52
  }
51
53
  }
52
54
  `;
55
+ /** Every field of `OrderFulfillmentCoverageOverride`. */
56
+ const COVERAGE_OVERRIDE_FIELDS = /* GraphQL */ `
57
+ id
58
+ orderId
59
+ reason
60
+ actorKind
61
+ actorId
62
+ outstandingAtGrant
63
+ currencyCode
64
+ createdAt
65
+ active
66
+ `;
67
+ /** Its own document: on an engine without the query this call alone fails validation. */
68
+ export const ORDER_FULFILLMENT_COVERAGE_QUERY = /* GraphQL */ `
69
+ query OrderFulfillmentCoverage($orderId: ID!) {
70
+ orderFulfillmentCoverage(orderId: $orderId) {
71
+ orderId
72
+ orderCode
73
+ currencyCode
74
+ policyActive
75
+ covered
76
+ outstanding
77
+ exempt
78
+ exemptReason
79
+ allowed
80
+ override { ${COVERAGE_OVERRIDE_FIELDS} }
81
+ }
82
+ }
83
+ `;
84
+ /** `$idempotencyKey` is optional and left out of the variables when not given. */
85
+ export const ALLOW_UNCOVERED_FULFILLMENT_MUTATION = /* GraphQL */ `
86
+ mutation AllowUncoveredFulfillment($orderId: ID!, $reason: String!, $idempotencyKey: String) {
87
+ allowUncoveredFulfillment(orderId: $orderId, reason: $reason, idempotencyKey: $idempotencyKey) {
88
+ ${COVERAGE_OVERRIDE_FIELDS}
89
+ }
90
+ }
91
+ `;
92
+ function invalidCoverage(field, message) {
93
+ return new ValidationError({
94
+ code: 'FULFILLMENT_COVERAGE_OVERRIDE_INVALID',
95
+ message,
96
+ status: 400,
97
+ service: 'vendure',
98
+ details: [{ field, code: 'FULFILLMENT_COVERAGE_OVERRIDE_INVALID', message }],
99
+ });
100
+ }
101
+ function assertOrderId(orderId) {
102
+ if (typeof orderId !== 'string' || orderId.trim() === '') {
103
+ throw invalidCoverage('orderId', 'An order id is required.');
104
+ }
105
+ }
106
+ /** Refused before any request: the engine would refuse it the same way. */
107
+ function assertOverrideReason(reason) {
108
+ const text = typeof reason === 'string' ? reason.trim() : '';
109
+ if (text === '') {
110
+ throw invalidCoverage('reason', 'Say why this order may be handed over before it is paid: a reason is required.');
111
+ }
112
+ if (text.length > FULFILLMENT_COVERAGE_REASON_MAX_LENGTH) {
113
+ throw invalidCoverage('reason', `The reason is at most ${FULFILLMENT_COVERAGE_REASON_MAX_LENGTH} characters.`);
114
+ }
115
+ return text;
116
+ }
117
+ function toCoverageOverride(raw) {
118
+ return {
119
+ id: raw.id,
120
+ orderId: raw.orderId,
121
+ reason: raw.reason,
122
+ actorKind: raw.actorKind,
123
+ actorId: raw.actorId,
124
+ outstandingAtGrant: raw.outstandingAtGrant,
125
+ currencyCode: raw.currencyCode,
126
+ createdAt: raw.createdAt,
127
+ active: raw.active,
128
+ };
129
+ }
53
130
  const OVERPAYMENT_CHOICES = new Set([
54
131
  'REFUND',
55
132
  'ACCOUNT_CREDIT',
@@ -406,6 +483,38 @@ export function createFulfillmentsModule(transport) {
406
483
  })),
407
484
  };
408
485
  },
486
+ async coverage(orderId, options) {
487
+ assertOrderId(orderId);
488
+ const data = await transport.graphql({ api: 'admin', query: ORDER_FULFILLMENT_COVERAGE_QUERY, variables: { orderId } }, options);
489
+ const coverage = data.orderFulfillmentCoverage;
490
+ return {
491
+ orderId: coverage.orderId,
492
+ orderCode: coverage.orderCode,
493
+ currencyCode: coverage.currencyCode,
494
+ policyActive: coverage.policyActive,
495
+ covered: coverage.covered,
496
+ outstanding: coverage.outstanding,
497
+ exempt: coverage.exempt,
498
+ exemptReason: coverage.exemptReason ?? null,
499
+ allowed: coverage.allowed,
500
+ override: coverage.override ? toCoverageOverride(coverage.override) : null,
501
+ };
502
+ },
503
+ async allowUncovered(orderId, reason, options) {
504
+ assertOrderId(orderId);
505
+ const text = assertOverrideReason(reason);
506
+ const data = await transport.graphql({
507
+ api: 'admin',
508
+ query: ALLOW_UNCOVERED_FULFILLMENT_MUTATION,
509
+ // A variable, not a header: the Admin API takes the key as an argument.
510
+ variables: {
511
+ orderId,
512
+ reason: text,
513
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
514
+ },
515
+ }, options);
516
+ return toCoverageOverride(data.allowUncoveredFulfillment);
517
+ },
409
518
  async reportAppFulfillment(fulfillmentId, input, options) {
410
519
  const data = await transport.graphql({
411
520
  api: 'admin',
package/dist/index.d.ts CHANGED
@@ -51,13 +51,13 @@ export type { Collection, CollectionListOptions, CollectionsModule, CollectionTr
51
51
  export type { CreateFacetInput, CreateFacetValueInput, Facet, FacetListOptions, FacetsModule, FacetTranslationInput, FacetValue, UpdateFacetInput, UpdateFacetValueInput, } from './catalog/facets.js';
52
52
  export type { CatalogModule } from './catalog/index.js';
53
53
  export type { CreateOptionGroupInput, CreateOptionInput, OptionsModule, OptionTranslationInput, ProductOption, ProductOptionGroup, UpdateOptionGroupInput, UpdateOptionInput, } from './catalog/options.js';
54
- export type { AvailabilityInStoresInput, CreateProductInput, LocalCopyOriginalOutcome, LocalCopyResult, LocalCopySkuInput, OrganizationProductAvailabilityAction, OrganizationProductAvailabilityChange, OrganizationProductStoreAvailability, OrganizationProductStoreState, Product, ProductCollectionNotRemovedReason, ProductCollectionsResult, ProductListFilter, ProductListOptions, ProductOptionGroupRef, ProductOptionRef, ProductsModule, ProductTranslation, ProductTranslationInput, SetAvailabilityInStoresInput, UpdateProductInput, } from './catalog/products.js';
54
+ export type { AvailabilityInStoresInput, CreateProductInput, LocalCopyOriginalOutcome, LocalCopyResult, LocalCopySkuInput, OrganizationProductAvailabilityAction, OrganizationProductAvailabilityChange, OrganizationProductStoreAvailability, OrganizationProductStoreState, Product, ProductCollectionNotRemovedReason, ProductCollectionsResult, ProductCondition, ProductListFilter, ProductListOptions, ProductOptionGroupRef, ProductOptionRef, ProductsModule, ProductTranslation, ProductTranslationInput, SaveProductFieldsInput, SaveProductInput, SaveProductPropertyValueInput, SaveProductResult, SaveProductVariantInput, SaveProductWarning, SetAvailabilityInStoresInput, UpdateProductInput, } from './catalog/products.js';
55
55
  export { MAX_AVAILABILITY_PRODUCTS, MAX_AVAILABILITY_STORES, MAX_PRODUCT_COLLECTION_IDS, MAX_STORE_EXCLUSION_PRODUCTS, } from './catalog/products.js';
56
56
  export type { ProductBulkAction, ProductBulkInput, ProductBulkRun, } from './catalog/products-bulk.js';
57
57
  export { MAX_BULK_PRODUCTS, PRODUCT_BULK_ACTIONS } from './catalog/products-bulk.js';
58
58
  export type { ContentFacetSyncResult, CreatePropertyGroupInput, CreatePropertyInput, ProductPropertyGroupValues, ProductPropertyValue, PropertiesModule, Property, PropertyConfig, PropertyFieldType, PropertyGroup, SetPropertyValueInput, UpdatePropertyGroupInput, UpdatePropertyInput, } from './catalog/properties.js';
59
59
  export type { AssetRef, Availability, AvailabilityInput, CatalogueOwnership, CatalogueOwnershipState, ConfigurableOperation, ConfigurableOperationInput, FacetValueRef, PriceBasis, ProductAvailabilityState, TranslationInput, VariantAvailabilityState, } from './catalog/types.js';
60
- export type { CreateProductVariantInput, InventoryFlag, ParcelPacking, ProductVariant, StockLevel, StockLevelInput, UpdateProductVariantInput, VariantPriceSource, VariantPriceSourceKind, VariantsModule, VariantTranslationInput, } from './catalog/variants.js';
60
+ export type { CreateProductVariantInput, InventoryFlag, ParcelPacking, ProductVariant, StockLevel, StockLevelInput, UpdateProductVariantInput, VariantBackorderPolicy, VariantPriceInput, VariantPriceSource, VariantPriceSourceKind, VariantsModule, VariantTranslationInput, } from './catalog/variants.js';
61
61
  export { MAX_REVERT_PRICE_VARIANTS } from './catalog/variants.js';
62
62
  export type { ProductVisibility, ProductVisibilityMode, SetProductVisibilityInput, VisibilityModule, } from './catalog/visibility.js';
63
63
  export { type AdminClient, type AdminClientConfig, type AppAuthConfig, createAdminClient, type SessionConfig, } from './client.js';
@@ -79,9 +79,11 @@ export { MAX_REDRIVE_EVENT_IDS } from './events/index.js';
79
79
  */
80
80
  export type { BulkStatusUpdateResult, BulkUpdateCategoryMappingStatusInput, CategorySuggestEnqueueResult, CategorySuggestStatus, CreateFeedCategoryMappingInput, CreateFeedConfigInput, CreateFeedInternalFieldInput, CreateFeedLookupTableInput, FeedAiModule, FeedAiSuggestion, FeedAiSuggestionKind, FeedAiSuggestionStatus, FeedCategoryMapping, FeedCategoryMappingSource, FeedCategoryMappingStatus, FeedCategoryMappingsModule, FeedCategoryMatchType, FeedCategorySuggestState, FeedCategorySuggestSummary, FeedCondition, FeedConditionGroup, FeedConditionOperand, FeedConditionOperator, FeedConditionValue, FeedConfig, FeedConfigSettings, FeedConfigsModule, FeedDeliveryMode, FeedDestination, FeedDestinationKey, FeedDestinationTemplateEntry, FeedFieldMapping, FeedFieldRule, FeedFilterSpec, FeedIdentifierFieldSupport, FeedIdentifierFieldsModule, FeedInternalField, FeedInternalFieldRules, FeedInternalFieldSpec, FeedInternalFieldsModule, FeedItemIssue, FeedItemIssueSeverity, FeedLookupEntry, FeedLookupTable, FeedLookupTablesModule, FeedMappingSpec, FeedPerDestinationCategories, FeedPreview, FeedPreviewDraft, FeedPreviewIssue, FeedPreviewItem, FeedRegenerateResult, FeedRegenerateThrottle, FeedRun, FeedRunStats, FeedRunStatus, FeedRunTrigger, FeedsModule, FeedTaxonomyModule, FeedTaxonomyNode, FeedTransformSpec, FeedValueSource, GenerateTitlePresetInput, ListFeedCategoryMappingsOptions, ListFeedConfigsOptions, ListFeedIssuesOptions, ListFeedRunsOptions, RotateFeedTokenResult, SearchTaxonomyOptions, SuggestCategoryMappingsInput, TitlePresetExample, TitlePresetPayload, TitlePresetStatus, UpdateFeedCategoryMappingInput, UpdateFeedConfigInput, UpdateFeedInternalFieldInput, UpdateFeedLookupTableInput, } from './feeds/index.js';
81
81
  export { AI_UNAVAILABLE_CODE, DEFAULT_FEED_PAGE_LIMIT, DEFAULT_PREVIEW_SAMPLE_SIZE, DEFAULT_REFRESH_INTERVAL_MINUTES, FEED_CATEGORY_MAPPING_SOURCES, FEED_CATEGORY_MAPPING_STATUSES, FEED_CATEGORY_MATCH_TYPES, FEED_CONDITION_OPERATORS, FEED_DESTINATIONS, FEED_IDENTIFIER_PATTERN, FEED_ITEM_ISSUE_SEVERITIES, FEED_PREVIEW_TIMEOUT_MS, FEED_REGENERATE_THROTTLED, FEED_RUN_STATUSES, FEED_RUN_TRIGGERS, FEED_TRANSFORM_KINDS, FEED_VALUE_SOURCE_KINDS, isAiUnavailable, isFeedConditionGroup, isFeedValueSourceKind, MAX_BULK_STATUS_IDS, MAX_FEED_PAGE_LIMIT, MAX_LOOKUP_ENTRIES, MAX_PREVIEW_SAMPLE_SIZE, MAX_REFRESH_INTERVAL_MINUTES, MIN_REFRESH_INTERVAL_MINUTES, readFeedRegenerateThrottle, TAXONOMY_DEFAULT_LIMIT, TAXONOMY_MAX_LIMIT, TITLE_PRESET_TIMEOUT_MS, VALUELESS_FEED_CONDITION_OPERATORS, } from './feeds/index.js';
82
- export type { AppFulfillmentReportState, CancelFulfillmentInput, CancelledFulfillment, ChargedParcelCountInput, FulfillmentCancelChoice, FulfillmentCancelOverpayment, FulfillmentCancelPreview, FulfillmentCancelSettlement, FulfillmentLabel, FulfillmentLabelFormat, FulfillmentParcelTracking, FulfillmentsModule, LabelMyparcelParcelsInput, MyparcelParcelsLabelRequest, MyparcelRetractionVerdict, MyparcelUnretractedShipment, OrderFulfillmentParcels, OrderFulfillmentUnretractedShipments, ReportAppFulfillmentInput, ReportedAppFulfillment, WarehouseDemandRouting, } from './fulfillments/index.js';
82
+ export type { AppFulfillmentReportState, CancelFulfillmentInput, CancelledFulfillment, ChargedParcelCountInput, FulfillmentCancelChoice, FulfillmentCancelOverpayment, FulfillmentCancelPreview, FulfillmentCancelSettlement, FulfillmentCoverageActorKind, FulfillmentCoverageExemption, FulfillmentCoverageOverride, FulfillmentLabel, FulfillmentLabelFormat, FulfillmentParcelTracking, FulfillmentsModule, LabelMyparcelParcelsInput, MyparcelParcelsLabelRequest, MyparcelRetractionVerdict, MyparcelUnretractedShipment, OrderFulfillmentCoverage, OrderFulfillmentParcels, OrderFulfillmentUnretractedShipments, ReportAppFulfillmentInput, ReportedAppFulfillment, WarehouseDemandRouting, } from './fulfillments/index.js';
83
83
  export type { CreateHeadInput, Head, HeadPrivateTokensModule, HeadStorefrontToken, HeadsModule, IssuedHeadStorefrontToken, UpdateHeadInput, } from './heads/index.js';
84
84
  export type { AppHookHealth, AppHookPing, AppProviderAssignment, AppProviderAssignmentsModule, AppProviderKind, AssignAppProviderInput, HooksModule, } from './hooks/index.js';
85
+ export type { CommittedPipelineDraft, ImportDependency, ImportDependencyWarning, IntegrationPipelinesModule, IntegrationsModule, PipelineDirection, PipelineDraft, PipelineDraftConnection, PipelineDraftDiscovery, PipelineDraftFieldMapping, PipelineDraftSchemaMap, PipelineDraftStep, PipelineDraftSummary, PipelineDraftsModule, PipelineScheduleType, PipelineSyncPolicy, PipelineTriggerType, UpdatePipelineDraftInput, UpdatePipelineDraftSchemaMapInput, } from './integrations/index.js';
86
+ export { PIPELINE_DRAFT_PRESERVE_KEYS, PIPELINE_DRAFT_SLOW_TIMEOUT_MS, } from './integrations/index.js';
85
87
  export type { BulkActionItem, BulkActionRun, BulkActionRunStatus, } from './jobs/bulk-action-run.js';
86
88
  export { TERMINAL_BULK_ACTION_STATUSES } from './jobs/bulk-action-run.js';
87
89
  /**
@@ -97,7 +99,11 @@ export { OPENING_HOURS_DAYS } from './locations/index.js';
97
99
  export type { ApiTokenTemplate, JsonSchema, LabelMap, MetaCatalog, MetaCatalogLabels, MetaCatalogPermissions, MetaCatalogPlugins, MetaCatalogTransitions, MetaModule, PermissionGroup, PluginCatalogEntry, RoleTemplate, StatusMetaMap, StatusTone, TransitionMap, } from './meta/index.js';
98
100
  export type { Metafield, MetafieldAttachment, MetafieldDefinition, MetafieldDefinitionsModule, MetafieldMoney, MetafieldOwnerType, MetafieldReference, MetafieldScalarType, MetafieldsModule, MetafieldType, MetafieldVisibility, SetMetafieldInput, UpsertMetafieldDefinitionInput, } from './metafields/index.js';
99
101
  export { METAFIELD_OWNER_TYPES, METAFIELD_SCALAR_TYPES } from './metafields/index.js';
102
+ export type { OrderBulkAction, OrderBulkCapture, OrderBulkInput, OrderBulkItem, OrderBulkRun, } from './orders/bulk.js';
103
+ export { MAX_BULK_ORDERS, ORDER_BULK_ACTIONS, ORDER_BULK_TRANSITION_REFUSED, } from './orders/bulk.js';
100
104
  export type { CommitOrderEditCall, OrderCommitEditModule, OrderEditCommit, OrderEditCommittedOrder, OrderEditCommittedRefund, OrderEditOverpaymentSettlement, } from './orders/commit-edit.js';
105
+ export type { OrderDepositPolicy, OrderDepositPolicyModule, StorefrontDepositPolicy, } from './orders/deposit-policy.js';
106
+ export { DEFAULT_ORDER_DEPOSIT_POLICY, DEPOSIT_POLICY_AUTO_CANCEL_DAYS_MIN, DEPOSIT_POLICY_MINIMUM_PERCENT_MAX, DEPOSIT_POLICY_STOREFRONT_METHODS_MAX, } from './orders/deposit-policy.js';
101
107
  export type { Order, OrderAddress, OrderAfasFields, OrderAsset, OrderCustomer, OrderCustomerAddress, OrderCustomerAfasFields, OrderCustomerParasutFields, OrderCustomerVatFields, OrderCustomFields, OrderDeliveryAdvice, OrderDeliverySelectionSource, OrderDeliveryTerms, OrderDeliveryTermsStatus, OrderFor, OrderFulfillment, OrderFulfillmentDetails, OrderFulfillmentHold, OrderFulfillmentHoldReason, OrderFulfillmentMyparcelFields, OrderGetAnswer, OrderGetModule, OrderGetOptions, OrderHistoryEntry, OrderInclude, OrderLine, OrderLineAllocation, OrderLineCustomFields, OrderLineOutstandingAllocation, OrderLineStockLevel, OrderLineVariant, OrderPackingSlip, OrderParasutFields, OrderPayment, OrderPaymentTerms, OrderPaymentTermsClassification, OrderPaymentTermsFields, OrderPaymentTermsStatus, OrderPriceList, OrderRefund, OrderSurcharge, OrderTaxSummary, } from './orders/get.js';
102
108
  export { ORDER_INCLUDES } from './orders/get.js';
103
109
  export type { OrderProviderFallback, OrderSettlement, OrdersModule } from './orders/index.js';
@@ -110,7 +116,7 @@ export type { OrderEditAddress, OrderEditAddressPatch, OrderEditBlocker, OrderEd
110
116
  export type { OrderAllocationBadge, OrderEditBlockCode, OrderLockReason, OrderStatusAction, OrderStatusActionName, OrderStatusModule, OrderStatusProviderFallback, OrderStatusReasonCode, OrderStatusView, } from './orders/status.js';
111
117
  export { ORDER_ALLOCATION_BADGES, ORDER_EDIT_BLOCK_CODES, ORDER_LOCK_REASONS, ORDER_STATUS_ACTIONS, ORDER_STATUS_REASON_CODES, } from './orders/status.js';
112
118
  export type { OrderOverpaymentChoice, OverpaymentOption, SurchargeCall, SurchargeChange, SurchargeChangePreview, SurchargedOrder, SurchargeInput, SurchargeRemoveCall, SurchargesModule, } from './orders/surcharges.js';
113
- export type { AccountCreditModule, ApplyUnappliedCashInput, AppPayment, AppPaymentReportState, CreditOverpaymentInput, IssuedRefund, OrderMoneyOnAccount, OrderPaymentPosition, OrderRefundPosition, PaidOrder, PaymentsModule, ProviderConnection, ProviderCredentialPath, ProviderOnboardingStart, ProviderReadiness, ProvidersModule, ProviderTerminal, ProviderTerminalsModule, ProvisionTerminalInput, ReadinessOptions, ReconcileRefundInput, RecordPaymentInput, RefundablePayment, RefundPaymentInput, RefundProviderOutcome, RefundUnappliedCashInput, ReportAppPaymentInput, ReportedAppPayment, UnappliedCash, UnappliedCashRefund, UnreconciledRefund, } from './payments/index.js';
119
+ export type { AccountCreditModule, ApplyUnappliedCashInput, AppPayment, AppPaymentReportState, CreditOverpaymentInput, IssuedRefund, OrderMoneyOnAccount, OrderPaymentPosition, OrderRefundPosition, PaidOrder, PaymentMethod, PaymentMethodsModule, PaymentsModule, ProviderConnection, ProviderCredentialPath, ProviderOnboardingStart, ProviderReadiness, ProvidersModule, ProviderTerminal, ProviderTerminalsModule, ProvisionTerminalInput, ReadinessOptions, ReconcileRefundInput, RecordPaymentInput, RefundablePayment, RefundPaymentInput, RefundProviderOutcome, RefundUnappliedCashInput, ReportAppPaymentInput, ReportedAppPayment, UnappliedCash, UnappliedCashRefund, UnreconciledRefund, } from './payments/index.js';
114
120
  export type { AppKey, PlatformAppsModule, RegisterAppResult, RegisteredApp, } from './platform/apps.js';
115
121
  export type { PlatformCatalogModule, RepairTranslationLanguagesInput, TranslationRepairEntity, TranslationRepairEntityKind, TranslationRepairNameMismatch, TranslationRepairPage, TranslationRepairRemovedRow, TranslationRepairSkipped, TranslationRepairSkipReason, } from './platform/catalog.js';
116
122
  export type { PlatformEntitlementSource, PlatformEntitlementsModule, PlatformPluginEntitlement, SetPlatformEntitlementOptions, } from './platform/entitlements.js';
@@ -128,9 +134,14 @@ export type { PlatformServerMetricsModule, ServerMetricPoint, ServerMetrics, Ser
128
134
  export type { CompletedPosSale, OpenPosSessionInput, PosCall, PosCart, PosCashModule, PosCashMovement, PosCashMovementType, PosDevice, PosDevicesModule, PosModule, PosMoneyCall, PosReceiptNumbering, PosReceiptNumberingModule, PosRefund, PosRefundsModule, PosRegister, PosRegisterSession, PosRegistersModule, PosSaleModule, PosSessionsModule, PosSessionTotals, PosTenderResult, PosTendersModule, PosXReport, } from './pos/index.js';
129
135
  export type { ActivePromotion, ActivePromotionsFilter, CreatePromotionInput, DiscountedOrderLine, LocalTime, OrderDiscount, OrderDiscounts, OrderPackage, PricingCouponsModule, PricingModule, PricingPromotion, PricingPromotionsModule, PromotionOperationSummary, PromotionTranslationInput, SetComponent, UpdatePromotionInput, Weekday, } from './pricing/index.js';
130
136
  export { promotionActions, promotionConditions } from './pricing/index.js';
137
+ export type { IssuedVoucher, IssueVoucherInput, IssueVouchersInput, IssueVouchersItem, PricingVouchersModule, Voucher, VoucherCustomer, VoucherStatus, VoucherTemplate, } from './pricing/vouchers.js';
131
138
  export type { EntityProvenance, ProvenanceActor, ProvenanceEntityType, ProvenanceFieldGroup, ProvenanceManagedBy, ProvenanceModule, } from './provenance/index.js';
132
139
  export { PROVENANCE_MAX_IDS } from './provenance/index.js';
133
140
  export type { LowStockInput, LowStockVariant, PopularVariant, PopularVariantsInput, ReportDay, ReportExport, ReportExportFilter, ReportExportKind, ReportOverview, ReportOverviewInput, ReportPeriod, ReportsModule, ReportTotals, } from './reports/index.js';
141
+ export type { OrderReturn, OrderReturnDetail, OrderReturnLine, OrderReturnStatusLogEntry, ReturnableOrderLine, ReturnCreditNoteLedger, ReturnCreditNoteUnavailableReason, ReturnEligibility, ReturnRefundUnavailableReason, ReturnSettlementBlocker, ReturnSettlementMethod, ReturnSettlementOptions, ReturnSettlementPayment, ReturnState, ReturnsModule, } from './returns/index.js';
142
+ export { RETURN_SETTLEMENT_BLOCKERS, RETURN_SETTLEMENT_METHODS, RETURN_STATES, } from './returns/index.js';
143
+ export type { EntitySearchResult, SearchContentHit, SearchCustomerHit, SearchEntitiesOptions, SearchEntityType, SearchModule, SearchOrderHit, SearchProductHit, SearchSkip, SearchSkipReason, } from './search/index.js';
144
+ export { SEARCH_ENTITIES_MAX_TAKE, SEARCH_ENTITIES_MIN_TERM_LENGTH } from './search/index.js';
134
145
  export type { Redirect, RedirectCreateInput, RedirectsModule, RedirectUpdateInput, } from './seo/redirects.js';
135
146
  export type { ParcelCountSuggestion, ParcelCountSuggestionInput, ParcelCountSuggestionItem, ParcelCountSuggestionMethod, } from './shipping/parcel-count-suggestion.js';
136
147
  export { PARCEL_SUGGESTION_MAX_ITEMS, PARCEL_SUGGESTION_MAX_QUANTITY, } from './shipping/parcel-count-suggestion.js';
package/dist/index.js CHANGED
@@ -38,16 +38,21 @@ export { MAX_DOCUMENT_EXTENSIONS } from './documents/index.js';
38
38
  export { AdminProjectionError } from './errors.js';
39
39
  export { MAX_REDRIVE_EVENT_IDS } from './events/index.js';
40
40
  export { AI_UNAVAILABLE_CODE, DEFAULT_FEED_PAGE_LIMIT, DEFAULT_PREVIEW_SAMPLE_SIZE, DEFAULT_REFRESH_INTERVAL_MINUTES, FEED_CATEGORY_MAPPING_SOURCES, FEED_CATEGORY_MAPPING_STATUSES, FEED_CATEGORY_MATCH_TYPES, FEED_CONDITION_OPERATORS, FEED_DESTINATIONS, FEED_IDENTIFIER_PATTERN, FEED_ITEM_ISSUE_SEVERITIES, FEED_PREVIEW_TIMEOUT_MS, FEED_REGENERATE_THROTTLED, FEED_RUN_STATUSES, FEED_RUN_TRIGGERS, FEED_TRANSFORM_KINDS, FEED_VALUE_SOURCE_KINDS, isAiUnavailable, isFeedConditionGroup, isFeedValueSourceKind, MAX_BULK_STATUS_IDS, MAX_FEED_PAGE_LIMIT, MAX_LOOKUP_ENTRIES, MAX_PREVIEW_SAMPLE_SIZE, MAX_REFRESH_INTERVAL_MINUTES, MIN_REFRESH_INTERVAL_MINUTES, readFeedRegenerateThrottle, TAXONOMY_DEFAULT_LIMIT, TAXONOMY_MAX_LIMIT, TITLE_PRESET_TIMEOUT_MS, VALUELESS_FEED_CONDITION_OPERATORS, } from './feeds/index.js';
41
+ export { PIPELINE_DRAFT_PRESERVE_KEYS, PIPELINE_DRAFT_SLOW_TIMEOUT_MS, } from './integrations/index.js';
41
42
  export { TERMINAL_BULK_ACTION_STATUSES } from './jobs/bulk-action-run.js';
42
43
  export { TERMINAL_JOB_STATUSES } from './jobs/index.js';
43
44
  export { OPENING_HOURS_DAYS } from './locations/index.js';
44
45
  export { METAFIELD_OWNER_TYPES, METAFIELD_SCALAR_TYPES } from './metafields/index.js';
46
+ export { MAX_BULK_ORDERS, ORDER_BULK_ACTIONS, ORDER_BULK_TRANSITION_REFUSED, } from './orders/bulk.js';
47
+ export { DEFAULT_ORDER_DEPOSIT_POLICY, DEPOSIT_POLICY_AUTO_CANCEL_DAYS_MIN, DEPOSIT_POLICY_MINIMUM_PERCENT_MAX, DEPOSIT_POLICY_STOREFRONT_METHODS_MAX, } from './orders/deposit-policy.js';
45
48
  export { ORDER_INCLUDES } from './orders/get.js';
46
49
  export { ORDER_ALLOCATION_BADGES, ORDER_EDIT_BLOCK_CODES, ORDER_LOCK_REASONS, ORDER_STATUS_ACTIONS, ORDER_STATUS_REASON_CODES, } from './orders/status.js';
47
50
  export { requireHumanSession } from './platform/guard.js';
48
51
  export { PROVISION_PROFILES } from './platform/provision-store.js';
49
52
  export { promotionActions, promotionConditions } from './pricing/index.js';
50
53
  export { PROVENANCE_MAX_IDS } from './provenance/index.js';
54
+ export { RETURN_SETTLEMENT_BLOCKERS, RETURN_SETTLEMENT_METHODS, RETURN_STATES, } from './returns/index.js';
55
+ export { SEARCH_ENTITIES_MAX_TAKE, SEARCH_ENTITIES_MIN_TERM_LENGTH } from './search/index.js';
51
56
  export { PARCEL_SUGGESTION_MAX_ITEMS, PARCEL_SUGGESTION_MAX_QUANTITY, } from './shipping/parcel-count-suggestion.js';
52
57
  export { PARCEL_CAPACITY_MAX, PARCEL_WEIGHT_GRAMS_MAX } from './shipping/parcel-rule.js';
53
58
  export { TAX_CLASS_FALLBACK_COUNTRY } from './tax/index.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Integrations (headless spec §9.2): the store's connections to other systems. Today the data
3
+ * pipelines' import and export set-ups; the rest of the pipeline surface follows in phase 7.
4
+ */
5
+ import type { Transport } from '@sixtyninecommerce/core';
6
+ import { type IntegrationPipelinesModule } from './pipelines.js';
7
+ export type { IntegrationPipelinesModule, PipelineDraftsModule } from './pipelines.js';
8
+ export { PIPELINE_DRAFT_PRESERVE_KEYS, PIPELINE_DRAFT_SLOW_TIMEOUT_MS } from './pipelines.js';
9
+ export type * from './types.js';
10
+ export interface IntegrationsModule {
11
+ /** Data pipelines: import and export set-ups kept on the server (`drafts`). */
12
+ pipelines: IntegrationPipelinesModule;
13
+ }
14
+ export declare function createIntegrationsModule(transport: Transport): IntegrationsModule;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Integrations (headless spec §9.2): the store's connections to other systems. Today the data
3
+ * pipelines' import and export set-ups; the rest of the pipeline surface follows in phase 7.
4
+ */
5
+ import { createIntegrationPipelinesModule } from './pipelines.js';
6
+ export { PIPELINE_DRAFT_PRESERVE_KEYS, PIPELINE_DRAFT_SLOW_TIMEOUT_MS } from './pipelines.js';
7
+ export function createIntegrationsModule(transport) {
8
+ return { pipelines: createIntegrationPipelinesModule(transport) };
9
+ }