@things-factory/operato-mms 4.3.646 → 4.3.651

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 (77) hide show
  1. package/package.json +6 -6
  2. package/dist-server/controllers/index.js +0 -1
  3. package/dist-server/controllers/index.js.map +0 -1
  4. package/dist-server/entities/index.js +0 -5
  5. package/dist-server/entities/index.js.map +0 -1
  6. package/dist-server/graphql/index.js +0 -33
  7. package/dist-server/graphql/index.js.map +0 -1
  8. package/dist-server/graphql/resolvers/index.js +0 -32
  9. package/dist-server/graphql/resolvers/index.js.map +0 -1
  10. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +0 -242
  11. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +0 -1
  12. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +0 -218
  13. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +0 -1
  14. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js +0 -159
  15. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js.map +0 -1
  16. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js +0 -27
  17. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js.map +0 -1
  18. package/dist-server/graphql/resolvers/interface-with-hub/index.js +0 -12
  19. package/dist-server/graphql/resolvers/interface-with-hub/index.js.map +0 -1
  20. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js +0 -157
  21. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map +0 -1
  22. package/dist-server/graphql/resolvers/shipping-provider/index.js +0 -6
  23. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +0 -1
  24. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +0 -32
  25. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +0 -1
  26. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js +0 -63
  27. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js.map +0 -1
  28. package/dist-server/graphql/resolvers/warehouse-product/index.js +0 -6
  29. package/dist-server/graphql/resolvers/warehouse-product/index.js.map +0 -1
  30. package/dist-server/graphql/types/index.js +0 -33
  31. package/dist-server/graphql/types/index.js.map +0 -1
  32. package/dist-server/graphql/types/interface-with-hub/index.js +0 -29
  33. package/dist-server/graphql/types/interface-with-hub/index.js.map +0 -1
  34. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js +0 -34
  35. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js.map +0 -1
  36. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js +0 -50
  37. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js.map +0 -1
  38. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js +0 -16
  39. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js.map +0 -1
  40. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js +0 -47
  41. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js.map +0 -1
  42. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js +0 -17
  43. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js.map +0 -1
  44. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js +0 -14
  45. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js.map +0 -1
  46. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js +0 -20
  47. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js.map +0 -1
  48. package/dist-server/graphql/types/shipping-provider/index.js +0 -10
  49. package/dist-server/graphql/types/shipping-provider/index.js.map +0 -1
  50. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +0 -13
  51. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +0 -1
  52. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +0 -13
  53. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +0 -1
  54. package/dist-server/graphql/types/warehouse-product/index.js +0 -11
  55. package/dist-server/graphql/types/warehouse-product/index.js.map +0 -1
  56. package/dist-server/graphql/types/warehouse-product/warehouse-product.js +0 -12
  57. package/dist-server/graphql/types/warehouse-product/warehouse-product.js.map +0 -1
  58. package/dist-server/index.js +0 -34
  59. package/dist-server/index.js.map +0 -1
  60. package/dist-server/middlewares/index.js +0 -4
  61. package/dist-server/middlewares/index.js.map +0 -1
  62. package/dist-server/migrations/1599732967233-SeedCommonCode.js +0 -52
  63. package/dist-server/migrations/1599732967233-SeedCommonCode.js.map +0 -1
  64. package/dist-server/migrations/1608009991075-SeedUser.js +0 -51
  65. package/dist-server/migrations/1608009991075-SeedUser.js.map +0 -1
  66. package/dist-server/migrations/index.js +0 -12
  67. package/dist-server/migrations/index.js.map +0 -1
  68. package/dist-server/routers/etrax-router.js +0 -155
  69. package/dist-server/routers/etrax-router.js.map +0 -1
  70. package/dist-server/routers/shopify-pos-public-router.js +0 -109
  71. package/dist-server/routers/shopify-pos-public-router.js.map +0 -1
  72. package/dist-server/routes.js +0 -11
  73. package/dist-server/routes.js.map +0 -1
  74. package/dist-server/util/interface-helper.js +0 -53
  75. package/dist-server/util/interface-helper.js.map +0 -1
  76. package/dist-server/util/no-generator.js +0 -14
  77. package/dist-server/util/no-generator.js.map +0 -1
