@medusajs/types 1.8.7 → 1.8.8-next-20230614133456
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/bundles.d.ts +2 -0
- package/dist/bundles.js +3 -1
- package/dist/bundles.js.map +1 -1
- package/dist/common/common.d.ts +2 -0
- package/dist/dal/index.d.ts +7 -56
- package/dist/dal/index.js.map +1 -1
- package/dist/dal/repository-service.d.ts +4 -3
- package/dist/dal/utils.d.ts +53 -0
- package/dist/{admin/common.js → dal/utils.js} +1 -1
- package/dist/dal/utils.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/inventory.d.ts +1 -1
- package/dist/modules-sdk/index.d.ts +2 -1
- package/dist/modules-sdk/index.js.map +1 -1
- package/dist/product/common.d.ts +51 -16
- package/dist/product/common.js.map +1 -1
- package/dist/product/service.d.ts +8 -7
- package/dist/product-category/index.d.ts +1 -0
- package/dist/{tax → product-category}/index.js +1 -2
- package/dist/product-category/index.js.map +1 -0
- package/dist/product-category/repository.d.ts +4 -0
- package/dist/{admin/widget.js → product-category/repository.js} +1 -1
- package/dist/product-category/repository.js.map +1 -0
- package/package.json +1 -1
- package/dist/admin/application.d.ts +0 -6
- package/dist/admin/application.js +0 -3
- package/dist/admin/application.js.map +0 -1
- package/dist/admin/common.d.ts +0 -14
- package/dist/admin/common.js.map +0 -1
- package/dist/admin/config.d.ts +0 -17
- package/dist/admin/config.js +0 -3
- package/dist/admin/config.js.map +0 -1
- package/dist/admin/helpers.d.ts +0 -14
- package/dist/admin/helpers.js +0 -3
- package/dist/admin/helpers.js.map +0 -1
- package/dist/admin/index.d.ts +0 -4
- package/dist/admin/index.js +0 -21
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/widget.d.ts +0 -20
- package/dist/admin/widget.js.map +0 -1
- package/dist/tax/common.d.ts +0 -20
- package/dist/tax/common.js +0 -3
- package/dist/tax/common.js.map +0 -1
- package/dist/tax/index.d.ts +0 -2
- package/dist/tax/index.js.map +0 -1
- package/dist/tax/tax-calculation-strategy.d.ts +0 -23
- package/dist/tax/tax-calculation-strategy.js +0 -10
- package/dist/tax/tax-calculation-strategy.js.map +0 -1
package/dist/bundles.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export * as CacheTypes from "./cache";
|
|
|
2
2
|
export * as CommonTypes from "./common";
|
|
3
3
|
export * as EventBusTypes from "./event-bus";
|
|
4
4
|
export * as InventoryTypes from "./inventory";
|
|
5
|
+
export * as ProductTypes from "./product";
|
|
5
6
|
export * as ModulesSdkTypes from "./modules-sdk";
|
|
6
7
|
export * as SearchTypes from "./search";
|
|
7
8
|
export * as StockLocationTypes from "./stock-location";
|
|
8
9
|
export * as TransactionBaseTypes from "./transaction-base";
|
|
10
|
+
export * as DAL from "./dal";
|
package/dist/bundles.js
CHANGED
|
@@ -23,13 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0;
|
|
26
|
+
exports.DAL = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.ProductTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0;
|
|
27
27
|
exports.CacheTypes = __importStar(require("./cache"));
|
|
28
28
|
exports.CommonTypes = __importStar(require("./common"));
|
|
29
29
|
exports.EventBusTypes = __importStar(require("./event-bus"));
|
|
30
30
|
exports.InventoryTypes = __importStar(require("./inventory"));
|
|
31
|
+
exports.ProductTypes = __importStar(require("./product"));
|
|
31
32
|
exports.ModulesSdkTypes = __importStar(require("./modules-sdk"));
|
|
32
33
|
exports.SearchTypes = __importStar(require("./search"));
|
|
33
34
|
exports.StockLocationTypes = __importStar(require("./stock-location"));
|
|
34
35
|
exports.TransactionBaseTypes = __importStar(require("./transaction-base"));
|
|
36
|
+
exports.DAL = __importStar(require("./dal"));
|
|
35
37
|
//# sourceMappingURL=bundles.js.map
|
package/dist/bundles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAqC;AACrC,wDAAuC;AACvC,6DAA4C;AAC5C,8DAA6C;AAC7C,iEAAgD;AAChD,wDAAuC;AACvC,uEAAsD;AACtD,2EAA0D"}
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAqC;AACrC,wDAAuC;AACvC,6DAA4C;AAC5C,8DAA6C;AAC7C,0DAAyC;AACzC,iEAAgD;AAChD,wDAAuC;AACvC,uEAAsD;AACtD,2EAA0D;AAC1D,6CAA4B"}
|
package/dist/common/common.d.ts
CHANGED
package/dist/dal/index.d.ts
CHANGED
|
@@ -1,58 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-readonly [K in keyof T as ExcludeFunctions<T, K>]?: T[K];
|
|
8
|
-
};
|
|
9
|
-
declare type ExpandScalar<T> = null | (T extends string ? string | RegExp : T extends Date ? Date | string : T);
|
|
10
|
-
declare type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Buffer | {
|
|
11
|
-
toHexString(): string;
|
|
12
|
-
};
|
|
13
|
-
declare type ExcludeFunctions<T, K extends keyof T> = T[K] extends Function ? never : K extends symbol ? never : K;
|
|
14
|
-
declare type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T;
|
|
15
|
-
declare const PrimaryKeyType: unique symbol;
|
|
16
|
-
declare type Primary<T> = T extends {
|
|
17
|
-
[PrimaryKeyType]?: infer PK;
|
|
18
|
-
} ? ReadonlyPrimary<PK> : T extends {
|
|
19
|
-
_id?: infer PK;
|
|
20
|
-
} ? ReadonlyPrimary<PK> | string : T extends {
|
|
21
|
-
uuid?: infer PK;
|
|
22
|
-
} ? ReadonlyPrimary<PK> : T extends {
|
|
23
|
-
id?: infer PK;
|
|
24
|
-
} ? ReadonlyPrimary<PK> : never;
|
|
25
|
-
export declare type OperatorMap<T> = {
|
|
26
|
-
$and?: Query<T>[];
|
|
27
|
-
$or?: Query<T>[];
|
|
28
|
-
$eq?: ExpandScalar<T> | ExpandScalar<T>[];
|
|
29
|
-
$ne?: ExpandScalar<T>;
|
|
30
|
-
$in?: ExpandScalar<T>[];
|
|
31
|
-
$nin?: ExpandScalar<T>[];
|
|
32
|
-
$not?: Query<T>;
|
|
33
|
-
$gt?: ExpandScalar<T>;
|
|
34
|
-
$gte?: ExpandScalar<T>;
|
|
35
|
-
$lt?: ExpandScalar<T>;
|
|
36
|
-
$lte?: ExpandScalar<T>;
|
|
37
|
-
$like?: string;
|
|
38
|
-
$re?: string;
|
|
39
|
-
$ilike?: string;
|
|
40
|
-
$fulltext?: string;
|
|
41
|
-
$overlap?: string[];
|
|
42
|
-
$contains?: string[];
|
|
43
|
-
$contained?: string[];
|
|
44
|
-
$exists?: boolean;
|
|
45
|
-
};
|
|
46
|
-
declare type FilterValue2<T> = T | ExpandScalar<T> | Primary<T>;
|
|
47
|
-
declare type FilterValue<T> = OperatorMap<FilterValue2<T>> | FilterValue2<T> | FilterValue2<T>[] | null;
|
|
48
|
-
declare type ExpandObject<T> = T extends object ? T extends Scalar ? never : {
|
|
49
|
-
-readonly [K in keyof T as ExcludeFunctions<T, K>]?: Query<any> | FilterValue<any> | null;
|
|
50
|
-
} : never;
|
|
51
|
-
declare type ObjectQuery<T> = ExpandObject<T> & OperatorMap<T>;
|
|
52
|
-
export declare type FilterQuery<T> = ObjectQuery<T> | NonNullable<ExpandScalar<Primary<T>>> | NonNullable<EntityProps<T> & OperatorMap<T>> | FilterQuery<T>[];
|
|
53
|
-
declare type Order<T> = {
|
|
54
|
-
[key in keyof T]?: "ASC" | "DESC" | Order<T[key] extends Array<any> ? T[key][0] : T[key]>;
|
|
55
|
-
};
|
|
1
|
+
import { Dictionary, FilterQuery, Order } from "./utils";
|
|
2
|
+
export { FilterQuery } from "./utils";
|
|
3
|
+
export interface BaseFilterable<T> {
|
|
4
|
+
$and?: T;
|
|
5
|
+
$or?: T;
|
|
6
|
+
}
|
|
56
7
|
export interface OptionsQuery<T, P extends string = never> {
|
|
57
8
|
populate?: string[];
|
|
58
9
|
orderBy?: Order<T> | Order<T>[];
|
|
@@ -62,7 +13,7 @@ export interface OptionsQuery<T, P extends string = never> {
|
|
|
62
13
|
groupBy?: string | string[];
|
|
63
14
|
filters?: Dictionary<boolean | Dictionary> | string[] | boolean;
|
|
64
15
|
}
|
|
65
|
-
export declare type FindOptions<T> = {
|
|
16
|
+
export declare type FindOptions<T = any> = {
|
|
66
17
|
where: FilterQuery<T>;
|
|
67
18
|
options?: OptionsQuery<T, any>;
|
|
68
19
|
};
|
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":";;;;;;;;;;;;;;;;AAuBA,uDAAoC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FindOptions } from "./index";
|
|
2
|
+
import { RepositoryTransformOptions } from "../common";
|
|
2
3
|
/**
|
|
3
4
|
* Data access layer (DAL) interface to implements for any repository service.
|
|
4
5
|
* This layer helps to separate the business logic (service layer) from accessing the
|
|
5
6
|
* ORM directly and allows to switch to another ORM without changing the business logic.
|
|
6
7
|
*/
|
|
7
|
-
export interface RepositoryService<
|
|
8
|
-
find
|
|
9
|
-
findAndCount
|
|
8
|
+
export interface RepositoryService<T = any> {
|
|
9
|
+
find(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<T[]>;
|
|
10
|
+
findAndCount(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<[T[], number]>;
|
|
10
11
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare type Dictionary<T = any> = {
|
|
3
|
+
[k: string]: T;
|
|
4
|
+
};
|
|
5
|
+
declare type Query<T> = T extends object ? T extends Scalar ? never : FilterQuery<T> : FilterValue<T>;
|
|
6
|
+
declare type ExpandScalar<T> = null | (T extends string ? string | RegExp : T extends Date ? Date | string : T);
|
|
7
|
+
declare type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Buffer | {
|
|
8
|
+
toHexString(): string;
|
|
9
|
+
};
|
|
10
|
+
declare type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T;
|
|
11
|
+
declare const PrimaryKeyType: unique symbol;
|
|
12
|
+
declare type Primary<T> = T extends {
|
|
13
|
+
[PrimaryKeyType]?: infer PK;
|
|
14
|
+
} ? ReadonlyPrimary<PK> : T extends {
|
|
15
|
+
_id?: infer PK;
|
|
16
|
+
} ? ReadonlyPrimary<PK> | string : T extends {
|
|
17
|
+
uuid?: infer PK;
|
|
18
|
+
} ? ReadonlyPrimary<PK> : T extends {
|
|
19
|
+
id?: infer PK;
|
|
20
|
+
} ? ReadonlyPrimary<PK> : never;
|
|
21
|
+
export declare type OperatorMap<T> = {
|
|
22
|
+
$and?: Query<T>[];
|
|
23
|
+
$or?: Query<T>[];
|
|
24
|
+
$eq?: ExpandScalar<T> | ExpandScalar<T>[];
|
|
25
|
+
$ne?: ExpandScalar<T>;
|
|
26
|
+
$in?: ExpandScalar<T>[];
|
|
27
|
+
$nin?: ExpandScalar<T>[];
|
|
28
|
+
$not?: Query<T>;
|
|
29
|
+
$gt?: ExpandScalar<T>;
|
|
30
|
+
$gte?: ExpandScalar<T>;
|
|
31
|
+
$lt?: ExpandScalar<T>;
|
|
32
|
+
$lte?: ExpandScalar<T>;
|
|
33
|
+
$like?: string;
|
|
34
|
+
$re?: string;
|
|
35
|
+
$ilike?: string;
|
|
36
|
+
$fulltext?: string;
|
|
37
|
+
$overlap?: string[];
|
|
38
|
+
$contains?: string[];
|
|
39
|
+
$contained?: string[];
|
|
40
|
+
$exists?: boolean;
|
|
41
|
+
};
|
|
42
|
+
declare type FilterValue2<T> = T | ExpandScalar<T> | Primary<T>;
|
|
43
|
+
declare type FilterValue<T> = OperatorMap<FilterValue2<T>> | FilterValue2<T> | FilterValue2<T>[] | null;
|
|
44
|
+
declare type PrevLimit = [never, 1, 2, 3];
|
|
45
|
+
export declare type FilterQuery<T = any, Prev extends number = 3> = Prev extends never ? never : {
|
|
46
|
+
[Key in keyof T]?: T[Key] extends boolean | number | string | bigint | symbol | Date ? T[Key] | OperatorMap<T[Key]> : T[Key] extends infer U ? U extends {
|
|
47
|
+
[x: number]: infer V;
|
|
48
|
+
} ? V extends object ? FilterQuery<Partial<V>, PrevLimit[Prev]> : never : never : never;
|
|
49
|
+
};
|
|
50
|
+
export declare type Order<T> = {
|
|
51
|
+
[key in keyof T]?: "ASC" | "DESC" | Order<T[key] extends Array<any> ? T[key][0] : T[key]>;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dal/utils.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export * from "./common";
|
|
|
4
4
|
export * from "./event-bus";
|
|
5
5
|
export * from "./inventory";
|
|
6
6
|
export * from "./modules-sdk";
|
|
7
|
+
export * from "./product";
|
|
8
|
+
export * from "./product-category";
|
|
7
9
|
export * from "./search";
|
|
8
10
|
export * from "./shared-context";
|
|
9
11
|
export * from "./stock-location";
|
|
10
12
|
export * from "./transaction-base";
|
|
13
|
+
export * from "./dal";
|
package/dist/index.js
CHANGED
|
@@ -20,8 +20,11 @@ __exportStar(require("./common"), exports);
|
|
|
20
20
|
__exportStar(require("./event-bus"), exports);
|
|
21
21
|
__exportStar(require("./inventory"), exports);
|
|
22
22
|
__exportStar(require("./modules-sdk"), exports);
|
|
23
|
+
__exportStar(require("./product"), exports);
|
|
24
|
+
__exportStar(require("./product-category"), exports);
|
|
23
25
|
__exportStar(require("./search"), exports);
|
|
24
26
|
__exportStar(require("./shared-context"), exports);
|
|
25
27
|
__exportStar(require("./stock-location"), exports);
|
|
26
28
|
__exportStar(require("./transaction-base"), exports);
|
|
29
|
+
__exportStar(require("./dal"), exports);
|
|
27
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B;AAC3B,gDAA6B;AAC7B,2CAAwB;AACxB,mDAAgC;AAChC,mDAAgC;AAChC,qDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B;AAC3B,gDAA6B;AAC7B,4CAAyB;AACzB,qDAAkC;AAClC,2CAAwB;AACxB,mDAAgC;AAChC,mDAAgC;AAChC,qDAAkC;AAClC,wCAAqB"}
|
|
@@ -14,7 +14,7 @@ export interface IInventoryService {
|
|
|
14
14
|
updateInventoryLevel(inventoryItemId: string, locationId: string, update: UpdateInventoryLevelInput, context?: SharedContext): Promise<InventoryLevelDTO>;
|
|
15
15
|
updateInventoryItem(inventoryItemId: string, input: CreateInventoryItemInput, context?: SharedContext): Promise<InventoryItemDTO>;
|
|
16
16
|
updateReservationItem(reservationItemId: string, input: UpdateReservationItemInput, context?: SharedContext): Promise<ReservationItemDTO>;
|
|
17
|
-
deleteReservationItemsByLineItem(lineItemId: string, context?: SharedContext): Promise<void>;
|
|
17
|
+
deleteReservationItemsByLineItem(lineItemId: string | string[], context?: SharedContext): Promise<void>;
|
|
18
18
|
deleteReservationItem(reservationItemId: string | string[], context?: SharedContext): Promise<void>;
|
|
19
19
|
deleteInventoryItem(inventoryItemId: string, context?: SharedContext): Promise<void>;
|
|
20
20
|
deleteInventoryItemLevelByLocationId(locationId: string, context?: SharedContext): Promise<void>;
|
|
@@ -26,7 +26,7 @@ export declare type InternalModuleDeclaration = {
|
|
|
26
26
|
};
|
|
27
27
|
export declare type ExternalModuleDeclaration = {
|
|
28
28
|
scope: MODULE_SCOPE.EXTERNAL;
|
|
29
|
-
server
|
|
29
|
+
server?: {
|
|
30
30
|
type: "http";
|
|
31
31
|
url: string;
|
|
32
32
|
keepAlive: boolean;
|
|
@@ -38,6 +38,7 @@ export declare type ModuleResolution = {
|
|
|
38
38
|
options?: Record<string, unknown>;
|
|
39
39
|
dependencies?: string[];
|
|
40
40
|
moduleDeclaration?: InternalModuleDeclaration | ExternalModuleDeclaration;
|
|
41
|
+
moduleExports?: ModuleExports;
|
|
41
42
|
};
|
|
42
43
|
export declare type ModuleDefinition = {
|
|
43
44
|
key: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,6DAA0C;AAkB1C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;AACvB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,6CAAqB,CAAA;AACvB,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B"}
|
package/dist/product/common.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseFilterable } from "../dal";
|
|
2
|
+
import { OperatorMap } from "../dal/utils";
|
|
2
3
|
export declare enum ProductStatus {
|
|
3
4
|
DRAFT = "draft",
|
|
4
5
|
PROPOSED = "proposed",
|
|
@@ -24,10 +25,11 @@ export interface ProductDTO {
|
|
|
24
25
|
hs_code?: string | null;
|
|
25
26
|
mid_code?: string | null;
|
|
26
27
|
material?: string | null;
|
|
27
|
-
collection
|
|
28
|
-
categories?:
|
|
29
|
-
type:
|
|
30
|
-
tags:
|
|
28
|
+
collection: ProductCollectionDTO;
|
|
29
|
+
categories?: ProductCategoryDTO[] | null;
|
|
30
|
+
type: ProductTypeDTO[];
|
|
31
|
+
tags: ProductTagDTO[];
|
|
32
|
+
variants: ProductVariantDTO[];
|
|
31
33
|
options: ProductOptionDTO[];
|
|
32
34
|
discountable?: boolean;
|
|
33
35
|
external_id?: string | null;
|
|
@@ -61,21 +63,45 @@ export interface ProductVariantDTO {
|
|
|
61
63
|
updated_at: string | Date;
|
|
62
64
|
deleted_at: string | Date;
|
|
63
65
|
}
|
|
64
|
-
export interface
|
|
66
|
+
export interface ProductCategoryDTO {
|
|
65
67
|
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
handle?: string;
|
|
71
|
+
is_active?: boolean;
|
|
72
|
+
is_internal?: boolean;
|
|
73
|
+
rank?: number;
|
|
74
|
+
parent_category?: ProductCategoryDTO;
|
|
75
|
+
category_children: ProductCategoryDTO[];
|
|
76
|
+
created_at: string | Date;
|
|
77
|
+
updated_at: string | Date;
|
|
66
78
|
}
|
|
67
|
-
export interface
|
|
79
|
+
export interface ProductTagDTO {
|
|
68
80
|
id: string;
|
|
81
|
+
value: string;
|
|
82
|
+
metadata?: Record<string, unknown> | null;
|
|
83
|
+
products: ProductDTO[];
|
|
69
84
|
}
|
|
70
85
|
export interface ProductCollectionDTO {
|
|
71
86
|
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
handle: string;
|
|
89
|
+
metadata?: Record<string, unknown> | null;
|
|
90
|
+
deleted_at?: string | Date;
|
|
91
|
+
}
|
|
92
|
+
export interface ProductTypeDTO {
|
|
93
|
+
id: string;
|
|
94
|
+
value: string;
|
|
95
|
+
metadata?: Record<string, unknown> | null;
|
|
96
|
+
deleted_at?: string | Date;
|
|
72
97
|
}
|
|
73
98
|
export interface ProductOptionDTO {
|
|
74
99
|
id: string;
|
|
75
100
|
title: string;
|
|
76
101
|
product: ProductDTO;
|
|
77
|
-
values: ProductOptionValueDTO;
|
|
102
|
+
values: ProductOptionValueDTO[];
|
|
78
103
|
metadata?: Record<string, unknown> | null;
|
|
104
|
+
deleted_at?: string | Date;
|
|
79
105
|
}
|
|
80
106
|
export interface ProductOptionValueDTO {
|
|
81
107
|
id: string;
|
|
@@ -83,33 +109,42 @@ export interface ProductOptionValueDTO {
|
|
|
83
109
|
option: ProductOptionDTO;
|
|
84
110
|
variant: ProductVariantDTO;
|
|
85
111
|
metadata?: Record<string, unknown> | null;
|
|
112
|
+
deleted_at?: string | Date;
|
|
86
113
|
}
|
|
87
114
|
/**
|
|
88
115
|
* Filters/Config (module API input filters and config)
|
|
89
116
|
*/
|
|
90
|
-
export interface FilterableProductProps {
|
|
117
|
+
export interface FilterableProductProps extends BaseFilterable<FilterableProductProps> {
|
|
118
|
+
handle?: string | string[];
|
|
91
119
|
id?: string | string[];
|
|
92
120
|
tags?: {
|
|
93
121
|
value?: string[];
|
|
94
122
|
};
|
|
95
123
|
categories?: {
|
|
96
|
-
id?:
|
|
97
|
-
[Operator in keyof OperatorMap<any>]: string[];
|
|
98
|
-
} | string[];
|
|
124
|
+
id?: string | string[] | OperatorMap<string>;
|
|
99
125
|
};
|
|
126
|
+
category_ids?: string | string[] | OperatorMap<string>;
|
|
100
127
|
}
|
|
101
|
-
export interface FilterableProductTagProps {
|
|
128
|
+
export interface FilterableProductTagProps extends BaseFilterable<FilterableProductTagProps> {
|
|
102
129
|
id?: string | string[];
|
|
103
130
|
value?: string;
|
|
104
131
|
}
|
|
105
|
-
export interface FilterableProductCollectionProps {
|
|
132
|
+
export interface FilterableProductCollectionProps extends BaseFilterable<FilterableProductCollectionProps> {
|
|
106
133
|
id?: string | string[];
|
|
107
134
|
title?: string;
|
|
108
135
|
}
|
|
109
|
-
export interface FilterableProductVariantProps {
|
|
136
|
+
export interface FilterableProductVariantProps extends BaseFilterable<FilterableProductVariantProps> {
|
|
110
137
|
id?: string | string[];
|
|
111
|
-
sku?: string;
|
|
138
|
+
sku?: string | string[];
|
|
112
139
|
options?: {
|
|
113
140
|
id?: string[];
|
|
114
141
|
};
|
|
115
142
|
}
|
|
143
|
+
export interface FilterableProductCategoryProps extends BaseFilterable<FilterableProductCategoryProps> {
|
|
144
|
+
id?: string | string[];
|
|
145
|
+
parent_category_id?: string | string[] | null;
|
|
146
|
+
handle?: string | string[];
|
|
147
|
+
is_active?: boolean;
|
|
148
|
+
is_internal?: boolean;
|
|
149
|
+
include_descendants_tree?: boolean;
|
|
150
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/product/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/product/common.ts"],"names":[],"mappings":";;;AAGA,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;AACvB,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FilterableProductCollectionProps, FilterableProductProps, FilterableProductTagProps, FilterableProductVariantProps, ProductCollectionDTO, ProductDTO, ProductTagDTO, ProductVariantDTO } from "./common";
|
|
1
|
+
import { FilterableProductCategoryProps, FilterableProductCollectionProps, FilterableProductProps, FilterableProductTagProps, FilterableProductVariantProps, ProductCategoryDTO, ProductCollectionDTO, ProductDTO, ProductTagDTO, ProductVariantDTO } from "./common";
|
|
2
2
|
import { FindConfig } from "../common";
|
|
3
3
|
import { SharedContext } from "../shared-context";
|
|
4
|
-
export interface
|
|
5
|
-
list
|
|
6
|
-
listAndCount
|
|
7
|
-
listTags
|
|
8
|
-
listVariants
|
|
9
|
-
listCollections
|
|
4
|
+
export interface IProductModuleService<TProduct = any, TProductVariant = any, TProductTag = any, TProductCollection = any, TProductCategory = any> {
|
|
5
|
+
list(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<ProductDTO[]>;
|
|
6
|
+
listAndCount(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<[ProductDTO[], number]>;
|
|
7
|
+
listTags(filter: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, context?: SharedContext): Promise<ProductTagDTO[]>;
|
|
8
|
+
listVariants(filter: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, context?: SharedContext): Promise<ProductVariantDTO[]>;
|
|
9
|
+
listCollections(filter: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, context?: SharedContext): Promise<ProductCollectionDTO[]>;
|
|
10
|
+
listCategories(filters: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: SharedContext): Promise<ProductCategoryDTO[]>;
|
|
10
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./repository";
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./tax-calculation-strategy"), exports);
|
|
17
|
+
__exportStar(require("./repository"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/product-category/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/product-category/repository.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DomainKey, HookPointKey, LoadedWidget, WidgetsConfig } from "./widget";
|
|
2
|
-
export declare type InjectionZone = `${DomainKey}.${HookPointKey}`;
|
|
3
|
-
export declare type InjectionZones = Map<InjectionZone, LoadedWidget[]>;
|
|
4
|
-
export interface Application {
|
|
5
|
-
registerWidgets(identifier: string, config: WidgetsConfig): void;
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/admin/application.ts"],"names":[],"mappings":""}
|
package/dist/admin/common.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface IBaseExtension {
|
|
3
|
-
/**
|
|
4
|
-
* The name of the extension, used to identify it in the admin panel and improve debugging.
|
|
5
|
-
*/
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* The component to render in the admin panel.
|
|
9
|
-
*/
|
|
10
|
-
Component: React.ComponentType<any>;
|
|
11
|
-
}
|
|
12
|
-
export interface IBaseLoadedExtension extends IBaseExtension {
|
|
13
|
-
origin: string;
|
|
14
|
-
}
|
package/dist/admin/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/admin/common.ts"],"names":[],"mappings":""}
|
package/dist/admin/config.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Application } from "./application";
|
|
2
|
-
import { WidgetsConfig } from "./widget";
|
|
3
|
-
export declare type ExtensionConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* A unique identifier for the customization configuration, used to differentiate it from other customization sources.
|
|
6
|
-
* It is recommended to use the name of the package where the customization configuration is defined, for example, `my-medusa-plugin`.
|
|
7
|
-
*/
|
|
8
|
-
identifier: string;
|
|
9
|
-
/**
|
|
10
|
-
* The configuration for custom widgets in the admin panel.
|
|
11
|
-
* Define your own widgets here to use in the admin panel.
|
|
12
|
-
*/
|
|
13
|
-
widgets?: WidgetsConfig;
|
|
14
|
-
};
|
|
15
|
-
export declare type Extension = {
|
|
16
|
-
setup(app: Application): void;
|
|
17
|
-
};
|
package/dist/admin/config.js
DELETED
package/dist/admin/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/admin/config.ts"],"names":[],"mappings":""}
|
package/dist/admin/helpers.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NavigateFunction } from "react-router-dom";
|
|
2
|
-
declare type NotificationFunction = (title: string, message: string) => void;
|
|
3
|
-
export declare type Notify = {
|
|
4
|
-
error: NotificationFunction;
|
|
5
|
-
success: NotificationFunction;
|
|
6
|
-
info: NotificationFunction;
|
|
7
|
-
warning: NotificationFunction;
|
|
8
|
-
};
|
|
9
|
-
export declare type Navigate = NavigateFunction;
|
|
10
|
-
export declare type FeatureFlagHelpers = {
|
|
11
|
-
isFeatureEnabled: (flag: string) => boolean;
|
|
12
|
-
featureToggleList: Record<string, boolean>;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
package/dist/admin/helpers.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/admin/helpers.ts"],"names":[],"mappings":""}
|
package/dist/admin/index.d.ts
DELETED
package/dist/admin/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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("./application"), exports);
|
|
18
|
-
__exportStar(require("./common"), exports);
|
|
19
|
-
__exportStar(require("./config"), exports);
|
|
20
|
-
__exportStar(require("./widget"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/dist/admin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,2CAAwB;AACxB,2CAAwB;AACxB,2CAAwB"}
|
package/dist/admin/widget.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IBaseExtension, IBaseLoadedExtension } from "./common";
|
|
2
|
-
import { FeatureFlagHelpers, Navigate, Notify } from "./helpers";
|
|
3
|
-
export interface Widget extends IBaseExtension {
|
|
4
|
-
}
|
|
5
|
-
export declare type DomainKey = "product" | "product_collection" | "order" | "customer";
|
|
6
|
-
export declare type HookPointKey = "details";
|
|
7
|
-
declare type HookPoint = {
|
|
8
|
-
[key in HookPointKey]?: Widget[];
|
|
9
|
-
};
|
|
10
|
-
export declare type WidgetsConfig = {
|
|
11
|
-
[key in DomainKey]?: HookPoint;
|
|
12
|
-
};
|
|
13
|
-
export interface LoadedWidget extends Widget, IBaseLoadedExtension {
|
|
14
|
-
}
|
|
15
|
-
export interface WidgetProps {
|
|
16
|
-
notify: Notify;
|
|
17
|
-
navigate: Navigate;
|
|
18
|
-
featureFlags: FeatureFlagHelpers;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/dist/admin/widget.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/admin/widget.ts"],"names":[],"mappings":""}
|
package/dist/tax/common.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** The amount of a gift card allocated to a line item */
|
|
2
|
-
export declare type GiftCardAllocation = {
|
|
3
|
-
amount: number;
|
|
4
|
-
unit_amount: number;
|
|
5
|
-
};
|
|
6
|
-
/** The amount of a discount allocated to a line item */
|
|
7
|
-
export declare type DiscountAllocation = {
|
|
8
|
-
amount: number;
|
|
9
|
-
unit_amount: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* A map of line item ids and its corresponding gift card and discount
|
|
13
|
-
* allocations
|
|
14
|
-
*/
|
|
15
|
-
export declare type LineAllocationsMap = {
|
|
16
|
-
[K: string]: {
|
|
17
|
-
gift_card?: GiftCardAllocation;
|
|
18
|
-
discount?: DiscountAllocation;
|
|
19
|
-
};
|
|
20
|
-
};
|
package/dist/tax/common.js
DELETED
package/dist/tax/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tax/common.ts"],"names":[],"mappings":""}
|
package/dist/tax/index.d.ts
DELETED
package/dist/tax/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tax/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,6DAA0C"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { LineAllocationsMap } from "./common";
|
|
2
|
-
export declare type TaxCalculationContext = {
|
|
3
|
-
shipping_address: any;
|
|
4
|
-
customer: any;
|
|
5
|
-
region: any;
|
|
6
|
-
is_return: boolean;
|
|
7
|
-
shipping_methods: any;
|
|
8
|
-
allocation_map: LineAllocationsMap;
|
|
9
|
-
tax_calculation_strategy: ITaxCalculationStrategy;
|
|
10
|
-
};
|
|
11
|
-
export interface ITaxCalculationStrategy {
|
|
12
|
-
/**
|
|
13
|
-
* Calculates the tax amount for a given set of line items under applicable
|
|
14
|
-
* tax conditions and calculation contexts.
|
|
15
|
-
* @param items - the line items to calculate the tax total for
|
|
16
|
-
* @param taxLines - the tax lines that applies to the calculation
|
|
17
|
-
* @param calculationContext - other details relevant for the calculation
|
|
18
|
-
* @return the tax total
|
|
19
|
-
*/
|
|
20
|
-
calculate(items: any, // LineItem[],
|
|
21
|
-
taxLines: any[], calculationContext: TaxCalculationContext): Promise<number>;
|
|
22
|
-
}
|
|
23
|
-
export declare function isTaxCalculationStrategy(object: any): object is ITaxCalculationStrategy;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTaxCalculationStrategy = void 0;
|
|
4
|
-
function isTaxCalculationStrategy(
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
object) {
|
|
7
|
-
return typeof object.calculate === "function";
|
|
8
|
-
}
|
|
9
|
-
exports.isTaxCalculationStrategy = isTaxCalculationStrategy;
|
|
10
|
-
//# sourceMappingURL=tax-calculation-strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tax-calculation-strategy.js","sourceRoot":"","sources":["../../src/tax/tax-calculation-strategy.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,wBAAwB;AACtC,8DAA8D;AAC9D,MAAW;IAEX,OAAO,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,CAAA;AAC/C,CAAC;AALD,4DAKC"}
|