@medusajs/types 1.11.3 → 1.11.4-next-20231019103251
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/common/common.d.ts +16 -0
- package/dist/dal/index.d.ts +8 -0
- package/dist/dal/index.js.map +1 -1
- package/dist/dal/repository-service.d.ts +14 -0
- package/dist/inventory/common.d.ts +12 -12
- package/dist/pricing/common/currency.d.ts +40 -0
- package/dist/pricing/common/money-amount.d.ts +44 -0
- package/dist/pricing/common/price-rule.d.ts +71 -0
- package/dist/pricing/common/price-set-money-amount-rules.d.ts +39 -0
- package/dist/pricing/common/price-set-money-amount.d.ts +10 -0
- package/dist/pricing/common/price-set.d.ts +97 -6
- package/dist/pricing/common/rule-type.d.ts +39 -0
- package/dist/pricing/service.d.ts +2269 -190
- package/dist/product/common.d.ts +437 -6
- package/dist/product/common.js +3 -0
- package/dist/product/common.js.map +1 -1
- package/dist/product/service.d.ts +2182 -0
- package/dist/shared-context.d.ts +12 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +2 -1
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/inventory/create-inventory-items.d.ts +18 -0
- package/dist/workflow/inventory/create-inventory-items.js +3 -0
- package/dist/workflow/inventory/create-inventory-items.js.map +1 -0
- package/dist/workflow/inventory/index.d.ts +1 -0
- package/dist/workflow/inventory/index.js +18 -0
- package/dist/workflow/inventory/index.js.map +1 -0
- package/package.json +1 -1
package/dist/common/common.d.ts
CHANGED
|
@@ -21,6 +21,22 @@ export interface SoftDeletableEntity extends BaseEntity {
|
|
|
21
21
|
export type Writable<T> = {
|
|
22
22
|
-readonly [key in keyof T]: T[key] | FindOperator<T[key]> | FindOperator<T[key][]> | FindOperator<string[]>;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @interface
|
|
26
|
+
*
|
|
27
|
+
* An object that is used to configure how an entity is retrieved from the database. It accepts as a typed parameter an `Entity` class,
|
|
28
|
+
* which provides correct typing of field names in its properties.
|
|
29
|
+
*
|
|
30
|
+
* @prop select - An array of strings, each being attribute names of the entity to retrieve in the result.
|
|
31
|
+
* @prop skip - A number indicating the number of records to skip before retrieving the results.
|
|
32
|
+
* @prop take - A number indicating the number of records to return in the result.
|
|
33
|
+
* @prop relations - An array of strings, each being relation names of the entity to retrieve in the result.
|
|
34
|
+
* @prop order -
|
|
35
|
+
* An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`
|
|
36
|
+
* to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
|
|
37
|
+
* @prop withDeleted - A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the
|
|
38
|
+
* `SoftDeletableEntity` class.
|
|
39
|
+
*/
|
|
24
40
|
export interface FindConfig<Entity> {
|
|
25
41
|
select?: (keyof Entity | string)[];
|
|
26
42
|
skip?: number;
|
package/dist/dal/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Dictionary, FilterQuery, Order } from "./utils";
|
|
2
2
|
export { FilterQuery } from "./utils";
|
|
3
|
+
/**
|
|
4
|
+
* @interface
|
|
5
|
+
*
|
|
6
|
+
* An object used to allow specifying flexible queries with and/or conditions.
|
|
7
|
+
*
|
|
8
|
+
* @prop $and - An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
|
|
9
|
+
* @prop $or - An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
|
|
10
|
+
*/
|
|
3
11
|
export interface BaseFilterable<T> {
|
|
4
12
|
$and?: (T | BaseFilterable<T>)[];
|
|
5
13
|
$or?: (T | BaseFilterable<T>)[];
|
package/dist/dal/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA,uDAAoC;AACpC,2CAAwB"}
|
|
@@ -39,9 +39,23 @@ export interface TreeRepositoryService<T = any> extends BaseRepositoryService<T>
|
|
|
39
39
|
create(data: unknown, context?: Context): Promise<T>;
|
|
40
40
|
delete(id: string, context?: Context): Promise<void>;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @interface
|
|
44
|
+
*
|
|
45
|
+
* An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
|
|
46
|
+
*
|
|
47
|
+
* @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations.
|
|
48
|
+
*/
|
|
42
49
|
export type SoftDeleteReturn<TReturnableLinkableKeys = string> = {
|
|
43
50
|
returnLinkableKeys?: TReturnableLinkableKeys[];
|
|
44
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* @interface
|
|
54
|
+
*
|
|
55
|
+
* An object that is used to specify an entity's related entities that should be restored when the main entity is restored.
|
|
56
|
+
*
|
|
57
|
+
* @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations.
|
|
58
|
+
*/
|
|
45
59
|
export type RestoreReturn<TReturnableLinkableKeys = string> = {
|
|
46
60
|
returnLinkableKeys?: TReturnableLinkableKeys[];
|
|
47
61
|
};
|
|
@@ -211,19 +211,19 @@ export type FilterableInventoryItemProps = {
|
|
|
211
211
|
requires_shipping?: boolean;
|
|
212
212
|
};
|
|
213
213
|
export type CreateInventoryItemInput = {
|
|
214
|
-
sku?: string;
|
|
215
|
-
origin_country?: string;
|
|
216
|
-
mid_code?: string;
|
|
217
|
-
material?: string;
|
|
218
|
-
weight?: number;
|
|
219
|
-
length?: number;
|
|
220
|
-
height?: number;
|
|
221
|
-
width?: number;
|
|
222
|
-
title?: string;
|
|
223
|
-
description?: string;
|
|
224
|
-
thumbnail?: string;
|
|
214
|
+
sku?: string | null;
|
|
215
|
+
origin_country?: string | null;
|
|
216
|
+
mid_code?: string | null;
|
|
217
|
+
material?: string | null;
|
|
218
|
+
weight?: number | null;
|
|
219
|
+
length?: number | null;
|
|
220
|
+
height?: number | null;
|
|
221
|
+
width?: number | null;
|
|
222
|
+
title?: string | null;
|
|
223
|
+
description?: string | null;
|
|
224
|
+
thumbnail?: string | null;
|
|
225
225
|
metadata?: Record<string, unknown> | null;
|
|
226
|
-
hs_code?: string;
|
|
226
|
+
hs_code?: string | null;
|
|
227
227
|
requires_shipping?: boolean;
|
|
228
228
|
};
|
|
229
229
|
export type CreateReservationItemInput = {
|
|
@@ -1,22 +1,62 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
|
+
/**
|
|
3
|
+
* @interface
|
|
4
|
+
*
|
|
5
|
+
* A currency's data.
|
|
6
|
+
*
|
|
7
|
+
* @prop code - The code of the currency.
|
|
8
|
+
* @prop symbol - The symbol of the currency.
|
|
9
|
+
* @prop symbol_native -
|
|
10
|
+
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
|
|
11
|
+
* @prop name - The name of the currency.
|
|
12
|
+
*/
|
|
2
13
|
export interface CurrencyDTO {
|
|
3
14
|
code: string;
|
|
4
15
|
symbol?: string;
|
|
5
16
|
symbol_native?: string;
|
|
6
17
|
name?: string;
|
|
7
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @interface
|
|
21
|
+
*
|
|
22
|
+
* A currency to create.
|
|
23
|
+
*
|
|
24
|
+
* @prop code - The code of the currency.
|
|
25
|
+
* @prop symbol - The symbol of the currency.
|
|
26
|
+
* @prop symbol_native -
|
|
27
|
+
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
|
|
28
|
+
* @prop name - The name of the currency.
|
|
29
|
+
*/
|
|
8
30
|
export interface CreateCurrencyDTO {
|
|
9
31
|
code: string;
|
|
10
32
|
symbol: string;
|
|
11
33
|
symbol_native: string;
|
|
12
34
|
name: string;
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @interface
|
|
38
|
+
*
|
|
39
|
+
* The data to update in a currency. The `code` is used to identify which currency to update.
|
|
40
|
+
*
|
|
41
|
+
* @prop code - The code of the currency to update.
|
|
42
|
+
* @prop symbol - The symbol of the currency.
|
|
43
|
+
* @prop symbol_native -
|
|
44
|
+
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
|
|
45
|
+
* @prop name - The name of the currency.
|
|
46
|
+
*/
|
|
14
47
|
export interface UpdateCurrencyDTO {
|
|
15
48
|
code: string;
|
|
16
49
|
symbol?: string;
|
|
17
50
|
symbol_native?: string;
|
|
18
51
|
name?: string;
|
|
19
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @interface
|
|
55
|
+
*
|
|
56
|
+
* Filters to apply on a currency.
|
|
57
|
+
*
|
|
58
|
+
* @prop code - The codes to filter the currencies by.
|
|
59
|
+
*/
|
|
20
60
|
export interface FilterableCurrencyProps extends BaseFilterable<FilterableCurrencyProps> {
|
|
21
61
|
code?: string[];
|
|
22
62
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
2
|
import { CreateCurrencyDTO, CurrencyDTO } from "./currency";
|
|
3
|
+
/**
|
|
4
|
+
* @interface
|
|
5
|
+
*
|
|
6
|
+
* A money amount's data. A money amount represents a price.
|
|
7
|
+
*
|
|
8
|
+
* @prop id - The ID of the money amount.
|
|
9
|
+
* @prop currency_code - The currency code of this money amount.
|
|
10
|
+
* @prop currency - The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
|
|
11
|
+
* @prop amount - The price of this money amount.
|
|
12
|
+
* @prop min_quantity - The minimum quantity required to be purchased for this price to be applied.
|
|
13
|
+
* @prop max_quantity - The maximum quantity required to be purchased for this price to be applied.
|
|
14
|
+
*/
|
|
3
15
|
export interface MoneyAmountDTO {
|
|
4
16
|
id: string;
|
|
5
17
|
currency_code?: string;
|
|
@@ -8,6 +20,18 @@ export interface MoneyAmountDTO {
|
|
|
8
20
|
min_quantity?: number;
|
|
9
21
|
max_quantity?: number;
|
|
10
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @interface
|
|
25
|
+
*
|
|
26
|
+
* The money amount to create.
|
|
27
|
+
*
|
|
28
|
+
* @prop id - The ID of the money amount.
|
|
29
|
+
* @prop currency_code - The currency code of this money amount.
|
|
30
|
+
* @prop currency - The currency of this money amount.
|
|
31
|
+
* @prop amount - The amount of this money amount.
|
|
32
|
+
* @prop min_quantity - The minimum quantity required to be purchased for this money amount to be applied.
|
|
33
|
+
* @prop max_quantity - The maximum quantity required to be purchased for this money amount to be applied.
|
|
34
|
+
*/
|
|
11
35
|
export interface CreateMoneyAmountDTO {
|
|
12
36
|
id?: string;
|
|
13
37
|
currency_code: string;
|
|
@@ -16,6 +40,18 @@ export interface CreateMoneyAmountDTO {
|
|
|
16
40
|
min_quantity?: number;
|
|
17
41
|
max_quantity?: number;
|
|
18
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* * @interface
|
|
45
|
+
*
|
|
46
|
+
* The data to update in a money amount. The `id` is used to identify which money amount to update.
|
|
47
|
+
*
|
|
48
|
+
* @prop id - The ID of the money amount to update.
|
|
49
|
+
* @prop currency_code - The code of the currency to associate with the money amount.
|
|
50
|
+
* @prop currency - The currency to associte with the money amount.
|
|
51
|
+
* @prop amount - The price of this money amount.
|
|
52
|
+
* @prop min_quantity - The minimum quantity required to be purchased for this money amount to be applied.
|
|
53
|
+
* @prop max_quantity - The maximum quantity required to be purchased for this money amount to be applied.
|
|
54
|
+
*/
|
|
19
55
|
export interface UpdateMoneyAmountDTO {
|
|
20
56
|
id: string;
|
|
21
57
|
currency_code?: string;
|
|
@@ -23,6 +59,14 @@ export interface UpdateMoneyAmountDTO {
|
|
|
23
59
|
min_quantity?: number;
|
|
24
60
|
max_quantity?: number;
|
|
25
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* @interface
|
|
64
|
+
*
|
|
65
|
+
* Filters to apply on a money amount.
|
|
66
|
+
*
|
|
67
|
+
* @prop id - IDs to filter money amounts by.
|
|
68
|
+
* @prop currency_code - Currency codes to filter money amounts by.
|
|
69
|
+
*/
|
|
26
70
|
export interface FilterableMoneyAmountProps extends BaseFilterable<FilterableMoneyAmountProps> {
|
|
27
71
|
id?: string[];
|
|
28
72
|
currency_code?: string | string[];
|
|
@@ -1,38 +1,109 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
2
|
import { PriceSetDTO } from "./price-set";
|
|
3
3
|
import { RuleTypeDTO } from "./rule-type";
|
|
4
|
+
/**
|
|
5
|
+
* @interface
|
|
6
|
+
*
|
|
7
|
+
* A price rule's data.
|
|
8
|
+
*
|
|
9
|
+
* @prop id - The ID of the price rule.
|
|
10
|
+
* @prop price_set_id - The ID of the associated price set.
|
|
11
|
+
* @prop price_set - The associated price set. It may only be available if the relation `price_set` is expanded.
|
|
12
|
+
* @prop rule_type_id - The ID of the associated rule type.
|
|
13
|
+
* @prop rule_type - The associated rule type. It may only be available if the relation `rule_type` is expanded.
|
|
14
|
+
* @prop value - The value of the price rule.
|
|
15
|
+
* @prop priority - The priority of the price rule in comparison to other applicable price rules.
|
|
16
|
+
* @prop price_set_money_amount_id - The ID of the associated price set money amount.
|
|
17
|
+
* @prop price_list_id - The ID of the associated price list.
|
|
18
|
+
*/
|
|
4
19
|
export interface PriceRuleDTO {
|
|
5
20
|
id: string;
|
|
6
21
|
price_set_id: string;
|
|
7
22
|
price_set: PriceSetDTO;
|
|
8
23
|
rule_type_id: string;
|
|
9
24
|
rule_type: RuleTypeDTO;
|
|
25
|
+
/**
|
|
26
|
+
* @ignore
|
|
27
|
+
* @privateRemark
|
|
28
|
+
*
|
|
29
|
+
* Behavior behind this property is not implemented yet.
|
|
30
|
+
*/
|
|
10
31
|
is_dynamic: boolean;
|
|
11
32
|
value: string;
|
|
12
33
|
priority: number;
|
|
13
34
|
price_set_money_amount_id: string;
|
|
14
35
|
price_list_id: string;
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @interface
|
|
40
|
+
*
|
|
41
|
+
* A price rule to create.
|
|
42
|
+
*
|
|
43
|
+
* @prop id - The ID of the price rule.
|
|
44
|
+
* @prop price_set_id - The ID of the associated price set.
|
|
45
|
+
* @prop rule_type_id - The ID of the associated rule type.
|
|
46
|
+
* @prop value - The value of the price rule.
|
|
47
|
+
* @prop priority - The priority of the price rule in comparison to other applicable price rules.
|
|
48
|
+
* @prop price_set_money_amount_id - The ID of the associated price set money amount.
|
|
49
|
+
* @prop price_list_id - The ID of the associated price list.
|
|
50
|
+
*/
|
|
16
51
|
export interface CreatePriceRuleDTO {
|
|
17
52
|
id: string;
|
|
18
53
|
price_set_id: string;
|
|
19
54
|
rule_type_id: string;
|
|
55
|
+
/**
|
|
56
|
+
* @ignore
|
|
57
|
+
* @privateRemark
|
|
58
|
+
*
|
|
59
|
+
* Behavior behind this property is not implemented yet.
|
|
60
|
+
*/
|
|
20
61
|
is_dynamic?: boolean;
|
|
21
62
|
value: string;
|
|
22
63
|
priority?: number;
|
|
23
64
|
price_set_money_amount_id: string;
|
|
24
65
|
price_list_id: string;
|
|
25
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @interface
|
|
70
|
+
*
|
|
71
|
+
* The data to update in a price rule. The `id` is used to identify which money amount to update.
|
|
72
|
+
*
|
|
73
|
+
* @prop id - The ID of the price rule to update.
|
|
74
|
+
* @prop price_set_id - The ID of the associated price set.
|
|
75
|
+
* @prop rule_type_id - The ID of the associated rule type.
|
|
76
|
+
* @prop value - The value of the price rule.
|
|
77
|
+
* @prop priority - The priority of the price rule in comparison to other applicable price rules.
|
|
78
|
+
* @prop price_set_money_amount_id - The ID of the associated price set money amount.
|
|
79
|
+
* @prop price_list_id - The ID of the associated price list.
|
|
80
|
+
*/
|
|
26
81
|
export interface UpdatePriceRuleDTO {
|
|
27
82
|
id: string;
|
|
28
83
|
price_set_id?: string;
|
|
29
84
|
rule_type_id?: string;
|
|
85
|
+
/**
|
|
86
|
+
* @ignore
|
|
87
|
+
* @privateRemark
|
|
88
|
+
*
|
|
89
|
+
* Behavior behind this property is not implemented yet.
|
|
90
|
+
*/
|
|
30
91
|
is_dynamic?: boolean;
|
|
31
92
|
value?: string;
|
|
32
93
|
priority?: number;
|
|
33
94
|
price_set_money_amount_id?: string;
|
|
34
95
|
price_list_id?: string;
|
|
35
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* @interface
|
|
99
|
+
*
|
|
100
|
+
* Filters to apply to price rules.
|
|
101
|
+
*
|
|
102
|
+
* @prop id - The IDs to filter price rules by.
|
|
103
|
+
* @prop name - The names to filter price rules by.
|
|
104
|
+
* @prop price_set_id - The IDs to filter the price rule's associated price set.
|
|
105
|
+
* @prop rule_type_id - The IDs to filter the price rule's associated rule type.
|
|
106
|
+
*/
|
|
36
107
|
export interface FilterablePriceRuleProps extends BaseFilterable<FilterablePriceRuleProps> {
|
|
37
108
|
id?: string[];
|
|
38
109
|
name?: string[];
|
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
2
|
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount";
|
|
3
3
|
import { RuleTypeDTO } from "./rule-type";
|
|
4
|
+
/**
|
|
5
|
+
* @interface
|
|
6
|
+
*
|
|
7
|
+
* A price set money amount rule's data.
|
|
8
|
+
*
|
|
9
|
+
* @prop id - The ID of the price set money amount.
|
|
10
|
+
* @prop price_set_money_amount - The associated price set money amount. It may only be available if the relation `price_set_money_amount` is expanded.
|
|
11
|
+
* @prop rule_type - The associated rule type. It may only be available if the relation `rule_type` is expanded.
|
|
12
|
+
* @prop value - The value of the price set money amount rule.
|
|
13
|
+
*/
|
|
4
14
|
export interface PriceSetMoneyAmountRulesDTO {
|
|
5
15
|
id: string;
|
|
6
16
|
price_set_money_amount: PriceSetMoneyAmountDTO;
|
|
7
17
|
rule_type: RuleTypeDTO;
|
|
8
18
|
value: string;
|
|
9
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @interface
|
|
22
|
+
*
|
|
23
|
+
* The price set money amount rule to create.
|
|
24
|
+
*
|
|
25
|
+
* @prop price_set_money_amount - The ID of a price set money amount.
|
|
26
|
+
* @prop rule_type - The ID of a rule type.
|
|
27
|
+
* @prop value - The value of the price set money amount rule.
|
|
28
|
+
*/
|
|
10
29
|
export interface CreatePriceSetMoneyAmountRulesDTO {
|
|
11
30
|
price_set_money_amount: string;
|
|
12
31
|
rule_type: string;
|
|
13
32
|
value: string;
|
|
14
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @interface
|
|
36
|
+
*
|
|
37
|
+
* The data to update in a price set money amount rule. The `id` is used to identify which money amount to update.
|
|
38
|
+
*
|
|
39
|
+
* @prop id - The ID of the price set money amount rule to update.
|
|
40
|
+
* @prop price_set_money_amount - The ID of a price set money amount.
|
|
41
|
+
* @prop rule_type - The ID of a rule type.
|
|
42
|
+
* @prop value - The value of the price set money amount rule.
|
|
43
|
+
*/
|
|
15
44
|
export interface UpdatePriceSetMoneyAmountRulesDTO {
|
|
16
45
|
id: string;
|
|
17
46
|
price_set_money_amount?: string;
|
|
18
47
|
rule_type?: string;
|
|
19
48
|
value?: string;
|
|
20
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @interface
|
|
52
|
+
*
|
|
53
|
+
* Filters to apply on price set money amount rules.
|
|
54
|
+
*
|
|
55
|
+
* @prop id - The ID to filter price set money amount rules by.
|
|
56
|
+
* @prop rule_type_id - The IDs to filter the price set money amount rule's associated rule type.
|
|
57
|
+
* @prop price_set_money_amount_id - The IDs to filter the price set money amount rule's associated price set money amount.
|
|
58
|
+
* @prop value - The value to filter price set money amount rules by.
|
|
59
|
+
*/
|
|
21
60
|
export interface FilterablePriceSetMoneyAmountRulesProps extends BaseFilterable<FilterablePriceSetMoneyAmountRulesProps> {
|
|
22
61
|
id?: string[];
|
|
23
62
|
rule_type_id?: string[];
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { MoneyAmountDTO } from "./money-amount";
|
|
2
2
|
import { PriceSetDTO } from "./price-set";
|
|
3
|
+
/**
|
|
4
|
+
* @interface
|
|
5
|
+
*
|
|
6
|
+
* A price set money amount's data.
|
|
7
|
+
*
|
|
8
|
+
* @prop id - The ID of a price set money amount.
|
|
9
|
+
* @prop title - The title of the price set money amount.
|
|
10
|
+
* @prop price_set - The price set associated with the price set money amount. It may only be available if the relation `price_set` is expanded.
|
|
11
|
+
* @prop money_amount - The money amount associated with the price set money amount. It may only be available if the relation `money_amount` is expanded.
|
|
12
|
+
*/
|
|
3
13
|
export interface PriceSetMoneyAmountDTO {
|
|
4
14
|
id: string;
|
|
5
15
|
title?: string;
|
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
2
|
import { CreateMoneyAmountDTO, FilterableMoneyAmountProps, MoneyAmountDTO } from "./money-amount";
|
|
3
3
|
import { RuleTypeDTO } from "./rule-type";
|
|
4
|
+
/**
|
|
5
|
+
* @interface
|
|
6
|
+
*
|
|
7
|
+
* The context to calculate prices. For example, you can specify the currency code to calculate prices in.
|
|
8
|
+
*
|
|
9
|
+
* @prop context -
|
|
10
|
+
* an object whose keys are the name of the context attribute. Its value can be a string or a number. For example, you can pass the `currency_code` property with its value being the currency code to calculate the price in.
|
|
11
|
+
* Another example is passing the `quantity` property to calculate the price for that specified quantity, which finds a price set whose `min_quantity` and `max_quantity` conditions match the specified quantity.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
4
14
|
export interface PricingContext {
|
|
5
15
|
context?: Record<string, string | number>;
|
|
6
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @interface
|
|
19
|
+
*
|
|
20
|
+
* Filters to apply on prices.
|
|
21
|
+
*
|
|
22
|
+
* @prop id - IDs to filter prices.
|
|
23
|
+
*/
|
|
7
24
|
export interface PricingFilters {
|
|
8
25
|
id: string[];
|
|
9
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @interface
|
|
29
|
+
*
|
|
30
|
+
* A price set's data.
|
|
31
|
+
*
|
|
32
|
+
* @prop id - The ID of the price set.
|
|
33
|
+
* @prop money_amounts - The prices that belong to this price set.
|
|
34
|
+
* @prop rule_types - The rule types applied on this price set.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
10
37
|
export interface PriceSetDTO {
|
|
11
38
|
id: string;
|
|
12
39
|
money_amounts?: MoneyAmountDTO[];
|
|
13
40
|
rule_types?: RuleTypeDTO[];
|
|
14
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @interface
|
|
44
|
+
*
|
|
45
|
+
* A calculated price set's data.
|
|
46
|
+
*
|
|
47
|
+
* @prop id - The ID of the price set.
|
|
48
|
+
* @prop amount - The calculated amount. It can possibly be `null` if there's no price set up for the provided context.
|
|
49
|
+
* @prop currency_code - The currency code of the calculated price. It can possibly be `null`.
|
|
50
|
+
* @prop min_quantity - The minimum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
|
|
51
|
+
* @prop max_quantity - The maximum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
|
|
52
|
+
*/
|
|
15
53
|
export interface CalculatedPriceSetDTO {
|
|
16
54
|
id: string;
|
|
17
55
|
amount: number | null;
|
|
@@ -19,33 +57,86 @@ export interface CalculatedPriceSetDTO {
|
|
|
19
57
|
min_quantity: number | null;
|
|
20
58
|
max_quantity: number | null;
|
|
21
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* @interface
|
|
62
|
+
*
|
|
63
|
+
* The rules to add to a price set.
|
|
64
|
+
*
|
|
65
|
+
* @prop priceSetId - The ID of the price set to add the rules to.
|
|
66
|
+
* @prop rules - The rules to add to a price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.
|
|
67
|
+
*/
|
|
22
68
|
export interface AddRulesDTO {
|
|
23
69
|
priceSetId: string;
|
|
24
70
|
rules: {
|
|
25
71
|
attribute: string;
|
|
26
72
|
}[];
|
|
27
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @interface
|
|
76
|
+
*
|
|
77
|
+
* The prices to create part of a price set.
|
|
78
|
+
*
|
|
79
|
+
* @prop rules - The rules to add to the price. The object's keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
|
|
80
|
+
*/
|
|
81
|
+
export interface CreatePricesDTO extends CreateMoneyAmountDTO {
|
|
82
|
+
rules: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @interface
|
|
86
|
+
*
|
|
87
|
+
* The prices to add to a price set.
|
|
88
|
+
*
|
|
89
|
+
* @prop priceSetId - The ID of the price set to add prices to.
|
|
90
|
+
* @prop prices - The prices to add to the price set.
|
|
91
|
+
*/
|
|
28
92
|
export interface AddPricesDTO {
|
|
29
93
|
priceSetId: string;
|
|
30
|
-
prices:
|
|
31
|
-
rules?: Record<string, string>;
|
|
32
|
-
})[];
|
|
94
|
+
prices: CreatePricesDTO[];
|
|
33
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* @interface
|
|
98
|
+
*
|
|
99
|
+
* The rules to remove from a price set.
|
|
100
|
+
*
|
|
101
|
+
* @prop id - The ID of the price set.
|
|
102
|
+
* @prop rules - The rules to remove. Each string is the `rule_attribute` of a rule to remove.
|
|
103
|
+
*/
|
|
34
104
|
export interface RemovePriceSetRulesDTO {
|
|
35
105
|
id: string;
|
|
36
106
|
rules: string[];
|
|
37
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* @interface
|
|
110
|
+
*
|
|
111
|
+
* A price set to create.
|
|
112
|
+
*
|
|
113
|
+
* @prop rules - The rules to associate with the price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.
|
|
114
|
+
* @prop prices -The prices to create and add to this price set.
|
|
115
|
+
*/
|
|
38
116
|
export interface CreatePriceSetDTO {
|
|
39
117
|
rules?: {
|
|
40
118
|
rule_attribute: string;
|
|
41
119
|
}[];
|
|
42
|
-
prices?:
|
|
43
|
-
rules: Record<string, string>;
|
|
44
|
-
})[];
|
|
120
|
+
prices?: CreatePricesDTO[];
|
|
45
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* @interface
|
|
124
|
+
*
|
|
125
|
+
* The data to update in a price set. The `id` is used to identify which price set to update.
|
|
126
|
+
*
|
|
127
|
+
* @prop id - A string indicating the ID of the price set to update.
|
|
128
|
+
*/
|
|
46
129
|
export interface UpdatePriceSetDTO {
|
|
47
130
|
id: string;
|
|
48
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* @interface
|
|
134
|
+
*
|
|
135
|
+
* Filters to apply on price sets.
|
|
136
|
+
*
|
|
137
|
+
* @prop id - IDs to filter price sets by.
|
|
138
|
+
* @prop money_amounts - Filters to apply on a price set's associated money amounts.
|
|
139
|
+
*/
|
|
49
140
|
export interface FilterablePriceSetProps extends BaseFilterable<FilterablePriceSetProps> {
|
|
50
141
|
id?: string[];
|
|
51
142
|
money_amounts?: FilterableMoneyAmountProps;
|
|
@@ -1,22 +1,61 @@
|
|
|
1
1
|
import { BaseFilterable } from "../../dal";
|
|
2
|
+
/**
|
|
3
|
+
* @interface
|
|
4
|
+
*
|
|
5
|
+
* A rule type's data.
|
|
6
|
+
*
|
|
7
|
+
* @prop id - The ID of the rule type.
|
|
8
|
+
* @prop name - The display name of the rule type.
|
|
9
|
+
* @prop rule_attribute - The unique name used to later identify the rule_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.
|
|
10
|
+
* @prop default_priority - The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.
|
|
11
|
+
*/
|
|
2
12
|
export interface RuleTypeDTO {
|
|
3
13
|
id: string;
|
|
4
14
|
name: string;
|
|
5
15
|
rule_attribute: string;
|
|
6
16
|
default_priority: number;
|
|
7
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @interface
|
|
20
|
+
*
|
|
21
|
+
* The rule type to create.
|
|
22
|
+
*
|
|
23
|
+
* @prop id - The ID of the rule type.
|
|
24
|
+
* @prop name - The display name of the rule type.
|
|
25
|
+
* @prop rule_attribute - The unique name used to later identify the rule_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.
|
|
26
|
+
* @prop default_priority - The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.
|
|
27
|
+
*/
|
|
8
28
|
export interface CreateRuleTypeDTO {
|
|
9
29
|
id?: string;
|
|
10
30
|
name: string;
|
|
11
31
|
rule_attribute: string;
|
|
12
32
|
default_priority?: number;
|
|
13
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @interface
|
|
36
|
+
*
|
|
37
|
+
* The data to update in a rule type. The `id` is used to identify which price set to update.
|
|
38
|
+
*
|
|
39
|
+
* @prop id - The ID of the rule type to update.
|
|
40
|
+
* @prop name - The display name of the rule type.
|
|
41
|
+
* @prop rule_attribute - The unique name used to later identify the rule_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.
|
|
42
|
+
* @prop default_priority - The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.
|
|
43
|
+
*/
|
|
14
44
|
export interface UpdateRuleTypeDTO {
|
|
15
45
|
id: string;
|
|
16
46
|
name?: string;
|
|
17
47
|
rule_attribute?: string;
|
|
18
48
|
default_priority?: number;
|
|
19
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @interface
|
|
52
|
+
*
|
|
53
|
+
* Filters to apply on rule types.
|
|
54
|
+
*
|
|
55
|
+
* @prop id - The IDs to filter rule types by.
|
|
56
|
+
* @prop name - The names to filter rule types by.
|
|
57
|
+
* @prop rule_attribute - The rule attributes to filter rule types by.
|
|
58
|
+
*/
|
|
20
59
|
export interface FilterableRuleTypeProps extends BaseFilterable<FilterableRuleTypeProps> {
|
|
21
60
|
id?: string[];
|
|
22
61
|
name?: string[];
|