@@ -1,159 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.autoUpdateAllMarketplaceProductVariationQuantityResolver = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const env_1 = require("@things-factory/env");
6
- const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
7
- const integration_marketplace_1 = require("@things-factory/integration-marketplace");
8
- const marketplace_base_1 = require("@things-factory/marketplace-base");
9
- const product_base_1 = require("@things-factory/product-base");
10
- const shell_1 = require("@things-factory/shell");
11
- const warehouse_base_1 = require("@things-factory/warehouse-base");
12
- exports.autoUpdateAllMarketplaceProductVariationQuantityResolver = {
13
- async autoUpdateAllMarketplaceProductVariationQuantity(_, { companyDomainId, warehouseId }, context) {
14
- const companyDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(companyDomainId);
15
- const marketplaceStores = await (0, typeorm_1.getRepository)(integration_marketplace_1.MarketplaceStore).find({
16
- where: { domain: companyDomain, status: 'ACTIVE' },
17
- relations: ['marketplaceDistributors']
18
- });
19
- const fulfilmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(warehouseId);
20
- const centerId = fulfilmentCenter.centerId;
21
- const warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
22
- let productLogs = [];
23
- let products = await (0, typeorm_1.getRepository)(product_base_1.Product).find({
24
- where: { domain: companyDomain },
25
- relations: ['productDetails']
26
- });
27
- let inventoryProducts = await Promise.all(products.map(async (product) => {
28
- const productDetails = product.productDetails;
29
- const defaultProductDetail = productDetails.filter(productDetail => productDetail.isDefault)[0];
30
- let qb = await (0, typeorm_1.getRepository)(warehouse_base_1.Inventory).createQueryBuilder('inv');
31
- qb.leftJoinAndSelect('inv.location', 'loc')
32
- .andWhere('"inv"."domain_id" = :domainId')
33
- .andWhere('"inv"."product_id" = :productId')
34
- .andWhere('"inv"."status" != :status')
35
- .andWhere('"loc"."type" NOT IN (:...locationTypes)')
36
- .setParameters({
37
- domainId: warehouseDomain.id,
38
- productId: product.id,
39
- status: warehouse_base_1.INVENTORY_STATUS.TERMINATED,
40
- locationTypes: [warehouse_base_1.LOCATION_TYPE.QUARANTINE, warehouse_base_1.LOCATION_TYPE.RESERVE]
41
- });
42
- let inventories = await qb.getMany();
43
- const inventoryQty = inventories.reduce((total, currentValue) => {
44
- total += currentValue.qty;
45
- return total;
46
- }, 0);
47
- const inventoryLockedQty = inventories.reduce((total, currentValue) => {
48
- total += currentValue.lockedQty;
49
- return total;
50
- }, 0);
51
- return {
52
- product,
53
- sku: product.sku,
54
- name: product.name,
55
- packingType: defaultProductDetail.packingType,
56
- packingSize: defaultProductDetail.packingSize,
57
- uom: defaultProductDetail.uom,
58
- qty: inventoryQty - inventoryLockedQty
59
- };
60
- }));
61
- await (0, typeorm_1.getConnection)().transaction(async (tx) => {
62
- let bundleProductInventories = await (0, warehouse_base_1.getProductBundleInventory)(warehouseDomain, companyDomain, inventoryProducts, tx);
63
- bundleProductInventories.map(bundleProductInventory => {
64
- inventoryProducts.push(bundleProductInventory);
65
- });
66
- });
67
- for (let i = 0; i < marketplaceStores.length; i++) {
68
- try {
69
- const marketplaceStore = marketplaceStores[i];
70
- const marketplaceSetting = await (0, typeorm_1.getRepository)(integration_marketplace_1.MarketplaceSetting).findOne({
71
- where: { marketplaceStore, category: 'stock_allocation' }
72
- });
73
- for (let j = 0; j < inventoryProducts.length; j++) {
74
- try {
75
- await (0, typeorm_1.getConnection)().transaction(async (tx) => {
76
- var _a, _b;
77
- const inventoryProduct = inventoryProducts[j];
78
- const marketplaceProductVariations = await tx
79
- .getRepository(marketplace_base_1.MarketplaceProductVariation)
80
- .find({
81
- where: { domain: companyDomain, sku: inventoryProduct.sku },
82
- relations: ['marketplaceProduct', 'marketplaceProduct.marketplaceStore']
83
- });
84
- let storeProductVariations = marketplaceProductVariations.filter(productVariation => productVariation.marketplaceProduct.marketplaceStore.id === marketplaceStore.id);
85
- let percentageValue = 100;
86
- if (storeProductVariations) {
87
- for (let k = 0; k < storeProductVariations.length; k++) {
88
- let storeProductVariation = storeProductVariations[k];
89
- if (marketplaceSetting) {
90
- percentageValue = parseInt(marketplaceSetting.value);
91
- }
92
- let remainQty = Math.floor((inventoryProduct.qty - storeProductVariation.reserveQty) * (percentageValue / 100));
93
- if (remainQty < 0)
94
- remainQty = 0;
95
- let productVariationLocationId = storeProductVariation === null || storeProductVariation === void 0 ? void 0 : storeProductVariation.locationId;
96
- let adjustQty = remainQty;
97
- if (marketplaceStore.platform === 'shopify') {
98
- let locationIds = JSON.parse(productVariationLocationId);
99
- adjustQty = adjustQty - storeProductVariation.qty;
100
- if ((_a = locationIds[0]) === null || _a === void 0 ? void 0 : _a.location_id)
101
- productVariationLocationId = locationIds[0].location_id;
102
- }
103
- let validMarketplaceDistributors = [];
104
- if (marketplaceStore.marketplaceDistributors) {
105
- validMarketplaceDistributors = marketplaceStore.marketplaceDistributors.filter(distributor => distributor.status === 'ACTIVE');
106
- }
107
- const hasVariation = (_b = storeProductVariation === null || storeProductVariation === void 0 ? void 0 : storeProductVariation.marketplaceProduct) === null || _b === void 0 ? void 0 : _b.hasVariation;
108
- productLogs.push({
109
- itemId: storeProductVariation.marketplaceProduct.itemId,
110
- variationId: storeProductVariation.variationId,
111
- variationSku: storeProductVariation.variationSku,
112
- qty: adjustQty
113
- });
114
- if (hasVariation) {
115
- await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(marketplaceStore, [
116
- {
117
- itemId: storeProductVariation.marketplaceProduct.itemId,
118
- variationId: storeProductVariation.variationId,
119
- variationSku: storeProductVariation.variationSku,
120
- qty: adjustQty,
121
- locationId: productVariationLocationId,
122
- inventoryItemId: storeProductVariation.inventoryItemId,
123
- distributors: validMarketplaceDistributors
124
- }
125
- ]);
126
- }
127
- else {
128
- await integration_marketplace_1.StoreAPI.updateStoreProductStock(marketplaceStore, [
129
- {
130
- itemId: storeProductVariation.marketplaceProduct.itemId,
131
- variationId: storeProductVariation.variationId,
132
- variationSku: storeProductVariation.variationSku,
133
- qty: adjustQty,
134
- distributors: validMarketplaceDistributors
135
- }
136
- ]);
137
- }
138
- storeProductVariation.qty = remainQty;
139
- await tx.getRepository(marketplace_base_1.MarketplaceProductVariation).save(storeProductVariation);
140
- }
141
- }
142
- });
143
- }
144
- catch (error) {
145
- env_1.logger.error(`interface-with-hub[autoUpdateAllMarketplaceProductVariationQuantity]inventoryProducts: ${error === null || error === void 0 ? void 0 : error.message}`);
146
- }
147
- }
148
- }
149
- catch (e) {
150
- env_1.logger.error(`interface-with-hub[autoUpdateAllMarketplaceProductVariationQuantity]marketplaceStores: ${e === null || e === void 0 ? void 0 : e.message}`);
151
- }
152
- finally {
153
- env_1.logger.info(`quantity_logs[autoUpdateAllMarketplaceProductVariationQuantity] - ${JSON.stringify(productLogs)}`);
154
- }
155
- }
156
- return true;
157
- }
158
- };
159
- //# sourceMappingURL=auto-update-all-marketplace-product-variation-quantity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-update-all-marketplace-product-variation-quantity.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AAEtD,6CAA4C;AAC5C,qFAAwE;AACxE,qFAAwG;AACxG,uEAA8E;AAC9E,+DAAqE;AACrE,iDAA8C;AAC9C,mEAAsH;AAEzG,QAAA,wDAAwD,GAAG;IACtE,KAAK,CAAC,gDAAgD,CAAC,CAAM,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,EAAE,OAAY;QAC3G,MAAM,aAAa,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAElF,MAAM,iBAAiB,GAAuB,MAAM,IAAA,uBAAa,EAAC,0CAAgB,CAAC,CAAC,IAAI,CAAC;YACvF,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE;YAClD,SAAS,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC,CAAA;QAEF,MAAM,gBAAgB,GAAG,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAC/E,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAClD,MAAM,eAAe,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EA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AE,SAAS;gDACd,UAAU,EAAE,0BAA0B;gDACtC,eAAe,EAAE,qBAAqB,CAAC,eAAe;gDACtD,YAAY,EAAE,4BAA4B;6CAC3C;yCACF,CAAC,CAAA;qCACH;yCAAM;wCACL,MAAM,kCAAQ,CAAC,uBAAuB,CAAC,gBAAgB,EAAE;4CACvD;gDACE,MAAM,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,MAAM;gDACvD,WAAW,EAAE,qBAAqB,CAAC,WAAW;gDAC9C,YAAY,EAAE,qBAAqB,CAAC,YAAY;gDAChD,GAAG,EAAE,SAAS;gDACd,YAAY,EAAE,4BAA4B;6CAC3C;yCACF,CAAC,CAAA;qCACH;oCAED,qBAAqB,CAAC,GAAG,GAAG,SAAS,CAAA;oCACrC,MAAM,EAAE,CAAC,aAAa,CAAC,8CAA2B,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;iCAChF;6BACF;wBACH,CAAC,CAAC,CAAA;qBACH;oBAAC,OAAO,KAAK,EAAE;wBACd,YAAM,CAAC,KAAK,CACV,0FAA0F,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAAE,CAC3G,CAAA;qBACF;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,YAAM,CAAC,KAAK,CAAC,0FAA0F,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,EAAE,CAAC,CAAA;aACrH;oBAAS;gBACR,YAAM,CAAC,IAAI,CAAC,qEAAqE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;aAChH;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateReplenishmentOrderResolver = void 0;
4
- const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
5
- const marketplace_base_1 = require("@things-factory/marketplace-base");
6
- const biz_base_1 = require("@things-factory/biz-base");
7
- exports.generateReplenishmentOrderResolver = {
8
- async generateReplenishmentOrder(_, { storeReplenishmentId, warehouseId }, context) {
9
- const { tx } = context.state;
10
- let storeReplenishment = await tx
11
- .getRepository(marketplace_base_1.StoreReplenishment)
12
- .findOne(storeReplenishmentId, {
13
- relations: ['storeReplenishmentItems']
14
- });
15
- var fulfillmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(warehouseId);
16
- var centerId = fulfillmentCenter.centerId;
17
- var subdominBizplace = await (0, biz_base_1.getSubdomainBizplace)(centerId);
18
- var warehouseBizplaceId = subdominBizplace === null || subdominBizplace === void 0 ? void 0 : subdominBizplace.id;
19
- var arrivalNotice = await integration_fulfillment_1.FulfillmentAPI.createInboundOrder(fulfillmentCenter, {
20
- warehouseBizplaceId,
21
- storeReplenishment
22
- });
23
- storeReplenishment.arrivalNoticeId = arrivalNotice.id;
24
- await tx.getRepository(marketplace_base_1.StoreReplenishment).save(storeReplenishment);
25
- }
26
- };
27
- //# sourceMappingURL=generate-replenishment-order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-replenishment-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/generate-replenishment-order.ts"],"names":[],"mappings":";;;AAAA,qFAAwE;AACxE,uEAAqE;AACrE,uDAAyE;AAG5D,QAAA,kCAAkC,GAAG;IAChD,KAAK,CAAC,0BAA0B,CAC9B,CAAO,EACP,EAAE,oBAAoB,EAAE,WAAW,EAAyD,EAC5F,OAAY;QAEZ,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;QAEnD,IAAI,kBAAkB,GAAuB,MAAM,EAAE;aAClD,aAAa,CAAC,qCAAkB,CAAC;aACjC,OAAO,CAAC,oBAAoB,EAAE;YAC7B,SAAS,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC,CAAA;QAEJ,IAAI,iBAAiB,GAAG,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAC9E,IAAI,QAAQ,GAAW,iBAAiB,CAAC,QAAQ,CAAA;QAEjD,IAAI,gBAAgB,GAAa,MAAM,IAAA,+BAAoB,EAAC,QAAQ,CAAC,CAAA;QACrE,IAAI,mBAAmB,GAAW,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,EAAE,CAAA;QAEtD,IAAI,aAAa,GAAG,MAAM,wCAAc,CAAC,kBAAkB,CAAC,iBAAiB,EAAE;YAC7E,mBAAmB;YACnB,kBAAkB;SACnB,CAAC,CAAA;QAEF,kBAAkB,CAAC,eAAe,GAAG,aAAa,CAAC,EAAE,CAAA;QACrD,MAAM,EAAE,CAAC,aAAa,CAAC,qCAAkB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IACrE,CAAC;CACF,CAAA"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warehouseMarketplaceProduct = exports.Mutation = exports.Query = void 0;
4
- const add_release_order_1 = require("./add-release-order");
5
- const auto_add_release_order_1 = require("./auto-add-release-order");
6
- const auto_update_all_marketplace_product_variation_quantity_1 = require("./auto-update-all-marketplace-product-variation-quantity");
7
- const generate_replenishment_order_1 = require("./generate-replenishment-order");
8
- const warehouse_marketplace_products_1 = require("./warehouse-marketplace-products");
9
- Object.defineProperty(exports, "warehouseMarketplaceProduct", { enumerable: true, get: function () { return warehouse_marketplace_products_1.warehouseMarketplaceProduct; } });
10
- exports.Query = Object.assign({}, warehouse_marketplace_products_1.warehouseMarketplaceProductsResolver);
11
- exports.Mutation = Object.assign(Object.assign(Object.assign(Object.assign({}, add_release_order_1.addReleaseOrderResolver), auto_add_release_order_1.autoAddReleaseOrderResolver), generate_replenishment_order_1.generateReplenishmentOrderResolver), auto_update_all_marketplace_product_variation_quantity_1.autoUpdateAllMarketplaceProductVariationQuantityResolver);
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAC7D,qEAAsE;AACtE,qIAAmI;AACnI,iFAAmF;AACnF,qFAAoH;AAa3G,4GAbA,4DAA2B,OAaA;AAXvB,QAAA,KAAK,qBACb,qEAAoC,EACxC;AAEY,QAAA,QAAQ,+DAChB,2CAAuB,GACvB,oDAA2B,GAC3B,iEAAkC,GAClC,iHAAwD,EAC5D"}
@@ -1,157 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warehouseMarketplaceProduct = exports.warehouseMarketplaceProductsResolver = void 0;
4
- const biz_base_1 = require("@things-factory/biz-base");
5
- exports.warehouseMarketplaceProductsResolver = {
6
- async warehouseMarketplaceProducts(_, params, context) {
7
- try {
8
- const { domain, user, tx } = context.state;
9
- return warehouseMarketplaceProduct(params, domain, user, tx);
10
- }
11
- catch (error) {
12
- throw error;
13
- }
14
- }
15
- };
16
- async function warehouseMarketplaceProduct(params, domain, user, tx) {
17
- const productFilters = params.filters.filter(x => x.name == 'product_info');
18
- const filters = params.filters.filter(x => x.name != 'product_info');
19
- const companyBizplace = await (0, biz_base_1.getCompanyBizplace)(domain, user);
20
- const myBizplace = await (0, biz_base_1.getMyBizplace)(domain, user);
21
- params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [companyBizplace.id, myBizplace.id] }];
22
- const bizplaceIds = params.filters
23
- .find((filter) => filter.name === 'bizplace_id')
24
- .value.map((id) => `'${id}'`)
25
- .join();
26
- let productQuery = '';
27
- if (productFilters && productFilters.length > 0) {
28
- let productInfo = productFilters[0];
29
- productQuery = ` AND (
30
- Lower("Product"."sku") LIKE '${productInfo.value.toLowerCase()}'
31
- OR Lower("Product"."name") LIKE '${productInfo.value.toLowerCase()}'
32
- OR Lower("Product"."description") LIKE '${productInfo.value.toLowerCase()}')`;
33
- }
34
- await tx.query(`
35
- CREATE TEMP TABLE "temp_products" ON COMMIT DROP AS (
36
- SELECT * FROM (
37
- SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
38
- "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
39
- "Product"."bizplace_id" AS "product_bizplace_id", 'PRODUCT' AS "type"
40
- FROM products "Product"
41
- WHERE "Product"."deleted_at" IS NULL
42
- AND "Product"."bizplace_id" IN (${bizplaceIds})
43
- ${productQuery}
44
- ) d1
45
- UNION ALL
46
- SELECT * FROM
47
- (
48
- SELECT "Product"."id" AS "product_id", "Product"."sku" AS "product_sku", "Product"."name" AS "product_name",
49
- "Product"."description" AS "product_description", "Product"."creator_id", "Product"."updater_id",
50
- "Product"."bizplace_id" AS "product_bizplace_id", 'BUNDLE' AS "type"
51
- FROM product_bundles "Product"
52
- WHERE "Product"."status" = 'ACTIVATED'
53
- AND "Product"."bizplace_id" IN (${bizplaceIds})
54
- ${productQuery}
55
- ) d2
56
- )
57
- `);
58
- await tx.query(`
59
- CREATE TEMP TABLE "temp_json_warehouse_marketplace_products" ON COMMIT DROP AS (
60
- select "product_id", array_to_json(array_agg(row_to_json(dt))) AS "Json_marketplaceProducts" FROM (
61
- select "dt"."marketplace_store_id", "dt"."product_id", "dt"."sku", array_agg(row_to_json(dt)) as product_variation
62
- from (
63
- select "mp"."marketplace_store_id" as "marketplace_store_id", "mpv"."sku", "mpv"."id" as "marketplace_product_variation_id",
64
- concat("mpv"."variation_sku", ' (', "mpv"."name", ')') as "name", "mpv"."qty" as "qty", "mpv"."reserve_qty" as "reserve_qty",
65
- "Product"."product_id" AS "product_id"
66
- from marketplace_product_variations "mpv"
67
- inner join marketplace_products "mp" on "mp"."id" = "mpv"."marketplace_product_id"
68
- inner join temp_products "Product" on "mpv"."sku" = "Product"."product_sku"
69
- ) as "dt"
70
- group by "dt"."marketplace_store_id", "dt"."sku", "dt"."product_id"
71
- ) "dt" group by "dt"."product_id"
72
- )
73
- `);
74
- await tx.query(`
75
- CREATE TEMP TABLE temp_json_warehouse_inventory ON COMMIT DROP AS (
76
- select "product_id", array_to_json(array_agg((row_to_json("dt")))) AS "Json_warehouseInventory" from(
77
- select wboi.domain_id, fc.id as fulfillment_id, fc.name as fulfillment_name,
78
- coalesce(wboi.product_id, wboi.product_bundle_id) as product_id, wboi.qty - wboi.remain_qty as inventory_locked_qty, wboi.qty as inventory_qty
79
- from warehouse_bizplace_onhand_inventories wboi
80
- inner join domains d on d.id = wboi.domain_id
81
- inner join fulfillment_centers fc on fc.center_id = d.subdomain
82
- inner join bizplaces b on b.id = wboi.bizplace_id
83
- inner join companies c on c.id = b.company_id
84
- inner join bizplaces b2 on b2.domain_id = c.domain_id
85
- where fc.domain_id = $1 and b2.id IN (${bizplaceIds})
86
- ) "dt" group by "dt"."product_id"
87
- )
88
- `, [domain.id]);
89
- await tx.query(`
90
- CREATE TEMP TABLE temp_warehouse_marketplace_products ON COMMIT DROP as (
91
- SELECT "Product"."product_id" AS "Product_id", "Product"."product_sku" AS "Product_sku",
92
- "Product"."product_name" AS "Product_name", "Product"."product_description" AS "Product_description",
93
- "Product"."product_bizplace_id" AS "Product_bizplace_id",
94
- "Product"."creator_id" AS "Product_creator_id", "Product"."updater_id" AS "Product_updater_id",
95
- "Bizplace"."name" AS "Bizplace_name", "Bizplace"."description" AS "Bizplace_description", "Bizplace"."address" AS "Bizplace_address", "Bizplace"."postal_code" AS "Bizplace_postal_code",
96
- "Bizplace"."latlng" AS "Bizplace_latlng", "Bizplace"."status" AS "Bizplace_status", "Bizplace"."created_at" AS "Bizplace_created_at", "Bizplace"."updated_at" AS "Bizplace_updated_at",
97
- "Bizplace"."domain_id" AS "Bizplace_domain_id", "Bizplace"."company_id" AS "Bizplace_company_id", "Bizplace"."creator_id" AS "Bizplace_creator_id", "Bizplace"."updater_id" AS "Bizplace_updater_id",
98
- "Creator"."id" AS "Creator_id", "Creator"."name" AS "Creator_name", "Creator"."description" AS "Creator_description", "Creator"."email" AS "Creator_email",
99
- "Updater"."id" AS "Updater_id", "Updater"."name" AS "Updater_name", "Updater"."description" AS "Updater_description", "Updater"."email" AS "Updater_email"
100
- ,COALESCE("whInv"."Json_warehouseInventory", null) AS "Json_warehouseInventory"
101
- ,COALESCE("mktPrd"."Json_marketplaceProducts", null) AS "Json_marketplaceProducts"
102
- FROM "temp_products" "Product"
103
- LEFT JOIN "bizplaces" "Bizplace" ON "Bizplace"."id" = "Product"."product_bizplace_id"
104
- LEFT JOIN "users" "Creator" ON "Creator"."id"="Product"."creator_id"
105
- LEFT JOIN "users" "Updater" ON "Updater"."id"="Product"."updater_id"
106
- LEFT JOIN "temp_json_warehouse_inventory" "whInv" ON "whInv"."product_id" = "Product"."product_id"
107
- LEFT JOIN "temp_json_warehouse_marketplace_products" "mktPrd" ON "mktPrd"."product_id" = "Product"."product_id"
108
- )
109
- `);
110
- const offsetQuery = (params === null || params === void 0 ? void 0 : params.pagination)
111
- ? `OFFSET ${(params.pagination.page - 1) * params.pagination.limit} LIMIT ${params.pagination.limit}`
112
- : '';
113
- const total = await tx.query(`select count(*) from temp_warehouse_marketplace_products`);
114
- const items = await tx.query(`
115
- select * from temp_warehouse_marketplace_products ${offsetQuery}
116
- `);
117
- return {
118
- items: items.map((itm, index) => {
119
- return {
120
- seq: index + ((params === null || params === void 0 ? void 0 : params.pagination) ? (params.pagination.page - 1) * params.pagination.limit + 1 : 0),
121
- id: itm.Product_id,
122
- sku: itm.Product_sku,
123
- name: itm.Product_name,
124
- description: itm.Product_description,
125
- marketplaceProduct: itm.Json_marketplaceProducts
126
- ? itm.Json_marketplaceProducts.map(product => {
127
- return {
128
- marketplaceStore: { id: product.marketplace_store_id },
129
- marketplaceProductVariations: product.product_variation.map(variation => {
130
- return {
131
- id: variation.marketplace_product_variation_id,
132
- name: variation.name,
133
- qty: variation.qty,
134
- reserveQty: variation.reserve_qty
135
- };
136
- })
137
- };
138
- })
139
- : null,
140
- warehouseInventory: itm.Json_warehouseInventory
141
- ? itm.Json_warehouseInventory.map(inventory => {
142
- return {
143
- bizplace: { id: inventory.fulfillment_id, name: inventory.fulfillment_name },
144
- product: { id: inventory.product_id },
145
- qty: inventory.inventory_qty,
146
- lockedQty: inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0,
147
- remainQty: inventory.inventory_qty - (inventory.inventory_locked_qty ? inventory.inventory_locked_qty : 0)
148
- };
149
- })
150
- : null
151
- };
152
- }),
153
- total: total[0].count
154
- };
155
- }
156
- exports.warehouseMarketplaceProduct = warehouseMarketplaceProduct;
157
- //# sourceMappingURL=warehouse-marketplace-products.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warehouse-marketplace-products.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts"],"names":[],"mappings":";;;AAGA,uDAAsF;AAGzE,QAAA,oCAAoC,GAAG;IAClD,KAAK,CAAC,4BAA4B,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACxE,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;YAC7F,OAAO,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;SAC7D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,2BAA2B,CAAC,MAAiB,EAAE,MAAc,EAAE,IAAU,EAAE,EAAkB;IACjH,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,cAAc,CAAC,CAAA;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,cAAc,CAAC,CAAA;IAEpE,MAAM,eAAe,GAAa,MAAM,IAAA,6BAAkB,EAAC,MAAM,EAAE,IAAI,C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gCAAgC;oCAC9C,IAAI,EAAE,SAAS,CAAC,IAAI;oCACpB,GAAG,EAAE,SAAS,CAAC,GAAG;oCAClB,UAAU,EAAE,SAAS,CAAC,WAAW;iCAClC,CAAA;4BACH,CAAC,CAAC;yBACH,CAAA;oBACH,CAAC,CAAC;oBACJ,CAAC,CAAC,IAAI;gBACR,kBAAkB,EAAE,GAAG,CAAC,uBAAuB;oBAC7C,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;wBAC1C,OAAO;4BACL,QAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,gBAAgB,EAAE;4BAC5E,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,UAAU,EAAE;4BACrC,GAAG,EAAE,SAAS,CAAC,aAAa;4BAC5B,SAAS,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;4BAC9E,SAAS,EACP,SAAS,CAAC,aAAa,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;yBAClG,CAAA;oBACH,CAAC,CAAC;oBACJ,CAAC,CAAC,IAAI;aACT,CAAA;QACH,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;KACtB,CAAA;AACH,CAAC;AA7JD,kEA6JC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Query = void 0;
4
- const shipping_providers_1 = require("./shipping-providers");
5
- exports.Query = Object.assign({}, shipping_providers_1.shippingProviders);
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/shipping-provider/index.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAE3C,QAAA,KAAK,qBACX,sCAAiB,EACvB"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shippingProviders = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const marketplace_base_1 = require("@things-factory/marketplace-base");
6
- exports.shippingProviders = {
7
- async shippingProviders(_, params, context) {
8
- try {
9
- const { domain } = context.state;
10
- let statusFilter = ``;
11
- if (params.statuses) {
12
- statusFilter = `AND status in (${params.statuses.map(e => {
13
- return `'` + e + `'`;
14
- })})`;
15
- }
16
- let items = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).query(`
17
- SELECT DISTINCT shipping_provider FROM marketplace_orders WHERE domain_id = '${domain.id}' AND marketplace_store_id = '${params.storeId}' AND shipping_provider IS NOT null AND shipping_provider != ''
18
- ` + statusFilter);
19
- items = items.map(e => {
20
- const { shipping_provider: shippingProvider } = e;
21
- return {
22
- shippingProvider
23
- };
24
- });
25
- return { items };
26
- }
27
- catch (error) {
28
- throw error;
29
- }
30
- }
31
- };
32
- //# sourceMappingURL=shipping-providers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shipping-providers.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/shipping-provider/shipping-providers.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,uEAAmE;AAItD,QAAA,iBAAiB,GAAG;IAC/B,KAAK,CAAC,iBAAiB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QAC7D,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;YAEpD,IAAI,YAAY,GAAG,EAAE,CAAA;YACrB,IAAI,MAAM,CAAC,QAAQ,EAAE;gBACnB,YAAY,GAAG,kBAAkB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;oBACvD,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;gBACtB,CAAC,CAAC,GAAG,CAAA;aACN;YAED,IAAI,KAAK,GAAU,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,KAAK,CAC5D;uFAC+E,MAAM,CAAC,EAAE,iCAAiC,MAAM,CAAC,OAAO;OACxI,GAAG,YAAY,CACf,CAAA;YAED,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACpB,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAA;gBAEjD,OAAO;oBACL,gBAAgB;iBACjB,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO,EAAE,KAAK,EAAE,CAAA;SACjB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.autoLinkWarehouseMarketplaceProductVariationsResolver = void 0;
4
- const shell_1 = require("@things-factory/shell");
5
- const typeorm_1 = require("typeorm");
6
- const warehouse_marketplace_products_1 = require("../interface-with-hub/warehouse-marketplace-products");
7
- const marketplace_base_1 = require("@things-factory/marketplace-base");
8
- exports.autoLinkWarehouseMarketplaceProductVariationsResolver = {
9
- async autoLinkWarehouseMarketplaceProductVariations(_, { marketplaceStoreIds, isCheckedSku }, context) {
10
- const { domain, user, tx } = context.state;
11
- const tag = `progress-link-product`;
12
- await linkMarketplaceProductVariations({
13
- domain,
14
- user,
15
- tag,
16
- marketplaceStoreIds,
17
- isCheckedSku,
18
- tx
19
- });
20
- return true;
21
- }
22
- };
23
- async function linkMarketplaceProductVariations({ domain, user, tag, marketplaceStoreIds, isCheckedSku, tx }) {
24
- try {
25
- const params = { filters: [], sortings: [] };
26
- const warehouseMarketplaceProducts = await (0, warehouse_marketplace_products_1.warehouseMarketplaceProduct)(params, domain, user, tx);
27
- const marketplaceProducts = await tx.getRepository(marketplace_base_1.MarketplaceProduct).find({
28
- where: { domain, marketplaceStore: (0, typeorm_1.In)(marketplaceStoreIds) }
29
- });
30
- let marketplaceProductVariations = await tx
31
- .getRepository(marketplace_base_1.MarketplaceProductVariation)
32
- .find({
33
- where: { domain, marketplaceProduct: (0, typeorm_1.In)(marketplaceProducts.map(product => product.id)), sku: (0, typeorm_1.IsNull)() }
34
- });
35
- let total = marketplaceProductVariations === null || marketplaceProductVariations === void 0 ? void 0 : marketplaceProductVariations.length;
36
- const linkedProductVariations = await Promise.all(marketplaceProductVariations.map((productVariation, idx) => {
37
- let foundSku;
38
- if (isCheckedSku) {
39
- foundSku = warehouseMarketplaceProducts.items.find(warehouseProd => warehouseProd.sku === productVariation.variationSku);
40
- }
41
- productVariation.sku = (foundSku === null || foundSku === void 0 ? void 0 : foundSku.sku) ? foundSku.sku : null;
42
- productVariation.updater = user;
43
- (0, shell_1.publishProgress)({
44
- domain,
45
- tag,
46
- progress: Math.floor((idx / total) * 100),
47
- message: `${idx} / ${total}`
48
- });
49
- return productVariation;
50
- }));
51
- await tx.getRepository(marketplace_base_1.MarketplaceProductVariation).save(linkedProductVariations);
52
- }
53
- catch (ex) {
54
- (0, shell_1.publishProgress)({
55
- domain,
56
- tag,
57
- progress: -1,
58
- message: 'failed'
59
- });
60
- throw ex;
61
- }
62
- }
63
- //# sourceMappingURL=auto-link-warehouse-marketplace-product-variations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-link-warehouse-marketplace-product-variations.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.ts"],"names":[],"mappings":";;;AAAA,iDAA+D;AAE/D,qCAAmD;AACnD,yGAAkG;AAClG,uEAAkG;AAErF,QAAA,qDAAqD,GAAG;IACnE,KAAK,CAAC,6CAA6C,CACjD,CAAM,EACN,EAAE,mBAAmB,EAAE,YAAY,EAAE,EACrC,OAAY;QAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAA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GAAG,EAAE,EAAE;YACtF,IAAI,QAAa,CAAA;YAEjB,IAAI,YAAY,EAAE;gBAChB,QAAQ,GAAG,4BAA4B,CAAC,KAAK,CAAC,IAAI,CAChD,aAAa,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,KAAK,gBAAgB,CAAC,YAAY,CACrE,CAAA;aACF;YAED,gBAAgB,CAAC,GAAG,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,EAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;YAC1D,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAA;YAE/B,IAAA,uBAAe,EAAC;gBACd,MAAM;gBACN,GAAG;gBACH,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC;gBACzC,OAAO,EAAE,GAAG,GAAG,MAAM,KAAK,EAAE;aAC7B,CAAC,CAAA;YAEF,OAAO,gBAAgB,CAAA;QACzB,CAAC,CAAC,CACH,CAAA;QAED,MAAM,EAAE,CAAC,aAAa,CAAC,8CAA2B,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;KAClF;IAAC,OAAO,EAAE,EAAE;QACX,IAAA,uBAAe,EAAC;YACd,MAAM;YACN,GAAG;YACH,QAAQ,EAAE,CAAC,CAAC;YACZ,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAA;QAEF,MAAM,EAAE,CAAA;KACT;AACH,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = void 0;
4
- const auto_link_warehouse_marketplace_product_variations_1 = require("./auto-link-warehouse-marketplace-product-variations");
5
- exports.Mutation = Object.assign({}, auto_link_warehouse_marketplace_product_variations_1.autoLinkWarehouseMarketplaceProductVariationsResolver);
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/warehouse-product/index.ts"],"names":[],"mappings":";;;AAAA,6HAA4H;AAE/G,QAAA,QAAQ,qBAChB,0GAAqD,EACzD"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.types = exports.mutations = exports.queries = void 0;
27
- const InterfaceWithHub = __importStar(require("./interface-with-hub"));
28
- const WarehouseProduct = __importStar(require("./warehouse-product"));
29
- const ShippingProvider = __importStar(require("./shipping-provider"));
30
- exports.queries = [InterfaceWithHub.Query, ShippingProvider.Query];
31
- exports.mutations = [InterfaceWithHub.Mutation, WarehouseProduct.Mutation];
32
- exports.types = [...InterfaceWithHub.Types, ...WarehouseProduct.Types, ...ShippingProvider.Types];
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAwD;AACxD,sEAAuD;AACvD,sEAAuD;AAE1C,QAAA,OAAO,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;AAE1D,QAAA,SAAS,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AAElE,QAAA,KAAK,GAAG,CAAC,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Types = exports.Query = exports.Mutation = void 0;
4
- const new_stock_replenishment_1 = require("./new-stock-replenishment");
5
- const replenishment_order_product_1 = require("./replenishment-order-product");
6
- const stock_replenishment_1 = require("./stock-replenishment");
7
- const stock_replenishment_list_1 = require("./stock-replenishment-list");
8
- const warehouse_inventory_1 = require("./warehouse-inventory");
9
- const warehouse_marketplace_product_1 = require("./warehouse-marketplace-product");
10
- const warehouse_marketplace_product_list_1 = require("./warehouse-marketplace-product-list");
11
- exports.Mutation = `
12
- addReleaseOrder(marketplaceOrderIds: [String]!, warehouseId: String!): Boolean @transaction
13
- autoAddReleaseOrder(warehouseId: String): Boolean @transaction
14
- generateReplenishmentOrder(stockReplenishmentId: String!, warehouseId: String!): StockReplenishment @transaction
15
- autoUpdateAllMarketplaceProductVariationQuantity(companyDomainId: String, warehouseId: String): Boolean @transaction
16
- `;
17
- exports.Query = `
18
- warehouseMarketplaceProducts(filters: [Filter], pagination: Pagination, sortings: [Sorting]): WarehouseMarketplaceProductList @transaction
19
- `;
20
- exports.Types = [
21
- stock_replenishment_1.StockReplenishment,
22
- new_stock_replenishment_1.NewStockReplenishment,
23
- replenishment_order_product_1.ReplenishmentOrderProduct,
24
- stock_replenishment_list_1.StockReplenishmentList,
25
- warehouse_inventory_1.WarehouseInventory,
26
- warehouse_marketplace_product_1.WarehouseMarketplaceProduct,
27
- warehouse_marketplace_product_list_1.WarehouseMarketplaceProductList
28
- ];
29
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/interface-with-hub/index.ts"],"names":[],"mappings":";;;AAAA,uEAAiE;AACjE,+EAAyE;AACzE,+DAA0D;AAC1D,yEAAmE;AACnE,+DAA0D;AAC1D,mFAA6E;AAC7E,6FAAsF;AAEzE,QAAA,QAAQ,GAAiB;;;;;CAKrC,CAAA;AAEY,QAAA,KAAK,GAAiB;;CAElC,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wCAAkB;IAClB,+CAAqB;IACrB,uDAAyB;IACzB,iDAAsB;IACtB,wCAAkB;IAClB,2DAA2B;IAC3B,oEAA+B;CAChC,CAAA"}