@medusajs/stock-location 2.0.0-next-20230104161618

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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @medusajs/stock-location
2
+
3
+ ## 2.0.0-next-20230104161618
4
+
5
+ ### Major Changes
6
+
7
+ - [#2907](https://github.com/medusajs/medusa/pull/2907) [`c07ffb616`](https://github.com/medusajs/medusa/commit/c07ffb61658b0cdbff00461d1fa267c6be2d1967) Thanks [@carlos-r-l-rodrigues](https://github.com/carlos-r-l-rodrigues)! - Stock locations module added
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`645e0d0ec`](https://github.com/medusajs/medusa/commit/645e0d0ec5e2e49048887c62db662427c8a39cdf), [`cc10c20f3`](https://github.com/medusajs/medusa/commit/cc10c20f356d4fe98336d879f8c9523bb63e9e48), [`eda26f6e8`](https://github.com/medusajs/medusa/commit/eda26f6e818a56672cdcce1d794c307c5490f956), [`c07ffb616`](https://github.com/medusajs/medusa/commit/c07ffb61658b0cdbff00461d1fa267c6be2d1967), [`b9680b641`](https://github.com/medusajs/medusa/commit/b9680b641f2984eddbc1f49a37c050499fbaff69)]:
12
+ - @medusajs/medusa@1.7.3-next-20230104161618
@@ -0,0 +1 @@
1
+ export declare const CONNECTION_NAME = "stock_location_connection";
package/dist/config.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONNECTION_NAME = void 0;
4
+ exports.CONNECTION_NAME = "stock_location_connection";
5
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,2BAA2B,CAAA"}
@@ -0,0 +1,7 @@
1
+ export const service: typeof StockLocationService;
2
+ export const migrations: (typeof SchemaMigration)[];
3
+ export const loaders: (({ configModule, }: {
4
+ configModule: import("@medusajs/medusa").ConfigModule;
5
+ }) => Promise<void>)[];
6
+ import StockLocationService from "./services/stock-location";
7
+ import * as SchemaMigration from "./migrations/schema-migrations/1665749860179-setup";
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.loaders = exports.migrations = exports.service = void 0;
30
+ var connection_1 = __importDefault(require("./loaders/connection"));
31
+ var stock_location_1 = __importDefault(require("./services/stock-location"));
32
+ var SchemaMigration = __importStar(require("./migrations/schema-migrations/1665749860179-setup"));
33
+ exports.service = stock_location_1.default;
34
+ exports.migrations = [SchemaMigration];
35
+ exports.loaders = [connection_1.default];
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAmD;AACnD,6EAA4D;AAC5D,kGAAqF;AAExE,QAAA,OAAO,GAAG,wBAAoB,CAAA;AAC9B,QAAA,UAAU,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9B,QAAA,OAAO,GAAG,CAAC,oBAAgB,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { ConfigModule } from "@medusajs/medusa";
2
+ declare const _default: ({ configModule, }: {
3
+ configModule: ConfigModule;
4
+ }) => Promise<void>;
5
+ export default _default;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var typeorm_1 = require("typeorm");
40
+ var config_1 = require("../config");
41
+ var models_1 = require("../models");
42
+ exports.default = (function (_a) {
43
+ var configModule = _a.configModule;
44
+ return __awaiter(void 0, void 0, void 0, function () {
45
+ return __generator(this, function (_b) {
46
+ switch (_b.label) {
47
+ case 0: return [4 /*yield*/, (0, typeorm_1.createConnection)({
48
+ name: config_1.CONNECTION_NAME,
49
+ type: configModule.projectConfig.database_type,
50
+ url: configModule.projectConfig.database_url,
51
+ database: configModule.projectConfig.database_database,
52
+ schema: configModule.projectConfig.database_schema,
53
+ extra: configModule.projectConfig.database_extra || {},
54
+ entities: [models_1.StockLocation, models_1.StockLocationAddress],
55
+ logging: configModule.projectConfig.database_logging || false,
56
+ })];
57
+ case 1:
58
+ _b.sent();
59
+ return [2 /*return*/];
60
+ }
61
+ });
62
+ });
63
+ });
64
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/loaders/connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mCAA6D;AAC7D,oCAA2C;AAE3C,oCAA+D;AAE/D,mBAAe,UAAO,EAIrB;QAHC,YAAY,kBAAA;;;;wBAIZ,qBAAM,IAAA,0BAAgB,EAAC;wBACrB,IAAI,EAAE,wBAAe;wBACrB,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,aAAa;wBAC9C,GAAG,EAAE,YAAY,CAAC,aAAa,CAAC,YAAY;wBAC5C,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,iBAAiB;wBACtD,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,eAAe;wBAClD,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,cAAc,IAAI,EAAE;wBACtD,QAAQ,EAAE,CAAC,sBAAa,EAAE,6BAAoB,CAAC;wBAC/C,OAAO,EAAE,YAAY,CAAC,aAAa,CAAC,gBAAgB,IAAI,KAAK;qBACzC,CAAC,EAAA;;oBATvB,SASuB,CAAA;;;;;CACxB,EAAA"}
@@ -0,0 +1,13 @@
1
+ import { ConfigModule } from "@medusajs/medusa";
2
+ import { MigrationInterface, QueryRunner } from "typeorm";
3
+ export declare const up: ({ configModule }: {
4
+ configModule: ConfigModule;
5
+ }) => Promise<void>;
6
+ export declare const down: ({ configModule, }: {
7
+ configModule: ConfigModule;
8
+ }) => Promise<void>;
9
+ export declare class setup1665749860179 implements MigrationInterface {
10
+ name: string;
11
+ up(queryRunner: QueryRunner): Promise<void>;
12
+ down(queryRunner: QueryRunner): Promise<void>;
13
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.setup1665749860179 = exports.down = exports.up = void 0;
40
+ var typeorm_1 = require("typeorm");
41
+ var config_1 = require("../../config");
42
+ var up = function (_a) {
43
+ var configModule = _a.configModule;
44
+ return __awaiter(void 0, void 0, void 0, function () {
45
+ var connection;
46
+ return __generator(this, function (_b) {
47
+ switch (_b.label) {
48
+ case 0: return [4 /*yield*/, (0, typeorm_1.createConnection)({
49
+ name: config_1.CONNECTION_NAME,
50
+ type: configModule.projectConfig.database_type,
51
+ url: configModule.projectConfig.database_url,
52
+ database: configModule.projectConfig.database_database,
53
+ schema: configModule.projectConfig.database_schema,
54
+ extra: configModule.projectConfig.database_extra || {},
55
+ migrations: [setup1665749860179],
56
+ logging: true,
57
+ })];
58
+ case 1:
59
+ connection = _b.sent();
60
+ return [4 /*yield*/, connection.runMigrations()];
61
+ case 2:
62
+ _b.sent();
63
+ return [2 /*return*/];
64
+ }
65
+ });
66
+ });
67
+ };
68
+ exports.up = up;
69
+ var down = function (_a) {
70
+ var configModule = _a.configModule;
71
+ return __awaiter(void 0, void 0, void 0, function () {
72
+ var connection;
73
+ return __generator(this, function (_b) {
74
+ switch (_b.label) {
75
+ case 0: return [4 /*yield*/, (0, typeorm_1.createConnection)({
76
+ name: config_1.CONNECTION_NAME,
77
+ type: configModule.projectConfig.database_type,
78
+ url: configModule.projectConfig.database_url,
79
+ database: configModule.projectConfig.database_database,
80
+ schema: configModule.projectConfig.database_schema,
81
+ extra: configModule.projectConfig.database_extra || {},
82
+ migrations: [setup1665749860179],
83
+ logging: true,
84
+ })];
85
+ case 1:
86
+ connection = _b.sent();
87
+ return [4 /*yield*/, connection.undoLastMigration({ transaction: "all" })];
88
+ case 2:
89
+ _b.sent();
90
+ return [2 /*return*/];
91
+ }
92
+ });
93
+ });
94
+ };
95
+ exports.down = down;
96
+ var setup1665749860179 = /** @class */ (function () {
97
+ function setup1665749860179() {
98
+ this.name = "setup1665749860179";
99
+ }
100
+ setup1665749860179.prototype.up = function (queryRunner) {
101
+ return __awaiter(this, void 0, void 0, function () {
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0: return [4 /*yield*/, queryRunner.query("\n CREATE TABLE \"stock_location_address\"\n (\n \"id\" CHARACTER VARYING NOT NULL,\n \"created_at\" TIMESTAMP WITH TIME zone NOT NULL DEFAULT Now(),\n \"updated_at\" TIMESTAMP WITH TIME zone NOT NULL DEFAULT Now(),\n \"deleted_at\" TIMESTAMP WITH TIME zone,\n \"address_1\" TEXT NOT NULL,\n \"address_2\" TEXT,\n \"city\" TEXT,\n \"country_code\" TEXT NOT NULL,\n \"phone\" TEXT,\n \"province\" TEXT,\n \"postal_code\" TEXT,\n \"metadata\" JSONB,\n CONSTRAINT \"PK_b79bc27285bede680501b7b81a5\" PRIMARY KEY (\"id\")\n );\n\n CREATE INDEX \"IDX_stock_location_address_country_code\" ON \"stock_location_address\" (\"country_code\");\n\n CREATE TABLE \"stock_location\"\n (\n \"id\" CHARACTER VARYING NOT NULL,\n \"created_at\" TIMESTAMP WITH time zone NOT NULL DEFAULT Now(),\n \"updated_at\" TIMESTAMP WITH time zone NOT NULL DEFAULT Now(),\n \"deleted_at\" TIMESTAMP WITH time zone,\n \"name\" TEXT NOT NULL,\n \"address_id\" TEXT NOT NULL,\n \"metadata\" JSONB,\n CONSTRAINT \"PK_adf770067d0df1421f525fa25cc\" PRIMARY KEY (\"id\")\n );\n\n CREATE INDEX \"IDX_stock_location_address_id\" ON \"stock_location\" (\"address_id\");\n ")];
105
+ case 1:
106
+ _a.sent();
107
+ return [2 /*return*/];
108
+ }
109
+ });
110
+ });
111
+ };
112
+ setup1665749860179.prototype.down = function (queryRunner) {
113
+ return __awaiter(this, void 0, void 0, function () {
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0: return [4 /*yield*/, queryRunner.query("\n DROP INDEX \"IDX_stock_location_address_id\";\n DROP TABLE \"stock_location\";\n\n DROP INDEX \"IDX_stock_location_address_country_code\";\n DROP TABLE \"stock_location_address\";\n ")];
117
+ case 1:
118
+ _a.sent();
119
+ return [2 /*return*/];
120
+ }
121
+ });
122
+ });
123
+ };
124
+ return setup1665749860179;
125
+ }());
126
+ exports.setup1665749860179 = setup1665749860179;
127
+ //# sourceMappingURL=1665749860179-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1665749860179-setup.js","sourceRoot":"","sources":["../../../src/migrations/schema-migrations/1665749860179-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mCAKgB;AAEhB,uCAA8C;AAEvC,IAAM,EAAE,GAAG,UAAO,EAAgD;QAA9C,YAAY,kBAAA;;;;;wBAClB,qBAAM,IAAA,0BAAgB,EAAC;wBACxC,IAAI,EAAE,wBAAe;wBACrB,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,aAAa;wBAC9C,GAAG,EAAE,YAAY,CAAC,aAAa,CAAC,YAAY;wBAC5C,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,iBAAiB;wBACtD,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,eAAe;wBAClD,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,cAAc,IAAI,EAAE;wBACtD,UAAU,EAAE,CAAC,kBAAkB,CAAC;wBAChC,OAAO,EAAE,IAAI;qBACO,CAAC,EAAA;;oBATjB,UAAU,GAAG,SASI;oBAEvB,qBAAM,UAAU,CAAC,aAAa,EAAE,EAAA;;oBAAhC,SAAgC,CAAA;;;;;CACjC,CAAA;AAbY,QAAA,EAAE,MAad;AAEM,IAAM,IAAI,GAAG,UAAO,EAI1B;QAHC,YAAY,kBAAA;;;;;wBAIO,qBAAM,IAAA,0BAAgB,EAAC;wBACxC,IAAI,EAAE,wBAAe;wBACrB,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,aAAa;wBAC9C,GAAG,EAAE,YAAY,CAAC,aAAa,CAAC,YAAY;wBAC5C,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,iBAAiB;wBACtD,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,eAAe;wBAClD,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,cAAc,IAAI,EAAE;wBACtD,UAAU,EAAE,CAAC,kBAAkB,CAAC;wBAChC,OAAO,EAAE,IAAI;qBACO,CAAC,EAAA;;oBATjB,UAAU,GAAG,SASI;oBAEvB,qBAAM,UAAU,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAA;;oBAA1D,SAA0D,CAAA;;;;;CAC3D,CAAA;AAjBY,QAAA,IAAI,QAiBhB;AAED;IAAA;QACE,SAAI,GAAG,oBAAoB,CAAA;IAgD7B,CAAC;IA9Cc,+BAAE,GAAf,UAAgB,WAAwB;;;;4BACtC,qBAAM,WAAW,CAAC,KAAK,CAAC,4zCAiCvB,CAAC,EAAA;;wBAjCF,SAiCE,CAAA;;;;;KACH;IAEY,iCAAI,GAAjB,UAAkB,WAAwB;;;;4BACxC,qBAAM,WAAW,CAAC,KAAK,CAAC,kNAMvB,CAAC,EAAA;;wBANF,SAME,CAAA;;;;;KACH;IACH,yBAAC;AAAD,CAAC,AAjDD,IAiDC;AAjDY,gDAAkB"}
@@ -0,0 +1,2 @@
1
+ export * from "./stock-location";
2
+ export * from "./stock-location-address";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./stock-location"), exports);
18
+ __exportStar(require("./stock-location-address"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,2DAAwC"}
@@ -0,0 +1,12 @@
1
+ import { SoftDeletableEntity } from "@medusajs/medusa";
2
+ export declare class StockLocationAddress extends SoftDeletableEntity {
3
+ address_1: string;
4
+ address_2: string | null;
5
+ city: string | null;
6
+ country_code: string;
7
+ phone: string | null;
8
+ province: string | null;
9
+ postal_code: string | null;
10
+ metadata: Record<string, unknown> | null;
11
+ private beforeInsert;
12
+ }
@@ -0,0 +1,83 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.StockLocationAddress = void 0;
28
+ var typeorm_1 = require("typeorm");
29
+ var medusa_1 = require("@medusajs/medusa");
30
+ var StockLocationAddress = /** @class */ (function (_super) {
31
+ __extends(StockLocationAddress, _super);
32
+ function StockLocationAddress() {
33
+ return _super !== null && _super.apply(this, arguments) || this;
34
+ }
35
+ StockLocationAddress.prototype.beforeInsert = function () {
36
+ this.id = (0, medusa_1.generateEntityId)(this.id, "laddr");
37
+ };
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: "text" }),
40
+ __metadata("design:type", String)
41
+ ], StockLocationAddress.prototype, "address_1", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
44
+ __metadata("design:type", Object)
45
+ ], StockLocationAddress.prototype, "address_2", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
48
+ __metadata("design:type", Object)
49
+ ], StockLocationAddress.prototype, "city", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Index)(),
52
+ (0, typeorm_1.Column)({ type: "text" }),
53
+ __metadata("design:type", String)
54
+ ], StockLocationAddress.prototype, "country_code", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
57
+ __metadata("design:type", Object)
58
+ ], StockLocationAddress.prototype, "phone", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], StockLocationAddress.prototype, "province", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
65
+ __metadata("design:type", Object)
66
+ ], StockLocationAddress.prototype, "postal_code", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
69
+ __metadata("design:type", Object)
70
+ ], StockLocationAddress.prototype, "metadata", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.BeforeInsert)(),
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", []),
75
+ __metadata("design:returntype", void 0)
76
+ ], StockLocationAddress.prototype, "beforeInsert", null);
77
+ StockLocationAddress = __decorate([
78
+ (0, typeorm_1.Entity)()
79
+ ], StockLocationAddress);
80
+ return StockLocationAddress;
81
+ }(medusa_1.SoftDeletableEntity));
82
+ exports.StockLocationAddress = StockLocationAddress;
83
+ //# sourceMappingURL=stock-location-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-location-address.js","sourceRoot":"","sources":["../../src/models/stock-location-address.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6D;AAC7D,2CAAwE;AAGxE;IAA0C,wCAAmB;IAA7D;;IA8BA,CAAC;IAHS,2CAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,yBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IA3BD;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DACR;IAGjB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACjB;IAGxB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACtB;IAInB;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DACL;IAGpB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACrB;IAGpB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DAClB;IAGvB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6DACf;IAG1B;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACF;IAGxC;QADC,IAAA,sBAAY,GAAE;;;;4DAGd;IA7BU,oBAAoB;QADhC,IAAA,gBAAM,GAAE;OACI,oBAAoB,CA8BhC;IAAD,2BAAC;CAAA,AA9BD,CAA0C,4BAAmB,GA8B5D;AA9BY,oDAAoB"}
@@ -0,0 +1,9 @@
1
+ import { SoftDeletableEntity } from "@medusajs/medusa";
2
+ import { StockLocationAddress } from ".";
3
+ export declare class StockLocation extends SoftDeletableEntity {
4
+ name: string;
5
+ address_id: string;
6
+ address: StockLocationAddress | null;
7
+ metadata: Record<string, unknown> | null;
8
+ private beforeInsert;
9
+ }
@@ -0,0 +1,69 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.StockLocation = void 0;
28
+ var typeorm_1 = require("typeorm");
29
+ var medusa_1 = require("@medusajs/medusa");
30
+ var _1 = require(".");
31
+ var StockLocation = /** @class */ (function (_super) {
32
+ __extends(StockLocation, _super);
33
+ function StockLocation() {
34
+ return _super !== null && _super.apply(this, arguments) || this;
35
+ }
36
+ StockLocation.prototype.beforeInsert = function () {
37
+ this.id = (0, medusa_1.generateEntityId)(this.id, "sloc");
38
+ };
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: "text" }),
41
+ __metadata("design:type", String)
42
+ ], StockLocation.prototype, "name", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Index)(),
45
+ (0, typeorm_1.Column)({ type: "text" }),
46
+ __metadata("design:type", String)
47
+ ], StockLocation.prototype, "address_id", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.ManyToOne)(function () { return _1.StockLocationAddress; }),
50
+ (0, typeorm_1.JoinColumn)({ name: "address_id" }),
51
+ __metadata("design:type", Object)
52
+ ], StockLocation.prototype, "address", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
55
+ __metadata("design:type", Object)
56
+ ], StockLocation.prototype, "metadata", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.BeforeInsert)(),
59
+ __metadata("design:type", Function),
60
+ __metadata("design:paramtypes", []),
61
+ __metadata("design:returntype", void 0)
62
+ ], StockLocation.prototype, "beforeInsert", null);
63
+ StockLocation = __decorate([
64
+ (0, typeorm_1.Entity)()
65
+ ], StockLocation);
66
+ return StockLocation;
67
+ }(medusa_1.SoftDeletableEntity));
68
+ exports.StockLocation = StockLocation;
69
+ //# sourceMappingURL=stock-location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-location.js","sourceRoot":"","sources":["../../src/models/stock-location.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAChB,2CAAwE;AAExE,sBAAwC;AAGxC;IAAmC,iCAAmB;IAAtD;;IAmBA,CAAC;IAHS,oCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,yBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IAhBD;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACb;IAIZ;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACP;IAIlB;QAFC,IAAA,mBAAS,EAAC,cAAM,OAAA,uBAAoB,EAApB,CAAoB,CAAC;QACrC,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;;kDACC;IAGpC;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACF;IAGxC;QADC,IAAA,sBAAY,GAAE;;;;qDAGd;IAlBU,aAAa;QADzB,IAAA,gBAAM,GAAE;OACI,aAAa,CAmBzB;IAAD,oBAAC;CAAA,AAnBD,CAAmC,4BAAmB,GAmBrD;AAnBY,sCAAa"}
@@ -0,0 +1 @@
1
+ export { default as StockLocationService } from "./stock-location";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.StockLocationService = void 0;
7
+ var stock_location_1 = require("./stock-location");
8
+ Object.defineProperty(exports, "StockLocationService", { enumerable: true, get: function () { return __importDefault(stock_location_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAkE;AAAzD,uIAAA,OAAO,OAAwB"}
@@ -0,0 +1,74 @@
1
+ import { EntityManager } from "typeorm";
2
+ import { FindConfig, FilterableStockLocationProps, CreateStockLocationInput, UpdateStockLocationInput, StockLocationAddressInput, IEventBusService } from "@medusajs/medusa";
3
+ import { StockLocation, StockLocationAddress } from "../models";
4
+ declare type InjectedDependencies = {
5
+ eventBusService: IEventBusService;
6
+ };
7
+ /**
8
+ * Service for managing stock locations.
9
+ */
10
+ export default class StockLocationService {
11
+ static Events: {
12
+ CREATED: string;
13
+ UPDATED: string;
14
+ DELETED: string;
15
+ };
16
+ protected readonly manager_: EntityManager;
17
+ protected readonly eventBusService_: IEventBusService;
18
+ constructor({ eventBusService }: InjectedDependencies);
19
+ private getManager;
20
+ /**
21
+ * Lists all stock locations that match the given selector.
22
+ * @param {FilterableStockLocationProps} [selector={}] - Properties to filter by.
23
+ * @param {FindConfig} [config={ relations: [], skip: 0, take: 10 }] - Additional configuration for the query.
24
+ * @return {Promise<StockLocation[]>} A list of stock locations.
25
+ */
26
+ list(selector?: FilterableStockLocationProps, config?: FindConfig<StockLocation>): Promise<StockLocation[]>;
27
+ /**
28
+ * Lists all stock locations that match the given selector and returns the count of matching stock locations.
29
+ * @param {FilterableStockLocationProps} [selector={}] - Properties to filter by.
30
+ * @param {FindConfig} [config={ relations: [], skip: 0, take: 10 }] - Additional configuration for the query.
31
+ * @return {Promise<[StockLocation[], number]>} A list of stock locations and the count of matching stock locations.
32
+ */
33
+ listAndCount(selector?: FilterableStockLocationProps, config?: FindConfig<StockLocation>): Promise<[StockLocation[], number]>;
34
+ /**
35
+ * Retrieves a stock location by its ID.
36
+ * @param {string} stockLocationId - The ID of the stock location.
37
+ * @param {FindConfig} [config={}] - Additional configuration for the query.
38
+ * @return {Promise<StockLocation>} The stock location.
39
+ * @throws {MedusaError} If the stock location ID is not defined.
40
+ * @throws {MedusaError} If the stock location with the given ID was not found.
41
+ */
42
+ retrieve(stockLocationId: string, config?: FindConfig<StockLocation>): Promise<StockLocation>;
43
+ /**
44
+ * Creates a new stock location.
45
+ * @param {CreateStockLocationInput} data - The input data for creating a stock location.
46
+ * @returns {Promise<StockLocation>} - The created stock location.
47
+ */
48
+ create(data: CreateStockLocationInput): Promise<StockLocation>;
49
+ /**
50
+ * Updates an existing stock location.
51
+ * @param {string} stockLocationId - The ID of the stock location to update.
52
+ * @param {UpdateStockLocationInput} updateData - The update data for the stock location.
53
+ * @returns {Promise<StockLocation>} - The updated stock location.
54
+ */
55
+ update(stockLocationId: string, updateData: UpdateStockLocationInput): Promise<StockLocation>;
56
+ /**
57
+ * Updates an address for a stock location.
58
+ * @param {string} addressId - The ID of the address to update.
59
+ * @param {StockLocationAddressInput} address - The update data for the address.
60
+ * @param {Object} context - Context for the update.
61
+ * @param {EntityManager} context.manager - The entity manager to use for the update.
62
+ * @returns {Promise<StockLocationAddress>} - The updated stock location address.
63
+ */
64
+ protected updateAddress(addressId: string, address: StockLocationAddressInput, context?: {
65
+ manager?: EntityManager;
66
+ }): Promise<StockLocationAddress>;
67
+ /**
68
+ * Deletes a stock location.
69
+ * @param {string} id - The ID of the stock location to delete.
70
+ * @returns {Promise<void>} - An empty promise.
71
+ */
72
+ delete(id: string): Promise<void>;
73
+ }
74
+ export {};
@@ -0,0 +1,336 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __rest = (this && this.__rest) || function (s, e) {
39
+ var t = {};
40
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
41
+ t[p] = s[p];
42
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
43
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
44
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
45
+ t[p[i]] = s[p[i]];
46
+ }
47
+ return t;
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ var typeorm_1 = require("typeorm");
51
+ var medusa_core_utils_1 = require("medusa-core-utils");
52
+ var medusa_1 = require("@medusajs/medusa");
53
+ var models_1 = require("../models");
54
+ var config_1 = require("../config");
55
+ /**
56
+ * Service for managing stock locations.
57
+ */
58
+ var StockLocationService = /** @class */ (function () {
59
+ function StockLocationService(_a) {
60
+ var eventBusService = _a.eventBusService;
61
+ this.eventBusService_ = eventBusService;
62
+ }
63
+ StockLocationService.prototype.getManager = function () {
64
+ var connection = (0, typeorm_1.getConnection)(config_1.CONNECTION_NAME);
65
+ return connection.manager;
66
+ };
67
+ /**
68
+ * Lists all stock locations that match the given selector.
69
+ * @param {FilterableStockLocationProps} [selector={}] - Properties to filter by.
70
+ * @param {FindConfig} [config={ relations: [], skip: 0, take: 10 }] - Additional configuration for the query.
71
+ * @return {Promise<StockLocation[]>} A list of stock locations.
72
+ */
73
+ StockLocationService.prototype.list = function (selector, config) {
74
+ if (selector === void 0) { selector = {}; }
75
+ if (config === void 0) { config = { relations: [], skip: 0, take: 10 }; }
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ var manager, locationRepo, query;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ manager = this.getManager();
82
+ locationRepo = manager.getRepository(models_1.StockLocation);
83
+ query = (0, medusa_1.buildQuery)(selector, config);
84
+ return [4 /*yield*/, locationRepo.find(query)];
85
+ case 1: return [2 /*return*/, _a.sent()];
86
+ }
87
+ });
88
+ });
89
+ };
90
+ /**
91
+ * Lists all stock locations that match the given selector and returns the count of matching stock locations.
92
+ * @param {FilterableStockLocationProps} [selector={}] - Properties to filter by.
93
+ * @param {FindConfig} [config={ relations: [], skip: 0, take: 10 }] - Additional configuration for the query.
94
+ * @return {Promise<[StockLocation[], number]>} A list of stock locations and the count of matching stock locations.
95
+ */
96
+ StockLocationService.prototype.listAndCount = function (selector, config) {
97
+ if (selector === void 0) { selector = {}; }
98
+ if (config === void 0) { config = { relations: [], skip: 0, take: 10 }; }
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ var manager, locationRepo, query;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0:
104
+ manager = this.getManager();
105
+ locationRepo = manager.getRepository(models_1.StockLocation);
106
+ query = (0, medusa_1.buildQuery)(selector, config);
107
+ return [4 /*yield*/, locationRepo.findAndCount(query)];
108
+ case 1: return [2 /*return*/, _a.sent()];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ /**
114
+ * Retrieves a stock location by its ID.
115
+ * @param {string} stockLocationId - The ID of the stock location.
116
+ * @param {FindConfig} [config={}] - Additional configuration for the query.
117
+ * @return {Promise<StockLocation>} The stock location.
118
+ * @throws {MedusaError} If the stock location ID is not defined.
119
+ * @throws {MedusaError} If the stock location with the given ID was not found.
120
+ */
121
+ StockLocationService.prototype.retrieve = function (stockLocationId, config) {
122
+ if (config === void 0) { config = {}; }
123
+ return __awaiter(this, void 0, void 0, function () {
124
+ var manager, locationRepo, query, loc;
125
+ return __generator(this, function (_a) {
126
+ switch (_a.label) {
127
+ case 0:
128
+ if (!(0, medusa_core_utils_1.isDefined)(stockLocationId)) {
129
+ throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "\"stockLocationId\" must be defined");
130
+ }
131
+ manager = this.getManager();
132
+ locationRepo = manager.getRepository(models_1.StockLocation);
133
+ query = (0, medusa_1.buildQuery)({ id: stockLocationId }, config);
134
+ return [4 /*yield*/, locationRepo.findOne(query)];
135
+ case 1:
136
+ loc = _a.sent();
137
+ if (!loc) {
138
+ throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "StockLocation with id ".concat(stockLocationId, " was not found"));
139
+ }
140
+ return [2 /*return*/, loc];
141
+ }
142
+ });
143
+ });
144
+ };
145
+ /**
146
+ * Creates a new stock location.
147
+ * @param {CreateStockLocationInput} data - The input data for creating a stock location.
148
+ * @returns {Promise<StockLocation>} - The created stock location.
149
+ */
150
+ StockLocationService.prototype.create = function (data) {
151
+ return __awaiter(this, void 0, void 0, function () {
152
+ var defaultManager;
153
+ var _this = this;
154
+ return __generator(this, function (_a) {
155
+ switch (_a.label) {
156
+ case 0:
157
+ defaultManager = this.getManager();
158
+ return [4 /*yield*/, defaultManager.transaction(function (manager) { return __awaiter(_this, void 0, void 0, function () {
159
+ var locationRepo, loc, addrId, address, locAddressRepo, locAddress, addressResult, metadata, result;
160
+ var _a;
161
+ return __generator(this, function (_b) {
162
+ switch (_b.label) {
163
+ case 0:
164
+ locationRepo = manager.getRepository(models_1.StockLocation);
165
+ loc = locationRepo.create({
166
+ name: data.name,
167
+ });
168
+ if (!((0, medusa_core_utils_1.isDefined)(data.address) || (0, medusa_core_utils_1.isDefined)(data.address_id))) return [3 /*break*/, 4];
169
+ if (!(typeof data.address === "string" || data.address_id)) return [3 /*break*/, 2];
170
+ addrId = ((_a = data.address) !== null && _a !== void 0 ? _a : data.address_id);
171
+ return [4 /*yield*/, this.retrieve(addrId, {
172
+ select: ["id"],
173
+ })];
174
+ case 1:
175
+ address = _b.sent();
176
+ loc.address_id = address.id;
177
+ return [3 /*break*/, 4];
178
+ case 2:
179
+ locAddressRepo = manager.getRepository(models_1.StockLocationAddress);
180
+ locAddress = locAddressRepo.create(data.address);
181
+ return [4 /*yield*/, locAddressRepo.save(locAddress)];
182
+ case 3:
183
+ addressResult = _b.sent();
184
+ loc.address_id = addressResult.id;
185
+ _b.label = 4;
186
+ case 4:
187
+ metadata = data.metadata;
188
+ if (metadata) {
189
+ loc.metadata = (0, medusa_1.setMetadata)(loc, metadata);
190
+ }
191
+ return [4 /*yield*/, locationRepo.save(loc)];
192
+ case 5:
193
+ result = _b.sent();
194
+ return [4 /*yield*/, this.eventBusService_.emit(StockLocationService.Events.CREATED, {
195
+ id: result.id,
196
+ })];
197
+ case 6:
198
+ _b.sent();
199
+ return [2 /*return*/, result];
200
+ }
201
+ });
202
+ }); })];
203
+ case 1: return [2 /*return*/, _a.sent()];
204
+ }
205
+ });
206
+ });
207
+ };
208
+ /**
209
+ * Updates an existing stock location.
210
+ * @param {string} stockLocationId - The ID of the stock location to update.
211
+ * @param {UpdateStockLocationInput} updateData - The update data for the stock location.
212
+ * @returns {Promise<StockLocation>} - The updated stock location.
213
+ */
214
+ StockLocationService.prototype.update = function (stockLocationId, updateData) {
215
+ return __awaiter(this, void 0, void 0, function () {
216
+ var defaultManager;
217
+ var _this = this;
218
+ return __generator(this, function (_a) {
219
+ switch (_a.label) {
220
+ case 0:
221
+ defaultManager = this.getManager();
222
+ return [4 /*yield*/, defaultManager.transaction(function (manager) { return __awaiter(_this, void 0, void 0, function () {
223
+ var locationRepo, item, address, metadata, data, locAddressRepo, locAddress, addressResult, toSave;
224
+ return __generator(this, function (_a) {
225
+ switch (_a.label) {
226
+ case 0:
227
+ locationRepo = manager.getRepository(models_1.StockLocation);
228
+ return [4 /*yield*/, this.retrieve(stockLocationId)];
229
+ case 1:
230
+ item = _a.sent();
231
+ address = updateData.address, metadata = updateData.metadata, data = __rest(updateData, ["address", "metadata"]);
232
+ if (!address) return [3 /*break*/, 5];
233
+ if (!item.address_id) return [3 /*break*/, 3];
234
+ return [4 /*yield*/, this.updateAddress(item.address_id, address, { manager: manager })];
235
+ case 2:
236
+ _a.sent();
237
+ return [3 /*break*/, 5];
238
+ case 3:
239
+ locAddressRepo = manager.getRepository(models_1.StockLocationAddress);
240
+ locAddress = locAddressRepo.create(address);
241
+ return [4 /*yield*/, locAddressRepo.save(locAddress)];
242
+ case 4:
243
+ addressResult = _a.sent();
244
+ data.address_id = addressResult.id;
245
+ _a.label = 5;
246
+ case 5:
247
+ if (metadata) {
248
+ item.metadata = (0, medusa_1.setMetadata)(item, metadata);
249
+ }
250
+ toSave = locationRepo.merge(item, data);
251
+ return [4 /*yield*/, locationRepo.save(toSave)];
252
+ case 6:
253
+ _a.sent();
254
+ return [4 /*yield*/, this.eventBusService_.emit(StockLocationService.Events.UPDATED, {
255
+ id: stockLocationId,
256
+ })];
257
+ case 7:
258
+ _a.sent();
259
+ return [2 /*return*/, item];
260
+ }
261
+ });
262
+ }); })];
263
+ case 1: return [2 /*return*/, _a.sent()];
264
+ }
265
+ });
266
+ });
267
+ };
268
+ /**
269
+ * Updates an address for a stock location.
270
+ * @param {string} addressId - The ID of the address to update.
271
+ * @param {StockLocationAddressInput} address - The update data for the address.
272
+ * @param {Object} context - Context for the update.
273
+ * @param {EntityManager} context.manager - The entity manager to use for the update.
274
+ * @returns {Promise<StockLocationAddress>} - The updated stock location address.
275
+ */
276
+ StockLocationService.prototype.updateAddress = function (addressId, address, context) {
277
+ if (context === void 0) { context = {}; }
278
+ return __awaiter(this, void 0, void 0, function () {
279
+ var manager, locationAddressRepo, existingAddress, toSave, metadata;
280
+ return __generator(this, function (_a) {
281
+ switch (_a.label) {
282
+ case 0:
283
+ manager = context.manager || this.getManager();
284
+ locationAddressRepo = manager.getRepository(models_1.StockLocationAddress);
285
+ return [4 /*yield*/, locationAddressRepo.findOne(addressId)];
286
+ case 1:
287
+ existingAddress = _a.sent();
288
+ if (!existingAddress) {
289
+ throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "StockLocation address with id ".concat(addressId, " was not found"));
290
+ }
291
+ toSave = locationAddressRepo.merge(existingAddress, address);
292
+ metadata = address.metadata;
293
+ if (metadata) {
294
+ toSave.metadata = (0, medusa_1.setMetadata)(toSave, metadata);
295
+ }
296
+ return [4 /*yield*/, locationAddressRepo.save(toSave)];
297
+ case 2: return [2 /*return*/, _a.sent()];
298
+ }
299
+ });
300
+ });
301
+ };
302
+ /**
303
+ * Deletes a stock location.
304
+ * @param {string} id - The ID of the stock location to delete.
305
+ * @returns {Promise<void>} - An empty promise.
306
+ */
307
+ StockLocationService.prototype.delete = function (id) {
308
+ return __awaiter(this, void 0, void 0, function () {
309
+ var manager, locationRepo;
310
+ return __generator(this, function (_a) {
311
+ switch (_a.label) {
312
+ case 0:
313
+ manager = this.getManager();
314
+ locationRepo = manager.getRepository(models_1.StockLocation);
315
+ return [4 /*yield*/, locationRepo.softRemove({ id: id })];
316
+ case 1:
317
+ _a.sent();
318
+ return [4 /*yield*/, this.eventBusService_.emit(StockLocationService.Events.DELETED, {
319
+ id: id,
320
+ })];
321
+ case 2:
322
+ _a.sent();
323
+ return [2 /*return*/];
324
+ }
325
+ });
326
+ });
327
+ };
328
+ StockLocationService.Events = {
329
+ CREATED: "stock-location.created",
330
+ UPDATED: "stock-location.updated",
331
+ DELETED: "stock-location.deleted",
332
+ };
333
+ return StockLocationService;
334
+ }());
335
+ exports.default = StockLocationService;
336
+ //# sourceMappingURL=stock-location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-location.js","sourceRoot":"","sources":["../../src/services/stock-location.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsD;AACtD,uDAA0D;AAC1D,2CASyB;AAEzB,oCAA+D;AAC/D,oCAA2C;AAM3C;;GAEG;AAEH;IAWE,8BAAY,EAAyC;YAAvC,eAAe,qBAAA;QAC3B,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;IACzC,CAAC;IAEO,yCAAU,GAAlB;QACE,IAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,wBAAe,CAAC,CAAA;QACjD,OAAO,UAAU,CAAC,OAAO,CAAA;IAC3B,CAAC;IAED;;;;;OAKG;IACG,mCAAI,GAAV,UACE,QAA2C,EAC3C,MAAwE;QADxE,yBAAA,EAAA,aAA2C;QAC3C,uBAAA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\\.[jt]s?$": "ts-jest",
10
+ },
11
+ testEnvironment: `node`,
12
+ moduleFileExtensions: [`js`, `ts`],
13
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@medusajs/stock-location",
3
+ "version": "2.0.0-next-20230104161618",
4
+ "description": "Stock Location Module for Medusa",
5
+ "main": "dist/index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/medusajs/medusa",
9
+ "directory": "packages/stock-location"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "author": "Medusa",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "@medusajs/medusa": "1.7.3-next-20230104161618",
18
+ "cross-env": "^5.2.1",
19
+ "jest": "^25.5.2",
20
+ "ts-jest": "^25.5.1",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "scripts": {
24
+ "watch": "tsc --build --watch",
25
+ "prepare": "cross-env NODE_ENV=production yarn run build",
26
+ "build": "tsc --build",
27
+ "test": "jest --passWithNoTests",
28
+ "test:unit": "jest --passWithNoTests"
29
+ },
30
+ "peerDependencies": {
31
+ "@medusajs/medusa": "1.7.3-next-20230104161618",
32
+ "medusa-interfaces": "1.3.3",
33
+ "typeorm": "^0.2.31"
34
+ }
35
+ }