@sixtyninecommerce/admin 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1501 -23
- package/dist/auth/index.d.ts +7 -1
- package/dist/auth/index.js +8 -1
- package/dist/catalog/documents.d.ts +142 -0
- package/dist/catalog/documents.js +114 -0
- package/dist/catalog/index.d.ts +48 -7
- package/dist/catalog/index.js +6 -1
- package/dist/catalog/metadata.d.ts +244 -0
- package/dist/catalog/metadata.js +220 -0
- package/dist/catalog/properties.d.ts +38 -0
- package/dist/catalog/properties.js +52 -1
- package/dist/catalog/recommendations.d.ts +33 -6
- package/dist/catalog/recommendations.js +94 -2
- package/dist/catalog/reviews.d.ts +17 -4
- package/dist/catalog/reviews.js +7 -0
- package/dist/catalog/variants.d.ts +60 -0
- package/dist/catalog/variants.js +39 -0
- package/dist/catalog/visibility.d.ts +18 -2
- package/dist/client.d.ts +29 -3
- package/dist/client.js +19 -8
- package/dist/content/assets.d.ts +3 -4
- package/dist/content/forms.d.ts +332 -1
- package/dist/content/forms.js +140 -4
- package/dist/content/items.d.ts +31 -8
- package/dist/content/items.js +1 -1
- package/dist/content/menus.d.ts +254 -0
- package/dist/content/menus.js +70 -0
- package/dist/content/strings.d.ts +137 -0
- package/dist/content/strings.js +82 -0
- package/dist/customers/delivery-terms.d.ts +44 -0
- package/dist/customers/delivery-terms.js +32 -0
- package/dist/customers/index.d.ts +15 -0
- package/dist/customers/index.js +4 -0
- package/dist/documents/emails.d.ts +150 -0
- package/dist/documents/emails.js +220 -0
- package/dist/documents/index.d.ts +13 -0
- package/dist/documents/index.js +2 -0
- package/dist/fulfillments/index.d.ts +119 -1
- package/dist/fulfillments/index.js +124 -4
- package/dist/index.d.ts +43 -23
- package/dist/index.js +11 -5
- package/dist/integrations/exact-online-types.d.ts +542 -0
- package/dist/integrations/exact-online.d.ts +541 -5
- package/dist/integrations/exact-online.js +714 -1
- package/dist/integrations/index.d.ts +23 -8
- package/dist/integrations/index.js +9 -4
- package/dist/integrations/pipeline-discoveries.d.ts +65 -0
- package/dist/integrations/pipeline-discoveries.js +65 -0
- package/dist/integrations/pipeline-runs.d.ts +119 -0
- package/dist/integrations/pipeline-runs.js +87 -0
- package/dist/integrations/pipelines.d.ts +73 -2
- package/dist/integrations/pipelines.js +36 -1
- package/dist/integrations/price-import.d.ts +223 -0
- package/dist/integrations/price-import.js +124 -0
- package/dist/integrations/types.d.ts +221 -3
- package/dist/integrations/types.js +4 -3
- package/dist/meta/index.d.ts +10 -0
- package/dist/metafields/index.d.ts +8 -1
- package/dist/metafields/index.js +10 -0
- package/dist/orders/cancel-with-money.d.ts +10 -0
- package/dist/orders/cancel-with-money.js +2 -0
- package/dist/orders/commit-edit.d.ts +16 -0
- package/dist/orders/commit-edit.js +14 -1
- package/dist/orders/deposit-policy.d.ts +3 -1
- package/dist/orders/index.d.ts +22 -11
- package/dist/orders/index.js +5 -2
- package/dist/orders/list.d.ts +26 -5
- package/dist/orders/list.js +123 -13
- package/dist/orders/manual-discounts.d.ts +13 -5
- package/dist/orders/money-view.d.ts +149 -0
- package/dist/orders/money-view.js +99 -0
- package/dist/orders/plan-edit.d.ts +34 -2
- package/dist/orders/plan-edit.js +110 -12
- package/dist/orders/surcharges.d.ts +12 -0
- package/dist/orders/surcharges.js +34 -9
- package/dist/payments/account-credit.d.ts +17 -1
- package/dist/payments/account-credit.js +25 -2
- package/dist/payments/credit-noted-fields.d.ts +8 -1
- package/dist/payments/credit-noted-fields.js +34 -2
- package/dist/payments/customer-consent.d.ts +30 -0
- package/dist/payments/customer-consent.js +49 -0
- package/dist/payments/index.d.ts +89 -14
- package/dist/payments/index.js +22 -2
- package/dist/payments/requests.d.ts +6 -3
- package/dist/payments/requests.js +1 -0
- package/dist/pickups/index.d.ts +5 -3
- package/dist/pickups/index.js +5 -2
- package/dist/platform/email-gateways.d.ts +165 -0
- package/dist/platform/email-gateways.js +78 -0
- package/dist/platform/tax.d.ts +11 -3
- package/dist/platform/tax.js +30 -0
- package/dist/pos/exchanges.d.ts +6 -1
- package/dist/pos/index.d.ts +229 -10
- package/dist/pos/index.js +113 -4
- package/dist/pos/offline-sales.d.ts +44 -3
- package/dist/pos/offline-sales.js +57 -3
- package/dist/pos/returns.d.ts +28 -1
- package/dist/pos/returns.js +36 -6
- package/dist/pricing/price-lists.d.ts +3 -1
- package/dist/purchasing/alerts.d.ts +19 -4
- package/dist/purchasing/alerts.js +29 -3
- package/dist/purchasing/backorders.d.ts +61 -0
- package/dist/purchasing/backorders.js +92 -0
- package/dist/purchasing/index.d.ts +21 -3
- package/dist/purchasing/index.js +8 -0
- package/dist/purchasing/links.d.ts +263 -0
- package/dist/purchasing/links.js +192 -0
- package/dist/purchasing/purchase-orders.d.ts +4 -1
- package/dist/purchasing/receipts.d.ts +396 -0
- package/dist/purchasing/receipts.js +287 -0
- package/dist/purchasing/returns.d.ts +273 -0
- package/dist/purchasing/returns.js +229 -0
- package/dist/quotes/index.d.ts +20 -3
- package/dist/returns/index.d.ts +62 -1
- package/dist/returns/index.js +61 -0
- package/dist/seo/config.d.ts +128 -0
- package/dist/seo/config.js +95 -0
- package/dist/seo/redirects.d.ts +125 -0
- package/dist/seo/redirects.js +60 -1
- package/dist/seo/settings.d.ts +147 -0
- package/dist/seo/settings.js +209 -0
- package/dist/shipping/index.d.ts +6 -0
- package/dist/shipping/index.js +2 -0
- package/dist/shipping/methods.d.ts +8 -1
- package/dist/shipping/myparcel.d.ts +415 -1
- package/dist/shipping/myparcel.js +291 -3
- package/dist/shipping/rate-tables.d.ts +149 -4
- package/dist/shipping/rate-tables.js +229 -23
- package/dist/shipping/ship-to-countries.d.ts +75 -0
- package/dist/shipping/ship-to-countries.js +47 -0
- package/dist/stock/by-location.d.ts +86 -0
- package/dist/stock/by-location.js +94 -0
- package/dist/stock/index.d.ts +8 -1
- package/dist/stock/index.js +4 -0
- package/dist/stock/settings.d.ts +106 -0
- package/dist/stock/settings.js +103 -0
- package/dist/stock/transfers.d.ts +171 -10
- package/dist/stock/transfers.js +82 -4
- package/dist/stored-value/index.d.ts +98 -7
- package/dist/stored-value/index.js +71 -4
- package/dist/tax/display-policy.d.ts +105 -0
- package/dist/tax/display-policy.js +84 -0
- package/dist/tax/index.d.ts +3 -0
- package/dist/tax/index.js +2 -0
- package/dist/tenant/email-templates.d.ts +222 -1
- package/dist/tenant/email-templates.js +227 -10
- package/package.json +2 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { ValidationError } from '@sixtyninecommerce/core';
|
|
1
|
+
import { createPage, PLATFORM_PASSTHROUGH_KEYS, readRestPage, ValidationError, } from '@sixtyninecommerce/core';
|
|
2
2
|
import { fieldOf } from '../catalog/types.js';
|
|
3
|
+
import { isUnknownFieldRejection } from '../payments/store-credit-fields.js';
|
|
4
|
+
/** The most sync-log rows one {@link ExactOnlineSyncModule.logs} read answers. */
|
|
5
|
+
export const EXACT_ONLINE_SYNC_LOG_LIMIT = 100;
|
|
3
6
|
const SYNC_WINDOW_FIELDS = /* GraphQL */ `enabled intervalMinutes`;
|
|
4
7
|
const CONFIG_FIELDS = /* GraphQL */ `
|
|
5
8
|
id
|
|
@@ -280,6 +283,487 @@ export const EXACT_ONLINE_SYNC_ESTIMATE_QUERY = /* GraphQL */ `
|
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
285
|
`;
|
|
286
|
+
const SYNC_LOG_FIELDS = /* GraphQL */ `
|
|
287
|
+
id
|
|
288
|
+
entity
|
|
289
|
+
mode
|
|
290
|
+
status
|
|
291
|
+
createdCount
|
|
292
|
+
updatedCount
|
|
293
|
+
skippedCount
|
|
294
|
+
failedCount
|
|
295
|
+
detachedCount
|
|
296
|
+
error
|
|
297
|
+
durationMs
|
|
298
|
+
createdAt
|
|
299
|
+
catalogueExclusions { inactive notWebshop nonStock unpriced total absent }
|
|
300
|
+
`;
|
|
301
|
+
export const EXACT_ONLINE_SYNC_LOGS_QUERY = /* GraphQL */ `
|
|
302
|
+
query ExactOnlineSyncLogs($limit: Int, $entity: String) {
|
|
303
|
+
exactOnlineSyncLogs(limit: $limit, entity: $entity) { ${SYNC_LOG_FIELDS} }
|
|
304
|
+
}
|
|
305
|
+
`;
|
|
306
|
+
const RUN_SUMMARY_FIELDS = /* GraphQL */ `lastRunAt status error lastSuccessAt`;
|
|
307
|
+
export const EXACT_ONLINE_SYNC_HEALTH_QUERY = /* GraphQL */ `
|
|
308
|
+
query ExactOnlineSyncHealth {
|
|
309
|
+
exactOnlineSyncHealth {
|
|
310
|
+
customers { ${RUN_SUMMARY_FIELDS} }
|
|
311
|
+
catalogue { ${RUN_SUMMARY_FIELDS} }
|
|
312
|
+
orders { ${RUN_SUMMARY_FIELDS} }
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
`;
|
|
316
|
+
export const RUN_EXACT_ONLINE_CATALOGUE_SYNC_MUTATION = /* GraphQL */ `
|
|
317
|
+
mutation RunExactOnlineCatalogueSync {
|
|
318
|
+
runExactOnlineCatalogueSync
|
|
319
|
+
}
|
|
320
|
+
`;
|
|
321
|
+
export const RUN_EXACT_ONLINE_CUSTOMER_SYNC_MUTATION = /* GraphQL */ `
|
|
322
|
+
mutation RunExactOnlineCustomerSync {
|
|
323
|
+
runExactOnlineCustomerSync
|
|
324
|
+
}
|
|
325
|
+
`;
|
|
326
|
+
export const RUN_EXACT_ONLINE_PRICE_LIST_SYNC_MUTATION = /* GraphQL */ `
|
|
327
|
+
mutation RunExactOnlinePriceListSync {
|
|
328
|
+
runExactOnlinePriceListSync
|
|
329
|
+
}
|
|
330
|
+
`;
|
|
331
|
+
export const REIMPORT_EXACT_ONLINE_ITEM_PICTURES_MUTATION = /* GraphQL */ `
|
|
332
|
+
mutation ReimportExactOnlineItemPictures {
|
|
333
|
+
reimportExactOnlineItemPictures
|
|
334
|
+
}
|
|
335
|
+
`;
|
|
336
|
+
export const EXACT_ONLINE_SYNC_CURSORS_QUERY = /* GraphQL */ `
|
|
337
|
+
query ExactOnlineSyncCursors {
|
|
338
|
+
exactOnlineSyncCursors { entity cursor }
|
|
339
|
+
}
|
|
340
|
+
`;
|
|
341
|
+
export const RESET_EXACT_ONLINE_SYNC_CURSOR_MUTATION = /* GraphQL */ `
|
|
342
|
+
mutation ResetExactOnlineSyncCursor($entity: String!) {
|
|
343
|
+
resetExactOnlineSyncCursor(entity: $entity)
|
|
344
|
+
}
|
|
345
|
+
`;
|
|
346
|
+
export const EXACT_ONLINE_WAREHOUSE_LINKS_QUERY = /* GraphQL */ `
|
|
347
|
+
query ExactOnlineWarehouseLinks {
|
|
348
|
+
exactOnlineWarehouseLinks { stockLocationId stockLocationName exactWarehouseId }
|
|
349
|
+
}
|
|
350
|
+
`;
|
|
351
|
+
const SHIPPING_MAPPING_FIELDS = /* GraphQL */ `
|
|
352
|
+
vendureShippingMethodId
|
|
353
|
+
vendureCode
|
|
354
|
+
vendureName
|
|
355
|
+
exactShippingMethodId
|
|
356
|
+
exactManaged
|
|
357
|
+
status
|
|
358
|
+
`;
|
|
359
|
+
export const EXACT_ONLINE_SHIPPING_METHODS_QUERY = /* GraphQL */ `
|
|
360
|
+
query ExactOnlineShippingMethods {
|
|
361
|
+
exactOnlineShippingMethods {
|
|
362
|
+
mappings { ${SHIPPING_MAPPING_FIELDS} }
|
|
363
|
+
exact { id code description active amount linked }
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
`;
|
|
367
|
+
export const RUN_EXACT_ONLINE_SHIPPING_METHOD_SYNC_MUTATION = /* GraphQL */ `
|
|
368
|
+
mutation RunExactOnlineShippingMethodSync {
|
|
369
|
+
runExactOnlineShippingMethodSync
|
|
370
|
+
}
|
|
371
|
+
`;
|
|
372
|
+
export const IMPORT_EXACT_ONLINE_SHIPPING_METHOD_MUTATION = /* GraphQL */ `
|
|
373
|
+
mutation ImportExactOnlineShippingMethod($exactShippingMethodId: String!) {
|
|
374
|
+
importExactOnlineShippingMethod(exactShippingMethodId: $exactShippingMethodId) {
|
|
375
|
+
${SHIPPING_MAPPING_FIELDS}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
`;
|
|
379
|
+
export const SET_EXACT_ONLINE_SHIPPING_METHOD_MAPPING_MUTATION = /* GraphQL */ `
|
|
380
|
+
mutation SetExactOnlineShippingMethodMapping(
|
|
381
|
+
$vendureShippingMethodId: ID!
|
|
382
|
+
$exactShippingMethodId: String
|
|
383
|
+
) {
|
|
384
|
+
setExactOnlineShippingMethodMapping(
|
|
385
|
+
vendureShippingMethodId: $vendureShippingMethodId
|
|
386
|
+
exactShippingMethodId: $exactShippingMethodId
|
|
387
|
+
) {
|
|
388
|
+
${SHIPPING_MAPPING_FIELDS}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
`;
|
|
392
|
+
export const CONVERT_EXACT_ONLINE_SHIPPING_METHOD_TO_MAPPING_MUTATION = /* GraphQL */ `
|
|
393
|
+
mutation ConvertExactOnlineShippingMethodToMapping(
|
|
394
|
+
$exactShippingMethodId: String!
|
|
395
|
+
$vendureShippingMethodId: ID!
|
|
396
|
+
) {
|
|
397
|
+
convertExactOnlineShippingMethodToMapping(
|
|
398
|
+
exactShippingMethodId: $exactShippingMethodId
|
|
399
|
+
vendureShippingMethodId: $vendureShippingMethodId
|
|
400
|
+
) {
|
|
401
|
+
${SHIPPING_MAPPING_FIELDS}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
`;
|
|
405
|
+
export const RETIRE_EXACT_ONLINE_IMPORTED_SHIPPING_METHOD_MUTATION = /* GraphQL */ `
|
|
406
|
+
mutation RetireExactOnlineImportedShippingMethod($exactShippingMethodId: String!) {
|
|
407
|
+
retireExactOnlineImportedShippingMethod(exactShippingMethodId: $exactShippingMethodId)
|
|
408
|
+
}
|
|
409
|
+
`;
|
|
410
|
+
// ── Payment and delivery terms (W10-57) ──
|
|
411
|
+
const PAYMENT_CONDITION_DISTRIBUTION_FIELDS = /* GraphQL */ `code description customerCount`;
|
|
412
|
+
const UNRESOLVED_PAYMENT_CONDITION_FIELDS = /* GraphQL */ `code customerCount`;
|
|
413
|
+
const DRY_RUN_RESOURCE_FIELDS = /* GraphQL */ `resource ok permissionWarning error`;
|
|
414
|
+
export const EXACT_ONLINE_PAYMENT_CONDITIONS_QUERY = /* GraphQL */ `
|
|
415
|
+
query ExactOnlinePaymentConditions {
|
|
416
|
+
exactOnlinePaymentConditions {
|
|
417
|
+
exactId
|
|
418
|
+
code
|
|
419
|
+
description
|
|
420
|
+
summary
|
|
421
|
+
classification
|
|
422
|
+
paymentDays
|
|
423
|
+
paymentEndOfMonths
|
|
424
|
+
paymentMethod
|
|
425
|
+
percentage
|
|
426
|
+
discountPaymentDays
|
|
427
|
+
discountPercentage
|
|
428
|
+
paymentDiscountType
|
|
429
|
+
active
|
|
430
|
+
syncedAt
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
`;
|
|
434
|
+
export const EXACT_ONLINE_PAYMENT_TERMS_DIAGNOSTICS_QUERY = /* GraphQL */ `
|
|
435
|
+
query ExactOnlinePaymentTermsDiagnostics {
|
|
436
|
+
exactOnlinePaymentTermsDiagnostics {
|
|
437
|
+
totalCustomers
|
|
438
|
+
assignedCount
|
|
439
|
+
unassignedCount
|
|
440
|
+
unresolvedCount
|
|
441
|
+
staleCount
|
|
442
|
+
lastSyncedAt
|
|
443
|
+
error
|
|
444
|
+
permissionWarning
|
|
445
|
+
distribution { ${PAYMENT_CONDITION_DISTRIBUTION_FIELDS} }
|
|
446
|
+
unresolvedCodes { ${UNRESOLVED_PAYMENT_CONDITION_FIELDS} }
|
|
447
|
+
lastReconciliation {
|
|
448
|
+
mode
|
|
449
|
+
status
|
|
450
|
+
createdCount
|
|
451
|
+
updatedCount
|
|
452
|
+
deactivatedCount
|
|
453
|
+
failedCount
|
|
454
|
+
at
|
|
455
|
+
error
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
`;
|
|
460
|
+
const DRY_RUN_CONDITION_FIELDS = /* GraphQL */ `code description summary classification scheduleCount`;
|
|
461
|
+
export const EXACT_ONLINE_PAYMENT_TERMS_DRY_RUN_QUERY = /* GraphQL */ `
|
|
462
|
+
query ExactOnlinePaymentTermsDryRun {
|
|
463
|
+
exactOnlinePaymentTermsDryRun {
|
|
464
|
+
division
|
|
465
|
+
generatedAt
|
|
466
|
+
complete
|
|
467
|
+
permissionWarning
|
|
468
|
+
catalogRowCount
|
|
469
|
+
catalogCodeCount
|
|
470
|
+
accountCount
|
|
471
|
+
assignedCount
|
|
472
|
+
unassignedCount
|
|
473
|
+
unresolvedCount
|
|
474
|
+
uncheckedCount
|
|
475
|
+
distribution { ${PAYMENT_CONDITION_DISTRIBUTION_FIELDS} }
|
|
476
|
+
duplicateConditions { ${DRY_RUN_CONDITION_FIELDS} }
|
|
477
|
+
complexConditions { ${DRY_RUN_CONDITION_FIELDS} }
|
|
478
|
+
unresolvedCodes { ${UNRESOLVED_PAYMENT_CONDITION_FIELDS} }
|
|
479
|
+
assignmentIssues { accountId accountCode conditionCode conditionDescription status }
|
|
480
|
+
resources { ${DRY_RUN_RESOURCE_FIELDS} }
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
`;
|
|
484
|
+
export const EXACT_ONLINE_INCOTERMS_QUERY = /* GraphQL */ `
|
|
485
|
+
query ExactOnlineIncoterms {
|
|
486
|
+
exactOnlineIncoterms {
|
|
487
|
+
exactId
|
|
488
|
+
code
|
|
489
|
+
version
|
|
490
|
+
description
|
|
491
|
+
catalogAvailable
|
|
492
|
+
stale
|
|
493
|
+
lastSyncedAt
|
|
494
|
+
error
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
`;
|
|
498
|
+
export const EXACT_ONLINE_DELIVERY_TERMS_DIAGNOSTICS_QUERY = /* GraphQL */ `
|
|
499
|
+
query ExactOnlineDeliveryTermsDiagnostics {
|
|
500
|
+
exactOnlineDeliveryTermsDiagnostics {
|
|
501
|
+
reconciliationRequired
|
|
502
|
+
accountSyncStatus
|
|
503
|
+
totalCustomers
|
|
504
|
+
assignedCount
|
|
505
|
+
unassignedCount
|
|
506
|
+
unresolvedCount
|
|
507
|
+
staleCount
|
|
508
|
+
mappedMethodCount
|
|
509
|
+
usableShippingMappingCount
|
|
510
|
+
unmappedMethodCount
|
|
511
|
+
inactiveMethodCount
|
|
512
|
+
unavailableMethodCount
|
|
513
|
+
nullAmountCount
|
|
514
|
+
invalidIncotermCount
|
|
515
|
+
lastSyncedAt
|
|
516
|
+
error
|
|
517
|
+
permissionWarning
|
|
518
|
+
shippingMethodDistribution { exactId code description customerCount }
|
|
519
|
+
incotermDistribution { code version description customerCount }
|
|
520
|
+
warnings
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
`;
|
|
524
|
+
export const EXACT_ONLINE_DELIVERY_TERMS_DRY_RUN_QUERY = /* GraphQL */ `
|
|
525
|
+
query ExactOnlineDeliveryTermsDryRun {
|
|
526
|
+
exactOnlineDeliveryTermsDryRun {
|
|
527
|
+
division
|
|
528
|
+
generatedAt
|
|
529
|
+
complete
|
|
530
|
+
permissionWarning
|
|
531
|
+
shippingMethodCount
|
|
532
|
+
activeShippingMethodCount
|
|
533
|
+
mappingCount
|
|
534
|
+
unmappedCatalogMethodCount
|
|
535
|
+
nullAmountCount
|
|
536
|
+
zeroAmountCount
|
|
537
|
+
incotermCount
|
|
538
|
+
accountCount
|
|
539
|
+
assignedShippingMethodCount
|
|
540
|
+
mappedAssignedShippingMethodCount
|
|
541
|
+
unmappedAssignedShippingMethodCount
|
|
542
|
+
unassignedShippingMethodCount
|
|
543
|
+
unresolvedShippingMethodCount
|
|
544
|
+
assignedIncotermCount
|
|
545
|
+
unassignedIncotermCount
|
|
546
|
+
unresolvedIncotermCount
|
|
547
|
+
invalidPolicyCount
|
|
548
|
+
shippingMethodDistribution { exactId customerCount }
|
|
549
|
+
incotermDistribution { code version customerCount }
|
|
550
|
+
assignmentIssues {
|
|
551
|
+
accountId
|
|
552
|
+
accountCode
|
|
553
|
+
shippingMethodId
|
|
554
|
+
incotermCode
|
|
555
|
+
incotermVersion
|
|
556
|
+
status
|
|
557
|
+
message
|
|
558
|
+
}
|
|
559
|
+
resources { ${DRY_RUN_RESOURCE_FIELDS} }
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
`;
|
|
563
|
+
// ── The customer, order and product cards (W10-57) ──
|
|
564
|
+
export const EXACT_ONLINE_CUSTOMER_PAYMENT_TERMS_QUERY = /* GraphQL */ `
|
|
565
|
+
query ExactOnlineCustomerPaymentTerms($customerId: ID!) {
|
|
566
|
+
exactOnlineCustomerPaymentTerms(customerId: $customerId) {
|
|
567
|
+
customerId
|
|
568
|
+
source
|
|
569
|
+
managedExternally
|
|
570
|
+
linkedExternally
|
|
571
|
+
status
|
|
572
|
+
stale
|
|
573
|
+
exactAccountId
|
|
574
|
+
exactAccountCode
|
|
575
|
+
conditionCode
|
|
576
|
+
conditionDescription
|
|
577
|
+
summary
|
|
578
|
+
classification
|
|
579
|
+
paymentDays
|
|
580
|
+
paymentEndOfMonths
|
|
581
|
+
paymentMethod
|
|
582
|
+
percentage
|
|
583
|
+
discountPaymentDays
|
|
584
|
+
discountPercentage
|
|
585
|
+
paymentDiscountType
|
|
586
|
+
syncedAt
|
|
587
|
+
lastCheckedAt
|
|
588
|
+
error
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
`;
|
|
592
|
+
export const EXACT_ONLINE_CUSTOMER_DELIVERY_TERMS_QUERY = /* GraphQL */ `
|
|
593
|
+
query ExactOnlineCustomerDeliveryTerms($customerId: ID!) {
|
|
594
|
+
exactOnlineCustomerDeliveryTerms(customerId: $customerId) {
|
|
595
|
+
customerId
|
|
596
|
+
source
|
|
597
|
+
managedExternally
|
|
598
|
+
linkedExternally
|
|
599
|
+
status
|
|
600
|
+
shippingMethodStatus
|
|
601
|
+
policyStatus
|
|
602
|
+
summary
|
|
603
|
+
exactAccountId
|
|
604
|
+
exactAccountCode
|
|
605
|
+
preferredShippingMethodId
|
|
606
|
+
preferredShippingMethodCode
|
|
607
|
+
preferredShippingMethodName
|
|
608
|
+
preferredShippingMethodAvailable
|
|
609
|
+
eligibleShippingMethodIds
|
|
610
|
+
incotermStatus
|
|
611
|
+
incotermCode
|
|
612
|
+
incotermVersion
|
|
613
|
+
incotermAddress
|
|
614
|
+
incotermDescription
|
|
615
|
+
shippingLeadDays
|
|
616
|
+
deliveryAdvice
|
|
617
|
+
stale
|
|
618
|
+
syncedAt
|
|
619
|
+
lastCheckedAt
|
|
620
|
+
error
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
`;
|
|
624
|
+
export const EXACT_ONLINE_CUSTOMER_PRICE_LIST_QUERY = /* GraphQL */ `
|
|
625
|
+
query ExactOnlineCustomerPriceList($customerId: ID!) {
|
|
626
|
+
exactOnlineCustomerPriceList(customerId: $customerId) {
|
|
627
|
+
customerId
|
|
628
|
+
exactAccountId
|
|
629
|
+
exactAccountCode
|
|
630
|
+
exactPriceListId
|
|
631
|
+
groupId
|
|
632
|
+
groupName
|
|
633
|
+
priceListId
|
|
634
|
+
priceListName
|
|
635
|
+
status
|
|
636
|
+
lastReconciledAt
|
|
637
|
+
lastError
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
`;
|
|
641
|
+
export const EXACT_ONLINE_ORDER_STATE_QUERY = /* GraphQL */ `
|
|
642
|
+
query ExactOnlineOrderState($orderId: ID!) {
|
|
643
|
+
exactOnlineOrderState(orderId: $orderId) {
|
|
644
|
+
pushed
|
|
645
|
+
origin
|
|
646
|
+
salesOrderId
|
|
647
|
+
salesOrderNumber
|
|
648
|
+
pushedAt
|
|
649
|
+
hasCustomer
|
|
650
|
+
customerLinked
|
|
651
|
+
unmappedSkus
|
|
652
|
+
warnings
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
`;
|
|
656
|
+
export const EXACT_ONLINE_ORDER_SYNC_STATE_QUERY = /* GraphQL */ `
|
|
657
|
+
query ExactOnlineOrderSyncState($orderId: ID!) {
|
|
658
|
+
exactOnlineOrderSyncState(orderId: $orderId) {
|
|
659
|
+
exactSalesOrderId
|
|
660
|
+
exactOrderNumber
|
|
661
|
+
revision
|
|
662
|
+
lastSyncedAt
|
|
663
|
+
driftDetected
|
|
664
|
+
exactDeletedAt
|
|
665
|
+
unmappedSkus
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
`;
|
|
669
|
+
export const PUSH_ORDER_TO_EXACT_ONLINE_MUTATION = /* GraphQL */ `
|
|
670
|
+
mutation PushOrderToExactOnline($orderId: ID!) {
|
|
671
|
+
pushOrderToExactOnline(orderId: $orderId) {
|
|
672
|
+
success
|
|
673
|
+
alreadyPushed
|
|
674
|
+
salesOrderId
|
|
675
|
+
salesOrderNumber
|
|
676
|
+
error
|
|
677
|
+
errorCode
|
|
678
|
+
warnings
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
`;
|
|
682
|
+
/**
|
|
683
|
+
* {@link EXACT_ONLINE_ORDER_STATE_QUERY} without `warnings`, for an engine that predates the field
|
|
684
|
+
* (#1925): services deploy separately, and GraphQL refuses the whole document over one unknown
|
|
685
|
+
* field. Drop it once every engine serves `warnings` (orchestrator probe 2026-10-16: production
|
|
686
|
+
* did not yet).
|
|
687
|
+
*/
|
|
688
|
+
export const EXACT_ONLINE_ORDER_STATE_LEGACY_QUERY = /* GraphQL */ `
|
|
689
|
+
query ExactOnlineOrderState($orderId: ID!) {
|
|
690
|
+
exactOnlineOrderState(orderId: $orderId) {
|
|
691
|
+
pushed
|
|
692
|
+
origin
|
|
693
|
+
salesOrderId
|
|
694
|
+
salesOrderNumber
|
|
695
|
+
pushedAt
|
|
696
|
+
hasCustomer
|
|
697
|
+
customerLinked
|
|
698
|
+
unmappedSkus
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
`;
|
|
702
|
+
/**
|
|
703
|
+
* {@link PUSH_ORDER_TO_EXACT_ONLINE_MUTATION} without `warnings`, for an engine that predates the
|
|
704
|
+
* field. Safe to send after the current document was refused: an unknown field fails validation,
|
|
705
|
+
* before the push runs, so nothing reached Exact. Drop it with the state read's.
|
|
706
|
+
*/
|
|
707
|
+
export const PUSH_ORDER_TO_EXACT_ONLINE_LEGACY_MUTATION = /* GraphQL */ `
|
|
708
|
+
mutation PushOrderToExactOnline($orderId: ID!) {
|
|
709
|
+
pushOrderToExactOnline(orderId: $orderId) {
|
|
710
|
+
success
|
|
711
|
+
alreadyPushed
|
|
712
|
+
salesOrderId
|
|
713
|
+
salesOrderNumber
|
|
714
|
+
error
|
|
715
|
+
errorCode
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
`;
|
|
719
|
+
export const REPRICE_EXACT_ONLINE_ORDER_MUTATION = /* GraphQL */ `
|
|
720
|
+
mutation RepriceExactOnlineOrder($orderId: ID!) {
|
|
721
|
+
repriceExactOnlineOrder(orderId: $orderId) {
|
|
722
|
+
success
|
|
723
|
+
changed
|
|
724
|
+
linesRepriced
|
|
725
|
+
error
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
`;
|
|
729
|
+
export const REPRICE_ALL_EXACT_ONLINE_IMPORTED_ORDERS_MUTATION = /* GraphQL */ `
|
|
730
|
+
mutation RepriceAllExactOnlineImportedOrders {
|
|
731
|
+
repriceAllExactOnlineImportedOrders {
|
|
732
|
+
total
|
|
733
|
+
repriced
|
|
734
|
+
skipped
|
|
735
|
+
failed
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
`;
|
|
739
|
+
export const RUN_EXACT_ONLINE_ORDER_SYNC_MUTATION = /* GraphQL */ `
|
|
740
|
+
mutation RunExactOnlineOrderSync {
|
|
741
|
+
runExactOnlineOrderSync
|
|
742
|
+
}
|
|
743
|
+
`;
|
|
744
|
+
export const RUN_EXACT_ONLINE_ORDER_BACKFILL_MUTATION = /* GraphQL */ `
|
|
745
|
+
mutation RunExactOnlineOrderBackfill {
|
|
746
|
+
runExactOnlineOrderBackfill
|
|
747
|
+
}
|
|
748
|
+
`;
|
|
749
|
+
export const EXACT_PRODUCT_STATUS_QUERY = /* GraphQL */ `
|
|
750
|
+
query ExactProductStatus($id: ID!) {
|
|
751
|
+
product(id: $id) {
|
|
752
|
+
id
|
|
753
|
+
customFields {
|
|
754
|
+
exactManaged
|
|
755
|
+
exactItemId
|
|
756
|
+
exactItemGroupId
|
|
757
|
+
exactDisabledReason
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
`;
|
|
762
|
+
/** The plugins service's Exact connection-log routes (force-scoped to the caller's store). */
|
|
763
|
+
const CONNECTION_LOGS = '/exact-online/logs';
|
|
764
|
+
/** How long a connection-log export may stream before the call gives up, unless said otherwise. */
|
|
765
|
+
export const EXACT_ONLINE_LOG_EXPORT_TIMEOUT_MS = 120_000;
|
|
766
|
+
const CONNECTION_LOG_KINDS = ['calls', 'events'];
|
|
283
767
|
const invalidInput = (message, field) => new ValidationError({
|
|
284
768
|
code: 'INVALID_EXACT_ONLINE_INPUT',
|
|
285
769
|
message,
|
|
@@ -312,8 +796,74 @@ function configVariables(input) {
|
|
|
312
796
|
}
|
|
313
797
|
return variables;
|
|
314
798
|
}
|
|
799
|
+
/** A sync-log read's variables: only what was given, after the checks the engine would skip. */
|
|
800
|
+
function syncLogVariables(options) {
|
|
801
|
+
const { entity, limit } = options;
|
|
802
|
+
if (limit !== undefined &&
|
|
803
|
+
(!Number.isInteger(limit) || limit < 1 || limit > EXACT_ONLINE_SYNC_LOG_LIMIT)) {
|
|
804
|
+
throw invalidInput(`limit must be a whole number from 1 to ${String(EXACT_ONLINE_SYNC_LOG_LIMIT)}.`, 'limit');
|
|
805
|
+
}
|
|
806
|
+
if (entity !== undefined && (typeof entity !== 'string' || entity.trim() === '')) {
|
|
807
|
+
throw invalidInput('entity must name a sync entity, such as "items".', 'entity');
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
...(limit === undefined ? {} : { limit }),
|
|
811
|
+
...(entity === undefined ? {} : { entity }),
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
/** An id the call is about, refused before sending when it is not a non-blank string. */
|
|
815
|
+
function requireId(id, field, method) {
|
|
816
|
+
if (typeof id !== 'string' || id.trim() === '') {
|
|
817
|
+
throw invalidInput(`${method} needs the ${field}.`, field);
|
|
818
|
+
}
|
|
819
|
+
return id;
|
|
820
|
+
}
|
|
821
|
+
function requireEntity(entity) {
|
|
822
|
+
if (typeof entity !== 'string' || entity.trim() === '') {
|
|
823
|
+
throw invalidInput('resetCursor needs the entity stream whose cursor to drop.', 'entity');
|
|
824
|
+
}
|
|
825
|
+
return entity;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* A connection-log filter as the route's query. The wire cursor is `?before=` (the rows run
|
|
829
|
+
* newest first); the SDK's name for "the cursor the previous page handed me" is `after`, as on
|
|
830
|
+
* every list. An undefined value is left out of the query.
|
|
831
|
+
*/
|
|
832
|
+
function connectionLogQuery(filter) {
|
|
833
|
+
return {
|
|
834
|
+
before: filter.after,
|
|
835
|
+
limit: filter.limit,
|
|
836
|
+
category: filter.category,
|
|
837
|
+
outcome: filter.outcome,
|
|
838
|
+
status_code: filter.statusCode,
|
|
839
|
+
q: filter.q,
|
|
840
|
+
date_from: filter.dateFrom,
|
|
841
|
+
date_to: filter.dateTo,
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
/** The per-call options of a filter object (`signal`, `tenant`, `idempotencyKey`). */
|
|
845
|
+
function callOf(filter) {
|
|
846
|
+
if (!filter)
|
|
847
|
+
return {};
|
|
848
|
+
const { signal, tenant, idempotencyKey } = filter;
|
|
849
|
+
return {
|
|
850
|
+
...(signal === undefined ? {} : { signal }),
|
|
851
|
+
...(tenant === undefined ? {} : { tenant }),
|
|
852
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
853
|
+
};
|
|
854
|
+
}
|
|
315
855
|
export function createExactOnlineModule(transport) {
|
|
316
856
|
const read = (document, field, options, variables = {}) => fieldOf(transport, document, field, variables, options);
|
|
857
|
+
async function connectionLogCalls(filter) {
|
|
858
|
+
const body = await transport.rest('plugins', { method: 'GET', path: `${CONNECTION_LOGS}/calls`, query: connectionLogQuery(filter ?? {}) }, { ...callOf(filter), preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
859
|
+
const { items, meta } = readRestPage(body);
|
|
860
|
+
return createPage(items, meta, (cursor) => connectionLogCalls({ ...filter, after: cursor }));
|
|
861
|
+
}
|
|
862
|
+
async function connectionLogEvents(filter) {
|
|
863
|
+
const body = await transport.rest('plugins', { method: 'GET', path: `${CONNECTION_LOGS}/events`, query: connectionLogQuery(filter ?? {}) }, { ...callOf(filter), preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
864
|
+
const { items, meta } = readRestPage(body);
|
|
865
|
+
return createPage(items, meta, (cursor) => connectionLogEvents({ ...filter, after: cursor }));
|
|
866
|
+
}
|
|
317
867
|
return {
|
|
318
868
|
config: {
|
|
319
869
|
async get(options) {
|
|
@@ -372,5 +922,168 @@ export function createExactOnlineModule(transport) {
|
|
|
372
922
|
async syncEstimate(schedule, options) {
|
|
373
923
|
return read(EXACT_ONLINE_SYNC_ESTIMATE_QUERY, 'exactOnlineSyncEstimate', options, { schedule: requireObject(schedule, 'syncEstimate') });
|
|
374
924
|
},
|
|
925
|
+
sync: {
|
|
926
|
+
async logs(options) {
|
|
927
|
+
const { entity, limit, ...call } = options ?? {};
|
|
928
|
+
return read(EXACT_ONLINE_SYNC_LOGS_QUERY, 'exactOnlineSyncLogs', call, syncLogVariables({ entity, limit }));
|
|
929
|
+
},
|
|
930
|
+
health(options) {
|
|
931
|
+
return read(EXACT_ONLINE_SYNC_HEALTH_QUERY, 'exactOnlineSyncHealth', options);
|
|
932
|
+
},
|
|
933
|
+
async runCatalogue(options) {
|
|
934
|
+
return ((await read(RUN_EXACT_ONLINE_CATALOGUE_SYNC_MUTATION, 'runExactOnlineCatalogueSync', options)) === true);
|
|
935
|
+
},
|
|
936
|
+
async runCustomers(options) {
|
|
937
|
+
return ((await read(RUN_EXACT_ONLINE_CUSTOMER_SYNC_MUTATION, 'runExactOnlineCustomerSync', options)) === true);
|
|
938
|
+
},
|
|
939
|
+
async runPriceLists(options) {
|
|
940
|
+
return ((await read(RUN_EXACT_ONLINE_PRICE_LIST_SYNC_MUTATION, 'runExactOnlinePriceListSync', options)) === true);
|
|
941
|
+
},
|
|
942
|
+
reimportPictures(options) {
|
|
943
|
+
return read(REIMPORT_EXACT_ONLINE_ITEM_PICTURES_MUTATION, 'reimportExactOnlineItemPictures', options);
|
|
944
|
+
},
|
|
945
|
+
cursors(options) {
|
|
946
|
+
return read(EXACT_ONLINE_SYNC_CURSORS_QUERY, 'exactOnlineSyncCursors', options);
|
|
947
|
+
},
|
|
948
|
+
async resetCursor(entity, options) {
|
|
949
|
+
return ((await read(RESET_EXACT_ONLINE_SYNC_CURSOR_MUTATION, 'resetExactOnlineSyncCursor', options, { entity: requireEntity(entity) })) === true);
|
|
950
|
+
},
|
|
951
|
+
},
|
|
952
|
+
warehouseLinks(options) {
|
|
953
|
+
return read(EXACT_ONLINE_WAREHOUSE_LINKS_QUERY, 'exactOnlineWarehouseLinks', options);
|
|
954
|
+
},
|
|
955
|
+
shipping: {
|
|
956
|
+
methods(options) {
|
|
957
|
+
return read(EXACT_ONLINE_SHIPPING_METHODS_QUERY, 'exactOnlineShippingMethods', options);
|
|
958
|
+
},
|
|
959
|
+
async runSync(options) {
|
|
960
|
+
return ((await read(RUN_EXACT_ONLINE_SHIPPING_METHOD_SYNC_MUTATION, 'runExactOnlineShippingMethodSync', options)) === true);
|
|
961
|
+
},
|
|
962
|
+
import(exactShippingMethodId, options) {
|
|
963
|
+
return read(IMPORT_EXACT_ONLINE_SHIPPING_METHOD_MUTATION, 'importExactOnlineShippingMethod', options, { exactShippingMethodId });
|
|
964
|
+
},
|
|
965
|
+
async setMapping(input, options) {
|
|
966
|
+
const { vendureShippingMethodId, exactShippingMethodId } = requireObject(input, 'shipping.setMapping');
|
|
967
|
+
// GraphQL reads a missing argument as null, and the engine trims a blank id to null: a
|
|
968
|
+
// forgotten key or an emptied field would CLEAR the mapping. Only `null` clears.
|
|
969
|
+
if (exactShippingMethodId !== null &&
|
|
970
|
+
(typeof exactShippingMethodId !== 'string' || exactShippingMethodId.trim() === '')) {
|
|
971
|
+
throw invalidInput('shipping.setMapping needs exactShippingMethodId: an Exact method, or null to clear the mapping.', 'exactShippingMethodId');
|
|
972
|
+
}
|
|
973
|
+
return read(SET_EXACT_ONLINE_SHIPPING_METHOD_MAPPING_MUTATION, 'setExactOnlineShippingMethodMapping', options, { vendureShippingMethodId, exactShippingMethodId });
|
|
974
|
+
},
|
|
975
|
+
async convertToMapping(input, options) {
|
|
976
|
+
const { exactShippingMethodId, vendureShippingMethodId } = requireObject(input, 'shipping.convertToMapping');
|
|
977
|
+
return read(CONVERT_EXACT_ONLINE_SHIPPING_METHOD_TO_MAPPING_MUTATION, 'convertExactOnlineShippingMethodToMapping', options, { exactShippingMethodId, vendureShippingMethodId });
|
|
978
|
+
},
|
|
979
|
+
async retireImported(exactShippingMethodId, options) {
|
|
980
|
+
return ((await read(RETIRE_EXACT_ONLINE_IMPORTED_SHIPPING_METHOD_MUTATION, 'retireExactOnlineImportedShippingMethod', options, { exactShippingMethodId })) === true);
|
|
981
|
+
},
|
|
982
|
+
},
|
|
983
|
+
terms: {
|
|
984
|
+
paymentConditions(options) {
|
|
985
|
+
return read(EXACT_ONLINE_PAYMENT_CONDITIONS_QUERY, 'exactOnlinePaymentConditions', options);
|
|
986
|
+
},
|
|
987
|
+
paymentDiagnostics(options) {
|
|
988
|
+
return read(EXACT_ONLINE_PAYMENT_TERMS_DIAGNOSTICS_QUERY, 'exactOnlinePaymentTermsDiagnostics', options);
|
|
989
|
+
},
|
|
990
|
+
paymentDryRun(options) {
|
|
991
|
+
return read(EXACT_ONLINE_PAYMENT_TERMS_DRY_RUN_QUERY, 'exactOnlinePaymentTermsDryRun', options);
|
|
992
|
+
},
|
|
993
|
+
incoterms(options) {
|
|
994
|
+
return read(EXACT_ONLINE_INCOTERMS_QUERY, 'exactOnlineIncoterms', options);
|
|
995
|
+
},
|
|
996
|
+
deliveryDiagnostics(options) {
|
|
997
|
+
return read(EXACT_ONLINE_DELIVERY_TERMS_DIAGNOSTICS_QUERY, 'exactOnlineDeliveryTermsDiagnostics', options);
|
|
998
|
+
},
|
|
999
|
+
deliveryDryRun(options) {
|
|
1000
|
+
return read(EXACT_ONLINE_DELIVERY_TERMS_DRY_RUN_QUERY, 'exactOnlineDeliveryTermsDryRun', options);
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
customers: {
|
|
1004
|
+
async paymentTerms(customerId, options) {
|
|
1005
|
+
return ((await read(EXACT_ONLINE_CUSTOMER_PAYMENT_TERMS_QUERY, 'exactOnlineCustomerPaymentTerms', options, { customerId: requireId(customerId, 'customerId', 'customers.paymentTerms') })) ?? null);
|
|
1006
|
+
},
|
|
1007
|
+
async deliveryTerms(customerId, options) {
|
|
1008
|
+
return ((await read(EXACT_ONLINE_CUSTOMER_DELIVERY_TERMS_QUERY, 'exactOnlineCustomerDeliveryTerms', options, { customerId: requireId(customerId, 'customerId', 'customers.deliveryTerms') })) ?? null);
|
|
1009
|
+
},
|
|
1010
|
+
async priceList(customerId, options) {
|
|
1011
|
+
return read(EXACT_ONLINE_CUSTOMER_PRICE_LIST_QUERY, 'exactOnlineCustomerPriceList', options, { customerId: requireId(customerId, 'customerId', 'customers.priceList') });
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
orders: {
|
|
1015
|
+
async state(orderId, options) {
|
|
1016
|
+
const variables = { orderId: requireId(orderId, 'orderId', 'orders.state') };
|
|
1017
|
+
try {
|
|
1018
|
+
return await read(EXACT_ONLINE_ORDER_STATE_QUERY, 'exactOnlineOrderState', options, variables);
|
|
1019
|
+
}
|
|
1020
|
+
catch (error) {
|
|
1021
|
+
if (!isUnknownFieldRejection(error))
|
|
1022
|
+
throw error;
|
|
1023
|
+
const state = await read(EXACT_ONLINE_ORDER_STATE_LEGACY_QUERY, 'exactOnlineOrderState', options, variables);
|
|
1024
|
+
return { ...state, warnings: [] };
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
async syncState(orderId, options) {
|
|
1028
|
+
return ((await read(EXACT_ONLINE_ORDER_SYNC_STATE_QUERY, 'exactOnlineOrderSyncState', options, { orderId: requireId(orderId, 'orderId', 'orders.syncState') })) ?? null);
|
|
1029
|
+
},
|
|
1030
|
+
async push(orderId, options) {
|
|
1031
|
+
const variables = { orderId: requireId(orderId, 'orderId', 'orders.push') };
|
|
1032
|
+
try {
|
|
1033
|
+
return await read(PUSH_ORDER_TO_EXACT_ONLINE_MUTATION, 'pushOrderToExactOnline', options, variables);
|
|
1034
|
+
}
|
|
1035
|
+
catch (error) {
|
|
1036
|
+
// Only a document the engine refused before running it is sent again (see the legacy
|
|
1037
|
+
// mutation's comment): any other failure may have reached Exact and is thrown as is.
|
|
1038
|
+
if (!isUnknownFieldRejection(error))
|
|
1039
|
+
throw error;
|
|
1040
|
+
const result = await read(PUSH_ORDER_TO_EXACT_ONLINE_LEGACY_MUTATION, 'pushOrderToExactOnline', options, variables);
|
|
1041
|
+
return { ...result, warnings: null };
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
async reprice(orderId, options) {
|
|
1045
|
+
return read(REPRICE_EXACT_ONLINE_ORDER_MUTATION, 'repriceExactOnlineOrder', options, { orderId: requireId(orderId, 'orderId', 'orders.reprice') });
|
|
1046
|
+
},
|
|
1047
|
+
repriceAll(options) {
|
|
1048
|
+
return read(REPRICE_ALL_EXACT_ONLINE_IMPORTED_ORDERS_MUTATION, 'repriceAllExactOnlineImportedOrders', options);
|
|
1049
|
+
},
|
|
1050
|
+
async runSync(options) {
|
|
1051
|
+
return ((await read(RUN_EXACT_ONLINE_ORDER_SYNC_MUTATION, 'runExactOnlineOrderSync', options)) === true);
|
|
1052
|
+
},
|
|
1053
|
+
async runBackfill(options) {
|
|
1054
|
+
return ((await read(RUN_EXACT_ONLINE_ORDER_BACKFILL_MUTATION, 'runExactOnlineOrderBackfill', options)) === true);
|
|
1055
|
+
},
|
|
1056
|
+
},
|
|
1057
|
+
products: {
|
|
1058
|
+
async status(productId, options) {
|
|
1059
|
+
const product = await read(EXACT_PRODUCT_STATUS_QUERY, 'product', options, { id: requireId(productId, 'productId', 'products.status') });
|
|
1060
|
+
if (!product)
|
|
1061
|
+
return null;
|
|
1062
|
+
const fields = product.customFields;
|
|
1063
|
+
return {
|
|
1064
|
+
exactManaged: fields?.exactManaged ?? null,
|
|
1065
|
+
exactItemId: fields?.exactItemId ?? null,
|
|
1066
|
+
exactItemGroupId: fields?.exactItemGroupId ?? null,
|
|
1067
|
+
exactDisabledReason: fields?.exactDisabledReason ?? null,
|
|
1068
|
+
};
|
|
1069
|
+
},
|
|
1070
|
+
},
|
|
1071
|
+
connectionLogs: {
|
|
1072
|
+
calls: connectionLogCalls,
|
|
1073
|
+
events: connectionLogEvents,
|
|
1074
|
+
async export(kind, filter, options) {
|
|
1075
|
+
if (!CONNECTION_LOG_KINDS.includes(kind)) {
|
|
1076
|
+
throw invalidInput('kind must be "calls" or "events".', 'kind');
|
|
1077
|
+
}
|
|
1078
|
+
// A CSV body, never JSON: `blob` keeps the transport from parsing or case-converting it.
|
|
1079
|
+
const answer = await transport.rest('plugins', {
|
|
1080
|
+
method: 'GET',
|
|
1081
|
+
path: `${CONNECTION_LOGS}/${kind}/export`,
|
|
1082
|
+
query: connectionLogQuery(requireObject(filter, 'connectionLogs.export')),
|
|
1083
|
+
expect: 'blob',
|
|
1084
|
+
}, { timeoutMs: EXACT_ONLINE_LOG_EXPORT_TIMEOUT_MS, ...options });
|
|
1085
|
+
return answer.blob.text();
|
|
1086
|
+
},
|
|
1087
|
+
},
|
|
375
1088
|
};
|
|
376
1089
|
}
|