@medusajs/inventory 1.0.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/dist/config.d.ts +1 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/connection.d.ts +5 -0
- package/dist/loaders/connection.js +64 -0
- package/dist/loaders/connection.js.map +1 -0
- package/dist/migrations/schema-migrations/1665748086258-inventory_setup.d.ts +13 -0
- package/dist/migrations/schema-migrations/1665748086258-inventory_setup.js +131 -0
- package/dist/migrations/schema-migrations/1665748086258-inventory_setup.js.map +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +20 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/inventory-item.d.ts +15 -0
- package/dist/models/inventory-item.js +95 -0
- package/dist/models/inventory-item.js.map +1 -0
- package/dist/models/inventory-level.d.ts +10 -0
- package/dist/models/inventory-level.js +77 -0
- package/dist/models/inventory-level.js.map +1 -0
- package/dist/models/reservation-item.d.ts +9 -0
- package/dist/models/reservation-item.js +73 -0
- package/dist/models/reservation-item.js.map +1 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +15 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/inventory-item.d.ts +53 -0
- package/dist/services/inventory-item.js +289 -0
- package/dist/services/inventory-item.js.map +1 -0
- package/dist/services/inventory-level.d.ts +89 -0
- package/dist/services/inventory-level.js +411 -0
- package/dist/services/inventory-level.js.map +1 -0
- package/dist/services/inventory.d.ts +150 -0
- package/dist/services/inventory.js +496 -0
- package/dist/services/inventory.js.map +1 -0
- package/dist/services/reservation-item.d.ts +68 -0
- package/dist/services/reservation-item.js +385 -0
- package/dist/services/reservation-item.js.map +1 -0
- package/jest.config.js +13 -0
- package/package.json +37 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONNECTION_NAME = "inventory_connection";
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,sBAAsB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const service: typeof InventoryService;
|
|
2
|
+
export const migrations: (typeof SchemaMigration)[];
|
|
3
|
+
export const loaders: (({ configModule, }: {
|
|
4
|
+
configModule: import("@medusajs/medusa").ConfigModule;
|
|
5
|
+
}) => Promise<void>)[];
|
|
6
|
+
import InventoryService from "./services/inventory";
|
|
7
|
+
import * as SchemaMigration from "./migrations/schema-migrations/1665748086258-inventory_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 inventory_1 = __importDefault(require("./services/inventory"));
|
|
32
|
+
var SchemaMigration = __importStar(require("./migrations/schema-migrations/1665748086258-inventory_setup"));
|
|
33
|
+
exports.service = inventory_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,mEAAmD;AACnD,4GAA+F;AAElF,QAAA,OAAO,GAAG,mBAAgB,CAAA;AAC1B,QAAA,UAAU,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9B,QAAA,OAAO,GAAG,CAAC,oBAAgB,CAAC,CAAA"}
|
|
@@ -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.ReservationItem, models_1.InventoryLevel, models_1.InventoryItem],
|
|
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,oCAA0E;AAE1E,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,wBAAe,EAAE,uBAAc,EAAE,sBAAa,CAAC;wBAC1D,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 inventorySetup1665748086258 implements MigrationInterface {
|
|
10
|
+
name: string;
|
|
11
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
12
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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.inventorySetup1665748086258 = 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
|
+
extra: configModule.projectConfig.database_extra || {},
|
|
53
|
+
schema: configModule.projectConfig.database_schema,
|
|
54
|
+
migrations: [inventorySetup1665748086258],
|
|
55
|
+
logging: true,
|
|
56
|
+
})];
|
|
57
|
+
case 1:
|
|
58
|
+
connection = _b.sent();
|
|
59
|
+
return [4 /*yield*/, connection.runMigrations()];
|
|
60
|
+
case 2:
|
|
61
|
+
_b.sent();
|
|
62
|
+
return [4 /*yield*/, connection.close()];
|
|
63
|
+
case 3:
|
|
64
|
+
_b.sent();
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.up = up;
|
|
71
|
+
var down = function (_a) {
|
|
72
|
+
var configModule = _a.configModule;
|
|
73
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var connection;
|
|
75
|
+
return __generator(this, function (_b) {
|
|
76
|
+
switch (_b.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, (0, typeorm_1.createConnection)({
|
|
78
|
+
name: config_1.CONNECTION_NAME,
|
|
79
|
+
type: configModule.projectConfig.database_type,
|
|
80
|
+
url: configModule.projectConfig.database_url,
|
|
81
|
+
extra: configModule.projectConfig.database_extra || {},
|
|
82
|
+
schema: configModule.projectConfig.database_schema,
|
|
83
|
+
migrations: [inventorySetup1665748086258],
|
|
84
|
+
logging: true,
|
|
85
|
+
})];
|
|
86
|
+
case 1:
|
|
87
|
+
connection = _b.sent();
|
|
88
|
+
return [4 /*yield*/, connection.undoLastMigration({ transaction: "all" })];
|
|
89
|
+
case 2:
|
|
90
|
+
_b.sent();
|
|
91
|
+
return [4 /*yield*/, connection.close()];
|
|
92
|
+
case 3:
|
|
93
|
+
_b.sent();
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
exports.down = down;
|
|
100
|
+
var inventorySetup1665748086258 = /** @class */ (function () {
|
|
101
|
+
function inventorySetup1665748086258() {
|
|
102
|
+
this.name = "inventorySetup1665748086258";
|
|
103
|
+
}
|
|
104
|
+
inventorySetup1665748086258.prototype.up = function (queryRunner) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, queryRunner.query("\n CREATE TABLE \"inventory_item\" (\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 \"sku\" text,\n \"origin_country\" text,\n \"hs_code\" text,\n \"mid_code\" text,\n \"material\" text,\n \"weight\" integer,\n \"length\" integer,\n \"height\" integer,\n \"width\" integer,\n \"requires_shipping\" boolean NOT NULL DEFAULT true,\n \"metadata\" jsonb,\n CONSTRAINT \"PK_inventory_item_id\" PRIMARY KEY (\"id\")\n );\n\n CREATE UNIQUE INDEX \"IDX_inventory_item_sku\" ON \"inventory_item\" (\"sku\");\n\n\n CREATE TABLE \"reservation_item\" (\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 \"line_item_id\" text,\n \"inventory_item_id\" text NOT NULL,\n \"location_id\" text NOT NULL,\n \"quantity\" integer NOT NULL,\n \"metadata\" jsonb,\n CONSTRAINT \"PK_reservation_item_id\" PRIMARY KEY (\"id\")\n );\n\n CREATE INDEX \"IDX_reservation_item_line_item_id\" ON \"reservation_item\" (\"line_item_id\") WHERE deleted_at IS NULL;\n CREATE INDEX \"IDX_reservation_item_inventory_item_id\" ON \"reservation_item\" (\"inventory_item_id\") WHERE deleted_at IS NULL;\n CREATE INDEX \"IDX_reservation_item_location_id\" ON \"reservation_item\" (\"location_id\") WHERE deleted_at IS NULL;\n\n\n CREATE TABLE \"inventory_level\" (\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 \"inventory_item_id\" text NOT NULL,\n \"location_id\" text NOT NULL,\n \"stocked_quantity\" integer NOT NULL DEFAULT 0,\n \"reserved_quantity\" integer NOT NULL DEFAULT 0,\n \"incoming_quantity\" integer NOT NULL DEFAULT 0,\n \"metadata\" jsonb,\n CONSTRAINT \"PK_inventory_level_id\" PRIMARY KEY (\"id\")\n );\n\n CREATE UNIQUE INDEX \"UQ_inventory_level_inventory_item_id_location_id\" ON \"inventory_level\" (\"inventory_item_id\", \"location_id\");\n CREATE INDEX \"IDX_inventory_level_inventory_item_id\" ON \"inventory_level\" (\"inventory_item_id\");\n CREATE INDEX \"IDX_inventory_level_location_id\" ON \"inventory_level\" (\"location_id\");\n ")];
|
|
109
|
+
case 1:
|
|
110
|
+
_a.sent();
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
inventorySetup1665748086258.prototype.down = function (queryRunner) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0: return [4 /*yield*/, queryRunner.query("\n DROP INDEX \"IDX_inventory_level_location_id\";\n DROP INDEX \"IDX_inventory_level_inventory_item_id\";\n DROP INDEX \"UQ_inventory_level_inventory_item_id_location_id\";\n DROP TABLE \"inventory_level\";\n\n DROP INDEX \"IDX_reservation_item_location_id\";\n DROP INDEX \"IDX_reservation_item_inventory_item_id\";\n DROP INDEX \"IDX_reservation_item_line_item_id\";\n DROP TABLE \"reservation_item\";\n\n DROP INDEX \"IDX_inventory_item_sku\";\n DROP TABLE \"inventory_item\";\n ")];
|
|
121
|
+
case 1:
|
|
122
|
+
_a.sent();
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
return inventorySetup1665748086258;
|
|
129
|
+
}());
|
|
130
|
+
exports.inventorySetup1665748086258 = inventorySetup1665748086258;
|
|
131
|
+
//# sourceMappingURL=1665748086258-inventory_setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1665748086258-inventory_setup.js","sourceRoot":"","sources":["../../../src/migrations/schema-migrations/1665748086258-inventory_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,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,cAAc,IAAI,EAAE;wBACtD,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,eAAe;wBAClD,UAAU,EAAE,CAAC,2BAA2B,CAAC;wBACzC,OAAO,EAAE,IAAI;qBACO,CAAC,EAAA;;oBARjB,UAAU,GAAG,SAQI;oBAEvB,qBAAM,UAAU,CAAC,aAAa,EAAE,EAAA;;oBAAhC,SAAgC,CAAA;oBAChC,qBAAM,UAAU,CAAC,KAAK,EAAE,EAAA;;oBAAxB,SAAwB,CAAA;;;;;CACzB,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,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,cAAc,IAAI,EAAE;wBACtD,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,eAAe;wBAClD,UAAU,EAAE,CAAC,2BAA2B,CAAC;wBACzC,OAAO,EAAE,IAAI;qBACO,CAAC,EAAA;;oBARjB,UAAU,GAAG,SAQI;oBAEvB,qBAAM,UAAU,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAA;;oBAA1D,SAA0D,CAAA;oBAC1D,qBAAM,UAAU,CAAC,KAAK,EAAE,EAAA;;oBAAxB,SAAwB,CAAA;;;;;CACzB,CAAA;AAjBY,QAAA,IAAI,QAiBhB;AAED;IAAA;QACE,SAAI,GAAG,6BAA6B,CAAA;IAgFtC,CAAC;IA9Ec,wCAAE,GAAf,UAAgB,WAAwB;;;;4BACtC,qBAAM,WAAW,CAAC,KAAK,CAAC,gsFA0DvB,CAAC,EAAA;;wBA1DF,SA0DE,CAAA;;;;;KACH;IAEY,0CAAI,GAAjB,UAAkB,WAAwB;;;;4BACxC,qBAAM,WAAW,CAAC,KAAK,CAAC,0hBAavB,CAAC,EAAA;;wBAbF,SAaE,CAAA;;;;;KACH;IACH,kCAAC;AAAD,CAAC,AAjFD,IAiFC;AAjFY,kEAA2B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./reservation-item"), exports);
|
|
18
|
+
__exportStar(require("./inventory-item"), exports);
|
|
19
|
+
__exportStar(require("./inventory-level"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,mDAAgC;AAChC,oDAAiC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SoftDeletableEntity } from "@medusajs/medusa";
|
|
2
|
+
export declare class InventoryItem extends SoftDeletableEntity {
|
|
3
|
+
sku: string | null;
|
|
4
|
+
origin_country: string | null;
|
|
5
|
+
hs_code: string | null;
|
|
6
|
+
mid_code: string | null;
|
|
7
|
+
material: string | null;
|
|
8
|
+
weight: number | null;
|
|
9
|
+
length: number | null;
|
|
10
|
+
height: number | null;
|
|
11
|
+
width: number | null;
|
|
12
|
+
requires_shipping: boolean;
|
|
13
|
+
metadata: Record<string, unknown> | null;
|
|
14
|
+
private beforeInsert;
|
|
15
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.InventoryItem = void 0;
|
|
28
|
+
var typeorm_1 = require("typeorm");
|
|
29
|
+
var medusa_1 = require("@medusajs/medusa");
|
|
30
|
+
var InventoryItem = /** @class */ (function (_super) {
|
|
31
|
+
__extends(InventoryItem, _super);
|
|
32
|
+
function InventoryItem() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
}
|
|
35
|
+
InventoryItem.prototype.beforeInsert = function () {
|
|
36
|
+
this.id = (0, medusa_1.generateEntityId)(this.id, "iitem");
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Index)({ unique: true }),
|
|
40
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], InventoryItem.prototype, "sku", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], InventoryItem.prototype, "origin_country", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], InventoryItem.prototype, "hs_code", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], InventoryItem.prototype, "mid_code", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], InventoryItem.prototype, "material", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], InventoryItem.prototype, "weight", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], InventoryItem.prototype, "length", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], InventoryItem.prototype, "height", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], InventoryItem.prototype, "width", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
77
|
+
__metadata("design:type", Boolean)
|
|
78
|
+
], InventoryItem.prototype, "requires_shipping", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], InventoryItem.prototype, "metadata", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
85
|
+
__metadata("design:type", Function),
|
|
86
|
+
__metadata("design:paramtypes", []),
|
|
87
|
+
__metadata("design:returntype", void 0)
|
|
88
|
+
], InventoryItem.prototype, "beforeInsert", null);
|
|
89
|
+
InventoryItem = __decorate([
|
|
90
|
+
(0, typeorm_1.Entity)()
|
|
91
|
+
], InventoryItem);
|
|
92
|
+
return InventoryItem;
|
|
93
|
+
}(medusa_1.SoftDeletableEntity));
|
|
94
|
+
exports.InventoryItem = InventoryItem;
|
|
95
|
+
//# sourceMappingURL=inventory-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory-item.js","sourceRoot":"","sources":["../../src/models/inventory-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6D;AAC7D,2CAAwE;AAGxE;IAAmC,iCAAmB;IAAtD;;IAuCA,CAAC;IAHS,oCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,yBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAnCD;QAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACvB;IAGlB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACZ;IAG7B;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACnB;IAGtB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAClB;IAGvB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAClB;IAGvB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACnB;IAGrB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACnB;IAGrB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACnB;IAGrB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACpB;IAGpB;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4DACA;IAG1B;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACF;IAGxC;QADC,IAAA,sBAAY,GAAE;;;;qDAGd;IAtCU,aAAa;QADzB,IAAA,gBAAM,GAAE;OACI,aAAa,CAuCzB;IAAD,oBAAC;CAAA,AAvCD,CAAmC,4BAAmB,GAuCrD;AAvCY,sCAAa"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SoftDeletableEntity } from "@medusajs/medusa";
|
|
2
|
+
export declare class InventoryLevel extends SoftDeletableEntity {
|
|
3
|
+
inventory_item_id: string;
|
|
4
|
+
location_id: string;
|
|
5
|
+
stocked_quantity: number;
|
|
6
|
+
reserved_quantity: number;
|
|
7
|
+
incoming_quantity: number;
|
|
8
|
+
metadata: Record<string, unknown> | null;
|
|
9
|
+
private beforeInsert;
|
|
10
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.InventoryLevel = void 0;
|
|
28
|
+
var typeorm_1 = require("typeorm");
|
|
29
|
+
var medusa_1 = require("@medusajs/medusa");
|
|
30
|
+
var InventoryLevel = /** @class */ (function (_super) {
|
|
31
|
+
__extends(InventoryLevel, _super);
|
|
32
|
+
function InventoryLevel() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
}
|
|
35
|
+
InventoryLevel.prototype.beforeInsert = function () {
|
|
36
|
+
this.id = (0, medusa_1.generateEntityId)(this.id, "ilev");
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Index)(),
|
|
40
|
+
(0, typeorm_1.Column)({ type: "text" }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], InventoryLevel.prototype, "inventory_item_id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Index)(),
|
|
45
|
+
(0, typeorm_1.Column)({ type: "text" }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], InventoryLevel.prototype, "location_id", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], InventoryLevel.prototype, "stocked_quantity", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], InventoryLevel.prototype, "reserved_quantity", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], InventoryLevel.prototype, "incoming_quantity", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], InventoryLevel.prototype, "metadata", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", []),
|
|
68
|
+
__metadata("design:returntype", void 0)
|
|
69
|
+
], InventoryLevel.prototype, "beforeInsert", null);
|
|
70
|
+
InventoryLevel = __decorate([
|
|
71
|
+
(0, typeorm_1.Entity)(),
|
|
72
|
+
(0, typeorm_1.Index)(["inventory_item_id", "location_id"], { unique: true })
|
|
73
|
+
], InventoryLevel);
|
|
74
|
+
return InventoryLevel;
|
|
75
|
+
}(medusa_1.SoftDeletableEntity));
|
|
76
|
+
exports.InventoryLevel = InventoryLevel;
|
|
77
|
+
//# sourceMappingURL=inventory-level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory-level.js","sourceRoot":"","sources":["../../src/models/inventory-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAqE;AACrE,2CAAwE;AAIxE;IAAoC,kCAAmB;IAAvD;;IAyBA,CAAC;IAHS,qCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,yBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IArBD;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DACA;IAIzB;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACN;IAGnB;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACC;IAGxB;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6DACE;IAGzB;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6DACE;IAGzB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACF;IAGxC;QADC,IAAA,sBAAY,GAAE;;;;sDAGd;IAxBU,cAAc;QAF1B,IAAA,gBAAM,GAAE;QACR,IAAA,eAAK,EAAC,CAAC,mBAAmB,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;OACjD,cAAc,CAyB1B;IAAD,qBAAC;CAAA,AAzBD,CAAoC,4BAAmB,GAyBtD;AAzBY,wCAAc"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SoftDeletableEntity } from "@medusajs/medusa";
|
|
2
|
+
export declare class ReservationItem extends SoftDeletableEntity {
|
|
3
|
+
line_item_id: string | null;
|
|
4
|
+
inventory_item_id: string;
|
|
5
|
+
location_id: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
metadata: Record<string, unknown> | null;
|
|
8
|
+
private beforeInsert;
|
|
9
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.ReservationItem = void 0;
|
|
28
|
+
var typeorm_1 = require("typeorm");
|
|
29
|
+
var medusa_1 = require("@medusajs/medusa");
|
|
30
|
+
var ReservationItem = /** @class */ (function (_super) {
|
|
31
|
+
__extends(ReservationItem, _super);
|
|
32
|
+
function ReservationItem() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
}
|
|
35
|
+
ReservationItem.prototype.beforeInsert = function () {
|
|
36
|
+
this.id = (0, medusa_1.generateEntityId)(this.id, "resitem");
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Index)(),
|
|
40
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], ReservationItem.prototype, "line_item_id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Index)(),
|
|
45
|
+
(0, typeorm_1.Column)({ type: "text" }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], ReservationItem.prototype, "inventory_item_id", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Index)(),
|
|
50
|
+
(0, typeorm_1.Column)({ type: "text" }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], ReservationItem.prototype, "location_id", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)(),
|
|
55
|
+
__metadata("design:type", Number)
|
|
56
|
+
], ReservationItem.prototype, "quantity", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], ReservationItem.prototype, "metadata", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", []),
|
|
65
|
+
__metadata("design:returntype", void 0)
|
|
66
|
+
], ReservationItem.prototype, "beforeInsert", null);
|
|
67
|
+
ReservationItem = __decorate([
|
|
68
|
+
(0, typeorm_1.Entity)()
|
|
69
|
+
], ReservationItem);
|
|
70
|
+
return ReservationItem;
|
|
71
|
+
}(medusa_1.SoftDeletableEntity));
|
|
72
|
+
exports.ReservationItem = ReservationItem;
|
|
73
|
+
//# sourceMappingURL=reservation-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservation-item.js","sourceRoot":"","sources":["../../src/models/reservation-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAqE;AACrE,2CAAwE;AAGxE;IAAqC,mCAAmB;IAAxD;;IAuBA,CAAC;IAHS,sCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,yBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;IAChD,CAAC;IAnBD;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACd;IAI3B;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DACA;IAIzB;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDACN;IAGnB;QADC,IAAA,gBAAM,GAAE;;qDACO;IAGhB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACF;IAGxC;QADC,IAAA,sBAAY,GAAE;;;;uDAGd;IAtBU,eAAe;QAD3B,IAAA,gBAAM,GAAE;OACI,eAAe,CAuB3B;IAAD,sBAAC;CAAA,AAvBD,CAAqC,4BAAmB,GAuBvD;AAvBY,0CAAe"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as InventoryLevelService } from "./inventory-level";
|
|
2
|
+
export { default as InventoryItemService } from "./inventory-item";
|
|
3
|
+
export { default as ReservationItemService } from "./reservation-item";
|
|
4
|
+
export { default as InventoryService } from "./inventory";
|