@things-factory/integration-fulfillment 9.0.0-beta.27 → 9.0.0-beta.29

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 (140) hide show
  1. package/dist-server/controllers/fulfillment-api/decorators.d.ts +1 -0
  2. package/dist-server/controllers/fulfillment-api/decorators.js +30 -0
  3. package/dist-server/controllers/fulfillment-api/decorators.js.map +1 -0
  4. package/dist-server/controllers/fulfillment-api/index.d.ts +19 -0
  5. package/dist-server/controllers/fulfillment-api/index.js +113 -0
  6. package/dist-server/controllers/fulfillment-api/index.js.map +1 -0
  7. package/dist-server/controllers/fulfillment-api/types.d.ts +0 -0
  8. package/dist-server/controllers/fulfillment-api/types.js +1 -0
  9. package/dist-server/controllers/fulfillment-api/types.js.map +1 -0
  10. package/dist-server/controllers/index.d.ts +1 -0
  11. package/dist-server/controllers/index.js +5 -0
  12. package/dist-server/controllers/index.js.map +1 -0
  13. package/dist-server/controllers/operato/cancel-release-order.d.ts +13 -0
  14. package/dist-server/controllers/operato/cancel-release-order.js +21 -0
  15. package/dist-server/controllers/operato/cancel-release-order.js.map +1 -0
  16. package/dist-server/controllers/operato/create-inbound-order.d.ts +23 -0
  17. package/dist-server/controllers/operato/create-inbound-order.js +35 -0
  18. package/dist-server/controllers/operato/create-inbound-order.js.map +1 -0
  19. package/dist-server/controllers/operato/create-outbound-order.d.ts +11 -0
  20. package/dist-server/controllers/operato/create-outbound-order.js +20 -0
  21. package/dist-server/controllers/operato/create-outbound-order.js.map +1 -0
  22. package/dist-server/controllers/operato/create-sales-invoice.d.ts +11 -0
  23. package/dist-server/controllers/operato/create-sales-invoice.js +20 -0
  24. package/dist-server/controllers/operato/create-sales-invoice.js.map +1 -0
  25. package/dist-server/controllers/operato/echo.d.ts +12 -0
  26. package/dist-server/controllers/operato/echo.js +18 -0
  27. package/dist-server/controllers/operato/echo.js.map +1 -0
  28. package/dist-server/controllers/operato/get-center-products.d.ts +10 -0
  29. package/dist-server/controllers/operato/get-center-products.js +22 -0
  30. package/dist-server/controllers/operato/get-center-products.js.map +1 -0
  31. package/dist-server/controllers/operato/get-inbound-order.d.ts +11 -0
  32. package/dist-server/controllers/operato/get-inbound-order.js +26 -0
  33. package/dist-server/controllers/operato/get-inbound-order.js.map +1 -0
  34. package/dist-server/controllers/operato/get-inventory-product-group-open-api.d.ts +14 -0
  35. package/dist-server/controllers/operato/get-inventory-product-group-open-api.js +21 -0
  36. package/dist-server/controllers/operato/get-inventory-product-group-open-api.js.map +1 -0
  37. package/dist-server/controllers/operato/get-inventory-product-group.d.ts +14 -0
  38. package/dist-server/controllers/operato/get-inventory-product-group.js +21 -0
  39. package/dist-server/controllers/operato/get-inventory-product-group.js.map +1 -0
  40. package/dist-server/controllers/operato/get-outbound-order.d.ts +11 -0
  41. package/dist-server/controllers/operato/get-outbound-order.js +26 -0
  42. package/dist-server/controllers/operato/get-outbound-order.js.map +1 -0
  43. package/dist-server/controllers/operato/get-outbound-orders.d.ts +11 -0
  44. package/dist-server/controllers/operato/get-outbound-orders.js +24 -0
  45. package/dist-server/controllers/operato/get-outbound-orders.js.map +1 -0
  46. package/dist-server/controllers/operato/index.d.ts +1 -0
  47. package/dist-server/controllers/operato/index.js +33 -0
  48. package/dist-server/controllers/operato/index.js.map +1 -0
  49. package/dist-server/controllers/operato/operato.d.ts +15 -0
  50. package/dist-server/controllers/operato/operato.js +93 -0
  51. package/dist-server/controllers/operato/operato.js.map +1 -0
  52. package/dist-server/controllers/operato/platform-action.d.ts +12 -0
  53. package/dist-server/controllers/operato/platform-action.js +49 -0
  54. package/dist-server/controllers/operato/platform-action.js.map +1 -0
  55. package/dist-server/controllers/operato/update-release-order-details.d.ts +14 -0
  56. package/dist-server/controllers/operato/update-release-order-details.js +20 -0
  57. package/dist-server/controllers/operato/update-release-order-details.js.map +1 -0
  58. package/dist-server/entities/fulfillment-center.d.ts +24 -0
  59. package/dist-server/entities/fulfillment-center.js +97 -0
  60. package/dist-server/entities/fulfillment-center.js.map +1 -0
  61. package/dist-server/entities/index.d.ts +3 -0
  62. package/dist-server/entities/index.js +7 -0
  63. package/dist-server/entities/index.js.map +1 -0
  64. package/dist-server/graphql/index.d.ts +6 -0
  65. package/dist-server/graphql/index.js +11 -0
  66. package/dist-server/graphql/index.js.map +1 -0
  67. package/dist-server/graphql/resolvers/fulfillment-center/create-fulfillment-center.d.ts +5 -0
  68. package/dist-server/graphql/resolvers/fulfillment-center/create-fulfillment-center.js +11 -0
  69. package/dist-server/graphql/resolvers/fulfillment-center/create-fulfillment-center.js.map +1 -0
  70. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-center.d.ts +5 -0
  71. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-center.js +12 -0
  72. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-center.js.map +1 -0
  73. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-centers.d.ts +5 -0
  74. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-centers.js +16 -0
  75. package/dist-server/graphql/resolvers/fulfillment-center/delete-fulfillment-centers.js.map +1 -0
  76. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-center.d.ts +6 -0
  77. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-center.js +15 -0
  78. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-center.js.map +1 -0
  79. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-centers.d.ts +8 -0
  80. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-centers.js +18 -0
  81. package/dist-server/graphql/resolvers/fulfillment-center/fulfillment-centers.js.map +1 -0
  82. package/dist-server/graphql/resolvers/fulfillment-center/having-fulfillment-center.d.ts +5 -0
  83. package/dist-server/graphql/resolvers/fulfillment-center/having-fulfillment-center.js +20 -0
  84. package/dist-server/graphql/resolvers/fulfillment-center/having-fulfillment-center.js.map +1 -0
  85. package/dist-server/graphql/resolvers/fulfillment-center/index.d.ts +29 -0
  86. package/dist-server/graphql/resolvers/fulfillment-center/index.js +16 -0
  87. package/dist-server/graphql/resolvers/fulfillment-center/index.js.map +1 -0
  88. package/dist-server/graphql/resolvers/fulfillment-center/operato/deactivate-operato-center.d.ts +6 -0
  89. package/dist-server/graphql/resolvers/fulfillment-center/operato/deactivate-operato-center.js +46 -0
  90. package/dist-server/graphql/resolvers/fulfillment-center/operato/deactivate-operato-center.js.map +1 -0
  91. package/dist-server/graphql/resolvers/fulfillment-center/operato/generate-operato-access-token.d.ts +6 -0
  92. package/dist-server/graphql/resolvers/fulfillment-center/operato/generate-operato-access-token.js +51 -0
  93. package/dist-server/graphql/resolvers/fulfillment-center/operato/generate-operato-access-token.js.map +1 -0
  94. package/dist-server/graphql/resolvers/fulfillment-center/operato/get-operato-auth-url.d.ts +5 -0
  95. package/dist-server/graphql/resolvers/fulfillment-center/operato/get-operato-auth-url.js +14 -0
  96. package/dist-server/graphql/resolvers/fulfillment-center/operato/get-operato-auth-url.js.map +1 -0
  97. package/dist-server/graphql/resolvers/fulfillment-center/operato/index.d.ts +17 -0
  98. package/dist-server/graphql/resolvers/fulfillment-center/operato/index.js +10 -0
  99. package/dist-server/graphql/resolvers/fulfillment-center/operato/index.js.map +1 -0
  100. package/dist-server/graphql/resolvers/fulfillment-center/operato/refresh-operato-access-token.d.ts +5 -0
  101. package/dist-server/graphql/resolvers/fulfillment-center/operato/refresh-operato-access-token.js +46 -0
  102. package/dist-server/graphql/resolvers/fulfillment-center/operato/refresh-operato-access-token.js.map +1 -0
  103. package/dist-server/graphql/resolvers/fulfillment-center/update-fulfillment-center.d.ts +6 -0
  104. package/dist-server/graphql/resolvers/fulfillment-center/update-fulfillment-center.js +15 -0
  105. package/dist-server/graphql/resolvers/fulfillment-center/update-fulfillment-center.js.map +1 -0
  106. package/dist-server/graphql/resolvers/fulfillment-center/update-multiple-fulfillment-center.d.ts +5 -0
  107. package/dist-server/graphql/resolvers/fulfillment-center/update-multiple-fulfillment-center.js +30 -0
  108. package/dist-server/graphql/resolvers/fulfillment-center/update-multiple-fulfillment-center.js.map +1 -0
  109. package/dist-server/graphql/resolvers/index.d.ts +29 -0
  110. package/dist-server/graphql/resolvers/index.js +8 -0
  111. package/dist-server/graphql/resolvers/index.js.map +1 -0
  112. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-list.d.ts +1 -0
  113. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-list.js +12 -0
  114. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-list.js.map +1 -0
  115. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-patch.d.ts +1 -0
  116. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-patch.js +17 -0
  117. package/dist-server/graphql/types/fulfillment-center/fulfillment-center-patch.js.map +1 -0
  118. package/dist-server/graphql/types/fulfillment-center/fulfillment-center.d.ts +1 -0
  119. package/dist-server/graphql/types/fulfillment-center/fulfillment-center.js +23 -0
  120. package/dist-server/graphql/types/fulfillment-center/fulfillment-center.js.map +1 -0
  121. package/dist-server/graphql/types/fulfillment-center/index.d.ts +3 -0
  122. package/dist-server/graphql/types/fulfillment-center/index.js +53 -0
  123. package/dist-server/graphql/types/fulfillment-center/index.js.map +1 -0
  124. package/dist-server/graphql/types/fulfillment-center/new-fulfillment-center.d.ts +1 -0
  125. package/dist-server/graphql/types/fulfillment-center/new-fulfillment-center.js +15 -0
  126. package/dist-server/graphql/types/fulfillment-center/new-fulfillment-center.js.map +1 -0
  127. package/dist-server/graphql/types/index.d.ts +4 -0
  128. package/dist-server/graphql/types/index.js +10 -0
  129. package/dist-server/graphql/types/index.js.map +1 -0
  130. package/dist-server/index.d.ts +5 -0
  131. package/dist-server/index.js +9 -0
  132. package/dist-server/index.js.map +1 -0
  133. package/dist-server/migrations/index.d.ts +1 -0
  134. package/dist-server/migrations/index.js +12 -0
  135. package/dist-server/migrations/index.js.map +1 -0
  136. package/dist-server/routes.d.ts +1 -0
  137. package/dist-server/routes.js +19 -0
  138. package/dist-server/routes.js.map +1 -0
  139. package/dist-server/tsconfig.tsbuildinfo +1 -0
  140. package/package.json +11 -11
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOutboundOrder = getOutboundOrder;
4
+ function getOutboundOrder() {
5
+ return {
6
+ method: 'get',
7
+ path: '/unstable/warehouse/{warehouseId}/get-release-order-detail',
8
+ denormalize(req) {
9
+ var { customerBizplaceId, refNo, releaseOrderNo } = req;
10
+ let param = {};
11
+ if (releaseOrderNo)
12
+ param.releaseOrderNo = releaseOrderNo;
13
+ if (refNo)
14
+ param.refNo = refNo;
15
+ return {
16
+ resource: { warehouseId: customerBizplaceId },
17
+ payload: Object.assign({}, param)
18
+ };
19
+ },
20
+ normalize(res) {
21
+ const { releaseGoodDetail } = res.result;
22
+ return releaseGoodDetail;
23
+ }
24
+ };
25
+ }
26
+ //# sourceMappingURL=get-outbound-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-outbound-order.js","sourceRoot":"","sources":["../../../server/controllers/operato/get-outbound-order.ts"],"names":[],"mappings":";;AAAA,4CAqBC;AArBD,SAAgB,gBAAgB;IAC9B,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,4DAA4D;QAClE,WAAW,CAAC,GAAG;YACb,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,GAAG,CAAA;YACvD,IAAI,KAAK,GAAQ,EAAE,CAAA;YAEnB,IAAI,cAAc;gBAAE,KAAK,CAAC,cAAc,GAAG,cAAc,CAAA;YACzD,IAAI,KAAK;gBAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;YAE9B,OAAO;gBACL,QAAQ,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE;gBAC7C,OAAO,oBAAO,KAAK,CAAE;aACtB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,MAAM,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;YACxC,OAAO,iBAAiB,CAAA;QAC1B,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getOutboundOrder() {\n return {\n method: 'get',\n path: '/unstable/warehouse/{warehouseId}/get-release-order-detail',\n denormalize(req) {\n var { customerBizplaceId, refNo, releaseOrderNo } = req\n let param: any = {}\n\n if (releaseOrderNo) param.releaseOrderNo = releaseOrderNo\n if (refNo) param.refNo = refNo\n\n return {\n resource: { warehouseId: customerBizplaceId },\n payload: { ...param }\n }\n },\n normalize(res) {\n const { releaseGoodDetail } = res.result\n return releaseGoodDetail\n }\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export declare function getOutboundOrders(): {
2
+ method: string;
3
+ path: string;
4
+ denormalize(req: any): {
5
+ resource: {
6
+ warehouseId: any;
7
+ };
8
+ payload: any;
9
+ };
10
+ normalize(res: any): any;
11
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOutboundOrders = getOutboundOrders;
4
+ function getOutboundOrders() {
5
+ return {
6
+ method: 'get',
7
+ path: '/unstable/warehouse/{warehouseId}/get-release-order-list',
8
+ denormalize(req) {
9
+ var { customerBizplaceId, refNo } = req;
10
+ let param = {};
11
+ if (refNo)
12
+ param.refNo = refNo;
13
+ return {
14
+ resource: { warehouseId: customerBizplaceId },
15
+ payload: Object.assign({}, param)
16
+ };
17
+ },
18
+ normalize(res) {
19
+ const { releaseGoods } = res.result;
20
+ return releaseGoods;
21
+ }
22
+ };
23
+ }
24
+ //# sourceMappingURL=get-outbound-orders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-outbound-orders.js","sourceRoot":"","sources":["../../../server/controllers/operato/get-outbound-orders.ts"],"names":[],"mappings":";;AAAA,8CAoBC;AApBD,SAAgB,iBAAiB;IAC/B,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,0DAA0D;QAChE,WAAW,CAAC,GAAG;YACb,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,GAAG,CAAA;YACvC,IAAI,KAAK,GAAQ,EAAE,CAAA;YAEnB,IAAI,KAAK;gBAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;YAE9B,OAAO;gBACL,QAAQ,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE;gBAC7C,OAAO,oBAAO,KAAK,CAAE;aACtB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;YACnC,OAAO,YAAY,CAAA;QACrB,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getOutboundOrders() {\n return {\n method: 'get',\n path: '/unstable/warehouse/{warehouseId}/get-release-order-list',\n denormalize(req) {\n var { customerBizplaceId, refNo } = req\n let param: any = {}\n\n if (refNo) param.refNo = refNo\n\n return {\n resource: { warehouseId: customerBizplaceId },\n payload: { ...param }\n }\n },\n normalize(res) {\n const { releaseGoods } = res.result\n return releaseGoods\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './operato';
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fulfillment_api_1 = require("../fulfillment-api");
5
+ const cancel_release_order_1 = require("./cancel-release-order");
6
+ const create_inbound_order_1 = require("./create-inbound-order");
7
+ const create_outbound_order_1 = require("./create-outbound-order");
8
+ const create_sales_invoice_1 = require("./create-sales-invoice");
9
+ const echo_1 = require("./echo");
10
+ const get_center_products_1 = require("./get-center-products");
11
+ const get_inbound_order_1 = require("./get-inbound-order");
12
+ const get_inventory_product_group_1 = require("./get-inventory-product-group");
13
+ const get_inventory_product_group_open_api_1 = require("./get-inventory-product-group-open-api");
14
+ const get_outbound_order_1 = require("./get-outbound-order");
15
+ const get_outbound_orders_1 = require("./get-outbound-orders");
16
+ const platform_action_1 = require("./platform-action");
17
+ const update_release_order_details_1 = require("./update-release-order-details");
18
+ tslib_1.__exportStar(require("./operato"), exports);
19
+ fulfillment_api_1.FulfillmentAPI.registerPlatform('operato', platform_action_1.action, {
20
+ echo: echo_1.echo,
21
+ getCenterProducts: get_center_products_1.getCenterProducts,
22
+ getInventoryProductGroup: get_inventory_product_group_1.getInventoryProductGroup,
23
+ getInboundOrder: get_inbound_order_1.getInboundOrder,
24
+ getOutboundOrder: get_outbound_order_1.getOutboundOrder,
25
+ getOutboundOrders: get_outbound_orders_1.getOutboundOrders,
26
+ getInventoryProductGroupOpenAPI: get_inventory_product_group_open_api_1.getInventoryProductGroupOpenAPI,
27
+ createSalesInvoice: create_sales_invoice_1.createSalesInvoice,
28
+ createOutboundOrder: create_outbound_order_1.createOutboundOrder,
29
+ createInboundOrder: create_inbound_order_1.createInboundOrder,
30
+ cancelReleaseOrder: cancel_release_order_1.cancelReleaseOrder,
31
+ updateReleaseGoodDetails: update_release_order_details_1.updateReleaseGoodDetails
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/operato/index.ts"],"names":[],"mappings":";;;AAAA,wDAAmD;AACnD,iEAA2D;AAC3D,iEAA2D;AAC3D,mEAA6D;AAC7D,iEAA2D;AAC3D,iCAA6B;AAC7B,+DAAyD;AACzD,2DAAqD;AACrD,+EAAwE;AACxE,iGAAwF;AACxF,6DAAuD;AACvD,+DAAyD;AACzD,uDAA0C;AAC1C,iFAAyE;AAEzE,oDAAyB;AAEzB,gCAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,wBAAM,EAAE;IACjD,IAAI,EAAJ,WAAI;IACJ,iBAAiB,EAAjB,uCAAiB;IACjB,wBAAwB,EAAxB,sDAAwB;IACxB,eAAe,EAAf,mCAAe;IACf,gBAAgB,EAAhB,qCAAgB;IAChB,iBAAiB,EAAjB,uCAAiB;IACjB,+BAA+B,EAA/B,sEAA+B;IAC/B,kBAAkB,EAAlB,yCAAkB;IAClB,mBAAmB,EAAnB,2CAAmB;IACnB,kBAAkB,EAAlB,yCAAkB;IAClB,kBAAkB,EAAlB,yCAAkB;IAClB,wBAAwB,EAAxB,uDAAwB;CACzB,CAAC,CAAA","sourcesContent":["import { FulfillmentAPI } from '../fulfillment-api'\nimport { cancelReleaseOrder } from './cancel-release-order'\nimport { createInboundOrder } from './create-inbound-order'\nimport { createOutboundOrder } from './create-outbound-order'\nimport { createSalesInvoice } from './create-sales-invoice'\nimport { echo } from './echo'\nimport { getCenterProducts } from './get-center-products'\nimport { getInboundOrder } from './get-inbound-order'\nimport { getInventoryProductGroup } from './get-inventory-product-group'\nimport { getInventoryProductGroupOpenAPI } from './get-inventory-product-group-open-api'\nimport { getOutboundOrder } from './get-outbound-order'\nimport { getOutboundOrders } from './get-outbound-orders'\nimport { action } from './platform-action'\nimport { updateReleaseGoodDetails } from './update-release-order-details'\n\nexport * from './operato'\n\nFulfillmentAPI.registerPlatform('operato', action, {\n echo,\n getCenterProducts,\n getInventoryProductGroup,\n getInboundOrder,\n getOutboundOrder,\n getOutboundOrders,\n getInventoryProductGroupOpenAPI,\n createSalesInvoice,\n createOutboundOrder,\n createInboundOrder,\n cancelReleaseOrder,\n updateReleaseGoodDetails\n})\n"]}
@@ -0,0 +1,15 @@
1
+ export type OperatoConfig = {
2
+ appKey: string;
3
+ appSecret: string;
4
+ center?: string;
5
+ accessToken?: string;
6
+ redirectUrl?: string;
7
+ };
8
+ export declare class Operato {
9
+ private config;
10
+ constructor(config: OperatoConfig);
11
+ buildAuthURL(state: any): string;
12
+ get(center: any, path: string, data: any): Promise<any>;
13
+ post(center: any, path: string, data?: any): Promise<any>;
14
+ static refreshAccessToken(fulfillmentCenter: any): Promise<any>;
15
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Operato = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
+ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
7
+ const env_1 = require("@things-factory/env");
8
+ const shell_1 = require("@things-factory/shell");
9
+ const utils_1 = require("@things-factory/utils");
10
+ const entities_1 = require("../../entities");
11
+ const { protocol = 'https', host, callback } = env_1.config.get('fulfillmentIntegrationOperato', {});
12
+ const debug = (0, debug_1.default)('things-factory:integration-fulfillment:operato');
13
+ class Operato {
14
+ constructor(config) {
15
+ this.config = Object.assign({}, config);
16
+ }
17
+ buildAuthURL(state) {
18
+ // TODO make scopes properly
19
+ const { appKey, redirectUrl } = this.config;
20
+ // return `http://${center}.${host}/oauth/authorize?response_type=code&client_id=${appKey}&scope=${scopes}&redirect_uri=${redirectUrl}&state=${state}`
21
+ return `${protocol}://${host}/oauth/authorize?response_type=code&client_id=${appKey}&scope=warehouse&redirect_uri=${redirectUrl}&state=${state}`;
22
+ }
23
+ async get(center, path, data) {
24
+ const qs = Object.entries(data)
25
+ .map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`)
26
+ .join('&');
27
+ const endpoint = `${protocol}://${host}/api${path}${qs ? '?' + qs : ''}`;
28
+ debug('endpoint', endpoint);
29
+ const response = await (0, node_fetch_1.default)(endpoint, {
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ 'x-access-token': center.accessToken,
33
+ 'x-things-factory-domain': center.centerId
34
+ }
35
+ });
36
+ const result = await response.json();
37
+ debug('response result', result);
38
+ return result;
39
+ }
40
+ async post(center, path, data = {}) {
41
+ debug('data', data);
42
+ const jsondata = JSON.stringify(data);
43
+ const endpoint = `${protocol}://${host}/api${path}`;
44
+ const response = await (0, node_fetch_1.default)(endpoint, {
45
+ method: 'post',
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ 'x-access-token': center.accessToken,
49
+ 'x-things-factory-domain': center.centerId
50
+ },
51
+ body: jsondata
52
+ });
53
+ if (response.ok) {
54
+ return await response.json();
55
+ }
56
+ else {
57
+ const text = await response.text();
58
+ debug('response result', text);
59
+ throw response;
60
+ }
61
+ }
62
+ static async refreshAccessToken(fulfillmentCenter) {
63
+ const requestBody = {
64
+ refreshToken: fulfillmentCenter.refreshToken
65
+ };
66
+ const refreshResponse = await (0, node_fetch_1.default)(`${protocol}://${host}/oauth/refresh-token`, {
67
+ method: 'post',
68
+ headers: {
69
+ 'Content-Type': 'application/json'
70
+ },
71
+ body: JSON.stringify(requestBody)
72
+ });
73
+ if (!refreshResponse.ok) {
74
+ throw new Error(`get operato information failed: ${await refreshResponse.text()}`);
75
+ }
76
+ const body = await refreshResponse.json();
77
+ const { accessToken /* token used to call the API */, id_token /* token containing user identity details (only returned if OpenID Connect scopes are requested) */, expires_in /* amount of seconds until the access token expires */, token_type: tokenType /* must be Bearer */, refreshToken
78
+ /* token used to refresh the access token once it has expired (only returned if the offline_access scope is requested).
79
+ */
80
+ } = body;
81
+ const { exp } = (0, utils_1.parseJwt)(accessToken);
82
+ var patch = {
83
+ accessToken,
84
+ refreshToken,
85
+ tokenType,
86
+ expiresIn: new Date(exp * 1000)
87
+ };
88
+ const repository = (0, shell_1.getRepository)(entities_1.FulfillmentCenter);
89
+ return await repository.save(Object.assign(Object.assign({}, fulfillmentCenter), patch));
90
+ }
91
+ }
92
+ exports.Operato = Operato;
93
+ //# sourceMappingURL=operato.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operato.js","sourceRoot":"","sources":["../../../server/controllers/operato/operato.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AACzB,oEAA8B;AAE9B,6CAA4C;AAC5C,iDAAqD;AACrD,iDAAgD;AAEhD,6CAAkD;AAElD,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,YAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAA;AAE9F,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gDAAgD,CAAC,CAAA;AAUrE,MAAa,OAAO;IAGlB,YAAY,MAAqB;QAC/B,IAAI,CAA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,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;QACzC,MAAM,EACJ,WAAW,CAAC,gCAAgC,EAC5C,QAAQ,CAAC,mGAAmG,EAC5G,UAAU,CAAC,sDAAsD,EACjE,UAAU,EAAE,SAAS,CAAC,oBAAoB,EAC1C,YAAY;QACZ;WACG;UACJ,GAAG,IAAI,CAAA;QAER,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,gBAAQ,EAAC,WAAW,CAAC,CAAA;QAErC,IAAI,KAAK,GAAG;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;SAChC,CAAA;QAED,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,4BAAiB,CAAC,CAAA;QAEnD,OAAO,MAAM,UAAU,CAAC,IAAI,iCACvB,iBAAiB,GACjB,KAAK,EACR,CAAA;IACJ,CAAC;CACF;AA5GD,0BA4GC","sourcesContent":["import Debug from 'debug'\nimport fetch from 'node-fetch'\n\nimport { config } from '@things-factory/env'\nimport { getRepository } from '@things-factory/shell'\nimport { parseJwt } from '@things-factory/utils'\n\nimport { FulfillmentCenter } from '../../entities'\n\nconst { protocol = 'https', host, callback } = config.get('fulfillmentIntegrationOperato', {})\n\nconst debug = Debug('things-factory:integration-fulfillment:operato')\n\nexport type OperatoConfig = {\n appKey: string\n appSecret: string\n center?: string\n accessToken?: string\n redirectUrl?: string\n}\n\nexport class Operato {\n private config: OperatoConfig\n\n constructor(config: OperatoConfig) {\n this.config = {\n ...config\n }\n }\n\n buildAuthURL(state) {\n // TODO make scopes properly\n const { appKey, redirectUrl } = this.config\n // return `http://${center}.${host}/oauth/authorize?response_type=code&client_id=${appKey}&scope=${scopes}&redirect_uri=${redirectUrl}&state=${state}`\n return `${protocol}://${host}/oauth/authorize?response_type=code&client_id=${appKey}&scope=warehouse&redirect_uri=${redirectUrl}&state=${state}`\n }\n\n async get(center: any, path: string, data: any) {\n const qs = Object.entries(data)\n .map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`)\n .join('&')\n\n const endpoint = `${protocol}://${host}/api${path}${qs ? '?' + qs : ''}`\n debug('endpoint', endpoint)\n\n const response = await fetch(endpoint, {\n headers: {\n 'Content-Type': 'application/json',\n 'x-access-token': center.accessToken,\n 'x-things-factory-domain': center.centerId\n }\n })\n\n const result = await response.json()\n debug('response result', result)\n\n return result\n }\n\n async post(center: any, path: string, data: any = {}) {\n debug('data', data)\n\n const jsondata = JSON.stringify(data)\n\n const endpoint = `${protocol}://${host}/api${path}`\n\n const response = await fetch(endpoint, {\n method: 'post',\n headers: {\n 'Content-Type': 'application/json',\n 'x-access-token': center.accessToken,\n 'x-things-factory-domain': center.centerId\n },\n body: jsondata\n })\n\n if (response.ok) {\n return await response.json()\n } else {\n const text = await response.text()\n debug('response result', text)\n throw response\n }\n }\n\n public static async refreshAccessToken(fulfillmentCenter) {\n const requestBody = {\n refreshToken: fulfillmentCenter.refreshToken\n }\n\n const refreshResponse = await fetch(`${protocol}://${host}/oauth/refresh-token`, {\n method: 'post',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(requestBody)\n })\n\n if (!refreshResponse.ok) {\n throw new Error(`get operato information failed: ${await refreshResponse.text()}`)\n }\n\n const body = await refreshResponse.json()\n const {\n accessToken /* token used to call the API */,\n id_token /* token containing user identity details (only returned if OpenID Connect scopes are requested) */,\n expires_in /* amount of seconds until the access token expires */,\n token_type: tokenType /* must be Bearer */,\n refreshToken\n /* token used to refresh the access token once it has expired (only returned if the offline_access scope is requested).\n */\n } = body\n\n const { exp } = parseJwt(accessToken)\n\n var patch = {\n accessToken,\n refreshToken,\n tokenType,\n expiresIn: new Date(exp * 1000)\n }\n\n const repository = getRepository(FulfillmentCenter)\n\n return await repository.save({\n ...fulfillmentCenter,\n ...patch\n })\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export declare const _action: ({ center, method, path, request }: {
2
+ center: any;
3
+ method?: string;
4
+ path: any;
5
+ request: any;
6
+ }) => Promise<any>;
7
+ export declare const action: ({ center, method, path, request }: {
8
+ center: any;
9
+ method?: string;
10
+ path: any;
11
+ request: any;
12
+ }) => Promise<any>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.action = exports._action = void 0;
4
+ const operato_1 = require("./operato");
5
+ const env_1 = require("@things-factory/env");
6
+ const operatoConfig = env_1.config.get('fulfillmentIntegrationOperato', {});
7
+ const { appKey, appSecret } = operatoConfig;
8
+ function substitute(path, obj) {
9
+ var props = [];
10
+ var re = /{([^}]+)}/g;
11
+ var text;
12
+ while ((text = re.exec(path))) {
13
+ props.push(text[1]);
14
+ }
15
+ var result = path;
16
+ props.forEach(prop => {
17
+ let value = obj[prop.trim()];
18
+ result = result.replace(`{${prop}}`, value === undefined ? '' : value);
19
+ });
20
+ return result;
21
+ }
22
+ const _action = async ({ center, method = 'get', path, request }) => {
23
+ const client = new operato_1.Operato({
24
+ center: center.centerId,
25
+ appKey,
26
+ appSecret,
27
+ accessToken: center.accessToken
28
+ });
29
+ const { resource = {}, payload = {} } = request;
30
+ path = substitute(path, resource);
31
+ return await client[method](center, path, payload);
32
+ };
33
+ exports._action = _action;
34
+ const action = async ({ center, method = 'get', path, request }) => {
35
+ try {
36
+ return await (0, exports._action)({ center, method, path, request });
37
+ }
38
+ catch (ex) {
39
+ if (ex.status === 401) {
40
+ var refreshed = await operato_1.Operato.refreshAccessToken(center);
41
+ return await (0, exports._action)({ center: refreshed, method, path, request });
42
+ }
43
+ else {
44
+ throw ex;
45
+ }
46
+ }
47
+ };
48
+ exports.action = action;
49
+ //# sourceMappingURL=platform-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-action.js","sourceRoot":"","sources":["../../../server/controllers/operato/platform-action.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEnC,6CAA4C;AAC5C,MAAM,aAAa,GAAG,YAAM,CAAC,GAAG,CAAC,+BAA+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I,EAAE,OAAO,CAAC,CAAA;AACpD,CAAC,CAAA;AAbY,QAAA,OAAO,WAanB;AAEM,MAAM,MAAM,GAAG,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACxE,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,eAAO,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACzD,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACtB,IAAI,SAAS,GAAG,MAAM,iBAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;YACxD,OAAO,MAAM,IAAA,eAAO,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;QACpE,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,CAAA;QACV,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB","sourcesContent":["import { Operato } from './operato'\n\nimport { config } from '@things-factory/env'\nconst operatoConfig = config.get('fulfillmentIntegrationOperato', {})\nconst { appKey, appSecret } = operatoConfig\n\nfunction substitute(path, obj) {\n var props = []\n var re = /{([^}]+)}/g\n var text\n\n while ((text = re.exec(path))) {\n props.push(text[1])\n }\n\n var result = path\n props.forEach(prop => {\n let value = obj[prop.trim()]\n result = result.replace(`{${prop}}`, value === undefined ? '' : value)\n })\n\n return result\n}\n\nexport const _action = async ({ center, method = 'get', path, request }) => {\n const client = new Operato({\n center: center.centerId,\n appKey,\n appSecret,\n accessToken: center.accessToken\n })\n\n const { resource = {}, payload = {} } = request\n\n path = substitute(path, resource)\n\n return await client[method](center, path, payload)\n}\n\nexport const action = async ({ center, method = 'get', path, request }) => {\n try {\n return await _action({ center, method, path, request })\n } catch (ex) {\n if (ex.status === 401) {\n var refreshed = await Operato.refreshAccessToken(center)\n return await _action({ center: refreshed, method, path, request })\n } else {\n throw ex\n }\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ export declare function updateReleaseGoodDetails(): {
2
+ method: string;
3
+ path: string;
4
+ denormalize(req: any): {
5
+ payload: {
6
+ releaseOrder: any;
7
+ shippingOrder: any;
8
+ };
9
+ resource: {
10
+ warehouseId: any;
11
+ };
12
+ };
13
+ normalize(res: any): any;
14
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateReleaseGoodDetails = updateReleaseGoodDetails;
4
+ function updateReleaseGoodDetails() {
5
+ return {
6
+ method: 'post',
7
+ path: '/unstable/warehouse/{warehouseId}/update-release-order-details',
8
+ denormalize(req) {
9
+ var { customerBizplaceId, releaseOrder, shippingOrder } = req;
10
+ return {
11
+ payload: { releaseOrder, shippingOrder },
12
+ resource: { warehouseId: customerBizplaceId }
13
+ };
14
+ },
15
+ normalize(res) {
16
+ return res;
17
+ }
18
+ };
19
+ }
20
+ //# sourceMappingURL=update-release-order-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-release-order-details.js","sourceRoot":"","sources":["../../../server/controllers/operato/update-release-order-details.ts"],"names":[],"mappings":";;AAAA,4DAgBC;AAhBD,SAAgB,wBAAwB;IACtC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,gEAAgE;QACtE,WAAW,CAAC,GAAG;YACb,IAAI,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,GAAG,CAAA;YAE7D,OAAO;gBACL,OAAO,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE;gBACxC,QAAQ,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE;aAC9C,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function updateReleaseGoodDetails() {\n return {\n method: 'post',\n path: '/unstable/warehouse/{warehouseId}/update-release-order-details',\n denormalize(req) {\n var { customerBizplaceId, releaseOrder, shippingOrder } = req\n\n return {\n payload: { releaseOrder, shippingOrder },\n resource: { warehouseId: customerBizplaceId }\n }\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain } from '@things-factory/shell';
3
+ export declare const enum FulfillmentCenterStatus {
4
+ Active = "active",
5
+ Inactive = "inactive"
6
+ }
7
+ export declare class FulfillmentCenter {
8
+ id: string;
9
+ domain: Domain;
10
+ platform: string;
11
+ centerId: string;
12
+ countryCode: string;
13
+ status: string;
14
+ name: string;
15
+ accessInfo: string;
16
+ accessToken: string;
17
+ refreshToken: string;
18
+ account: string;
19
+ description: string;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ creator: User;
23
+ updater: User;
24
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FulfillmentCenter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const auth_base_1 = require("@things-factory/auth-base");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const typeorm_1 = require("typeorm");
8
+ let FulfillmentCenter = class FulfillmentCenter {
9
+ };
10
+ exports.FulfillmentCenter = FulfillmentCenter;
11
+ tslib_1.__decorate([
12
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
13
+ tslib_1.__metadata("design:type", String)
14
+ ], FulfillmentCenter.prototype, "id", void 0);
15
+ tslib_1.__decorate([
16
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
17
+ tslib_1.__metadata("design:type", shell_1.Domain)
18
+ ], FulfillmentCenter.prototype, "domain", void 0);
19
+ tslib_1.__decorate([
20
+ (0, typeorm_1.Column)(),
21
+ tslib_1.__metadata("design:type", String)
22
+ ], FulfillmentCenter.prototype, "platform", void 0);
23
+ tslib_1.__decorate([
24
+ (0, typeorm_1.Column)({
25
+ nullable: true
26
+ }),
27
+ tslib_1.__metadata("design:type", String)
28
+ ], FulfillmentCenter.prototype, "centerId", void 0);
29
+ tslib_1.__decorate([
30
+ (0, typeorm_1.Column)(),
31
+ tslib_1.__metadata("design:type", String)
32
+ ], FulfillmentCenter.prototype, "countryCode", void 0);
33
+ tslib_1.__decorate([
34
+ (0, typeorm_1.Column)({
35
+ nullable: true
36
+ }),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], FulfillmentCenter.prototype, "status", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.Column)(),
41
+ tslib_1.__metadata("design:type", String)
42
+ ], FulfillmentCenter.prototype, "name", void 0);
43
+ tslib_1.__decorate([
44
+ (0, typeorm_1.Column)({
45
+ nullable: true
46
+ }),
47
+ tslib_1.__metadata("design:type", String)
48
+ ], FulfillmentCenter.prototype, "accessInfo", void 0);
49
+ tslib_1.__decorate([
50
+ (0, typeorm_1.Column)({
51
+ nullable: true
52
+ }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], FulfillmentCenter.prototype, "accessToken", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.Column)({
57
+ nullable: true
58
+ }),
59
+ tslib_1.__metadata("design:type", String)
60
+ ], FulfillmentCenter.prototype, "refreshToken", void 0);
61
+ tslib_1.__decorate([
62
+ (0, typeorm_1.Column)({
63
+ nullable: true
64
+ }),
65
+ tslib_1.__metadata("design:type", String)
66
+ ], FulfillmentCenter.prototype, "account", void 0);
67
+ tslib_1.__decorate([
68
+ (0, typeorm_1.Column)({
69
+ nullable: true
70
+ }),
71
+ tslib_1.__metadata("design:type", String)
72
+ ], FulfillmentCenter.prototype, "description", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.CreateDateColumn)(),
75
+ tslib_1.__metadata("design:type", Date)
76
+ ], FulfillmentCenter.prototype, "createdAt", void 0);
77
+ tslib_1.__decorate([
78
+ (0, typeorm_1.UpdateDateColumn)(),
79
+ tslib_1.__metadata("design:type", Date)
80
+ ], FulfillmentCenter.prototype, "updatedAt", void 0);
81
+ tslib_1.__decorate([
82
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
83
+ nullable: true
84
+ }),
85
+ tslib_1.__metadata("design:type", auth_base_1.User)
86
+ ], FulfillmentCenter.prototype, "creator", void 0);
87
+ tslib_1.__decorate([
88
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
89
+ nullable: true
90
+ }),
91
+ tslib_1.__metadata("design:type", auth_base_1.User)
92
+ ], FulfillmentCenter.prototype, "updater", void 0);
93
+ exports.FulfillmentCenter = FulfillmentCenter = tslib_1.__decorate([
94
+ (0, typeorm_1.Entity)(),
95
+ (0, typeorm_1.Index)('ix_fulfillment-center_0', (fulfillmentCenter) => [fulfillmentCenter.domain, fulfillmentCenter.name], { unique: true })
96
+ ], FulfillmentCenter);
97
+ //# sourceMappingURL=fulfillment-center.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfillment-center.js","sourceRoot":"","sources":["../../server/entities/fulfillment-center.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,iDAA8C;AAC9C,qCAAsH;AAa/G,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAkE7B,CAAA;AAlEY,8CAAiB;AAE5B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;6CACrB;AAGV;IADC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCAClB,cAAM;iDAAA;AAGd;IADC,IAAA,gBAAM,GAAE;;mDACO;AAKhB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;mDACc;AAGhB;IADC,IAAA,gBAAM,GAAE;;sDACU;AAKnB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;iDACY;AAGd;IADC,IAAA,gBAAM,GAAE;;+CACG;AAKZ;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;qDACgB;AAKlB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;sDACiB;AAKnB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;uDACkB;AAKpB;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;kDACa;AAKf;IAHC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;;sDACiB;AAGnB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;oDAAA;AAGf;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;oDAAA;AAKf;IAHC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;sCACO,gBAAI;kDAAA;AAKb;IAHC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;sCACO,gBAAI;kDAAA;4BAjEF,iBAAiB;IAN7B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,yBAAyB,EACzB,CAAC,iBAAoC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAC5F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;GACY,iBAAiB,CAkE7B","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\nimport { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'\n\nexport const enum FulfillmentCenterStatus {\n Active = 'active',\n Inactive = 'inactive'\n}\n\n@Entity()\n@Index(\n 'ix_fulfillment-center_0',\n (fulfillmentCenter: FulfillmentCenter) => [fulfillmentCenter.domain, fulfillmentCenter.name],\n { unique: true }\n)\nexport class FulfillmentCenter {\n @PrimaryGeneratedColumn('uuid')\n id: string\n\n @ManyToOne(type => Domain)\n domain: Domain\n\n @Column()\n platform: string\n\n @Column({\n nullable: true\n })\n centerId: string\n\n @Column()\n countryCode: string\n\n @Column({\n nullable: true\n })\n status: string\n\n @Column()\n name: string\n\n @Column({\n nullable: true\n })\n accessInfo: string\n\n @Column({\n nullable: true\n })\n accessToken: string\n\n @Column({\n nullable: true\n })\n refreshToken: string\n\n @Column({\n nullable: true\n })\n account: string\n\n @Column({\n nullable: true\n })\n description: string\n\n @CreateDateColumn()\n createdAt: Date\n\n @UpdateDateColumn()\n updatedAt: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n creator: User\n\n @ManyToOne(type => User, {\n nullable: true\n })\n updater: User\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { FulfillmentCenter, FulfillmentCenterStatus } from './fulfillment-center';
2
+ export declare const entities: (typeof FulfillmentCenter)[];
3
+ export { FulfillmentCenter, FulfillmentCenterStatus };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FulfillmentCenter = exports.entities = void 0;
4
+ const fulfillment_center_1 = require("./fulfillment-center");
5
+ Object.defineProperty(exports, "FulfillmentCenter", { enumerable: true, get: function () { return fulfillment_center_1.FulfillmentCenter; } });
6
+ exports.entities = [fulfillment_center_1.FulfillmentCenter];
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/entities/index.ts"],"names":[],"mappings":";;;AAAA,6DAAiF;AAIxE,kGAJA,sCAAiB,OAIA;AAFb,QAAA,QAAQ,GAAG,CAAC,sCAAiB,CAAC,CAAA","sourcesContent":["import { FulfillmentCenter, FulfillmentCenterStatus } from './fulfillment-center'\n\nexport const entities = [FulfillmentCenter]\n\nexport { FulfillmentCenter, FulfillmentCenterStatus }\n"]}
@@ -0,0 +1,6 @@
1
+ import * as typeDefs from './types';
2
+ import * as resolvers from './resolvers';
3
+ export declare const schema: {
4
+ typeDefs: typeof typeDefs;
5
+ resolvers: typeof resolvers;
6
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schema = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeDefs = tslib_1.__importStar(require("./types"));
6
+ const resolvers = tslib_1.__importStar(require("./resolvers"));
7
+ exports.schema = {
8
+ typeDefs,
9
+ resolvers
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/graphql/index.ts"],"names":[],"mappings":";;;;AAAA,0DAAmC;AACnC,+DAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,QAAQ;IACR,SAAS;CACV,CAAA","sourcesContent":["import * as typeDefs from './types'\nimport * as resolvers from './resolvers'\n\nexport const schema = {\n typeDefs,\n resolvers\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const createFulfillmentCenter: {
2
+ createFulfillmentCenter(_: any, { fulfillmentCenter }: {
3
+ fulfillmentCenter: any;
4
+ }, context: ResolverContext): Promise<any>;
5
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFulfillmentCenter = void 0;
4
+ const shell_1 = require("@things-factory/shell");
5
+ const entities_1 = require("../../../entities");
6
+ exports.createFulfillmentCenter = {
7
+ async createFulfillmentCenter(_, { fulfillmentCenter }, context) {
8
+ return await (0, shell_1.getRepository)(entities_1.FulfillmentCenter).save(Object.assign(Object.assign({}, fulfillmentCenter), { domain: context.state.domain, creator: context.state.user, updater: context.state.user }));
9
+ }
10
+ };
11
+ //# sourceMappingURL=create-fulfillment-center.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-fulfillment-center.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/fulfillment-center/create-fulfillment-center.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,gDAAqD;AAExC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,uBAAuB,CAAC,CAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,OAAwB;QACnF,OAAO,MAAM,IAAA,qBAAa,EAAC,4BAAiB,CAAC,CAAC,IAAI,iCAC7C,iBAAiB,KACpB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAC5B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAC3B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { FulfillmentCenter } from '../../../entities'\n\nexport const createFulfillmentCenter = {\n async createFulfillmentCenter(_: any, { fulfillmentCenter }, context: ResolverContext) {\n return await getRepository(FulfillmentCenter).save({\n ...fulfillmentCenter,\n domain: context.state.domain,\n creator: context.state.user,\n updater: context.state.user\n })\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const deleteFulfillmentCenter: {
2
+ deleteFulfillmentCenter(_: any, { name }: {
3
+ name: any;
4
+ }, context: ResolverContext): Promise<boolean>;
5
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteFulfillmentCenter = void 0;
4
+ const shell_1 = require("@things-factory/shell");
5
+ const entities_1 = require("../../../entities");
6
+ exports.deleteFulfillmentCenter = {
7
+ async deleteFulfillmentCenter(_, { name }, context) {
8
+ await (0, shell_1.getRepository)(entities_1.FulfillmentCenter).delete({ domain: { id: context.state.domain.id }, name });
9
+ return true;
10
+ }
11
+ };
12
+ //# sourceMappingURL=delete-fulfillment-center.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-fulfillment-center.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/fulfillment-center/delete-fulfillment-center.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,gDAAqD;AAExC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,uBAAuB,CAAC,CAAM,EAAE,EAAE,IAAI,EAAE,EAAE,OAAwB;QACtE,MAAM,IAAA,qBAAa,EAAC,4BAAiB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;QAChG,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { FulfillmentCenter } from '../../../entities'\n\nexport const deleteFulfillmentCenter = {\n async deleteFulfillmentCenter(_: any, { name }, context: ResolverContext) {\n await getRepository(FulfillmentCenter).delete({ domain: { id: context.state.domain.id }, name })\n return true\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const deleteFulfillmentCenters: {
2
+ deleteFulfillmentCenters(_: any, { ids }: {
3
+ ids: any;
4
+ }, context: ResolverContext): Promise<boolean>;
5
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteFulfillmentCenters = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const shell_1 = require("@things-factory/shell");
6
+ const entities_1 = require("../../../entities");
7
+ exports.deleteFulfillmentCenters = {
8
+ async deleteFulfillmentCenters(_, { ids }, context) {
9
+ await (0, shell_1.getRepository)(entities_1.FulfillmentCenter).delete({
10
+ domain: { id: context.state.domain.id },
11
+ id: (0, typeorm_1.In)(ids)
12
+ });
13
+ return true;
14
+ }
15
+ };
16
+ //# sourceMappingURL=delete-fulfillment-centers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-fulfillment-centers.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/fulfillment-center/delete-fulfillment-centers.ts"],"names":[],"mappings":";;;AAAA,qCAA4B;AAE5B,iDAAqD;AAErD,gDAAqD;AAExC,QAAA,wBAAwB,GAAG;IACtC,KAAK,CAAC,wBAAwB,CAAC,CAAM,EAAE,EAAE,GAAG,EAAE,EAAE,OAAwB;QACtE,MAAM,IAAA,qBAAa,EAAC,4BAAiB,CAAC,CAAC,MAAM,CAAC;YAC5C,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE;YACvC,EAAE,EAAE,IAAA,YAAE,EAAC,GAAG,CAAC;SACZ,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA","sourcesContent":["import { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { FulfillmentCenter } from '../../../entities'\n\nexport const deleteFulfillmentCenters = {\n async deleteFulfillmentCenters(_: any, { ids }, context: ResolverContext) {\n await getRepository(FulfillmentCenter).delete({\n domain: { id: context.state.domain.id },\n id: In(ids)\n })\n return true\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { FulfillmentCenter } from '../../../entities';
2
+ export declare const fulfillmentCenterResolver: {
3
+ fulfillmentCenter(_: any, { id }: {
4
+ id: any;
5
+ }, context: ResolverContext): Promise<FulfillmentCenter>;
6
+ };