rerobe-js-orm 4.5.5 → 4.5.7

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.
@@ -2,4 +2,5 @@ import OrderFactory from './OrderFactory';
2
2
  export default class OrderFromShopifyWebhook extends OrderFactory {
3
3
  createOrder(order: ShopifyRestApiOrderObj): ReRobeOrderObj;
4
4
  createOrderV2(order: any): ReRobeOrderObj;
5
+ createOrderV3(order: ShopifyOrdersCreatePayload): ReRobeOrderObj;
5
6
  }
@@ -264,7 +264,7 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
264
264
  };
265
265
  // @ts-ignore
266
266
  const fulfillmentStatus = !fulfillment_status ? '' : fulfillmentStatusRestMapping[fulfillment_status];
267
- const rerobeOrder = new Order_1.default(Object.assign(Object.assign({}, order), { id: orderHelpers.getOrderIdFromShopifyObj(order), shopifyId: `gid://shopify/Order/${id}`, shopifyOrderNumber: name ? Number(name.split('#')[1]) : 0, financialStatus: financial_status ? financial_status.toUpperCase() : '', fulfillmentStatus, cancelReason: cancel_reason ? cancel_reason.toUpperCase() : '', lineItems,
267
+ const rerobeOrder = new Order_1.default(Object.assign(Object.assign({}, order), { id: orderHelpers.getOrderIdFromShopifyObj({ id, tags }), shopifyId: `gid://shopify/Order/${id}`, shopifyOrderNumber: name ? Number(name.split('#')[1]) : 0, financialStatus: financial_status ? financial_status.toUpperCase() : '', fulfillmentStatus, cancelReason: cancel_reason ? cancel_reason.toUpperCase() : '', lineItems,
268
268
  subtotalPrice,
269
269
  totalPrice,
270
270
  totalShippingPrice,
@@ -308,7 +308,8 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
308
308
  title: item.title,
309
309
  quantity: item.quantity,
310
310
  variant: {
311
- id: item.variant_id ? `gid://shopify/ProductVariant/${item.variant_id}` : '',
311
+ id: '',
312
+ shopifyId: item.variant_id ? `gid://shopify/ProductVariant/${item.variant_id}` : '',
312
313
  title: item.variant_title || '',
313
314
  image: { id: '', originalSrc: '' },
314
315
  },
@@ -337,7 +338,10 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
337
338
  taxLines: (shipping_lines[0].tax_lines || []).map((t) => ({
338
339
  rate: t.rate,
339
340
  title: t.title,
340
- priceSet: { amount: t.price, currencyCode: currency || '' },
341
+ priceSet: {
342
+ shopMoney: { amount: t.price, currencyCode: currency || '' },
343
+ presentmentMoney: { amount: t.price, currencyCode: currency || '' },
344
+ },
341
345
  })),
342
346
  }
343
347
  : {
@@ -352,7 +356,7 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
352
356
  // @ts-ignore
353
357
  const fulfillmentStatus = !fulfillment_status ? '' : fulfillmentStatusRestMapping[fulfillment_status];
354
358
  const rerobeOrder = new Order_1.default({
355
- id: orderHelpers.getOrderIdFromShopifyObj(order),
359
+ id: orderHelpers.getOrderIdFromShopifyObj({ id, tags }),
356
360
  shopifyId: `gid://shopify/Order/${id}`,
357
361
  shopifyOrderNumber: name ? Number(String(name).replace('#', '')) : order_number || 0,
358
362
  name: name || '',
@@ -384,5 +388,234 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
384
388
  });
385
389
  return rerobeOrder.toObj();
386
390
  }
391
+ // Aligned with Shopify REST order payload that includes current_* fields and statusUrl
392
+ createOrderV3(order) {
393
+ const { id, name, financial_status, fulfillment_status, cancel_reason, created_at, processed_at, updated_at, currency, contact_email, email, order_status_url, shipping_address, line_items = [], discount_applications = [], shipping_lines = [], tax_lines = [], tags = '', cancelled_at, closed_at, order_number, current_subtotal_price_set, current_total_price_set, current_total_tax_set, current_total_discounts_set, current_shipping_price_set, } = order || {};
394
+ const moneyFromSet = (setObj) => {
395
+ const shop = setObj === null || setObj === void 0 ? void 0 : setObj.shop_money;
396
+ return shop
397
+ ? { amount: shop.amount, currencyCode: shop.currency_code }
398
+ : { amount: 0, currencyCode: currency || '' };
399
+ };
400
+ const subtotalPrice = moneyFromSet(current_subtotal_price_set);
401
+ const totalPrice = moneyFromSet(current_total_price_set);
402
+ const totalTax = moneyFromSet(current_total_tax_set);
403
+ const totalShippingPrice = moneyFromSet(current_shipping_price_set);
404
+ const totalDiscount = current_total_discounts_set
405
+ ? moneyFromSet(current_total_discounts_set)
406
+ : { amount: 0, currencyCode: currency || '' };
407
+ const shippingAddress = shipping_address
408
+ ? {
409
+ address1: shipping_address.address1,
410
+ address2: shipping_address.address2,
411
+ city: shipping_address.city,
412
+ country: shipping_address.country,
413
+ countryCode: shipping_address.country_code,
414
+ province: shipping_address.province,
415
+ zip: shipping_address.zip,
416
+ }
417
+ : null;
418
+ const lineItems = (line_items || []).map((item) => ({
419
+ title: item.title,
420
+ quantity: item.quantity,
421
+ variant: {
422
+ id: '',
423
+ shopifyId: item.variant_id ? `gid://shopify/ProductVariant/${item.variant_id}` : '',
424
+ title: item.variant_title || '',
425
+ image: { id: '', originalSrc: '' },
426
+ },
427
+ shopifyProductId: item.product_id ? `gid://shopify/Product/${item.product_id}` : null,
428
+ originalTotalPrice: moneyFromSet(item.price_set),
429
+ discountedTotalPrice: moneyFromSet(item.total_discount_set),
430
+ }));
431
+ const discountApplications = discount_applications.map((item) => ({
432
+ allocationMethod: item.allocation_method ? String(item.allocation_method).toUpperCase() : '',
433
+ targetSelection: item.target_selection ? String(item.target_selection).toUpperCase() : '',
434
+ targetType: item.target_type ? String(item.target_type).toUpperCase() : '',
435
+ value: { amount: item.value },
436
+ }));
437
+ const taxLinesV3 = (tax_lines || []).map((item) => ({
438
+ rate: item.rate,
439
+ title: item.title,
440
+ priceSet: {
441
+ shopMoney: { amount: item.price, currencyCode: currency || '' },
442
+ presentmentMoney: { amount: item.price, currencyCode: currency || '' },
443
+ },
444
+ }));
445
+ const shippingLine = shipping_lines && shipping_lines.length
446
+ ? {
447
+ id: '',
448
+ title: shipping_lines[0].title,
449
+ source: shipping_lines[0].source,
450
+ discountedPrice: moneyFromSet(shipping_lines[0].discounted_price_set),
451
+ originalPrice: moneyFromSet(shipping_lines[0].price_set),
452
+ taxLines: (shipping_lines[0].tax_lines || []).map((t) => ({
453
+ rate: t.rate,
454
+ title: t.title,
455
+ priceSet: {
456
+ shopMoney: { amount: t.price, currencyCode: currency || '' },
457
+ presentmentMoney: { amount: t.price, currencyCode: currency || '' },
458
+ },
459
+ })),
460
+ }
461
+ : {
462
+ id: '',
463
+ title: '',
464
+ taxLines: [],
465
+ discountAllocations: [],
466
+ discountedPrice: { amount: 0 },
467
+ originalPrice: { amount: 0 },
468
+ source: '',
469
+ };
470
+ const fulfillments = ((order === null || order === void 0 ? void 0 : order.fulfillments) || []).map((item) => ({
471
+ id: item.id,
472
+ createdAt: item.created_at,
473
+ name: item.name,
474
+ updatedAt: item.updated_at || '',
475
+ status: item.status ? String(item.status).toUpperCase() : undefined,
476
+ trackingInfo: {
477
+ company: item.tracking_company || '',
478
+ number: item.tracking_numbers && item.tracking_numbers.length ? String(item.tracking_numbers[0]) : '',
479
+ url: item.tracking_urls && item.tracking_urls.length ? item.tracking_urls[0] : '',
480
+ },
481
+ fulfillmentLineItems: (item.line_items || []).map((lineItem) => ({
482
+ lineItem: { shopifyProductId: (lineItem === null || lineItem === void 0 ? void 0 : lineItem.product_id) || null },
483
+ quantity: Number(lineItem.quantity || 0),
484
+ })),
485
+ }));
486
+ const refunds = ((order === null || order === void 0 ? void 0 : order.refunds) || []).map((rawRefundItem) => {
487
+ const currencyCode = currency;
488
+ const refundedShippingAmount = !rawRefundItem.order_adjustments.length
489
+ ? 0
490
+ : rawRefundItem.order_adjustments.reduce((result, item) => {
491
+ if (item.kind === 'shipping_refund') {
492
+ result = result - Number(item.amount);
493
+ }
494
+ return result;
495
+ }, 0);
496
+ const totalRefundedAmount = !rawRefundItem.transactions.length
497
+ ? 0
498
+ : rawRefundItem.transactions.reduce((result, item) => {
499
+ if (item.kind === 'refund') {
500
+ result = result + Number(item.amount);
501
+ }
502
+ return result;
503
+ }, 0);
504
+ let refundDiscountAmount = 0;
505
+ const subtotalRefundedAmount = !rawRefundItem.refund_line_items.length
506
+ ? 0
507
+ : (rawRefundItem.refund_line_items || []).reduce((result, item) => {
508
+ if (item.line_item) {
509
+ const itemSubtotal = Number(Number(item.line_item.price || 0) * Number(item.quantity || 0));
510
+ result = result + itemSubtotal;
511
+ refundDiscountAmount = refundDiscountAmount + itemSubtotal - Number(item.subtotal || 0);
512
+ }
513
+ return result;
514
+ }, 0);
515
+ let refundLineItems = !rawRefundItem.refund_line_items || !rawRefundItem.refund_line_items.length
516
+ ? []
517
+ : (rawRefundItem.refund_line_items || []).map((item) => {
518
+ var _a, _b;
519
+ const quantityRefund = !item.location_id ? Number(item.quantity || 0) : 0;
520
+ const quantityCancel = item.location_id ? Number(item.quantity || 0) : 0;
521
+ const discountRefundAmount = Number(Number(((_a = item.line_item) === null || _a === void 0 ? void 0 : _a.price) || 0) * Number(item.quantity || 0)) -
522
+ Number(item.subtotal || 0);
523
+ const subtotalRefundAmount = !item.location_id ? Number(item.subtotal || 0) : 0;
524
+ const subtotalCanceledAmount = item.location_id ? Number(item.subtotal || 0) : 0;
525
+ return {
526
+ lineItem: { shopifyProductId: (((_b = item.line_item) === null || _b === void 0 ? void 0 : _b.product_id) || null) },
527
+ quantityRefund,
528
+ quantityCancel,
529
+ discountRefund: { currencyCode, amount: discountRefundAmount },
530
+ subtotalRefund: { currencyCode, amount: subtotalRefundAmount },
531
+ subtotalCanceled: { currencyCode, amount: subtotalCanceledAmount },
532
+ };
533
+ });
534
+ if (refundLineItems.length) {
535
+ refundLineItems = refundLineItems.reduce((result, item) => {
536
+ var _a, _b, _c, _d, _e, _f, _g;
537
+ const existedLineItemsIds = !result.length ? [] : result.map((itm) => itm.lineItem.shopifyProductId);
538
+ const existedLineItemIdx = existedLineItemsIds.indexOf((_a = item.lineItem) === null || _a === void 0 ? void 0 : _a.shopifyProductId);
539
+ if (existedLineItemIdx < 0) {
540
+ result.push(item);
541
+ }
542
+ else {
543
+ result[existedLineItemIdx] = {
544
+ lineItem: result[existedLineItemIdx].lineItem,
545
+ quantityRefund: Number(result[existedLineItemIdx].quantityRefund) + Number(item.quantityRefund),
546
+ quantityCancel: Number(result[existedLineItemIdx].quantityCancel) + Number(item.quantityCancel),
547
+ discountRefund: Object.assign(Object.assign({}, result[existedLineItemIdx].discountRefund), { amount: Number(((_b = result[existedLineItemIdx].discountRefund) === null || _b === void 0 ? void 0 : _b.amount) || 0) +
548
+ Number(((_c = item.discountRefund) === null || _c === void 0 ? void 0 : _c.amount) || 0) }),
549
+ subtotalRefund: Object.assign(Object.assign({}, result[existedLineItemIdx].subtotalRefund), { amount: Number(((_d = result[existedLineItemIdx].subtotalRefund) === null || _d === void 0 ? void 0 : _d.amount) || 0) +
550
+ Number(((_e = item.subtotalRefund) === null || _e === void 0 ? void 0 : _e.amount) || 0) }),
551
+ subtotalCanceled: Object.assign(Object.assign({}, result[existedLineItemIdx].subtotalCanceled), { amount: Number(((_f = result[existedLineItemIdx].subtotalCanceled) === null || _f === void 0 ? void 0 : _f.amount) || 0) +
552
+ Number(((_g = item.subtotalCanceled) === null || _g === void 0 ? void 0 : _g.amount) || 0) }),
553
+ };
554
+ }
555
+ return result;
556
+ }, []);
557
+ }
558
+ return {
559
+ documentId: String(rawRefundItem.id),
560
+ createdAt: rawRefundItem.created_at,
561
+ note: rawRefundItem.note,
562
+ totalRefunded: { amount: totalRefundedAmount, currencyCode },
563
+ totalRefundedPresentment: { amount: totalRefundedAmount, currencyCode },
564
+ subtotalRefunded: { amount: subtotalRefundedAmount, currencyCode },
565
+ refundDiscount: { amount: refundDiscountAmount, currencyCode },
566
+ refundShipping: { amount: refundedShippingAmount, currencyCode },
567
+ totalTax: { amount: 0, currencyCode },
568
+ refundLineItems,
569
+ };
570
+ });
571
+ const totalRefunded = {
572
+ currencyCode: currency,
573
+ amount: !refunds || !refunds.length
574
+ ? 0
575
+ : refunds.reduce((result, item) => {
576
+ result = result + Number(item.totalRefunded.amount);
577
+ return result;
578
+ }, 0),
579
+ };
580
+ // @ts-ignore
581
+ const fulfillmentStatus = !fulfillment_status ? '' : fulfillmentStatusRestMapping[fulfillment_status];
582
+ const rerobeOrder = new Order_1.default({
583
+ id: orderHelpers.getOrderIdFromShopifyObj({ id, tags }),
584
+ shopifyId: `gid://shopify/Order/${id}`,
585
+ shopifyOrderNumber: name ? Number(String(name).replace('#', '')) : order_number || 0,
586
+ name: name || '',
587
+ currencyCode: currency || '',
588
+ statusUrl: order_status_url || '',
589
+ email: contact_email || email || '',
590
+ financialStatus: financial_status ? String(financial_status).toUpperCase() : '',
591
+ fulfillmentStatus,
592
+ cancelReason: cancel_reason ? String(cancel_reason).toUpperCase() : '',
593
+ createdAt: created_at,
594
+ processedAt: processed_at,
595
+ updatedAt: updated_at,
596
+ canceledAt: cancelled_at,
597
+ closedAt: closed_at,
598
+ orderNumber: order_number || 0,
599
+ shippingAddress,
600
+ lineItems,
601
+ subtotalPrice,
602
+ totalPrice,
603
+ totalTax,
604
+ totalShippingPrice,
605
+ totalDiscount,
606
+ taxLines: taxLinesV3,
607
+ discountApplications,
608
+ fulfillments,
609
+ refunds,
610
+ totalRefunded,
611
+ shippingLine,
612
+ tags: tags ? String(tags).split(', ').filter(Boolean) : [],
613
+ state: Order_1.default.ORDER_STATES.completed,
614
+ shippingType: orderHelpers.getShippingTypeFromShopifyObj((shipping_lines || [])),
615
+ paymentType: orderHelpers.getPaymentTypeUsingTags(tags),
616
+ salesChannel: orderHelpers.getSalesChannelUsingTags(tags),
617
+ });
618
+ return rerobeOrder.toObj();
619
+ }
387
620
  }
388
621
  exports.default = OrderFromShopifyWebhook;
@@ -78,6 +78,11 @@ export default class ProductFormState extends FormState {
78
78
  removeVariantByOptions(options: {
79
79
  [k: string]: string;
80
80
  }): void;
81
+ removeVariantById(id: string): void;
82
+ removeVariants(options?: {
83
+ ids?: string[];
84
+ predicate?: (v: VariantInventory) => boolean;
85
+ }): void;
81
86
  findVariantByOptions(options: {
82
87
  [k: string]: string;
83
88
  }): VariantInventory | undefined;
@@ -811,6 +811,47 @@ class ProductFormState extends FormState_1.default {
811
811
  this.aggregateInventoryLocationsFromVariants();
812
812
  }
813
813
  }
814
+ // Remove a single variant by id
815
+ removeVariantById(id) {
816
+ const rows = this.fields.variantInventory.selectedValues;
817
+ const ind = rows.findIndex((v) => v.id === id);
818
+ if (ind === -1)
819
+ return;
820
+ rows.splice(ind, 1);
821
+ // Recompute aggregates
822
+ const totalQty = rows.reduce((acc, cur) => {
823
+ const locs = cur.locations;
824
+ const sum = Array.isArray(locs) ? locs.reduce((a, l) => a + (Number(l === null || l === void 0 ? void 0 : l.availableAmount) || 0), 0) : 0;
825
+ return acc + sum;
826
+ }, 0);
827
+ this.fields.quantity.inputValue = totalQty;
828
+ this.fields.availableForSale.selectedValue = totalQty > 0;
829
+ this.aggregateInventoryLocationsFromVariants();
830
+ }
831
+ // Bulk remove variants by selector (ids and/or predicate)
832
+ removeVariants(options) {
833
+ const rows = this.fields.variantInventory.selectedValues || [];
834
+ if (!rows.length)
835
+ return;
836
+ const shouldRemove = (v) => {
837
+ if ((options === null || options === void 0 ? void 0 : options.ids) && options.ids.length && options.ids.includes(v.id))
838
+ return true;
839
+ if ((options === null || options === void 0 ? void 0 : options.predicate) && options.predicate(v))
840
+ return true;
841
+ return false;
842
+ };
843
+ const next = rows.filter((v) => !shouldRemove(v));
844
+ this.fields.variantInventory.selectedValues = next;
845
+ // Recompute aggregates
846
+ const totalQty = next.reduce((acc, cur) => {
847
+ const locs = cur.locations;
848
+ const sum = Array.isArray(locs) ? locs.reduce((a, l) => a + (Number(l === null || l === void 0 ? void 0 : l.availableAmount) || 0), 0) : 0;
849
+ return acc + sum;
850
+ }, 0);
851
+ this.fields.quantity.inputValue = totalQty;
852
+ this.fields.availableForSale.selectedValue = totalQty > 0;
853
+ this.aggregateInventoryLocationsFromVariants();
854
+ }
814
855
  findVariantByOptions(options) {
815
856
  return this.getExistingVariantByOptions(options);
816
857
  }
@@ -441,9 +441,6 @@ class ReRobeProductHelpers {
441
441
  if (status === product_constants_1.PRODUCT_STATES.soldSellerPayoutProcessing && !soldSellerPayoutProcessingTimestamp) {
442
442
  const timeNow = new Date().getTime();
443
443
  docFieldsToUpdate.soldSellerPayoutProcessingTimestamp = timeNow;
444
- if (!soldSellerSelfPayTimestamp) {
445
- docFieldsToUpdate.soldSellerSelfPayTimestamp = timeNow;
446
- }
447
444
  if (!soldTimestamp) {
448
445
  docFieldsToUpdate.soldTimestamp = timeNow;
449
446
  }
@@ -335,7 +335,7 @@ class Product extends Base_1.default {
335
335
  : [];
336
336
  if (variantsFromInventory.length === 0) {
337
337
  // Fallback: single-variant product (legacy behavior)
338
- const variant = Object.assign(Object.assign({}, baseVariantFields()), { inventoryQuantities: [
338
+ const variant = Object.assign(Object.assign({ id: '' }, baseVariantFields()), { inventoryQuantities: [
339
339
  {
340
340
  locationId: `gid://shopify/Location/${locationId}`,
341
341
  name: 'available',
@@ -404,7 +404,7 @@ class Product extends Base_1.default {
404
404
  },
405
405
  ];
406
406
  const basePrice = ((_b = (_a = v.price) !== null && _a !== void 0 ? _a : this.attributes.price) !== null && _b !== void 0 ? _b : '0');
407
- const variant = Object.assign(Object.assign({}, baseVariantFields()), { optionValues,
407
+ const variant = Object.assign(Object.assign({ id: v.id }, baseVariantFields()), { optionValues,
408
408
  inventoryQuantities });
409
409
  // Override inventory policy if allowed to continue selling
410
410
  if (v.continueSellingWhenOutOfStock === true) {
@@ -119,6 +119,7 @@ type ReRobeOrderObj = {
119
119
  totalRefunded?: Money;
120
120
  totalShippingPrice?: Money;
121
121
  totalTax?: Money;
122
+ taxLines?: TaxLine[];
122
123
  taxTitle?: string;
123
124
  originalTotalPrice?: Money;
124
125
  cancelReason?: CancelReasonTypes | string | null;
@@ -381,6 +382,7 @@ type OrderLineItemAdmin = {
381
382
  };
382
383
  type ProductVariant = {
383
384
  id: string;
385
+ shopifyId?: string;
384
386
  title?: string;
385
387
  image?: Image;
386
388
  priceV2?: Money;
@@ -939,3 +941,843 @@ type OrderAdjustment = {
939
941
  }[];
940
942
  type?: 'SHIPPING_TYPE_ADJUSTMENT' | 'SHIPPING_ADDRESS_ADJUSTMENT' | 'CUSTOMER_DETAILS_ADJUSTMENT' | 'ADDITONAL_FEE';
941
943
  };
944
+ interface ShopifyOrdersCreatePayload {
945
+ admin_graphql_api_id: string;
946
+ app_id: number | null;
947
+ billing_address: {
948
+ address1: string;
949
+ address2: null | string;
950
+ city: string;
951
+ company: null | string;
952
+ country: string;
953
+ country_code: string;
954
+ first_name: string;
955
+ last_name: string;
956
+ latitude: null | number;
957
+ longitude: null | number;
958
+ name: string;
959
+ phone: string;
960
+ province: string;
961
+ province_code: string;
962
+ zip: string;
963
+ [k: string]: unknown;
964
+ };
965
+ browser_ip: null | string;
966
+ buyer_accepts_marketing: boolean;
967
+ cancel_reason: null | string;
968
+ cancelled_at: null | string;
969
+ cart_token: null | string;
970
+ checkout_id: number | null;
971
+ checkout_token: null | string;
972
+ client_details: null | {
973
+ accept_language: null | string;
974
+ browser_height: number | null;
975
+ browser_ip?: string;
976
+ browser_width?: number | null;
977
+ session_hash?: null;
978
+ user_agent?: string;
979
+ [k: string]: unknown;
980
+ };
981
+ closed_at: null | string;
982
+ confirmation_number: null | string;
983
+ confirmed: boolean;
984
+ contact_email: string;
985
+ created_at: string;
986
+ currency: string;
987
+ current_shipping_price_set: {
988
+ presentment_money: {
989
+ amount: string;
990
+ currency_code: string;
991
+ [k: string]: unknown;
992
+ };
993
+ shop_money: {
994
+ amount: string;
995
+ currency_code: string;
996
+ [k: string]: unknown;
997
+ };
998
+ [k: string]: unknown;
999
+ };
1000
+ current_subtotal_price: string;
1001
+ current_subtotal_price_set: {
1002
+ presentment_money: {
1003
+ amount: string;
1004
+ currency_code: string;
1005
+ [k: string]: unknown;
1006
+ };
1007
+ shop_money: {
1008
+ amount: string;
1009
+ currency_code: string;
1010
+ [k: string]: unknown;
1011
+ };
1012
+ [k: string]: unknown;
1013
+ };
1014
+ current_total_additional_fees_set: null | {
1015
+ presentment_money: {
1016
+ amount: string;
1017
+ currency_code: string;
1018
+ [k: string]: unknown;
1019
+ };
1020
+ shop_money: {
1021
+ amount: string;
1022
+ currency_code: string;
1023
+ [k: string]: unknown;
1024
+ };
1025
+ [k: string]: unknown;
1026
+ };
1027
+ current_total_discounts: string;
1028
+ current_total_discounts_set: {
1029
+ presentment_money: {
1030
+ amount: string;
1031
+ currency_code: string;
1032
+ [k: string]: unknown;
1033
+ };
1034
+ shop_money: {
1035
+ amount: string;
1036
+ currency_code: string;
1037
+ [k: string]: unknown;
1038
+ };
1039
+ [k: string]: unknown;
1040
+ };
1041
+ current_total_duties_set: null | {
1042
+ presentment_money: {
1043
+ amount: string;
1044
+ currency_code: string;
1045
+ [k: string]: unknown;
1046
+ };
1047
+ shop_money: {
1048
+ amount: string;
1049
+ currency_code: string;
1050
+ [k: string]: unknown;
1051
+ };
1052
+ [k: string]: unknown;
1053
+ };
1054
+ current_total_price: string;
1055
+ current_total_price_set: {
1056
+ presentment_money: {
1057
+ amount: string;
1058
+ currency_code: string;
1059
+ [k: string]: unknown;
1060
+ };
1061
+ shop_money: {
1062
+ amount: string;
1063
+ currency_code: string;
1064
+ [k: string]: unknown;
1065
+ };
1066
+ [k: string]: unknown;
1067
+ };
1068
+ current_total_tax: string;
1069
+ current_total_tax_set: {
1070
+ presentment_money: {
1071
+ amount: string;
1072
+ currency_code: string;
1073
+ [k: string]: unknown;
1074
+ };
1075
+ shop_money: {
1076
+ amount: string;
1077
+ currency_code: string;
1078
+ [k: string]: unknown;
1079
+ };
1080
+ [k: string]: unknown;
1081
+ };
1082
+ customer: {
1083
+ accepts_marketing?: boolean;
1084
+ accepts_marketing_updated_at?: null | string;
1085
+ admin_graphql_api_id: string;
1086
+ created_at: null | string;
1087
+ currency: string;
1088
+ default_address: {
1089
+ address1: string;
1090
+ address2: null | string;
1091
+ city: string;
1092
+ company: null | string;
1093
+ country: string;
1094
+ country_code: string;
1095
+ country_name: string;
1096
+ customer_id: number;
1097
+ default: boolean;
1098
+ first_name: string;
1099
+ id: number;
1100
+ last_name: string;
1101
+ name: string;
1102
+ phone: string;
1103
+ province: string;
1104
+ province_code: string;
1105
+ zip: string;
1106
+ [k: string]: unknown;
1107
+ };
1108
+ email: string;
1109
+ email_marketing_consent?: {
1110
+ consent_updated_at: null | string;
1111
+ opt_in_level: string;
1112
+ state: string;
1113
+ [k: string]: unknown;
1114
+ };
1115
+ first_name: string;
1116
+ id: number;
1117
+ last_name: string;
1118
+ marketing_opt_in_level?: string;
1119
+ multipass_identifier: null | string;
1120
+ note: null | string;
1121
+ phone: null | string;
1122
+ sms_marketing_consent?: null | {
1123
+ consent_collected_from: string;
1124
+ consent_updated_at: null | string;
1125
+ opt_in_level: string;
1126
+ state: string;
1127
+ [k: string]: unknown;
1128
+ };
1129
+ state: string;
1130
+ tags?: string;
1131
+ tax_exempt: boolean;
1132
+ tax_exemptions: never[];
1133
+ updated_at: null | string;
1134
+ verified_email: boolean;
1135
+ [k: string]: unknown;
1136
+ };
1137
+ customer_locale: null | string;
1138
+ device_id: null | string;
1139
+ discount_applications: {
1140
+ allocation_method: string;
1141
+ code?: string;
1142
+ description?: string;
1143
+ target_selection: string;
1144
+ target_type: string;
1145
+ title?: string;
1146
+ type: string;
1147
+ value: string;
1148
+ value_type: string;
1149
+ [k: string]: unknown;
1150
+ }[];
1151
+ discount_codes: {
1152
+ amount: string;
1153
+ code: string;
1154
+ type: string;
1155
+ [k: string]: unknown;
1156
+ }[];
1157
+ duties_included: boolean;
1158
+ email: string;
1159
+ estimated_taxes: boolean;
1160
+ financial_status: string;
1161
+ fulfillment_status: null | string;
1162
+ fulfillments: {
1163
+ admin_graphql_api_id: string;
1164
+ created_at: string;
1165
+ id: number;
1166
+ line_items: {
1167
+ admin_graphql_api_id: string;
1168
+ current_quantity?: number;
1169
+ discount_allocations: {
1170
+ amount: string;
1171
+ amount_set: {
1172
+ presentment_money: {
1173
+ amount: string;
1174
+ currency_code: string;
1175
+ [k: string]: unknown;
1176
+ };
1177
+ shop_money: {
1178
+ amount: string;
1179
+ currency_code: string;
1180
+ [k: string]: unknown;
1181
+ };
1182
+ [k: string]: unknown;
1183
+ };
1184
+ discount_application_index: number;
1185
+ [k: string]: unknown;
1186
+ }[];
1187
+ duties: never[];
1188
+ fulfillable_quantity: number;
1189
+ fulfillment_service: string;
1190
+ fulfillment_status: string;
1191
+ gift_card: boolean;
1192
+ grams: number;
1193
+ id: number;
1194
+ name: string;
1195
+ pre_tax_price?: string;
1196
+ pre_tax_price_set?: {
1197
+ presentment_money: {
1198
+ amount: string;
1199
+ currency_code: string;
1200
+ [k: string]: unknown;
1201
+ };
1202
+ shop_money: {
1203
+ amount: string;
1204
+ currency_code: string;
1205
+ [k: string]: unknown;
1206
+ };
1207
+ [k: string]: unknown;
1208
+ };
1209
+ price: string;
1210
+ price_set: {
1211
+ presentment_money: {
1212
+ amount: string;
1213
+ currency_code: string;
1214
+ [k: string]: unknown;
1215
+ };
1216
+ shop_money: {
1217
+ amount: string;
1218
+ currency_code: string;
1219
+ [k: string]: unknown;
1220
+ };
1221
+ [k: string]: unknown;
1222
+ };
1223
+ product_exists: boolean;
1224
+ product_id: number;
1225
+ properties: never[];
1226
+ quantity: number;
1227
+ requires_shipping: boolean;
1228
+ sku: string;
1229
+ tax_lines: {
1230
+ channel_liable: boolean;
1231
+ price: string;
1232
+ price_set: {
1233
+ presentment_money: {
1234
+ amount: string;
1235
+ currency_code: string;
1236
+ [k: string]: unknown;
1237
+ };
1238
+ shop_money: {
1239
+ amount: string;
1240
+ currency_code: string;
1241
+ [k: string]: unknown;
1242
+ };
1243
+ [k: string]: unknown;
1244
+ };
1245
+ rate: number;
1246
+ title: string;
1247
+ [k: string]: unknown;
1248
+ }[];
1249
+ taxable: boolean;
1250
+ title: string;
1251
+ total_discount: string;
1252
+ total_discount_set: {
1253
+ presentment_money: {
1254
+ amount: string;
1255
+ currency_code: string;
1256
+ [k: string]: unknown;
1257
+ };
1258
+ shop_money: {
1259
+ amount: string;
1260
+ currency_code: string;
1261
+ [k: string]: unknown;
1262
+ };
1263
+ [k: string]: unknown;
1264
+ };
1265
+ variant_id: number;
1266
+ variant_inventory_management: null | string;
1267
+ variant_title: null | string;
1268
+ vendor: string;
1269
+ [k: string]: unknown;
1270
+ }[];
1271
+ location_id: number;
1272
+ name: string;
1273
+ order_id: number;
1274
+ origin_address: {
1275
+ [k: string]: unknown;
1276
+ };
1277
+ receipt: {
1278
+ [k: string]: unknown;
1279
+ };
1280
+ service: string;
1281
+ shipment_status: null | string;
1282
+ status: string;
1283
+ tracking_company: null | string;
1284
+ tracking_number: null | string;
1285
+ tracking_numbers: string[];
1286
+ tracking_url: null | string;
1287
+ tracking_urls: string[];
1288
+ updated_at: string;
1289
+ [k: string]: unknown;
1290
+ }[];
1291
+ id: number;
1292
+ landing_site: null | string;
1293
+ landing_site_ref: null | string;
1294
+ line_items: {
1295
+ admin_graphql_api_id: string;
1296
+ attributed_staffs: {
1297
+ id: string;
1298
+ quantity: number;
1299
+ [k: string]: unknown;
1300
+ }[];
1301
+ current_quantity: number;
1302
+ discount_allocations: {
1303
+ amount: string;
1304
+ amount_set: {
1305
+ presentment_money: {
1306
+ amount: string;
1307
+ currency_code: string;
1308
+ [k: string]: unknown;
1309
+ };
1310
+ shop_money: {
1311
+ amount: string;
1312
+ currency_code: string;
1313
+ [k: string]: unknown;
1314
+ };
1315
+ [k: string]: unknown;
1316
+ };
1317
+ discount_application_index: number;
1318
+ [k: string]: unknown;
1319
+ }[];
1320
+ duties: never[];
1321
+ fulfillable_quantity: number;
1322
+ fulfillment_service: string;
1323
+ fulfillment_status: null | string;
1324
+ gift_card: boolean;
1325
+ grams: number;
1326
+ id: number;
1327
+ name: string;
1328
+ pre_tax_price?: string;
1329
+ pre_tax_price_set?: {
1330
+ presentment_money: {
1331
+ amount: string;
1332
+ currency_code: string;
1333
+ [k: string]: unknown;
1334
+ };
1335
+ shop_money: {
1336
+ amount: string;
1337
+ currency_code: string;
1338
+ [k: string]: unknown;
1339
+ };
1340
+ [k: string]: unknown;
1341
+ };
1342
+ price: string;
1343
+ price_set: {
1344
+ presentment_money: {
1345
+ amount: string;
1346
+ currency_code: string;
1347
+ [k: string]: unknown;
1348
+ };
1349
+ shop_money: {
1350
+ amount: string;
1351
+ currency_code: string;
1352
+ [k: string]: unknown;
1353
+ };
1354
+ [k: string]: unknown;
1355
+ };
1356
+ product_exists: boolean;
1357
+ product_id: number;
1358
+ properties: {
1359
+ name: string;
1360
+ value: string;
1361
+ [k: string]: unknown;
1362
+ }[];
1363
+ quantity: number;
1364
+ requires_shipping: boolean;
1365
+ sales_line_item_group_id?: number | null;
1366
+ sku: string;
1367
+ tax_lines: {
1368
+ channel_liable: boolean;
1369
+ price: string;
1370
+ price_set: {
1371
+ presentment_money: {
1372
+ amount: string;
1373
+ currency_code: string;
1374
+ [k: string]: unknown;
1375
+ };
1376
+ shop_money: {
1377
+ amount: string;
1378
+ currency_code: string;
1379
+ [k: string]: unknown;
1380
+ };
1381
+ [k: string]: unknown;
1382
+ };
1383
+ rate: number;
1384
+ title: string;
1385
+ [k: string]: unknown;
1386
+ }[];
1387
+ taxable: boolean;
1388
+ title: string;
1389
+ total_discount: string;
1390
+ total_discount_set: {
1391
+ presentment_money: {
1392
+ amount: string;
1393
+ currency_code: string;
1394
+ [k: string]: unknown;
1395
+ };
1396
+ shop_money: {
1397
+ amount: string;
1398
+ currency_code: string;
1399
+ [k: string]: unknown;
1400
+ };
1401
+ [k: string]: unknown;
1402
+ };
1403
+ variant_id: number | null;
1404
+ variant_inventory_management: null | string;
1405
+ variant_title: null | string;
1406
+ vendor: null | string;
1407
+ [k: string]: unknown;
1408
+ }[];
1409
+ location_id: number | null;
1410
+ merchant_business_entity_id: string;
1411
+ merchant_of_record_app_id: number | null;
1412
+ name: string;
1413
+ note: null | string;
1414
+ note_attributes: {
1415
+ name: string;
1416
+ value: string;
1417
+ [k: string]: unknown;
1418
+ }[];
1419
+ number: number;
1420
+ order_number: number;
1421
+ order_status_url: string;
1422
+ original_total_additional_fees_set: null | {
1423
+ presentment_money: {
1424
+ amount: string;
1425
+ currency_code: string;
1426
+ [k: string]: unknown;
1427
+ };
1428
+ shop_money: {
1429
+ amount: string;
1430
+ currency_code: string;
1431
+ [k: string]: unknown;
1432
+ };
1433
+ [k: string]: unknown;
1434
+ };
1435
+ original_total_duties_set: null | {
1436
+ presentment_money: {
1437
+ amount: string;
1438
+ currency_code: string;
1439
+ [k: string]: unknown;
1440
+ };
1441
+ shop_money: {
1442
+ amount: string;
1443
+ currency_code: string;
1444
+ [k: string]: unknown;
1445
+ };
1446
+ [k: string]: unknown;
1447
+ };
1448
+ payment_gateway_names: string[];
1449
+ payment_terms: null | string;
1450
+ phone: null | string;
1451
+ po_number: null | string;
1452
+ presentment_currency: string;
1453
+ processed_at: string;
1454
+ reference: null | string;
1455
+ referring_site: null | string;
1456
+ refunds: never[];
1457
+ returns: never[];
1458
+ shipping_address: {
1459
+ address1: string;
1460
+ address2: null | string;
1461
+ city: string;
1462
+ company: null | string;
1463
+ country: string;
1464
+ country_code: string;
1465
+ first_name: string;
1466
+ last_name: string;
1467
+ latitude: null | number;
1468
+ longitude: null | number;
1469
+ name: string;
1470
+ phone: string;
1471
+ province: string;
1472
+ province_code: string;
1473
+ zip: string;
1474
+ [k: string]: unknown;
1475
+ };
1476
+ shipping_lines: {
1477
+ carrier_identifier: null | string;
1478
+ code: null | string;
1479
+ current_discounted_price_set: {
1480
+ presentment_money: {
1481
+ amount: string;
1482
+ currency_code: string;
1483
+ [k: string]: unknown;
1484
+ };
1485
+ shop_money: {
1486
+ amount: string;
1487
+ currency_code: string;
1488
+ [k: string]: unknown;
1489
+ };
1490
+ [k: string]: unknown;
1491
+ };
1492
+ discount_allocations: never[];
1493
+ discounted_price: string;
1494
+ discounted_price_set: {
1495
+ presentment_money: {
1496
+ amount: string;
1497
+ currency_code: string;
1498
+ [k: string]: unknown;
1499
+ };
1500
+ shop_money: {
1501
+ amount: string;
1502
+ currency_code: string;
1503
+ [k: string]: unknown;
1504
+ };
1505
+ [k: string]: unknown;
1506
+ };
1507
+ id: number;
1508
+ is_removed: boolean;
1509
+ phone: null | string;
1510
+ price: string;
1511
+ price_set: {
1512
+ presentment_money: {
1513
+ amount: string;
1514
+ currency_code: string;
1515
+ [k: string]: unknown;
1516
+ };
1517
+ shop_money: {
1518
+ amount: string;
1519
+ currency_code: string;
1520
+ [k: string]: unknown;
1521
+ };
1522
+ [k: string]: unknown;
1523
+ };
1524
+ requested_fulfillment_service_id: null;
1525
+ source: null | string;
1526
+ tax_lines: {
1527
+ channel_liable: boolean;
1528
+ price: string;
1529
+ price_set: {
1530
+ presentment_money: {
1531
+ amount: string;
1532
+ currency_code: string;
1533
+ [k: string]: unknown;
1534
+ };
1535
+ shop_money: {
1536
+ amount: string;
1537
+ currency_code: string;
1538
+ [k: string]: unknown;
1539
+ };
1540
+ [k: string]: unknown;
1541
+ };
1542
+ rate: number;
1543
+ title: string;
1544
+ [k: string]: unknown;
1545
+ }[];
1546
+ title: string;
1547
+ [k: string]: unknown;
1548
+ }[];
1549
+ source_identifier: null | string;
1550
+ source_name: string;
1551
+ source_url: null | string;
1552
+ subtotal_price: string;
1553
+ subtotal_price_set: {
1554
+ presentment_money: {
1555
+ amount: string;
1556
+ currency_code: string;
1557
+ [k: string]: unknown;
1558
+ };
1559
+ shop_money: {
1560
+ amount: string;
1561
+ currency_code: string;
1562
+ [k: string]: unknown;
1563
+ };
1564
+ [k: string]: unknown;
1565
+ };
1566
+ tags: string;
1567
+ tax_exempt: boolean;
1568
+ tax_lines: {
1569
+ channel_liable: boolean;
1570
+ price: string;
1571
+ price_set: {
1572
+ presentment_money: {
1573
+ amount: string;
1574
+ currency_code: string;
1575
+ [k: string]: unknown;
1576
+ };
1577
+ shop_money: {
1578
+ amount: string;
1579
+ currency_code: string;
1580
+ [k: string]: unknown;
1581
+ };
1582
+ [k: string]: unknown;
1583
+ };
1584
+ rate: number;
1585
+ title: string;
1586
+ [k: string]: unknown;
1587
+ }[];
1588
+ taxes_included: boolean;
1589
+ test: boolean;
1590
+ token: string;
1591
+ total_cash_rounding_payment_adjustment_set: {
1592
+ presentment_money: {
1593
+ amount: string;
1594
+ currency_code: string;
1595
+ [k: string]: unknown;
1596
+ };
1597
+ shop_money: {
1598
+ amount: string;
1599
+ currency_code: string;
1600
+ [k: string]: unknown;
1601
+ };
1602
+ [k: string]: unknown;
1603
+ };
1604
+ total_cash_rounding_refund_adjustment_set: {
1605
+ presentment_money: {
1606
+ amount: string;
1607
+ currency_code: string;
1608
+ [k: string]: unknown;
1609
+ };
1610
+ shop_money: {
1611
+ amount: string;
1612
+ currency_code: string;
1613
+ [k: string]: unknown;
1614
+ };
1615
+ [k: string]: unknown;
1616
+ };
1617
+ total_discounts: string;
1618
+ total_discounts_set: {
1619
+ presentment_money: {
1620
+ amount: string;
1621
+ currency_code: string;
1622
+ [k: string]: unknown;
1623
+ };
1624
+ shop_money: {
1625
+ amount: string;
1626
+ currency_code: string;
1627
+ [k: string]: unknown;
1628
+ };
1629
+ [k: string]: unknown;
1630
+ };
1631
+ total_line_items_price: string;
1632
+ total_line_items_price_set: {
1633
+ presentment_money: {
1634
+ amount: string;
1635
+ currency_code: string;
1636
+ [k: string]: unknown;
1637
+ };
1638
+ shop_money: {
1639
+ amount: string;
1640
+ currency_code: string;
1641
+ [k: string]: unknown;
1642
+ };
1643
+ [k: string]: unknown;
1644
+ };
1645
+ total_outstanding: string;
1646
+ total_price: string;
1647
+ total_price_set: {
1648
+ presentment_money: {
1649
+ amount: string;
1650
+ currency_code: string;
1651
+ [k: string]: unknown;
1652
+ };
1653
+ shop_money: {
1654
+ amount: string;
1655
+ currency_code: string;
1656
+ [k: string]: unknown;
1657
+ };
1658
+ [k: string]: unknown;
1659
+ };
1660
+ total_shipping_price_set: {
1661
+ presentment_money: {
1662
+ amount: string;
1663
+ currency_code: string;
1664
+ [k: string]: unknown;
1665
+ };
1666
+ shop_money: {
1667
+ amount: string;
1668
+ currency_code: string;
1669
+ [k: string]: unknown;
1670
+ };
1671
+ [k: string]: unknown;
1672
+ };
1673
+ total_tax: string;
1674
+ total_tax_set: {
1675
+ presentment_money: {
1676
+ amount: string;
1677
+ currency_code: string;
1678
+ [k: string]: unknown;
1679
+ };
1680
+ shop_money: {
1681
+ amount: string;
1682
+ currency_code: string;
1683
+ [k: string]: unknown;
1684
+ };
1685
+ [k: string]: unknown;
1686
+ };
1687
+ total_tip_received: string;
1688
+ total_weight: number;
1689
+ updated_at: string;
1690
+ user_id: number | null;
1691
+ [k: string]: unknown;
1692
+ }
1693
+ type ShopifyOrdersCreateLineItem = {
1694
+ title: string;
1695
+ quantity: number;
1696
+ variant_id?: string | number | null;
1697
+ variant_title?: string | null;
1698
+ product_id?: string | number | null;
1699
+ price_set?: MoneyBagRest;
1700
+ total_discount_set?: MoneyBagRest;
1701
+ };
1702
+ type ShopifyOrdersCreateTaxLine = {
1703
+ rate: number;
1704
+ title: string;
1705
+ price: string | number;
1706
+ };
1707
+ type ShopifyOrdersCreateFulfillment = {
1708
+ id: string | number;
1709
+ created_at: string;
1710
+ updated_at?: string;
1711
+ name: string;
1712
+ status?: string | null;
1713
+ tracking_company?: string | null;
1714
+ tracking_numbers?: (string | number)[];
1715
+ tracking_urls?: string[];
1716
+ line_items?: ShopifyOrdersCreateLineItem[];
1717
+ };
1718
+ type ShopifyOrdersCreateShippingLine = {
1719
+ title: string;
1720
+ source?: string | null;
1721
+ price_set?: MoneyBagRest;
1722
+ discounted_price_set?: MoneyBagRest;
1723
+ tax_lines?: ShopifyOrdersCreateTaxLine[];
1724
+ };
1725
+ type ShopifyOrdersCreateRefundLineItem = {
1726
+ line_item?: {
1727
+ price?: string | number;
1728
+ product_id?: string | number;
1729
+ };
1730
+ quantity: number;
1731
+ location_id?: string | number | null;
1732
+ subtotal?: string | number;
1733
+ };
1734
+ type ShopifyOrdersCreateRefund = {
1735
+ id: string | number;
1736
+ created_at?: string;
1737
+ note?: string;
1738
+ order_adjustments: any[];
1739
+ transactions: any[];
1740
+ refund_line_items: ShopifyOrdersCreateRefundLineItem[];
1741
+ };
1742
+ type GadgetRefundLineItem = {
1743
+ line_item?: {
1744
+ price?: string | number;
1745
+ product_id?: string | number;
1746
+ };
1747
+ quantity: number;
1748
+ location_id?: string | number | null;
1749
+ subtotal?: string | number;
1750
+ };
1751
+ type GadgetRefund = {
1752
+ id: string | number;
1753
+ created_at?: string;
1754
+ note?: string;
1755
+ order_adjustments: any[];
1756
+ transactions: any[];
1757
+ refund_line_items: GadgetRefundLineItem[];
1758
+ };
1759
+ type GadgetLineItem = {
1760
+ title: string;
1761
+ quantity: number;
1762
+ variant_id?: string | number | null;
1763
+ variant_title?: string;
1764
+ product_id?: string | number | null;
1765
+ price_set?: MoneyBagRest;
1766
+ total_discount_set?: MoneyBagRest;
1767
+ };
1768
+ type GadgetTaxLine = {
1769
+ price: string | number;
1770
+ rate: number;
1771
+ title: string;
1772
+ };
1773
+ type GadgetFulfillment = {
1774
+ id: string | number;
1775
+ created_at: string;
1776
+ updated_at?: string;
1777
+ name: string;
1778
+ status?: string;
1779
+ tracking_company?: string;
1780
+ tracking_numbers?: (string | number)[];
1781
+ tracking_urls?: string[];
1782
+ line_items?: GadgetLineItem[];
1783
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.5.5",
3
+ "version": "4.5.7",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",