@medusajs/order 0.1.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/README.md +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +29 -0
- package/dist/joiner-config.d.ts +5 -0
- package/dist/joiner-config.js +23 -0
- package/dist/models/address.d.ts +24 -0
- package/dist/models/address.js +125 -0
- package/dist/models/adjustment-line.d.ts +21 -0
- package/dist/models/adjustment-line.js +73 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +22 -0
- package/dist/models/line-item-adjustment.d.ts +8 -0
- package/dist/models/line-item-adjustment.js +57 -0
- package/dist/models/line-item-tax-line.d.ts +8 -0
- package/dist/models/line-item-tax-line.js +54 -0
- package/dist/models/line-item.d.ts +45 -0
- package/dist/models/line-item.js +241 -0
- package/dist/models/order.d.ts +32 -0
- package/dist/models/order.js +195 -0
- package/dist/models/shipping-method-adjustment.d.ts +8 -0
- package/dist/models/shipping-method-adjustment.js +55 -0
- package/dist/models/shipping-method-tax-line.d.ts +8 -0
- package/dist/models/shipping-method-tax-line.js +55 -0
- package/dist/models/shipping-method.d.ts +26 -0
- package/dist/models/shipping-method.js +157 -0
- package/dist/models/tax-line.d.ts +17 -0
- package/dist/models/tax-line.js +67 -0
- package/dist/module-definition.d.ts +2 -0
- package/dist/module-definition.js +58 -0
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +5 -0
- package/dist/scripts/bin/run-seed.d.ts +3 -0
- package/dist/scripts/bin/run-seed.js +48 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +8 -0
- package/dist/services/order-module-service.d.ts +114 -0
- package/dist/services/order-module-service.js +671 -0
- package/dist/types/UpdateOrderShippingMethodDTO.d.ts +7 -0
- package/dist/types/UpdateOrderShippingMethodDTO.js +2 -0
- package/dist/types/address.d.ts +19 -0
- package/dist/types/address.js +2 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +24 -0
- package/dist/types/line-item-adjustment.d.ts +12 -0
- package/dist/types/line-item-adjustment.js +2 -0
- package/dist/types/line-item-tax-line.d.ts +7 -0
- package/dist/types/line-item-tax-line.js +2 -0
- package/dist/types/line-item.d.ts +31 -0
- package/dist/types/line-item.js +2 -0
- package/dist/types/order.d.ts +24 -0
- package/dist/types/order.js +2 -0
- package/dist/types/shipping-method-adjustment.d.ts +17 -0
- package/dist/types/shipping-method-adjustment.js +2 -0
- package/dist/types/shipping-method-tax-line.d.ts +7 -0
- package/dist/types/shipping-method-tax-line.js +2 -0
- package/dist/types/shipping-method.d.ts +13 -0
- package/dist/types/shipping-method.js +2 -0
- package/dist/types/tax-line.d.ts +16 -0
- package/dist/types/tax-line.js +2 -0
- package/package.json +61 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UpsertOrderAddressDTO {
|
|
2
|
+
customer_id?: string;
|
|
3
|
+
company?: string;
|
|
4
|
+
first_name?: string;
|
|
5
|
+
last_name?: string;
|
|
6
|
+
address_1?: string;
|
|
7
|
+
address_2?: string;
|
|
8
|
+
city?: string;
|
|
9
|
+
country_code?: string;
|
|
10
|
+
province?: string;
|
|
11
|
+
postal_code?: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateOrderAddressDTO extends UpsertOrderAddressDTO {
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateOrderAddressDTO extends UpsertOrderAddressDTO {
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IEventBusModuleService, Logger } from "@medusajs/types";
|
|
2
|
+
export * from "./address";
|
|
3
|
+
export * from "./line-item";
|
|
4
|
+
export * from "./line-item-adjustment";
|
|
5
|
+
export * from "./line-item-tax-line";
|
|
6
|
+
export * from "./order";
|
|
7
|
+
export * from "./shipping-method";
|
|
8
|
+
export * from "./shipping-method-adjustment";
|
|
9
|
+
export * from "./shipping-method-tax-line";
|
|
10
|
+
export type InitializeModuleInjectableDependencies = {
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
eventBusService?: IEventBusModuleService;
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./address"), exports);
|
|
18
|
+
__exportStar(require("./line-item"), exports);
|
|
19
|
+
__exportStar(require("./line-item-adjustment"), exports);
|
|
20
|
+
__exportStar(require("./line-item-tax-line"), exports);
|
|
21
|
+
__exportStar(require("./order"), exports);
|
|
22
|
+
__exportStar(require("./shipping-method"), exports);
|
|
23
|
+
__exportStar(require("./shipping-method-adjustment"), exports);
|
|
24
|
+
__exportStar(require("./shipping-method-tax-line"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
2
|
+
export interface CreateOrderLineItemAdjustmentDTO {
|
|
3
|
+
item_id: string;
|
|
4
|
+
amount: BigNumberInput;
|
|
5
|
+
code?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
promotion_id?: string;
|
|
8
|
+
provider_id?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateOrderLineItemAdjustmentDTO extends Partial<CreateOrderLineItemAdjustmentDTO> {
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateOrderTaxLineDTO, UpdateOrderTaxLineDTO } from "./tax-line";
|
|
2
|
+
export interface CreateOrderLineItemTaxLineDTO extends CreateOrderTaxLineDTO {
|
|
3
|
+
item_id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UpdateOrderLineItemTaxLineDTO extends UpdateOrderTaxLineDTO {
|
|
6
|
+
item_id: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
2
|
+
interface PartialUpsertOrderLineItemDTO {
|
|
3
|
+
subtitle?: string;
|
|
4
|
+
thumbnail?: string;
|
|
5
|
+
product_id?: string;
|
|
6
|
+
product_title?: string;
|
|
7
|
+
product_description?: string;
|
|
8
|
+
product_subtitle?: string;
|
|
9
|
+
product_type?: string;
|
|
10
|
+
product_collection?: string;
|
|
11
|
+
product_handle?: string;
|
|
12
|
+
variant_id?: string;
|
|
13
|
+
variant_sku?: string;
|
|
14
|
+
variant_barcode?: string;
|
|
15
|
+
variant_title?: string;
|
|
16
|
+
variant_option_values?: Record<string, unknown>;
|
|
17
|
+
requires_shipping?: boolean;
|
|
18
|
+
is_discountable?: boolean;
|
|
19
|
+
is_tax_inclusive?: boolean;
|
|
20
|
+
compare_at_unit_price?: BigNumberInput;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateOrderLineItemDTO extends PartialUpsertOrderLineItemDTO {
|
|
23
|
+
title: string;
|
|
24
|
+
quantity: BigNumberInput;
|
|
25
|
+
unit_price: BigNumberInput;
|
|
26
|
+
order_id: string;
|
|
27
|
+
}
|
|
28
|
+
export interface UpdateOrderLineItemDTO extends PartialUpsertOrderLineItemDTO, Partial<CreateOrderLineItemDTO> {
|
|
29
|
+
id: string;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OrderStatus } from "@medusajs/utils";
|
|
2
|
+
import { CreateOrderLineItemAdjustmentDTO, UpdateOrderLineItemAdjustmentDTO } from "./line-item-adjustment";
|
|
3
|
+
export interface CreateOrderDTO {
|
|
4
|
+
region_id?: string;
|
|
5
|
+
customer_id?: string;
|
|
6
|
+
sales_channel_id?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
currency_code: string;
|
|
9
|
+
status?: OrderStatus;
|
|
10
|
+
no_notification?: boolean;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface UpdateOrderDTO {
|
|
14
|
+
id: string;
|
|
15
|
+
region_id?: string;
|
|
16
|
+
customer_id?: string;
|
|
17
|
+
sales_channel_id?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
currency_code?: string;
|
|
20
|
+
status?: OrderStatus;
|
|
21
|
+
no_notification?: boolean;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
adjustments?: (CreateOrderLineItemAdjustmentDTO | UpdateOrderLineItemAdjustmentDTO)[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
2
|
+
export interface CreateOrderShippingMethodAdjustmentDTO {
|
|
3
|
+
shipping_method_id: string;
|
|
4
|
+
code: string;
|
|
5
|
+
amount: BigNumberInput;
|
|
6
|
+
description?: string;
|
|
7
|
+
promotion_id?: string;
|
|
8
|
+
provider_id?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateOrderShippingMethodAdjustmentDTO {
|
|
11
|
+
id: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
amount?: BigNumberInput;
|
|
14
|
+
description?: string;
|
|
15
|
+
promotion_id?: string;
|
|
16
|
+
provider_id?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateOrderTaxLineDTO, UpdateOrderTaxLineDTO } from "./tax-line";
|
|
2
|
+
export interface CreateOrderShippingMethodTaxLineDTO extends CreateOrderTaxLineDTO {
|
|
3
|
+
shipping_method_id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UpdateOrderShippingMethodTaxLineDTO extends UpdateOrderTaxLineDTO {
|
|
6
|
+
shipping_method_id: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
2
|
+
export interface CreateOrderShippingMethodDTO {
|
|
3
|
+
name: string;
|
|
4
|
+
shipping_method_id: string;
|
|
5
|
+
amount: BigNumberInput;
|
|
6
|
+
data?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface UpdateOrderShippingMethodDTO {
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
amount?: BigNumberInput;
|
|
12
|
+
data?: Record<string, unknown>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
2
|
+
export interface UpdateOrderTaxLineDTO {
|
|
3
|
+
id: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
tax_rate_id?: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
rate?: BigNumberInput;
|
|
8
|
+
provider_id?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateOrderTaxLineDTO {
|
|
11
|
+
description?: string;
|
|
12
|
+
tax_rate_id?: string;
|
|
13
|
+
code: string;
|
|
14
|
+
rate: BigNumberInput;
|
|
15
|
+
provider_id?: string;
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@medusajs/order",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Medusa Order module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=16"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"medusa-order-seed": "dist/scripts/bin/run-seed.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/medusajs/medusa",
|
|
19
|
+
"directory": "packages/order"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"author": "Medusa",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"watch": "tsc --build --watch",
|
|
28
|
+
"watch:test": "tsc --build tsconfig.spec.json --watch",
|
|
29
|
+
"prepublishOnly": "cross-env NODE_ENV=production tsc --build && tsc-alias -p tsconfig.json",
|
|
30
|
+
"build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
|
|
31
|
+
"test": "jest --runInBand --bail --forceExit -- src/**/__tests__/**/*.ts",
|
|
32
|
+
"test:integration": "jest --runInBand --forceExit -- integration-tests/**/__tests__/**/*.ts",
|
|
33
|
+
"migration:generate": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:generate",
|
|
34
|
+
"migration:initial": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:create --initial",
|
|
35
|
+
"migration:create": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:create",
|
|
36
|
+
"migration:up": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:up",
|
|
37
|
+
"orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@mikro-orm/cli": "5.9.7",
|
|
41
|
+
"cross-env": "^5.2.1",
|
|
42
|
+
"jest": "^29.6.3",
|
|
43
|
+
"medusa-test-utils": "^1.1.40",
|
|
44
|
+
"rimraf": "^3.0.2",
|
|
45
|
+
"ts-jest": "^29.1.1",
|
|
46
|
+
"ts-node": "^10.9.1",
|
|
47
|
+
"tsc-alias": "^1.8.6",
|
|
48
|
+
"typescript": "^5.1.6"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@medusajs/modules-sdk": "^1.12.4",
|
|
52
|
+
"@medusajs/types": "^1.11.8",
|
|
53
|
+
"@medusajs/utils": "^1.11.1",
|
|
54
|
+
"@mikro-orm/core": "5.9.7",
|
|
55
|
+
"@mikro-orm/migrations": "5.9.7",
|
|
56
|
+
"@mikro-orm/postgresql": "5.9.7",
|
|
57
|
+
"awilix": "^8.0.0",
|
|
58
|
+
"dotenv": "^16.1.4",
|
|
59
|
+
"knex": "2.4.2"
|
|
60
|
+
}
|
|
61
|
+
}
|