@things-factory/warehouse-base 4.3.671 → 4.3.673
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/constants/adjustment-code.js +13 -0
- package/dist-server/constants/adjustment-code.js.map +1 -0
- package/dist-server/constants/index.js +23 -0
- package/dist-server/constants/index.js.map +1 -0
- package/dist-server/constants/inventory.js +74 -0
- package/dist-server/constants/inventory.js.map +1 -0
- package/dist-server/constants/location.js +19 -0
- package/dist-server/constants/location.js.map +1 -0
- package/dist-server/constants/pallet.js +13 -0
- package/dist-server/constants/pallet.js.map +1 -0
- package/dist-server/constants/rule-type.js +8 -0
- package/dist-server/constants/rule-type.js.map +1 -0
- package/dist-server/constants/tote.js +9 -0
- package/dist-server/constants/tote.js.map +1 -0
- package/dist-server/controllers/ecommerce/ecommerce-controller.js +125 -0
- package/dist-server/controllers/ecommerce/ecommerce-controller.js.map +1 -0
- package/dist-server/controllers/ecommerce/index.js +22 -0
- package/dist-server/controllers/ecommerce/index.js.map +1 -0
- package/dist-server/controllers/ecommerce/pos-controller.js +65 -0
- package/dist-server/controllers/ecommerce/pos-controller.js.map +1 -0
- package/dist-server/controllers/ecommerce/powrup-controller.js +87 -0
- package/dist-server/controllers/ecommerce/powrup-controller.js.map +1 -0
- package/dist-server/controllers/ecommerce/sellercraft-controller.js +85 -0
- package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -0
- package/dist-server/controllers/ecommerce/webspert-controller.js +131 -0
- package/dist-server/controllers/ecommerce/webspert-controller.js.map +1 -0
- package/dist-server/controllers/index.js +19 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/warehouse-controller.js +143 -0
- package/dist-server/controllers/warehouse-controller.js.map +1 -0
- package/dist-server/index.js +35 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +1 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/service/index.js +96 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/inventory/index.js +9 -0
- package/dist-server/service/inventory/index.js.map +1 -0
- package/dist-server/service/inventory/inventory-mutation.js +414 -0
- package/dist-server/service/inventory/inventory-mutation.js.map +1 -0
- package/dist-server/service/inventory/inventory-query.js +1211 -0
- package/dist-server/service/inventory/inventory-query.js.map +1 -0
- package/dist-server/service/inventory/inventory-types.js +478 -0
- package/dist-server/service/inventory/inventory-types.js.map +1 -0
- package/dist-server/service/inventory/inventory.js +569 -0
- package/dist-server/service/inventory/inventory.js.map +1 -0
- package/dist-server/service/inventory-change/index.js +9 -0
- package/dist-server/service/inventory-change/index.js.map +1 -0
- package/dist-server/service/inventory-change/inventory-change-mutation.js +1188 -0
- package/dist-server/service/inventory-change/inventory-change-mutation.js.map +1 -0
- package/dist-server/service/inventory-change/inventory-change-query.js +150 -0
- package/dist-server/service/inventory-change/inventory-change-query.js.map +1 -0
- package/dist-server/service/inventory-change/inventory-change-types.js +73 -0
- package/dist-server/service/inventory-change/inventory-change-types.js.map +1 -0
- package/dist-server/service/inventory-change/inventory-change.js +225 -0
- package/dist-server/service/inventory-change/inventory-change.js.map +1 -0
- package/dist-server/service/inventory-history/index.js +9 -0
- package/dist-server/service/inventory-history/index.js.map +1 -0
- package/dist-server/service/inventory-history/inventory-history-mutation.js +121 -0
- package/dist-server/service/inventory-history/inventory-history-mutation.js.map +1 -0
- package/dist-server/service/inventory-history/inventory-history-query.js +1694 -0
- package/dist-server/service/inventory-history/inventory-history-query.js.map +1 -0
- package/dist-server/service/inventory-history/inventory-history-types.js +626 -0
- package/dist-server/service/inventory-history/inventory-history-types.js.map +1 -0
- package/dist-server/service/inventory-history/inventory-history.js +238 -0
- package/dist-server/service/inventory-history/inventory-history.js.map +1 -0
- package/dist-server/service/inventory-item/index.js +9 -0
- package/dist-server/service/inventory-item/index.js.map +1 -0
- package/dist-server/service/inventory-item/inventory-item-mutation.js +274 -0
- package/dist-server/service/inventory-item/inventory-item-mutation.js.map +1 -0
- package/dist-server/service/inventory-item/inventory-item-query.js +265 -0
- package/dist-server/service/inventory-item/inventory-item-query.js.map +1 -0
- package/dist-server/service/inventory-item/inventory-item-type.js +127 -0
- package/dist-server/service/inventory-item/inventory-item-type.js.map +1 -0
- package/dist-server/service/inventory-item/inventory-item.js +146 -0
- package/dist-server/service/inventory-item/inventory-item.js.map +1 -0
- package/dist-server/service/inventory-item-change/index.js +9 -0
- package/dist-server/service/inventory-item-change/index.js.map +1 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-mutation.js +121 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-mutation.js.map +1 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-query.js +87 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-query.js.map +1 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-type.js +107 -0
- package/dist-server/service/inventory-item-change/inventory-item-change-type.js.map +1 -0
- package/dist-server/service/inventory-item-change/inventory-item-change.js +110 -0
- package/dist-server/service/inventory-item-change/inventory-item-change.js.map +1 -0
- package/dist-server/service/inventory-product/index.js +9 -0
- package/dist-server/service/inventory-product/index.js.map +1 -0
- package/dist-server/service/inventory-product/inventory-product-mutation.js +120 -0
- package/dist-server/service/inventory-product/inventory-product-mutation.js.map +1 -0
- package/dist-server/service/inventory-product/inventory-product-query.js +87 -0
- package/dist-server/service/inventory-product/inventory-product-query.js.map +1 -0
- package/dist-server/service/inventory-product/inventory-product-type.js +95 -0
- package/dist-server/service/inventory-product/inventory-product-type.js.map +1 -0
- package/dist-server/service/inventory-product/inventory-product.js +112 -0
- package/dist-server/service/inventory-product/inventory-product.js.map +1 -0
- package/dist-server/service/location/index.js +9 -0
- package/dist-server/service/location/index.js.map +1 -0
- package/dist-server/service/location/location-mutation.js +279 -0
- package/dist-server/service/location/location-mutation.js.map +1 -0
- package/dist-server/service/location/location-query.js +321 -0
- package/dist-server/service/location/location-query.js.map +1 -0
- package/dist-server/service/location/location-types.js +296 -0
- package/dist-server/service/location/location-types.js.map +1 -0
- package/dist-server/service/location/location.js +146 -0
- package/dist-server/service/location/location.js.map +1 -0
- package/dist-server/service/movement/index.js +9 -0
- package/dist-server/service/movement/index.js.map +1 -0
- package/dist-server/service/movement/movement-mutation.js +80 -0
- package/dist-server/service/movement/movement-mutation.js.map +1 -0
- package/dist-server/service/movement/movement-query.js +286 -0
- package/dist-server/service/movement/movement-query.js.map +1 -0
- package/dist-server/service/movement/movement-types.js +117 -0
- package/dist-server/service/movement/movement-types.js.map +1 -0
- package/dist-server/service/movement/movement.js +101 -0
- package/dist-server/service/movement/movement.js.map +1 -0
- package/dist-server/service/pallet/index.js +9 -0
- package/dist-server/service/pallet/index.js.map +1 -0
- package/dist-server/service/pallet/pallet-mutation.js +194 -0
- package/dist-server/service/pallet/pallet-mutation.js.map +1 -0
- package/dist-server/service/pallet/pallet-query.js +164 -0
- package/dist-server/service/pallet/pallet-query.js.map +1 -0
- package/dist-server/service/pallet/pallet-types.js +109 -0
- package/dist-server/service/pallet/pallet-types.js.map +1 -0
- package/dist-server/service/pallet/pallet.js +112 -0
- package/dist-server/service/pallet/pallet.js.map +1 -0
- package/dist-server/service/pallet-count/index.js +9 -0
- package/dist-server/service/pallet-count/index.js.map +1 -0
- package/dist-server/service/pallet-count/pallet-count-mutation.js +153 -0
- package/dist-server/service/pallet-count/pallet-count-mutation.js.map +1 -0
- package/dist-server/service/pallet-count/pallet-count-query.js +86 -0
- package/dist-server/service/pallet-count/pallet-count-query.js.map +1 -0
- package/dist-server/service/pallet-count/pallet-count-types.js +65 -0
- package/dist-server/service/pallet-count/pallet-count-types.js.map +1 -0
- package/dist-server/service/pallet-count/pallet-count.js +89 -0
- package/dist-server/service/pallet-count/pallet-count.js.map +1 -0
- package/dist-server/service/pallet-history/index.js +9 -0
- package/dist-server/service/pallet-history/index.js.map +1 -0
- package/dist-server/service/pallet-history/pallet-history-mutation.js +120 -0
- package/dist-server/service/pallet-history/pallet-history-mutation.js.map +1 -0
- package/dist-server/service/pallet-history/pallet-history-query.js +87 -0
- package/dist-server/service/pallet-history/pallet-history-query.js.map +1 -0
- package/dist-server/service/pallet-history/pallet-history-types.js +65 -0
- package/dist-server/service/pallet-history/pallet-history-types.js.map +1 -0
- package/dist-server/service/pallet-history/pallet-history.js +107 -0
- package/dist-server/service/pallet-history/pallet-history.js.map +1 -0
- package/dist-server/service/product-detail-stock/index.js +9 -0
- package/dist-server/service/product-detail-stock/index.js.map +1 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-mutation.js +120 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-mutation.js.map +1 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-query.js +66 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-query.js.map +1 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-types.js +57 -0
- package/dist-server/service/product-detail-stock/product-detail-stock-types.js.map +1 -0
- package/dist-server/service/product-detail-stock/product-detail-stock.js +90 -0
- package/dist-server/service/product-detail-stock/product-detail-stock.js.map +1 -0
- package/dist-server/service/reduced-inventory-history/index.js +6 -0
- package/dist-server/service/reduced-inventory-history/index.js.map +1 -0
- package/dist-server/service/reduced-inventory-history/reduced-inventory-history.js +133 -0
- package/dist-server/service/reduced-inventory-history/reduced-inventory-history.js.map +1 -0
- package/dist-server/service/tote/index.js +9 -0
- package/dist-server/service/tote/index.js.map +1 -0
- package/dist-server/service/tote/tote-mutation.js +192 -0
- package/dist-server/service/tote/tote-mutation.js.map +1 -0
- package/dist-server/service/tote/tote-query.js +162 -0
- package/dist-server/service/tote/tote-query.js.map +1 -0
- package/dist-server/service/tote/tote-types.js +75 -0
- package/dist-server/service/tote/tote-types.js.map +1 -0
- package/dist-server/service/tote/tote.js +98 -0
- package/dist-server/service/tote/tote.js.map +1 -0
- package/dist-server/service/warehouse/index.js +9 -0
- package/dist-server/service/warehouse/index.js.map +1 -0
- package/dist-server/service/warehouse/warehouse-mutation.js +148 -0
- package/dist-server/service/warehouse/warehouse-mutation.js.map +1 -0
- package/dist-server/service/warehouse/warehouse-query.js +91 -0
- package/dist-server/service/warehouse/warehouse-query.js.map +1 -0
- package/dist-server/service/warehouse/warehouse-types.js +82 -0
- package/dist-server/service/warehouse/warehouse-types.js.map +1 -0
- package/dist-server/service/warehouse/warehouse.js +114 -0
- package/dist-server/service/warehouse/warehouse.js.map +1 -0
- package/dist-server/utils/datetime-util.js +61 -0
- package/dist-server/utils/datetime-util.js.map +1 -0
- package/dist-server/utils/index.js +20 -0
- package/dist-server/utils/index.js.map +1 -0
- package/dist-server/utils/inventory-no-generator.js +17 -0
- package/dist-server/utils/inventory-no-generator.js.map +1 -0
- package/dist-server/utils/inventory-util.js +413 -0
- package/dist-server/utils/inventory-util.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebspertController = void 0;
|
|
7
|
+
const typeorm_1 = require("typeorm");
|
|
8
|
+
const env_1 = require("@things-factory/env");
|
|
9
|
+
const env_2 = require("@things-factory/env");
|
|
10
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
11
|
+
const inventory_1 = require("../../service/inventory/inventory");
|
|
12
|
+
const axios_1 = __importDefault(require("axios"));
|
|
13
|
+
var webspertConfig = env_2.config.get('webspert');
|
|
14
|
+
// const { PerformanceObserver, performance } = require('node:perf_hooks')
|
|
15
|
+
class WebspertController {
|
|
16
|
+
static async updateStock(productDetails, bizplace, domain, user, tx) {
|
|
17
|
+
if (tx) {
|
|
18
|
+
await this._updateStock(productDetails, bizplace, domain, user, tx);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
await (0, typeorm_1.getConnection)().transaction(async (tx) => {
|
|
22
|
+
await this._updateStock(productDetails, bizplace, domain, user, tx);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static async _updateStock(productDetails, bizplace, domain, user, tx) {
|
|
27
|
+
// group 100 Product Details in single batch
|
|
28
|
+
const batchSize = 100;
|
|
29
|
+
// deduplicate and batching
|
|
30
|
+
let bulkPD = productDetails.reduce((ids, productDetail, idx) => {
|
|
31
|
+
if (!ids.find(id => id == productDetail.id)) {
|
|
32
|
+
ids.push(productDetail.id);
|
|
33
|
+
}
|
|
34
|
+
return ids;
|
|
35
|
+
}, [])
|
|
36
|
+
.reduce((acc, productDetailId, idx) => {
|
|
37
|
+
if (idx % batchSize === 0) {
|
|
38
|
+
return [...acc, [productDetailId]];
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
acc[acc.length - 1].push(productDetailId);
|
|
42
|
+
return acc;
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
// console.log(bulkPD)
|
|
46
|
+
//// Query db by batches and loop through based on batches. Can switch up to call Warehouse Bizplace Onhand Inventory View instead direct query to maintain consistency
|
|
47
|
+
Promise.all(bulkPD.map(async (productDetails) => {
|
|
48
|
+
try {
|
|
49
|
+
let productDetailsID = productDetails.map(productDetail => {
|
|
50
|
+
return "'" + (productDetail === null || productDetail === void 0 ? void 0 : productDetail.trim()) + "'";
|
|
51
|
+
}).join(',');
|
|
52
|
+
let rawQb = await (0, typeorm_1.getRepository)(inventory_1.Inventory).query(`
|
|
53
|
+
select id, sku, ref_code, bizplace_id, domain_id, max("available_qty") as "availableQty" from (
|
|
54
|
+
select pd.id, p.sku, pd.ref_code, b.id as bizplace_id, $2 as domain_id, 0 as available_qty
|
|
55
|
+
from bizplaces b
|
|
56
|
+
inner join companies c on c.id = b.company_id
|
|
57
|
+
inner join domains d on d.id = c.domain_id
|
|
58
|
+
inner join product_details pd on pd.domain_id = d.id
|
|
59
|
+
inner join products p on p.id = pd.product_id
|
|
60
|
+
where b.id = $1 and
|
|
61
|
+
pd.id in (${productDetailsID})
|
|
62
|
+
union all
|
|
63
|
+
select pd.id, p.sku, pd.ref_code, i.bizplace_id, i.domain_id,
|
|
64
|
+
sum(i.qty - coalesce(i.locked_qty,0) - coalesce(i.transfer_qty,0) - coalesce(pds.unassigned_qty,0)) as available_qty
|
|
65
|
+
from inventories i
|
|
66
|
+
inner join locations loc on loc.id = i.location_id
|
|
67
|
+
inner join product_details pd on pd.id = i.product_detail_id
|
|
68
|
+
left join product_detail_stocks pds on pds.product_detail_id = pd.id
|
|
69
|
+
left join products p on p.id = pd.product_id
|
|
70
|
+
where
|
|
71
|
+
loc."type" not in ('QUARANTINE', 'RESERVED') and
|
|
72
|
+
i.status = 'STORED' and
|
|
73
|
+
i.bizplace_id = $1 and
|
|
74
|
+
i.domain_id = $2 and
|
|
75
|
+
i.product_detail_id in (${productDetailsID})
|
|
76
|
+
group by pd.id, p.sku, pd.ref_code, i.bizplace_id, i.domain_id
|
|
77
|
+
) src
|
|
78
|
+
group by id, sku, ref_code, bizplace_id, domain_id
|
|
79
|
+
`, [bizplace.id, domain.id]);
|
|
80
|
+
for (let index = 0; index < rawQb.length; index++) {
|
|
81
|
+
const data = rawQb[index];
|
|
82
|
+
////// Calling Webspert API 1 by 1 is unavoidable as Webspert's API only allow singular update
|
|
83
|
+
await this.sendRequestToAPI('product/update_product_stock_by_sku', {
|
|
84
|
+
sku: data.sku,
|
|
85
|
+
stock: data.availableQty
|
|
86
|
+
}, domain, user);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
env_1.logger.error(`webspert-controller[_updateStock]: ${error}`);
|
|
91
|
+
console.log(error);
|
|
92
|
+
}
|
|
93
|
+
// }
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
static async sendRequestToAPI(endpoint, data, domain, user) {
|
|
97
|
+
let results = undefined;
|
|
98
|
+
let postRequest = {
|
|
99
|
+
baseURL: webspertConfig.shedazzle.baseUrl,
|
|
100
|
+
url: `api/v1/${endpoint}`,
|
|
101
|
+
data: Object.assign({ secretkey: webspertConfig.shedazzle.secretKey }, data)
|
|
102
|
+
};
|
|
103
|
+
try {
|
|
104
|
+
results = await (0, axios_1.default)({
|
|
105
|
+
method: 'post',
|
|
106
|
+
url: postRequest.url,
|
|
107
|
+
baseURL: postRequest.baseURL,
|
|
108
|
+
data: postRequest.data
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
env_1.logger.error(`webspert-controller[sendRequestToAPI]-${endpoint}: ${error}`);
|
|
113
|
+
results = { status: error === null || error === void 0 ? void 0 : error.response.status, statusText: error === null || error === void 0 ? void 0 : error.response.statusText };
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
(0, integration_base_1.createPayloadLog)('WebspertShedazzle', postRequest.baseURL + '/' + postRequest.url, postRequest.data, {
|
|
117
|
+
data: results === null || results === void 0 ? void 0 : results.data,
|
|
118
|
+
status: results.status,
|
|
119
|
+
statusText: results.statusText
|
|
120
|
+
}, {
|
|
121
|
+
state: {
|
|
122
|
+
user: user,
|
|
123
|
+
domain: domain
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return results;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.WebspertController = WebspertController;
|
|
131
|
+
//# sourceMappingURL=webspert-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webspert-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/webspert-controller.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAqE;AAGrE,6CAA4C;AAG5C,6CAA4C;AAC5C,uEAAmE;AAEnE,iEAA6D;AAE7D,kDAAyB;AAEzB,IAAI,cAAc,GAAQ,YAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AAEhD,0EAA0E;AAE1E,MAAa,kBAAkB;IACtB,MAAM,CAAC,KAAK,CAAC,WAAW,CAC7B,c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(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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ecommerce"), exports);
|
|
18
|
+
__exportStar(require("./warehouse-controller"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,yDAAsC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarehouseController = void 0;
|
|
4
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
5
|
+
const biz_base_1 = require("@things-factory/biz-base");
|
|
6
|
+
class WarehouseController {
|
|
7
|
+
constructor(trxMgr, domain, user) {
|
|
8
|
+
this.ERROR_MSG = {
|
|
9
|
+
FIND: {
|
|
10
|
+
NO_RESULT: (condition) => `There's no results matched with condition ${condition}`,
|
|
11
|
+
NO_CHILD_RESULT: (condition) => `There's no child result matched with condition ${condition}`,
|
|
12
|
+
NOT_MATCH: (source, target) => `Unable to find matching ${target} using ${source}`
|
|
13
|
+
},
|
|
14
|
+
CREATE: {
|
|
15
|
+
ID_EXISTS: 'Target has ID already',
|
|
16
|
+
EMPTY_CREATOR: 'Cannot create without creator',
|
|
17
|
+
EMPTY_UPDATER: 'Cannot create without updater'
|
|
18
|
+
},
|
|
19
|
+
UPDATE: {
|
|
20
|
+
ID_NOT_EXISTS: `Target doesn't have ID`,
|
|
21
|
+
EMPTY_UPDATER: 'Cannot update without updater'
|
|
22
|
+
},
|
|
23
|
+
VALIDITY: {
|
|
24
|
+
UNEXPECTED_FIELD_VALUE: (field, expectedValue, actualValue) => `Expected ${field} value is ${expectedValue} but got ${actualValue}`,
|
|
25
|
+
DUPLICATED: (field, value) => `There is duplicated ${field} value (${value})`,
|
|
26
|
+
CANT_PROCEED_STEP_BY: (step, reason) => `Can't proceed to ${step} it because ${reason}`
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this.ROLE_NAMES = {
|
|
30
|
+
OFFICE_ADMIN: 'Office Admin'
|
|
31
|
+
};
|
|
32
|
+
this.trxMgr = trxMgr;
|
|
33
|
+
this.domain = domain;
|
|
34
|
+
this.user = user;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @summary Notify to passed users
|
|
38
|
+
* @description Passed notification message will be sent to passed users
|
|
39
|
+
*/
|
|
40
|
+
async notifyToUsers(users, message) {
|
|
41
|
+
const receivers = users.map(user => user.id);
|
|
42
|
+
/**
|
|
43
|
+
* @notes Temporary off sendNotification due to suspect of causing wms down
|
|
44
|
+
*/
|
|
45
|
+
// await sendNotification({
|
|
46
|
+
// receivers,
|
|
47
|
+
// message
|
|
48
|
+
// })
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @summary Notify to office admin
|
|
52
|
+
* @description Passed notification message will be sent to office admin of current domain
|
|
53
|
+
* default role name is defiend as ROLE_NAME.OFFICE_ADMIn by default
|
|
54
|
+
* You can change role name by passing roleName as parameter
|
|
55
|
+
*/
|
|
56
|
+
async notifyToOfficeAdmin(message, roleName) {
|
|
57
|
+
const users = await this.trxMgr
|
|
58
|
+
.getRepository('users_roles')
|
|
59
|
+
.createQueryBuilder('ur')
|
|
60
|
+
.select('ur.users_id', 'id')
|
|
61
|
+
.where(qb => {
|
|
62
|
+
const subQuery = qb
|
|
63
|
+
.subQuery()
|
|
64
|
+
.select('role.id')
|
|
65
|
+
.from(auth_base_1.Role, 'role')
|
|
66
|
+
.where('role.name = :roleName', { roleName: roleName || this.ROLE_NAMES.OFFICE_ADMIN })
|
|
67
|
+
.andWhere('role.domain_id = :domainId', { domainId: this.domain.id })
|
|
68
|
+
.getQuery();
|
|
69
|
+
return 'ur.roles_id IN ' + subQuery;
|
|
70
|
+
})
|
|
71
|
+
.getRawMany();
|
|
72
|
+
this.notifyToUsers(users, message);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @summary Notify to customer of passed bizplace
|
|
76
|
+
* @description Passed notification message will be sent to customer of passed bizplace
|
|
77
|
+
*/
|
|
78
|
+
async notifyToCustomer(bizplace, message) {
|
|
79
|
+
const users = await (0, biz_base_1.getDomainUsers)(bizplace, this.trxMgr);
|
|
80
|
+
this.notifyToUsers(users, message);
|
|
81
|
+
}
|
|
82
|
+
async getChildPackingSize(productDetails, defaultProductDetail, unmatchingProductDetail) {
|
|
83
|
+
let hasChildRelation = Boolean(unmatchingProductDetail === null || unmatchingProductDetail === void 0 ? void 0 : unmatchingProductDetail.childProductDetail);
|
|
84
|
+
let hasMatchingChild;
|
|
85
|
+
let packingSize = 1;
|
|
86
|
+
let currentChildProductDetail;
|
|
87
|
+
if (hasChildRelation) {
|
|
88
|
+
currentChildProductDetail = productDetails.find((productDetail) => productDetail.id === unmatchingProductDetail.childProductDetail.id);
|
|
89
|
+
if (!currentChildProductDetail) {
|
|
90
|
+
throw new Error(this.ERROR_MSG.FIND.NOT_MATCH('packing type', `GTIN (${unmatchingProductDetail.gtin})`));
|
|
91
|
+
}
|
|
92
|
+
hasMatchingChild = Boolean(defaultProductDetail.id === currentChildProductDetail.id);
|
|
93
|
+
if (hasMatchingChild) {
|
|
94
|
+
packingSize = unmatchingProductDetail.packingSize;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
packingSize = unmatchingProductDetail.packingSize * packingSize;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw new Error(this.ERROR_MSG.FIND.NO_CHILD_RESULT(`${unmatchingProductDetail.gtin}`));
|
|
102
|
+
}
|
|
103
|
+
while (hasChildRelation && !hasMatchingChild) {
|
|
104
|
+
if (hasMatchingChild) {
|
|
105
|
+
packingSize = currentChildProductDetail.packingSize * packingSize; // 12 x 10
|
|
106
|
+
}
|
|
107
|
+
else if (!hasMatchingChild && hasChildRelation) {
|
|
108
|
+
packingSize = currentChildProductDetail.packingSize * packingSize; // 12 x 10
|
|
109
|
+
currentChildProductDetail = productDetails.find((productDetail) => productDetail.id === currentChildProductDetail.childProductDetail.id);
|
|
110
|
+
hasChildRelation = Boolean(currentChildProductDetail === null || currentChildProductDetail === void 0 ? void 0 : currentChildProductDetail.childProductDetail);
|
|
111
|
+
hasMatchingChild = Boolean(defaultProductDetail.id === currentChildProductDetail.id);
|
|
112
|
+
}
|
|
113
|
+
else if (!hasChildRelation && !hasMatchingChild) {
|
|
114
|
+
throw new Error(this.ERROR_MSG.FIND.NO_RESULT(unmatchingProductDetail.gtin));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return packingSize;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @summary set common stamp like domain, creator, updater
|
|
121
|
+
* @description Set common stamp to passed record
|
|
122
|
+
* If it doesn't have id it will handle it as creating one
|
|
123
|
+
* If it has id it will handle it as updating one
|
|
124
|
+
*/
|
|
125
|
+
setStamp(record) {
|
|
126
|
+
if (!record.domain)
|
|
127
|
+
record.domain = this.domain;
|
|
128
|
+
if (!record.id && !record.creator)
|
|
129
|
+
record.creator = this.user;
|
|
130
|
+
if (!record.updater)
|
|
131
|
+
record.updater = this.user;
|
|
132
|
+
return record;
|
|
133
|
+
}
|
|
134
|
+
tidyConditions(record) {
|
|
135
|
+
Object.keys(record).forEach((key) => {
|
|
136
|
+
if (record[key] === null || record[key] instanceof Date || Array.isArray(record[key]))
|
|
137
|
+
delete record[key];
|
|
138
|
+
});
|
|
139
|
+
return record;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.WarehouseController = WarehouseController;
|
|
143
|
+
//# sourceMappingURL=warehouse-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warehouse-controller.js","sourceRoot":"","sources":["../../server/controllers/warehouse-controller.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,uDAAmE;AAgBnE,MAAa,mBAAmB;IAgC9B,YAAY,MAAqB,EAAE,MAAc,EAAE,IAAU;QA/B7C,cAAS,GAAG;YAC1B,IAAI,EAAE;gBACJ,SAAS,EAAE,CAAC,SAAc,EAAE,EAAE,CAAC,6CAA6C,SAAS,EAAE;gBACvF,eAAe,EAAE,CAAC,SAAc,EAAE,EAAE,CAAC,kDAAkD,SAAS,EAAE;gBAClG,SAAS,EAAE,CAAC,MAAW,EAAE,MAAW,EAAE,EAAE,CAAC,2BAA2B,MAAM,UAAU,MAAM,EAAE;aAC7F;YACD,MAAM,EAAE;gBACN,SAAS,EAAE,uBAAuB;gBAClC,aAAa,EAAE,+BAA+B;gBAC9C,aAAa,EAAE,+BAA+B;aAC/C;YACD,MAAM,EAAE;gBACN,aAAa,EAAE,wBAAwB;gBACvC,aAAa,EAAE,+BAA+B;aAC/C;YACD,QAAQ,EAAE;gBACR,sBAAsB,EAAE,CAAC,KAAa,EAAE,aAAkB,EAAE,WAAgB,EAAE,EAAE,CAC9E,YAAY,KAAK,aAAa,aAAa,YAAY,WAAW,EAAE;gBACtE,UAAU,EAAE,CAAC,KAAa,EAAE,KAAU,EAAE,EAAE,CAAC,u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AAM,CAAC,OAAO;YAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAA;QAE/C,OAAO,MAAM,CAAA;IACf,CAAC;IAED,cAAc,CAAC,MAA2B;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;YAC1C,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QAC3G,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAhKD,kDAgKC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.approveInventoryChanges = exports.updateWarehouse = exports.deleteWarehouses = exports.deleteWarehouse = exports.createWarehouse = exports.updateLocation = exports.deleteLocations = exports.deleteLocation = exports.createLocation = void 0;
|
|
18
|
+
__exportStar(require("./constants"), exports);
|
|
19
|
+
var location_mutation_1 = require("./service/location/location-mutation");
|
|
20
|
+
Object.defineProperty(exports, "createLocation", { enumerable: true, get: function () { return location_mutation_1.createLocation; } });
|
|
21
|
+
Object.defineProperty(exports, "deleteLocation", { enumerable: true, get: function () { return location_mutation_1.deleteLocation; } });
|
|
22
|
+
Object.defineProperty(exports, "deleteLocations", { enumerable: true, get: function () { return location_mutation_1.deleteLocations; } });
|
|
23
|
+
Object.defineProperty(exports, "updateLocation", { enumerable: true, get: function () { return location_mutation_1.updateLocation; } });
|
|
24
|
+
var warehouse_mutation_1 = require("./service/warehouse/warehouse-mutation");
|
|
25
|
+
Object.defineProperty(exports, "createWarehouse", { enumerable: true, get: function () { return warehouse_mutation_1.createWarehouse; } });
|
|
26
|
+
Object.defineProperty(exports, "deleteWarehouse", { enumerable: true, get: function () { return warehouse_mutation_1.deleteWarehouse; } });
|
|
27
|
+
Object.defineProperty(exports, "deleteWarehouses", { enumerable: true, get: function () { return warehouse_mutation_1.deleteWarehouses; } });
|
|
28
|
+
Object.defineProperty(exports, "updateWarehouse", { enumerable: true, get: function () { return warehouse_mutation_1.updateWarehouse; } });
|
|
29
|
+
__exportStar(require("./migrations"), exports);
|
|
30
|
+
__exportStar(require("./utils"), exports);
|
|
31
|
+
__exportStar(require("./service"), exports);
|
|
32
|
+
__exportStar(require("./controllers"), exports);
|
|
33
|
+
var inventory_change_mutation_1 = require("./service/inventory-change/inventory-change-mutation");
|
|
34
|
+
Object.defineProperty(exports, "approveInventoryChanges", { enumerable: true, get: function () { return inventory_change_mutation_1.approveInventoryChanges; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,0EAAsH;AAA7G,mHAAA,cAAc,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,oHAAA,eAAe,OAAA;AAAE,mHAAA,cAAc,OAAA;AACxE,6EAK+C;AAJ7C,qHAAA,eAAe,OAAA;AACf,qHAAA,eAAe,OAAA;AACf,sHAAA,gBAAgB,OAAA;AAChB,qHAAA,eAAe,OAAA;AAEjB,+CAA4B;AAC5B,0CAAuB;AACvB,4CAAyB;AACzB,gDAA6B;AAE7B,kGAA8F;AAArF,oIAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrations = void 0;
|
|
4
|
+
const glob = require('glob');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
exports.migrations = [];
|
|
7
|
+
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {
|
|
8
|
+
if (file.indexOf('index.js') !== -1)
|
|
9
|
+
return;
|
|
10
|
+
exports.migrations = exports.migrations.concat(Object.values(require(path.resolve(file))) || []);
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.schema = exports.entities = void 0;
|
|
18
|
+
const inventory_1 = require("./inventory");
|
|
19
|
+
const inventory_change_1 = require("./inventory-change");
|
|
20
|
+
const inventory_history_1 = require("./inventory-history");
|
|
21
|
+
const inventory_item_1 = require("./inventory-item");
|
|
22
|
+
const inventory_item_change_1 = require("./inventory-item-change");
|
|
23
|
+
const location_1 = require("./location");
|
|
24
|
+
const movement_1 = require("./movement");
|
|
25
|
+
const pallet_1 = require("./pallet");
|
|
26
|
+
const pallet_count_1 = require("./pallet-count");
|
|
27
|
+
const pallet_history_1 = require("./pallet-history");
|
|
28
|
+
const reduced_inventory_history_1 = require("./reduced-inventory-history");
|
|
29
|
+
const warehouse_1 = require("./warehouse");
|
|
30
|
+
const tote_1 = require("./tote");
|
|
31
|
+
const product_detail_stock_1 = require("./product-detail-stock");
|
|
32
|
+
/* EXPORT ENTITY TYPES */
|
|
33
|
+
__exportStar(require("./product-detail-stock/product-detail-stock"), exports);
|
|
34
|
+
__exportStar(require("./inventory-item-change/inventory-item-change"), exports);
|
|
35
|
+
__exportStar(require("./inventory-item/inventory-item"), exports);
|
|
36
|
+
__exportStar(require("./inventory-item-change/inventory-item-change"), exports);
|
|
37
|
+
__exportStar(require("./inventory/inventory"), exports);
|
|
38
|
+
__exportStar(require("./inventory-change/inventory-change"), exports);
|
|
39
|
+
__exportStar(require("./inventory-history/inventory-history"), exports);
|
|
40
|
+
__exportStar(require("./location/location"), exports);
|
|
41
|
+
__exportStar(require("./movement/movement"), exports);
|
|
42
|
+
__exportStar(require("./pallet/pallet"), exports);
|
|
43
|
+
__exportStar(require("./pallet-count/pallet-count"), exports);
|
|
44
|
+
__exportStar(require("./pallet-history/pallet-history"), exports);
|
|
45
|
+
__exportStar(require("./warehouse/warehouse"), exports);
|
|
46
|
+
__exportStar(require("./reduced-inventory-history/reduced-inventory-history"), exports);
|
|
47
|
+
__exportStar(require("./tote/tote"), exports);
|
|
48
|
+
/* EXPORT TYPES */
|
|
49
|
+
__exportStar(require("./product-detail-stock/product-detail-stock-types"), exports);
|
|
50
|
+
__exportStar(require("./inventory/inventory-types"), exports);
|
|
51
|
+
__exportStar(require("./inventory/inventory-types"), exports);
|
|
52
|
+
__exportStar(require("./inventory-item/inventory-item"), exports);
|
|
53
|
+
__exportStar(require("./inventory-item-change/inventory-item-change"), exports);
|
|
54
|
+
__exportStar(require("./inventory-change/inventory-change-types"), exports);
|
|
55
|
+
__exportStar(require("./inventory-history/inventory-history-types"), exports);
|
|
56
|
+
__exportStar(require("./location/location-types"), exports);
|
|
57
|
+
__exportStar(require("./movement/movement-types"), exports);
|
|
58
|
+
__exportStar(require("./pallet/pallet-types"), exports);
|
|
59
|
+
__exportStar(require("./pallet-count/pallet-count-types"), exports);
|
|
60
|
+
__exportStar(require("./pallet-history/pallet-history-types"), exports);
|
|
61
|
+
__exportStar(require("./warehouse/warehouse-types"), exports);
|
|
62
|
+
__exportStar(require("./tote/tote-types"), exports);
|
|
63
|
+
exports.entities = [
|
|
64
|
+
...inventory_1.entities,
|
|
65
|
+
...inventory_change_1.entities,
|
|
66
|
+
...inventory_history_1.entities,
|
|
67
|
+
...inventory_item_1.entities,
|
|
68
|
+
...inventory_item_change_1.entities,
|
|
69
|
+
...location_1.entities,
|
|
70
|
+
...movement_1.entities,
|
|
71
|
+
...pallet_1.entities,
|
|
72
|
+
...pallet_count_1.entities,
|
|
73
|
+
...pallet_history_1.entities,
|
|
74
|
+
...warehouse_1.entities,
|
|
75
|
+
...reduced_inventory_history_1.entities,
|
|
76
|
+
...tote_1.entities,
|
|
77
|
+
...product_detail_stock_1.entities
|
|
78
|
+
];
|
|
79
|
+
exports.schema = {
|
|
80
|
+
resolverClasses: [
|
|
81
|
+
...inventory_1.resolvers,
|
|
82
|
+
...inventory_change_1.resolvers,
|
|
83
|
+
...inventory_history_1.resolvers,
|
|
84
|
+
...inventory_item_1.resolvers,
|
|
85
|
+
...inventory_item_change_1.resolvers,
|
|
86
|
+
...location_1.resolvers,
|
|
87
|
+
...movement_1.resolvers,
|
|
88
|
+
...pallet_1.resolvers,
|
|
89
|
+
...pallet_count_1.resolvers,
|
|
90
|
+
...pallet_history_1.resolvers,
|
|
91
|
+
...warehouse_1.resolvers,
|
|
92
|
+
...tote_1.resolvers,
|
|
93
|
+
...product_detail_stock_1.resolvers
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;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,wBAAoB;QACvB,GAAG,0BAAsB;QACzB,GAAG,qBAAkB;QACrB,GAAG,gBAAa;QAChB,GAAG,gCAA2B;KAC/B;CACF,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const inventory_1 = require("./inventory");
|
|
5
|
+
const inventory_mutation_1 = require("./inventory-mutation");
|
|
6
|
+
const inventory_query_1 = require("./inventory-query");
|
|
7
|
+
exports.entities = [inventory_1.Inventory];
|
|
8
|
+
exports.resolvers = [inventory_query_1.InventoryQuery, inventory_mutation_1.InventoryMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/inventory/index.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,6DAAwD;AACxD,uDAAkD;AAErC,QAAA,QAAQ,GAAG,CAAC,qBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,gCAAc,EAAE,sCAAiB,CAAC,CAAA"}
|