@medusajs/medusa 1.7.2 → 1.7.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-test.log +0 -75
- package/CHANGELOG.md +50 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/middlewares/check-registered-modules.d.ts +4 -0
- package/dist/api/middlewares/check-registered-modules.js +78 -0
- package/dist/api/middlewares/check-registered-modules.js.map +1 -0
- package/dist/api/routes/admin/discounts/add-resources-to-condition-batch.d.ts +1 -1
- package/dist/api/routes/admin/discounts/add-resources-to-condition-batch.js +1 -1
- package/dist/api/routes/admin/discounts/delete-resources-from-condition-batch.d.ts +1 -1
- package/dist/api/routes/admin/discounts/delete-resources-from-condition-batch.js +1 -1
- package/dist/api/routes/admin/discounts/list-discounts.d.ts +1 -1
- package/dist/api/routes/admin/index.js +4 -0
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/order-edits/add-line-item.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/add-line-item.js +1 -1
- package/dist/api/routes/admin/order-edits/delete-line-item.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/delete-line-item.js +1 -1
- package/dist/api/routes/admin/order-edits/delete-order-edit-item-change.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/delete-order-edit-item-change.js +1 -1
- package/dist/api/routes/admin/order-edits/delete-order-edit.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/delete-order-edit.js +1 -1
- package/dist/api/routes/admin/order-edits/get-order-edit.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/get-order-edit.js +1 -1
- package/dist/api/routes/admin/order-edits/list-order-edit.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/request-confirmation.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/request-confirmation.js +1 -1
- package/dist/api/routes/admin/order-edits/update-order-edit-line-item.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/update-order-edit-line-item.js +1 -1
- package/dist/api/routes/admin/order-edits/update-order-edit.d.ts +1 -1
- package/dist/api/routes/admin/order-edits/update-order-edit.js +1 -1
- package/dist/api/routes/admin/orders/cancel-fulfillment.d.ts +5 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment.js +46 -2
- package/dist/api/routes/admin/orders/cancel-fulfillment.js.map +1 -1
- package/dist/api/routes/admin/orders/create-fulfillment.d.ts +1 -0
- package/dist/api/routes/admin/orders/create-fulfillment.js +87 -5
- package/dist/api/routes/admin/orders/create-fulfillment.js.map +1 -1
- package/dist/api/routes/admin/orders/index.js +3 -7
- package/dist/api/routes/admin/orders/index.js.map +1 -1
- package/dist/api/routes/admin/payment-collections/delete-payment-collection.d.ts +1 -1
- package/dist/api/routes/admin/payment-collections/delete-payment-collection.js +1 -1
- package/dist/api/routes/admin/payment-collections/get-payment-collection.d.ts +1 -1
- package/dist/api/routes/admin/payment-collections/get-payment-collection.js +1 -1
- package/dist/api/routes/admin/payment-collections/mark-authorized-payment-collection.d.ts +1 -1
- package/dist/api/routes/admin/payment-collections/mark-authorized-payment-collection.js +1 -1
- package/dist/api/routes/admin/payment-collections/update-payment-collection.d.ts +1 -1
- package/dist/api/routes/admin/payment-collections/update-payment-collection.js +1 -1
- package/dist/api/routes/admin/price-lists/list-price-list-products.d.ts +2 -2
- package/dist/api/routes/admin/price-lists/list-price-list-products.js +1 -1
- package/dist/api/routes/admin/product-categories/delete-product-category.d.ts +64 -0
- package/dist/api/routes/admin/product-categories/delete-product-category.js +129 -0
- package/dist/api/routes/admin/product-categories/delete-product-category.js.map +1 -0
- package/dist/api/routes/admin/product-categories/get-product-category.d.ts +58 -0
- package/dist/api/routes/admin/product-categories/get-product-category.js +134 -0
- package/dist/api/routes/admin/product-categories/get-product-category.js.map +1 -0
- package/dist/api/routes/admin/product-categories/index.d.ts +7 -0
- package/dist/api/routes/admin/product-categories/index.js +68 -0
- package/dist/api/routes/admin/product-categories/index.js.map +1 -0
- package/dist/api/routes/admin/product-categories/list-product-categories.d.ts +78 -0
- package/dist/api/routes/admin/product-categories/list-product-categories.js +206 -0
- package/dist/api/routes/admin/product-categories/list-product-categories.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/add-channels-batch.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/add-channels-batch.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/create-publishable-api-key.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/create-publishable-api-key.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/delete-channels-batch.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/delete-channels-batch.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/delete-publishable-api-key.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/delete-publishable-api-key.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/get-publishable-api-key.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/get-publishable-api-key.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-key-sales-channels.d.ts +2 -2
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-key-sales-channels.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-keys.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/revoke-publishable-api-key.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/revoke-publishable-api-key.js +1 -1
- package/dist/api/routes/admin/publishable-api-keys/update-publishable-api-key.d.ts +1 -1
- package/dist/api/routes/admin/publishable-api-keys/update-publishable-api-key.js +1 -1
- package/dist/api/routes/admin/returns/cancel-return.js.map +1 -1
- package/dist/api/routes/admin/returns/receive-return.d.ts +1 -0
- package/dist/api/routes/admin/returns/receive-return.js +8 -1
- package/dist/api/routes/admin/returns/receive-return.js.map +1 -1
- package/dist/api/routes/admin/sales-channels/associate-stock-location.d.ts +79 -0
- package/dist/api/routes/admin/sales-channels/associate-stock-location.js +163 -0
- package/dist/api/routes/admin/sales-channels/associate-stock-location.js.map +1 -0
- package/dist/api/routes/admin/sales-channels/index.d.ts +2 -0
- package/dist/api/routes/admin/sales-channels/index.js +6 -0
- package/dist/api/routes/admin/sales-channels/index.js.map +1 -1
- package/dist/api/routes/admin/sales-channels/list-sales-channels.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/remove-stock-location.d.ts +88 -0
- package/dist/api/routes/admin/sales-channels/remove-stock-location.js +174 -0
- package/dist/api/routes/admin/sales-channels/remove-stock-location.js.map +1 -0
- package/dist/api/routes/admin/stock-locations/create-stock-location.d.ts +105 -0
- package/dist/api/routes/admin/stock-locations/create-stock-location.js +240 -0
- package/dist/api/routes/admin/stock-locations/create-stock-location.js.map +1 -0
- package/dist/api/routes/admin/stock-locations/get-stock-location.d.ts +48 -0
- package/dist/api/routes/admin/stock-locations/get-stock-location.js +121 -0
- package/dist/api/routes/admin/stock-locations/get-stock-location.js.map +1 -0
- package/dist/api/routes/admin/stock-locations/index.d.ts +18 -0
- package/dist/api/routes/admin/stock-locations/index.js +78 -0
- package/dist/api/routes/admin/stock-locations/index.js.map +1 -0
- package/dist/api/routes/admin/stock-locations/list-stock-locations.d.ts +144 -0
- package/dist/api/routes/admin/stock-locations/list-stock-locations.js +265 -0
- package/dist/api/routes/admin/stock-locations/list-stock-locations.js.map +1 -0
- package/dist/api/routes/admin/stock-locations/update-stock-location.d.ts +103 -0
- package/dist/api/routes/admin/stock-locations/update-stock-location.js +240 -0
- package/dist/api/routes/admin/stock-locations/update-stock-location.js.map +1 -0
- package/dist/api/routes/admin/uploads/create-protected-upload.d.ts +2 -2
- package/dist/api/routes/admin/uploads/create-protected-upload.js +2 -2
- package/dist/api/routes/admin/uploads/delete-upload.d.ts +1 -1
- package/dist/api/routes/admin/uploads/delete-upload.js +1 -1
- package/dist/api/routes/admin/uploads/get-download-url.d.ts +1 -1
- package/dist/api/routes/admin/uploads/get-download-url.js +1 -1
- package/dist/api/routes/store/order-edits/complete-order-edit.js +35 -34
- package/dist/api/routes/store/order-edits/complete-order-edit.js.map +1 -1
- package/dist/api/routes/store/orders/confirm-order-request.d.ts +2 -2
- package/dist/api/routes/store/orders/confirm-order-request.js +2 -2
- package/dist/api/routes/store/orders/request-order.d.ts +1 -1
- package/dist/api/routes/store/orders/request-order.js +1 -1
- package/dist/api/routes/store/payment-collections/authorize-batch-payment-sessions.d.ts +2 -2
- package/dist/api/routes/store/payment-collections/authorize-batch-payment-sessions.js +2 -2
- package/dist/api/routes/store/payment-collections/authorize-payment-session.d.ts +2 -2
- package/dist/api/routes/store/payment-collections/authorize-payment-session.js +2 -2
- package/dist/api/routes/store/payment-collections/get-payment-collection.d.ts +2 -2
- package/dist/api/routes/store/payment-collections/get-payment-collection.js +2 -2
- package/dist/api/routes/store/payment-collections/manage-batch-payment-sessions.d.ts +2 -2
- package/dist/api/routes/store/payment-collections/manage-batch-payment-sessions.js +2 -2
- package/dist/api/routes/store/payment-collections/manage-payment-session.d.ts +2 -2
- package/dist/api/routes/store/payment-collections/manage-payment-session.js +2 -2
- package/dist/api/routes/store/payment-collections/refresh-payment-session.d.ts +1 -1
- package/dist/api/routes/store/payment-collections/refresh-payment-session.js +1 -1
- package/dist/commands/develop.js +24 -0
- package/dist/commands/develop.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces/payment-processor.d.ts +102 -0
- package/dist/interfaces/payment-processor.js +31 -0
- package/dist/interfaces/payment-processor.js.map +1 -0
- package/dist/interfaces/payment-service.d.ts +92 -1
- package/dist/interfaces/payment-service.js +10 -0
- package/dist/interfaces/payment-service.js.map +1 -1
- package/dist/interfaces/services/event-bus.d.ts +3 -0
- package/dist/interfaces/services/event-bus.js +3 -0
- package/dist/interfaces/services/event-bus.js.map +1 -0
- package/dist/interfaces/services/index.d.ts +3 -0
- package/dist/interfaces/services/index.js +3 -0
- package/dist/interfaces/services/index.js.map +1 -1
- package/dist/interfaces/services/inventory.d.ts +24 -0
- package/dist/interfaces/services/inventory.js +3 -0
- package/dist/interfaces/services/inventory.js.map +1 -0
- package/dist/interfaces/services/stock-location.d.ts +9 -0
- package/dist/interfaces/services/stock-location.js +3 -0
- package/dist/interfaces/services/stock-location.js.map +1 -0
- package/dist/loaders/feature-flags/product-categories.d.ts +3 -0
- package/dist/loaders/feature-flags/product-categories.js +10 -0
- package/dist/loaders/feature-flags/product-categories.js.map +1 -0
- package/dist/loaders/feature-flags/publishable-api-keys.js +1 -1
- package/dist/loaders/feature-flags/publishable-api-keys.js.map +1 -1
- package/dist/loaders/feature-flags/sales-channels.js +1 -1
- package/dist/loaders/feature-flags/sales-channels.js.map +1 -1
- package/dist/loaders/plugins.d.ts +1 -0
- package/dist/loaders/plugins.js +3 -1
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/migrations/1671711415179-multi_location.d.ts +6 -0
- package/dist/migrations/1671711415179-multi_location.js +119 -0
- package/dist/migrations/1671711415179-multi_location.js.map +1 -0
- package/dist/migrations/1672906846559-product-category.d.ts +6 -0
- package/dist/migrations/1672906846559-product-category.js +83 -0
- package/dist/migrations/1672906846559-product-category.js.map +1 -0
- package/dist/migrations/1672906846560-payment-session-is-initiated.d.ts +6 -0
- package/dist/migrations/1672906846560-payment-session-is-initiated.js +81 -0
- package/dist/migrations/1672906846560-payment-session-is-initiated.js.map +1 -0
- package/dist/migrations/1673003729870-staged_job_options.d.ts +6 -0
- package/dist/migrations/1673003729870-staged_job_options.js +71 -0
- package/dist/migrations/1673003729870-staged_job_options.js.map +1 -0
- package/dist/models/fulfillment.d.ts +5 -0
- package/dist/models/fulfillment.js +8 -0
- package/dist/models/fulfillment.js.map +1 -1
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item.d.ts +6 -6
- package/dist/models/line-item.js +9 -9
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/payment-session.d.ts +6 -0
- package/dist/models/payment-session.js +9 -0
- package/dist/models/payment-session.js.map +1 -1
- package/dist/models/product-category.d.ts +67 -0
- package/dist/models/product-category.js +144 -0
- package/dist/models/product-category.js.map +1 -0
- package/dist/models/product-variant-inventory-item.d.ts +7 -0
- package/dist/models/product-variant-inventory-item.js +66 -0
- package/dist/models/product-variant-inventory-item.js.map +1 -0
- package/dist/models/return.d.ts +7 -6
- package/dist/models/return.js +14 -9
- package/dist/models/return.js.map +1 -1
- package/dist/models/sales-channel-location.d.ts +6 -0
- package/dist/models/sales-channel-location.js +62 -0
- package/dist/models/sales-channel-location.js.map +1 -0
- package/dist/models/staged-job.d.ts +1 -0
- package/dist/models/staged-job.js +4 -0
- package/dist/models/staged-job.js.map +1 -1
- package/dist/models/store.d.ts +6 -5
- package/dist/models/store.js +11 -7
- package/dist/models/store.js.map +1 -1
- package/dist/repositories/customer-group.js +18 -2
- package/dist/repositories/customer-group.js.map +1 -1
- package/dist/repositories/product-category.d.ts +6 -0
- package/dist/repositories/product-category.js +125 -0
- package/dist/repositories/product-category.js.map +1 -0
- package/dist/repositories/product-variant.js +30 -5
- package/dist/repositories/product-variant.js.map +1 -1
- package/dist/repositories/product.js +7 -2
- package/dist/repositories/product.js.map +1 -1
- package/dist/scripts/migrate-inventory-items.d.ts +1 -0
- package/dist/scripts/migrate-inventory-items.js +197 -0
- package/dist/scripts/migrate-inventory-items.js.map +1 -0
- package/dist/services/cache.js +2 -5
- package/dist/services/cache.js.map +1 -1
- package/dist/services/cart.d.ts +9 -26
- package/dist/services/cart.js +276 -182
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim-item.js +3 -0
- package/dist/services/claim-item.js.map +1 -1
- package/dist/services/claim.d.ts +4 -4
- package/dist/services/claim.js +132 -166
- package/dist/services/claim.js.map +1 -1
- package/dist/services/event-bus.d.ts +23 -10
- package/dist/services/event-bus.js +106 -42
- package/dist/services/event-bus.js.map +1 -1
- package/dist/services/fulfillment.d.ts +7 -3
- package/dist/services/fulfillment.js +79 -90
- package/dist/services/fulfillment.js.map +1 -1
- package/dist/services/index.d.ts +4 -1
- package/dist/services/index.js +10 -4
- package/dist/services/index.js.map +1 -1
- package/dist/services/line-item.d.ts +5 -5
- package/dist/services/line-item.js +2 -1
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/order.d.ts +5 -19
- package/dist/services/order.js +146 -181
- package/dist/services/order.js.map +1 -1
- package/dist/services/payment-collection.d.ts +2 -2
- package/dist/services/payment-collection.js +88 -128
- package/dist/services/payment-collection.js.map +1 -1
- package/dist/services/payment-provider.d.ts +2 -1
- package/dist/services/payment-provider.js +32 -27
- package/dist/services/payment-provider.js.map +1 -1
- package/dist/services/product-category.d.ts +41 -0
- package/dist/services/product-category.js +190 -0
- package/dist/services/product-category.js.map +1 -0
- package/dist/services/product-variant-inventory.d.ts +115 -0
- package/dist/services/product-variant-inventory.js +747 -0
- package/dist/services/product-variant-inventory.js.map +1 -0
- package/dist/services/return.d.ts +7 -12
- package/dist/services/return.js +12 -9
- package/dist/services/return.js.map +1 -1
- package/dist/services/sales-channel-inventory.d.ts +24 -0
- package/dist/services/sales-channel-inventory.js +70 -0
- package/dist/services/sales-channel-inventory.js.map +1 -0
- package/dist/services/sales-channel-location.d.ts +41 -0
- package/dist/services/sales-channel-location.js +159 -0
- package/dist/services/sales-channel-location.js.map +1 -0
- package/dist/services/swap.d.ts +4 -4
- package/dist/services/swap.js +78 -127
- package/dist/services/swap.js.map +1 -1
- package/dist/services/totals.d.ts +2 -2
- package/dist/services/totals.js +2 -2
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/batch-jobs/product/import.d.ts +1 -1
- package/dist/strategies/batch-jobs/product/import.js +4 -3
- package/dist/strategies/batch-jobs/product/import.js.map +1 -1
- package/dist/strategies/cart-completion.d.ts +14 -9
- package/dist/strategies/cart-completion.js +111 -48
- package/dist/strategies/cart-completion.js.map +1 -1
- package/dist/subscribers/cart.d.ts +2 -4
- package/dist/subscribers/cart.js +8 -21
- package/dist/subscribers/cart.js.map +1 -1
- package/dist/subscribers/product.d.ts +1 -5
- package/dist/subscribers/product.js +15 -5
- package/dist/subscribers/product.js.map +1 -1
- package/dist/types/inventory.d.ts +106 -0
- package/dist/types/inventory.js +3 -0
- package/dist/types/inventory.js.map +1 -0
- package/dist/types/payment.d.ts +1 -0
- package/dist/types/product.d.ts +1 -0
- package/dist/types/product.js.map +1 -1
- package/dist/types/stock-location.d.ts +245 -0
- package/dist/types/stock-location.js +3 -0
- package/dist/types/stock-location.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/repository.d.ts +4 -3
- package/dist/utils/repository.js +43 -23
- package/dist/utils/repository.js.map +1 -1
- package/package.json +2 -2
- package/dist/services/inventory.d.ts +0 -31
- package/dist/services/inventory.js +0 -151
- package/dist/services/inventory.js.map +0 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AdminGetStockLocationsLocationParams = void 0;
|
|
55
|
+
var common_1 = require("../../../../types/common");
|
|
56
|
+
/**
|
|
57
|
+
* @oas [get] /stock-locations/{id}
|
|
58
|
+
* operationId: "GetStockLocationsStockLocation"
|
|
59
|
+
* summary: "Get a Stock Location"
|
|
60
|
+
* description: "Retrieves the Stock Location."
|
|
61
|
+
* x-authenticated: true
|
|
62
|
+
* parameters:
|
|
63
|
+
* - (path) id=* {string} The ID of the Stock Location.
|
|
64
|
+
* - (query) expand {string} Comma separated list of relations to include in the results.
|
|
65
|
+
* - (query) fields {string} Comma separated list of fields to include in the results.
|
|
66
|
+
* x-codeSamples:
|
|
67
|
+
* - lang: JavaScript
|
|
68
|
+
* label: JS Client
|
|
69
|
+
* source: |
|
|
70
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
71
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
72
|
+
* // must be previously logged in or use api token
|
|
73
|
+
* medusa.admin.stockLocations.retrieve(stock_location_id)
|
|
74
|
+
* .then(({ stock_location }) => {
|
|
75
|
+
* console.log(stock_location.id);
|
|
76
|
+
* });
|
|
77
|
+
* - lang: Shell
|
|
78
|
+
* label: cURL
|
|
79
|
+
* source: |
|
|
80
|
+
* curl --location --request GET 'https://medusa-url.com/admin/stock-locations/{id}' \
|
|
81
|
+
* --header 'Authorization: Bearer {api_token}' \
|
|
82
|
+
* security:
|
|
83
|
+
* - api_token: []
|
|
84
|
+
* - cookie_auth: []
|
|
85
|
+
* tags:
|
|
86
|
+
* - Stock Location
|
|
87
|
+
* responses:
|
|
88
|
+
* 200:
|
|
89
|
+
* description: OK
|
|
90
|
+
* content:
|
|
91
|
+
* application/json:
|
|
92
|
+
* schema:
|
|
93
|
+
* type: object
|
|
94
|
+
* properties:
|
|
95
|
+
* stock_location:
|
|
96
|
+
* $ref: "#/components/schemas/StockLocationDTO"
|
|
97
|
+
*/
|
|
98
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
var id, locationService, stockLocation;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
id = req.params.id;
|
|
104
|
+
locationService = req.scope.resolve("stockLocationService");
|
|
105
|
+
return [4 /*yield*/, locationService.retrieve(id, req.retrieveConfig)];
|
|
106
|
+
case 1:
|
|
107
|
+
stockLocation = _a.sent();
|
|
108
|
+
res.status(200).json({ stock_location: stockLocation });
|
|
109
|
+
return [2 /*return*/];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}); });
|
|
113
|
+
var AdminGetStockLocationsLocationParams = /** @class */ (function (_super) {
|
|
114
|
+
__extends(AdminGetStockLocationsLocationParams, _super);
|
|
115
|
+
function AdminGetStockLocationsLocationParams() {
|
|
116
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
117
|
+
}
|
|
118
|
+
return AdminGetStockLocationsLocationParams;
|
|
119
|
+
}(common_1.FindParams));
|
|
120
|
+
exports.AdminGetStockLocationsLocationParams = AdminGetStockLocationsLocationParams;
|
|
121
|
+
//# sourceMappingURL=get-stock-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-stock-location.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/stock-locations/get-stock-location.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,mDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,mBAAe,UAAO,GAAY,EAAE,GAAa;;;;;gBACvC,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,eAAe,GAA0B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC9D,sBAAsB,CACvB,CAAA;gBACqB,qBAAM,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,cAAc,CAAC,EAAA;;gBAAtE,aAAa,GAAG,SAAsD;gBAE5E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,CAAA;;;;KACxD,EAAA;AAED;IAA0D,wDAAU;IAApE;;IAAsE,CAAC;IAAD,2CAAC;AAAD,CAAC,AAAvE,CAA0D,mBAAU,GAAG;AAA1D,oFAAoC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { DeleteResponse, PaginatedResponse } from "../../../../types/common";
|
|
3
|
+
import { StockLocationDTO } from "../../../../types/stock-location";
|
|
4
|
+
declare const _default: (app: any) => any;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const defaultAdminStockLocationFields: (keyof StockLocationDTO)[];
|
|
7
|
+
export declare const defaultAdminStockLocationRelations: never[];
|
|
8
|
+
export declare type AdminStockLocationsRes = {
|
|
9
|
+
stock_location: StockLocationDTO;
|
|
10
|
+
};
|
|
11
|
+
export declare type AdminStockLocationsDeleteRes = DeleteResponse;
|
|
12
|
+
export declare type AdminStockLocationsListRes = PaginatedResponse & {
|
|
13
|
+
stock_locations: StockLocationDTO[];
|
|
14
|
+
};
|
|
15
|
+
export * from "./list-stock-locations";
|
|
16
|
+
export * from "./get-stock-location";
|
|
17
|
+
export * from "./create-stock-location";
|
|
18
|
+
export * from "./update-stock-location";
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.defaultAdminStockLocationRelations = exports.defaultAdminStockLocationFields = void 0;
|
|
30
|
+
var express_1 = require("express");
|
|
31
|
+
require("reflect-metadata");
|
|
32
|
+
var middlewares_1 = __importStar(require("../../../middlewares"));
|
|
33
|
+
var list_stock_locations_1 = require("./list-stock-locations");
|
|
34
|
+
var get_stock_location_1 = require("./get-stock-location");
|
|
35
|
+
var update_stock_location_1 = require("./update-stock-location");
|
|
36
|
+
var create_stock_location_1 = require("./create-stock-location");
|
|
37
|
+
var check_registered_modules_1 = require("../../../middlewares/check-registered-modules");
|
|
38
|
+
var route = (0, express_1.Router)();
|
|
39
|
+
exports.default = (function (app) {
|
|
40
|
+
app.use("/stock-locations", (0, check_registered_modules_1.checkRegisteredModules)({
|
|
41
|
+
stockLocationService: "Stock Locations are not enabled. Please add a Stock Location module to enable this functionality.",
|
|
42
|
+
}), route);
|
|
43
|
+
route.get("/", (0, middlewares_1.transformQuery)(list_stock_locations_1.AdminGetStockLocationsParams, {
|
|
44
|
+
defaultFields: exports.defaultAdminStockLocationFields,
|
|
45
|
+
defaultRelations: exports.defaultAdminStockLocationRelations,
|
|
46
|
+
isList: true,
|
|
47
|
+
}), middlewares_1.default.wrap(require("./list-stock-locations").default));
|
|
48
|
+
route.post("/", (0, middlewares_1.transformQuery)(create_stock_location_1.AdminPostStockLocationsParams, {
|
|
49
|
+
defaultFields: exports.defaultAdminStockLocationFields,
|
|
50
|
+
defaultRelations: exports.defaultAdminStockLocationRelations,
|
|
51
|
+
isList: false,
|
|
52
|
+
}), (0, middlewares_1.transformBody)(create_stock_location_1.AdminPostStockLocationsReq), middlewares_1.default.wrap(require("./create-stock-location").default));
|
|
53
|
+
route.get("/:id", (0, middlewares_1.transformQuery)(get_stock_location_1.AdminGetStockLocationsLocationParams, {
|
|
54
|
+
defaultFields: exports.defaultAdminStockLocationFields,
|
|
55
|
+
defaultRelations: exports.defaultAdminStockLocationRelations,
|
|
56
|
+
isList: false,
|
|
57
|
+
}), middlewares_1.default.wrap(require("./get-stock-location").default));
|
|
58
|
+
route.post("/:id", (0, middlewares_1.transformQuery)(update_stock_location_1.AdminPostStockLocationsLocationParams, {
|
|
59
|
+
defaultFields: exports.defaultAdminStockLocationFields,
|
|
60
|
+
defaultRelations: exports.defaultAdminStockLocationRelations,
|
|
61
|
+
isList: false,
|
|
62
|
+
}), (0, middlewares_1.transformBody)(update_stock_location_1.AdminPostStockLocationsLocationReq), middlewares_1.default.wrap(require("./update-stock-location").default));
|
|
63
|
+
return app;
|
|
64
|
+
});
|
|
65
|
+
exports.defaultAdminStockLocationFields = [
|
|
66
|
+
"id",
|
|
67
|
+
"name",
|
|
68
|
+
"address_id",
|
|
69
|
+
"metadata",
|
|
70
|
+
"created_at",
|
|
71
|
+
"updated_at",
|
|
72
|
+
];
|
|
73
|
+
exports.defaultAdminStockLocationRelations = [];
|
|
74
|
+
__exportStar(require("./list-stock-locations"), exports);
|
|
75
|
+
__exportStar(require("./get-stock-location"), exports);
|
|
76
|
+
__exportStar(require("./create-stock-location"), exports);
|
|
77
|
+
__exportStar(require("./update-stock-location"), exports);
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/stock-locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,4BAAyB;AAGzB,kEAG6B;AAC7B,+DAAqE;AACrE,2DAA2E;AAC3E,iEAGgC;AAChC,iEAGgC;AAChC,0FAAsF;AAEtF,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CACL,kBAAkB,EAClB,IAAA,iDAAsB,EAAC;QACrB,oBAAoB,EAClB,mGAAmG;KACtG,CAAC,EACF,KAAK,CACN,CAAA;IAED,KAAK,CAAC,GAAG,CACP,GAAG,EACH,IAAA,4BAAc,EAAC,mDAA4B,EAAE;QAC3C,aAAa,EAAE,uCAA+B;QAC9C,gBAAgB,EAAE,0CAAkC;QACpD,MAAM,EAAE,IAAI;KACb,CAAC,EACF,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAC5D,CAAA;IACD,KAAK,CAAC,IAAI,CACR,GAAG,EACH,IAAA,4BAAc,EAAC,qDAA6B,EAAE;QAC5C,aAAa,EAAE,uCAA+B;QAC9C,gBAAgB,EAAE,0CAAkC;QACpD,MAAM,EAAE,KAAK;KACd,CAAC,EACF,IAAA,2BAAa,EAAC,kDAA0B,CAAC,EACzC,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC,CAC7D,CAAA;IAED,KAAK,CAAC,GAAG,CACP,MAAM,EACN,IAAA,4BAAc,EAAC,yDAAoC,EAAE;QACnD,aAAa,EAAE,uCAA+B;QAC9C,gBAAgB,EAAE,0CAAkC;QACpD,MAAM,EAAE,KAAK;KACd,CAAC,EACF,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,CAC1D,CAAA;IAED,KAAK,CAAC,IAAI,CACR,MAAM,EACN,IAAA,4BAAc,EAAC,6DAAqC,EAAE;QACpD,aAAa,EAAE,uCAA+B;QAC9C,gBAAgB,EAAE,0CAAkC;QACpD,MAAM,EAAE,KAAK;KACd,CAAC,EACF,IAAA,2BAAa,EAAC,0DAAkC,CAAC,EACjD,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC,CAC7D,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAEY,QAAA,+BAA+B,GAA+B;IACzE,IAAI;IACJ,MAAM;IACN,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,YAAY;CACb,CAAA;AAEY,QAAA,kCAAkC,GAAG,EAAE,CAAA;AAYpD,yDAAsC;AACtC,uDAAoC;AACpC,0DAAuC;AACvC,0DAAuC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
/**
|
|
3
|
+
* @oas [get] /stock-locations
|
|
4
|
+
* operationId: "GetStockLocations"
|
|
5
|
+
* summary: "List Stock Locations"
|
|
6
|
+
* description: "Retrieves a list of stock locations"
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (query) id {string} ID of the stock location
|
|
10
|
+
* - (query) name {string} Name of the stock location
|
|
11
|
+
* - (query) order {string} The field to order the results by.
|
|
12
|
+
* - in: query
|
|
13
|
+
* name: created_at
|
|
14
|
+
* description: Date comparison for when resulting collections were created.
|
|
15
|
+
* schema:
|
|
16
|
+
* type: object
|
|
17
|
+
* properties:
|
|
18
|
+
* lt:
|
|
19
|
+
* type: string
|
|
20
|
+
* description: filter by dates less than this date
|
|
21
|
+
* format: date
|
|
22
|
+
* gt:
|
|
23
|
+
* type: string
|
|
24
|
+
* description: filter by dates greater than this date
|
|
25
|
+
* format: date
|
|
26
|
+
* lte:
|
|
27
|
+
* type: string
|
|
28
|
+
* description: filter by dates less than or equal to this date
|
|
29
|
+
* format: date
|
|
30
|
+
* gte:
|
|
31
|
+
* type: string
|
|
32
|
+
* description: filter by dates greater than or equal to this date
|
|
33
|
+
* format: date
|
|
34
|
+
* - in: query
|
|
35
|
+
* name: updated_at
|
|
36
|
+
* description: Date comparison for when resulting collections were updated.
|
|
37
|
+
* schema:
|
|
38
|
+
* type: object
|
|
39
|
+
* properties:
|
|
40
|
+
* lt:
|
|
41
|
+
* type: string
|
|
42
|
+
* description: filter by dates less than this date
|
|
43
|
+
* format: date
|
|
44
|
+
* gt:
|
|
45
|
+
* type: string
|
|
46
|
+
* description: filter by dates greater than this date
|
|
47
|
+
* format: date
|
|
48
|
+
* lte:
|
|
49
|
+
* type: string
|
|
50
|
+
* description: filter by dates less than or equal to this date
|
|
51
|
+
* format: date
|
|
52
|
+
* gte:
|
|
53
|
+
* type: string
|
|
54
|
+
* description: filter by dates greater than or equal to this date
|
|
55
|
+
* format: date
|
|
56
|
+
* - in: query
|
|
57
|
+
* name: deleted_at
|
|
58
|
+
* description: Date comparison for when resulting collections were deleted.
|
|
59
|
+
* schema:
|
|
60
|
+
* type: object
|
|
61
|
+
* properties:
|
|
62
|
+
* lt:
|
|
63
|
+
* type: string
|
|
64
|
+
* description: filter by dates less than this date
|
|
65
|
+
* format: date
|
|
66
|
+
* gt:
|
|
67
|
+
* type: string
|
|
68
|
+
* description: filter by dates greater than this date
|
|
69
|
+
* format: date
|
|
70
|
+
* lte:
|
|
71
|
+
* type: string
|
|
72
|
+
* description: filter by dates less than or equal to this date
|
|
73
|
+
* format: date
|
|
74
|
+
* gte:
|
|
75
|
+
* type: string
|
|
76
|
+
* description: filter by dates greater than or equal to this date
|
|
77
|
+
* format: date
|
|
78
|
+
* - (query) offset=0 {integer} How many stock locations to skip in the result.
|
|
79
|
+
* - (query) limit=20 {integer} Limit the number of stock locations returned.
|
|
80
|
+
* - (query) expand {string} (Comma separated) Which fields should be expanded in each stock location of the result.
|
|
81
|
+
* - (query) fields {string} (Comma separated) Which fields should be included in each stock location of the result.
|
|
82
|
+
* x-codeSamples:
|
|
83
|
+
* - lang: JavaScript
|
|
84
|
+
* label: JS Client
|
|
85
|
+
* source: |
|
|
86
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
87
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
88
|
+
* // must be previously logged in or use api token
|
|
89
|
+
* medusa.admin.stockLocations.list()
|
|
90
|
+
* .then(({ stock_locations, limit, offset, count }) => {
|
|
91
|
+
* console.log(stock_locations.length);
|
|
92
|
+
* });
|
|
93
|
+
* - lang: Shell
|
|
94
|
+
* label: cURL
|
|
95
|
+
* source: |
|
|
96
|
+
* curl --location --request GET 'https://medusa-url.com/admin/stock-locations' \
|
|
97
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
98
|
+
* security:
|
|
99
|
+
* - api_token: []
|
|
100
|
+
* - cookie_auth: []
|
|
101
|
+
* tags:
|
|
102
|
+
* - Sales Channel
|
|
103
|
+
* responses:
|
|
104
|
+
* 200:
|
|
105
|
+
* description: OK
|
|
106
|
+
* content:
|
|
107
|
+
* application/json:
|
|
108
|
+
* schema:
|
|
109
|
+
* type: object
|
|
110
|
+
* properties:
|
|
111
|
+
* stock_locations:
|
|
112
|
+
* type: array
|
|
113
|
+
* items:
|
|
114
|
+
* $ref: "#/components/schemas/StockLocationDTO"
|
|
115
|
+
* count:
|
|
116
|
+
* type: integer
|
|
117
|
+
* description: The total number of items available
|
|
118
|
+
* offset:
|
|
119
|
+
* type: integer
|
|
120
|
+
* description: The number of items skipped before these items
|
|
121
|
+
* limit:
|
|
122
|
+
* type: integer
|
|
123
|
+
* description: The number of items per page
|
|
124
|
+
* "400":
|
|
125
|
+
* $ref: "#/components/responses/400_error"
|
|
126
|
+
* "401":
|
|
127
|
+
* $ref: "#/components/responses/unauthorized"
|
|
128
|
+
* "404":
|
|
129
|
+
* $ref: "#/components/responses/not_found_error"
|
|
130
|
+
* "409":
|
|
131
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
132
|
+
* "422":
|
|
133
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
134
|
+
* "500":
|
|
135
|
+
* $ref: "#/components/responses/500_error"
|
|
136
|
+
*/
|
|
137
|
+
declare const _default: (req: Request, res: Response) => Promise<void>;
|
|
138
|
+
export default _default;
|
|
139
|
+
declare const AdminGetStockLocationsParams_base: import("../../../..").ClassConstructor<import("../../../../types/common").FindParams & import("../../../../types/common").FindPaginationParams>;
|
|
140
|
+
export declare class AdminGetStockLocationsParams extends AdminGetStockLocationsParams_base {
|
|
141
|
+
id?: string | string[];
|
|
142
|
+
name?: string | string[];
|
|
143
|
+
address_id?: string | string[];
|
|
144
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
+
function step(op) {
|
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
+
while (_) try {
|
|
42
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
43
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
+
switch (op[0]) {
|
|
45
|
+
case 0: case 1: t = op; break;
|
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
+
default:
|
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
+
if (t[2]) _.ops.pop();
|
|
55
|
+
_.trys.pop(); continue;
|
|
56
|
+
}
|
|
57
|
+
op = body.call(thisArg, _);
|
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
63
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
64
|
+
if (!m) return o;
|
|
65
|
+
var i = m.call(o), r, ar = [], e;
|
|
66
|
+
try {
|
|
67
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
68
|
+
}
|
|
69
|
+
catch (error) { e = { error: error }; }
|
|
70
|
+
finally {
|
|
71
|
+
try {
|
|
72
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
73
|
+
}
|
|
74
|
+
finally { if (e) throw e.error; }
|
|
75
|
+
}
|
|
76
|
+
return ar;
|
|
77
|
+
};
|
|
78
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
+
exports.AdminGetStockLocationsParams = void 0;
|
|
80
|
+
var class_validator_1 = require("class-validator");
|
|
81
|
+
var is_type_1 = require("../../../../utils/validators/is-type");
|
|
82
|
+
var common_1 = require("../../../../types/common");
|
|
83
|
+
/**
|
|
84
|
+
* @oas [get] /stock-locations
|
|
85
|
+
* operationId: "GetStockLocations"
|
|
86
|
+
* summary: "List Stock Locations"
|
|
87
|
+
* description: "Retrieves a list of stock locations"
|
|
88
|
+
* x-authenticated: true
|
|
89
|
+
* parameters:
|
|
90
|
+
* - (query) id {string} ID of the stock location
|
|
91
|
+
* - (query) name {string} Name of the stock location
|
|
92
|
+
* - (query) order {string} The field to order the results by.
|
|
93
|
+
* - in: query
|
|
94
|
+
* name: created_at
|
|
95
|
+
* description: Date comparison for when resulting collections were created.
|
|
96
|
+
* schema:
|
|
97
|
+
* type: object
|
|
98
|
+
* properties:
|
|
99
|
+
* lt:
|
|
100
|
+
* type: string
|
|
101
|
+
* description: filter by dates less than this date
|
|
102
|
+
* format: date
|
|
103
|
+
* gt:
|
|
104
|
+
* type: string
|
|
105
|
+
* description: filter by dates greater than this date
|
|
106
|
+
* format: date
|
|
107
|
+
* lte:
|
|
108
|
+
* type: string
|
|
109
|
+
* description: filter by dates less than or equal to this date
|
|
110
|
+
* format: date
|
|
111
|
+
* gte:
|
|
112
|
+
* type: string
|
|
113
|
+
* description: filter by dates greater than or equal to this date
|
|
114
|
+
* format: date
|
|
115
|
+
* - in: query
|
|
116
|
+
* name: updated_at
|
|
117
|
+
* description: Date comparison for when resulting collections were updated.
|
|
118
|
+
* schema:
|
|
119
|
+
* type: object
|
|
120
|
+
* properties:
|
|
121
|
+
* lt:
|
|
122
|
+
* type: string
|
|
123
|
+
* description: filter by dates less than this date
|
|
124
|
+
* format: date
|
|
125
|
+
* gt:
|
|
126
|
+
* type: string
|
|
127
|
+
* description: filter by dates greater than this date
|
|
128
|
+
* format: date
|
|
129
|
+
* lte:
|
|
130
|
+
* type: string
|
|
131
|
+
* description: filter by dates less than or equal to this date
|
|
132
|
+
* format: date
|
|
133
|
+
* gte:
|
|
134
|
+
* type: string
|
|
135
|
+
* description: filter by dates greater than or equal to this date
|
|
136
|
+
* format: date
|
|
137
|
+
* - in: query
|
|
138
|
+
* name: deleted_at
|
|
139
|
+
* description: Date comparison for when resulting collections were deleted.
|
|
140
|
+
* schema:
|
|
141
|
+
* type: object
|
|
142
|
+
* properties:
|
|
143
|
+
* lt:
|
|
144
|
+
* type: string
|
|
145
|
+
* description: filter by dates less than this date
|
|
146
|
+
* format: date
|
|
147
|
+
* gt:
|
|
148
|
+
* type: string
|
|
149
|
+
* description: filter by dates greater than this date
|
|
150
|
+
* format: date
|
|
151
|
+
* lte:
|
|
152
|
+
* type: string
|
|
153
|
+
* description: filter by dates less than or equal to this date
|
|
154
|
+
* format: date
|
|
155
|
+
* gte:
|
|
156
|
+
* type: string
|
|
157
|
+
* description: filter by dates greater than or equal to this date
|
|
158
|
+
* format: date
|
|
159
|
+
* - (query) offset=0 {integer} How many stock locations to skip in the result.
|
|
160
|
+
* - (query) limit=20 {integer} Limit the number of stock locations returned.
|
|
161
|
+
* - (query) expand {string} (Comma separated) Which fields should be expanded in each stock location of the result.
|
|
162
|
+
* - (query) fields {string} (Comma separated) Which fields should be included in each stock location of the result.
|
|
163
|
+
* x-codeSamples:
|
|
164
|
+
* - lang: JavaScript
|
|
165
|
+
* label: JS Client
|
|
166
|
+
* source: |
|
|
167
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
168
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
169
|
+
* // must be previously logged in or use api token
|
|
170
|
+
* medusa.admin.stockLocations.list()
|
|
171
|
+
* .then(({ stock_locations, limit, offset, count }) => {
|
|
172
|
+
* console.log(stock_locations.length);
|
|
173
|
+
* });
|
|
174
|
+
* - lang: Shell
|
|
175
|
+
* label: cURL
|
|
176
|
+
* source: |
|
|
177
|
+
* curl --location --request GET 'https://medusa-url.com/admin/stock-locations' \
|
|
178
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
179
|
+
* security:
|
|
180
|
+
* - api_token: []
|
|
181
|
+
* - cookie_auth: []
|
|
182
|
+
* tags:
|
|
183
|
+
* - Sales Channel
|
|
184
|
+
* responses:
|
|
185
|
+
* 200:
|
|
186
|
+
* description: OK
|
|
187
|
+
* content:
|
|
188
|
+
* application/json:
|
|
189
|
+
* schema:
|
|
190
|
+
* type: object
|
|
191
|
+
* properties:
|
|
192
|
+
* stock_locations:
|
|
193
|
+
* type: array
|
|
194
|
+
* items:
|
|
195
|
+
* $ref: "#/components/schemas/StockLocationDTO"
|
|
196
|
+
* count:
|
|
197
|
+
* type: integer
|
|
198
|
+
* description: The total number of items available
|
|
199
|
+
* offset:
|
|
200
|
+
* type: integer
|
|
201
|
+
* description: The number of items skipped before these items
|
|
202
|
+
* limit:
|
|
203
|
+
* type: integer
|
|
204
|
+
* description: The number of items per page
|
|
205
|
+
* "400":
|
|
206
|
+
* $ref: "#/components/responses/400_error"
|
|
207
|
+
* "401":
|
|
208
|
+
* $ref: "#/components/responses/unauthorized"
|
|
209
|
+
* "404":
|
|
210
|
+
* $ref: "#/components/responses/not_found_error"
|
|
211
|
+
* "409":
|
|
212
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
213
|
+
* "422":
|
|
214
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
215
|
+
* "500":
|
|
216
|
+
* $ref: "#/components/responses/500_error"
|
|
217
|
+
*/
|
|
218
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
|
+
var stockLocationService, filterableFields, listConfig, skip, take, _a, locations, count;
|
|
220
|
+
return __generator(this, function (_b) {
|
|
221
|
+
switch (_b.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
stockLocationService = req.scope.resolve("stockLocationService");
|
|
224
|
+
filterableFields = req.filterableFields, listConfig = req.listConfig;
|
|
225
|
+
skip = listConfig.skip, take = listConfig.take;
|
|
226
|
+
return [4 /*yield*/, stockLocationService.listAndCount(filterableFields, listConfig)];
|
|
227
|
+
case 1:
|
|
228
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), locations = _a[0], count = _a[1];
|
|
229
|
+
res.status(200).json({
|
|
230
|
+
stock_locations: locations,
|
|
231
|
+
count: count,
|
|
232
|
+
offset: skip,
|
|
233
|
+
limit: take,
|
|
234
|
+
});
|
|
235
|
+
return [2 /*return*/];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}); });
|
|
239
|
+
var AdminGetStockLocationsParams = /** @class */ (function (_super) {
|
|
240
|
+
__extends(AdminGetStockLocationsParams, _super);
|
|
241
|
+
function AdminGetStockLocationsParams() {
|
|
242
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
243
|
+
}
|
|
244
|
+
__decorate([
|
|
245
|
+
(0, class_validator_1.IsOptional)(),
|
|
246
|
+
(0, is_type_1.IsType)([String, [String]]),
|
|
247
|
+
__metadata("design:type", Object)
|
|
248
|
+
], AdminGetStockLocationsParams.prototype, "id", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
(0, class_validator_1.IsOptional)(),
|
|
251
|
+
(0, is_type_1.IsType)([String, [String]]),
|
|
252
|
+
__metadata("design:type", Object)
|
|
253
|
+
], AdminGetStockLocationsParams.prototype, "name", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
(0, class_validator_1.IsOptional)(),
|
|
256
|
+
(0, is_type_1.IsType)([String, [String]]),
|
|
257
|
+
__metadata("design:type", Object)
|
|
258
|
+
], AdminGetStockLocationsParams.prototype, "address_id", void 0);
|
|
259
|
+
return AdminGetStockLocationsParams;
|
|
260
|
+
}((0, common_1.extendedFindParamsMixin)({
|
|
261
|
+
limit: 20,
|
|
262
|
+
offset: 0,
|
|
263
|
+
})));
|
|
264
|
+
exports.AdminGetStockLocationsParams = AdminGetStockLocationsParams;
|
|
265
|
+
//# sourceMappingURL=list-stock-locations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-stock-locations.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/stock-locations/list-stock-locations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA4C;AAC5C,gEAA6D;AAG7D,mDAAkE;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsIG;AACH,mBAAe,UAAO,GAAY,EAAE,GAAa;;;;;gBACzC,oBAAoB,GAA0B,GAAG,CAAC,KAAK,CAAC,OAAO,CACnE,sBAAsB,CACvB,CAAA;gBAEO,gBAAgB,GAAiB,GAAG,iBAApB,EAAE,UAAU,GAAK,GAAG,WAAR,CAAQ;gBACpC,IAAI,GAAW,UAAU,KAArB,EAAE,IAAI,GAAK,UAAU,KAAf,CAAe;gBAEN,qBAAM,oBAAoB,CAAC,YAAY,CAChE,gBAAgB,EAChB,UAAU,CACX,EAAA;;gBAHK,KAAA,sBAAqB,SAG1B,KAAA,EAHM,SAAS,QAAA,EAAE,KAAK,QAAA;gBAKvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,eAAe,EAAE,SAAS;oBAC1B,KAAK,OAAA;oBACL,MAAM,EAAE,IAAI;oBACZ,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAA;;;;KACH,EAAA;AAED;IAAkD,gDAGhD;IAHF;;IAeA,CAAC;IATC;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,gBAAM,EAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;;4DACL;IAItB;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,gBAAM,EAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;;8DACH;IAIxB;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,gBAAM,EAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;;oEACG;IAChC,mCAAC;CAAA,AAfD,CAAkD,IAAA,gCAAuB,EAAC;IACxE,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,CAAC;CACV,CAAC,GAYD;AAfY,oEAA4B"}
|