@medusajs/types 0.0.2-next-20230323083446 → 0.0.2-rc.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.
Files changed (64) hide show
  1. package/dist/bundles.d.ts +4 -0
  2. package/dist/bundles.js +5 -1
  3. package/dist/bundles.js.map +1 -1
  4. package/dist/cache/index.d.ts +1 -0
  5. package/dist/cache/index.js +18 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/cache/service.d.ts +5 -0
  8. package/dist/cache/service.js +3 -0
  9. package/dist/cache/service.js.map +1 -0
  10. package/dist/common/common.d.ts +138 -0
  11. package/dist/common/common.js +3 -0
  12. package/dist/common/common.js.map +1 -0
  13. package/dist/common/config-module.d.ts +1 -1
  14. package/dist/common/index.d.ts +2 -0
  15. package/dist/common/index.js +2 -0
  16. package/dist/common/index.js.map +1 -1
  17. package/dist/common/medusa-container.d.ts +5 -0
  18. package/dist/common/medusa-container.js +3 -0
  19. package/dist/common/medusa-container.js.map +1 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.js +4 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/interfaces/event-bus.d.ts +11 -0
  24. package/dist/interfaces/event-bus.js +3 -0
  25. package/dist/interfaces/event-bus.js.map +1 -0
  26. package/dist/interfaces/index.d.ts +2 -0
  27. package/dist/interfaces/index.js +29 -0
  28. package/dist/interfaces/index.js.map +1 -0
  29. package/dist/interfaces/services/event-bus.d.ts +11 -0
  30. package/dist/interfaces/services/event-bus.js +3 -0
  31. package/dist/interfaces/services/event-bus.js.map +1 -0
  32. package/dist/interfaces/services/transaction-base.d.ts +20 -0
  33. package/dist/interfaces/services/transaction-base.js +3 -0
  34. package/dist/interfaces/services/transaction-base.js.map +1 -0
  35. package/dist/interfaces/transaction-base.d.ts +0 -0
  36. package/dist/interfaces/transaction-base.js +1 -0
  37. package/dist/interfaces/transaction-base.js.map +1 -0
  38. package/dist/inventory/common.d.ts +238 -0
  39. package/dist/inventory/common.js +3 -0
  40. package/dist/inventory/common.js.map +1 -0
  41. package/dist/inventory/index.d.ts +2 -0
  42. package/dist/inventory/index.js +19 -0
  43. package/dist/inventory/index.js.map +1 -0
  44. package/dist/inventory/inventory.d.ts +27 -0
  45. package/dist/inventory/inventory.js +3 -0
  46. package/dist/inventory/inventory.js.map +1 -0
  47. package/dist/modules-sdk/index.d.ts +69 -0
  48. package/dist/modules-sdk/index.js +29 -0
  49. package/dist/modules-sdk/index.js.map +1 -0
  50. package/dist/search/index-types.js +1 -1
  51. package/dist/search/index-types.js.map +1 -1
  52. package/dist/search/indexes.d.ts +3 -0
  53. package/dist/search/indexes.js +7 -0
  54. package/dist/search/indexes.js.map +1 -0
  55. package/dist/stock-location/common.d.ts +262 -0
  56. package/dist/stock-location/common.js +3 -0
  57. package/dist/stock-location/common.js.map +1 -0
  58. package/dist/stock-location/index.d.ts +2 -0
  59. package/dist/stock-location/index.js +19 -0
  60. package/dist/stock-location/index.js.map +1 -0
  61. package/dist/stock-location/stock-location.d.ts +10 -0
  62. package/dist/stock-location/stock-location.js +3 -0
  63. package/dist/stock-location/stock-location.js.map +1 -0
  64. package/package.json +4 -5
package/dist/bundles.d.ts CHANGED
@@ -1,4 +1,8 @@
1
+ export * as CacheTypes from "./cache";
1
2
  export * as CommonTypes from "./common";
2
3
  export * as EventBusTypes from "./event-bus";
4
+ export * as InventoryTypes from "./inventory";
5
+ export * as ModulesSdkTypes from "./modules-sdk";
3
6
  export * as SearchTypes from "./search";
7
+ export * as StockLocationTypes from "./stock-location";
4
8
  export * as TransactionBaseTypes from "./transaction-base";
package/dist/bundles.js CHANGED
@@ -23,9 +23,13 @@ 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.SearchTypes = exports.EventBusTypes = exports.CommonTypes = void 0;
26
+ exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0;
27
+ exports.CacheTypes = __importStar(require("./cache"));
27
28
  exports.CommonTypes = __importStar(require("./common"));
28
29
  exports.EventBusTypes = __importStar(require("./event-bus"));
30
+ exports.InventoryTypes = __importStar(require("./inventory"));
31
+ exports.ModulesSdkTypes = __importStar(require("./modules-sdk"));
29
32
  exports.SearchTypes = __importStar(require("./search"));
33
+ exports.StockLocationTypes = __importStar(require("./stock-location"));
30
34
  exports.TransactionBaseTypes = __importStar(require("./transaction-base"));
31
35
  //# sourceMappingURL=bundles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAuC;AACvC,6DAA4C;AAC5C,wDAAuC;AACvC,2EAA0D"}
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"}
@@ -0,0 +1 @@
1
+ export * from "./service";
@@ -0,0 +1,18 @@
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("./service"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB"}
@@ -0,0 +1,5 @@
1
+ export interface ICacheService {
2
+ get<T>(key: string): Promise<T | null>;
3
+ set(key: string, data: unknown, ttl?: number): Promise<void>;
4
+ invalidate(key: string): Promise<void>;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/cache/service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,138 @@
1
+ import { FindManyOptions, FindOneOptions, FindOperator, FindOptionsSelect, FindOptionsWhere, OrderByCondition } from "typeorm";
2
+ import { FindOptionsOrder } from "typeorm/find-options/FindOptionsOrder";
3
+ import { FindOptionsRelations } from "typeorm/find-options/FindOptionsRelations";
4
+ /**
5
+ * Utility type used to remove some optional attributes (coming from K) from a type T
6
+ */
7
+ export declare type WithRequiredProperty<T, K extends keyof T> = T & {
8
+ [Property in K]-?: T[Property];
9
+ };
10
+ export declare type PartialPick<T, K extends keyof T> = {
11
+ [P in K]?: T[P];
12
+ };
13
+ export interface BaseEntity {
14
+ id: string;
15
+ created_at: Date;
16
+ updated_at: Date;
17
+ }
18
+ export interface SoftDeletableEntity extends BaseEntity {
19
+ deleted_at: Date | null;
20
+ }
21
+ export declare type Writable<T> = {
22
+ -readonly [key in keyof T]: T[key] | FindOperator<T[key]> | FindOperator<T[key][]> | FindOperator<string[]>;
23
+ };
24
+ export interface FindConfig<Entity> {
25
+ select?: (keyof Entity)[];
26
+ skip?: number;
27
+ take?: number;
28
+ relations?: string[];
29
+ order?: {
30
+ [K: string]: "ASC" | "DESC";
31
+ };
32
+ }
33
+ export declare type ExtendedFindConfig<TEntity> = (Omit<FindOneOptions<TEntity>, "where" | "relations" | "select"> | Omit<FindManyOptions<TEntity>, "where" | "relations" | "select">) & {
34
+ select?: FindOptionsSelect<TEntity>;
35
+ relations?: FindOptionsRelations<TEntity>;
36
+ where: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[];
37
+ order?: FindOptionsOrder<TEntity>;
38
+ skip?: number;
39
+ take?: number;
40
+ };
41
+ export declare type QuerySelector<TEntity> = Selector<TEntity> & {
42
+ q?: string;
43
+ };
44
+ export declare type TreeQuerySelector<TEntity> = QuerySelector<TEntity> & {
45
+ include_descendants_tree?: boolean;
46
+ };
47
+ export declare type Selector<TEntity> = {
48
+ [key in keyof TEntity]?: TEntity[key] | TEntity[key][] | DateComparisonOperator | StringComparisonOperator | NumericalComparisonOperator | FindOperator<TEntity[key][] | string | string[]>;
49
+ };
50
+ export declare type TotalField = "shipping_total" | "discount_total" | "tax_total" | "refunded_total" | "total" | "subtotal" | "refundable_amount" | "gift_card_total" | "gift_card_tax_total";
51
+ export interface CustomFindOptions<TModel, InKeys extends keyof TModel> {
52
+ select?: FindManyOptions<TModel>["select"];
53
+ where?: FindManyOptions<TModel>["where"] & {
54
+ [P in InKeys]?: TModel[P][];
55
+ };
56
+ order?: OrderByCondition;
57
+ skip?: number;
58
+ take?: number;
59
+ }
60
+ export declare type QueryConfig<TEntity extends BaseEntity> = {
61
+ defaultFields?: (keyof TEntity | string)[];
62
+ defaultRelations?: string[];
63
+ allowedFields?: string[];
64
+ allowedRelations?: string[];
65
+ defaultLimit?: number;
66
+ isList?: boolean;
67
+ };
68
+ export declare type RequestQueryFields = {
69
+ expand?: string;
70
+ fields?: string;
71
+ offset?: number;
72
+ limit?: number;
73
+ order?: string;
74
+ };
75
+ export declare type PaginatedResponse = {
76
+ limit: number;
77
+ offset: number;
78
+ count: number;
79
+ };
80
+ export declare type DeleteResponse = {
81
+ id: string;
82
+ object: string;
83
+ deleted: boolean;
84
+ };
85
+ export interface EmptyQueryParams {
86
+ }
87
+ export interface DateComparisonOperator {
88
+ lt?: Date;
89
+ gt?: Date;
90
+ gte?: Date;
91
+ lte?: Date;
92
+ }
93
+ export interface StringComparisonOperator {
94
+ lt?: string;
95
+ gt?: string;
96
+ gte?: string;
97
+ lte?: string;
98
+ }
99
+ export interface NumericalComparisonOperator {
100
+ lt?: number;
101
+ gt?: number;
102
+ gte?: number;
103
+ lte?: number;
104
+ }
105
+ export interface AddressPayload {
106
+ first_name?: string;
107
+ last_name?: string;
108
+ phone?: string;
109
+ metadata?: Record<string, unknown>;
110
+ company?: string;
111
+ address_1?: string;
112
+ address_2?: string;
113
+ city?: string;
114
+ country_code?: string;
115
+ province?: string;
116
+ postal_code?: string;
117
+ }
118
+ export interface AddressCreatePayload {
119
+ first_name: string;
120
+ last_name: string;
121
+ phone: string;
122
+ metadata: object;
123
+ company: string;
124
+ address_1: string;
125
+ address_2: string;
126
+ city: string;
127
+ country_code: string;
128
+ province: string;
129
+ postal_code: string;
130
+ }
131
+ export interface FindParams {
132
+ expand?: string;
133
+ fields?: string;
134
+ }
135
+ export interface FindPaginationParams {
136
+ offset?: number;
137
+ limit?: number;
138
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common/common.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
2
1
  import { LoggerOptions } from "typeorm";
2
+ import { ExternalModuleDeclaration, InternalModuleDeclaration } from "../modules-sdk";
3
3
  declare type SessionOptions = {
4
4
  name?: string;
5
5
  resave?: boolean;
@@ -1 +1,3 @@
1
+ export * from "./common";
1
2
  export * from "./config-module";
3
+ export * from "./medusa-container";
@@ -14,5 +14,7 @@ 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("./common"), exports);
17
18
  __exportStar(require("./config-module"), exports);
19
+ __exportStar(require("./medusa-container"), exports);
18
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,kDAA+B;AAC/B,qDAAkC"}
@@ -0,0 +1,5 @@
1
+ import { AwilixContainer } from "awilix";
2
+ export declare type MedusaContainer = AwilixContainer & {
3
+ registerAdd: <T>(name: string, registration: T) => MedusaContainer;
4
+ createScope: () => MedusaContainer;
5
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=medusa-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"medusa-container.js","sourceRoot":"","sources":["../../src/common/medusa-container.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from "./bundles";
2
+ export * from "./cache";
2
3
  export * from "./common";
3
4
  export * from "./event-bus";
5
+ export * from "./inventory";
6
+ export * from "./modules-sdk";
4
7
  export * from "./search";
5
8
  export * from "./shared-context";
9
+ export * from "./stock-location";
6
10
  export * from "./transaction-base";
package/dist/index.js CHANGED
@@ -15,9 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./bundles"), exports);
18
+ __exportStar(require("./cache"), exports);
18
19
  __exportStar(require("./common"), exports);
19
20
  __exportStar(require("./event-bus"), exports);
21
+ __exportStar(require("./inventory"), exports);
22
+ __exportStar(require("./modules-sdk"), exports);
20
23
  __exportStar(require("./search"), exports);
21
24
  __exportStar(require("./shared-context"), exports);
25
+ __exportStar(require("./stock-location"), exports);
22
26
  __exportStar(require("./transaction-base"), exports);
23
27
  //# 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,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,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,2CAAwB;AACxB,mDAAgC;AAChC,mDAAgC;AAChC,qDAAkC"}
@@ -0,0 +1,11 @@
1
+ import { TransactionBaseService } from "@medusajs/medusa";
2
+ import { EmitData, Subscriber, SubscriberContext } from "../event-bus";
3
+ export interface IEventBusService extends TransactionBaseService {
4
+ emit<T>(event: string, data: T, options?: unknown): Promise<unknown | void>;
5
+ }
6
+ export interface IEventBusModuleService {
7
+ emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
8
+ emit<T>(data: EmitData<T>[]): Promise<void>;
9
+ subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
10
+ unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/interfaces/event-bus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * as EventBus from "../event-bus/event-bus";
2
+ export * as ITransactionBaseService from "../transaction-base/transaction-base";
@@ -0,0 +1,29 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ITransactionBaseService = exports.EventBus = void 0;
27
+ exports.EventBus = __importStar(require("../event-bus/event-bus"));
28
+ exports.ITransactionBaseService = __importStar(require("../transaction-base/transaction-base"));
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmD;AACnD,gGAAgF"}
@@ -0,0 +1,11 @@
1
+ import { EmitData, Subscriber, SubscriberContext } from "../../event-bus";
2
+ import { ITransactionBaseService } from "./transaction-base";
3
+ export interface IEventBusService extends ITransactionBaseService {
4
+ emit<T>(event: string, data: T, options?: unknown): Promise<unknown | void>;
5
+ }
6
+ export interface IEventBusModuleService {
7
+ emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
8
+ emit<T>(data: EmitData<T>[]): Promise<void>;
9
+ subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
10
+ unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../src/interfaces/services/event-bus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { EntityManager } from "typeorm";
2
+ import { IsolationLevel } from "typeorm/driver/types/IsolationLevel";
3
+ export interface ITransactionBaseService {
4
+ manager_: EntityManager;
5
+ transactionManager_: EntityManager | undefined;
6
+ withTransaction(transactionManager?: EntityManager): this;
7
+ shouldRetryTransaction_(err: {
8
+ code: string;
9
+ } | Record<string, unknown>): boolean;
10
+ /**
11
+ * Wraps some work within a transactional block. If the service already has
12
+ * a transaction manager attached this will be reused, otherwise a new
13
+ * transaction manager is created.
14
+ * @param work - the transactional work to be done
15
+ * @param isolationOrErrorHandler - the isolation level to be used for the work.
16
+ * @param maybeErrorHandlerOrDontFail Potential error handler
17
+ * @return the result of the transactional work
18
+ */
19
+ atomicPhase_<TResult, TError>(work: (transactionManager: EntityManager) => Promise<TResult | never>, isolationOrErrorHandler?: IsolationLevel | ((error: TError) => Promise<never | TResult | void>), maybeErrorHandlerOrDontFail?: (error: TError) => Promise<never | TResult | void>): Promise<never | TResult>;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=transaction-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../../src/interfaces/services/transaction-base.ts"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=transaction-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../src/interfaces/transaction-base.ts"],"names":[],"mappings":""}
@@ -0,0 +1,238 @@
1
+ import { NumericalComparisonOperator, StringComparisonOperator } from "../common";
2
+ /**
3
+ * @schema InventoryItemDTO
4
+ * type: object
5
+ * required:
6
+ * - sku
7
+ * properties:
8
+ * sku:
9
+ * description: The Stock Keeping Unit (SKU) code of the Inventory Item.
10
+ * type: string
11
+ * hs_code:
12
+ * description: The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.
13
+ * type: string
14
+ * origin_country:
15
+ * description: The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.
16
+ * type: string
17
+ * mid_code:
18
+ * description: The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.
19
+ * type: string
20
+ * material:
21
+ * description: The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.
22
+ * type: string
23
+ * weight:
24
+ * description: The weight of the Inventory Item. May be used in shipping rate calculations.
25
+ * type: number
26
+ * height:
27
+ * description: The height of the Inventory Item. May be used in shipping rate calculations.
28
+ * type: number
29
+ * width:
30
+ * description: The width of the Inventory Item. May be used in shipping rate calculations.
31
+ * type: number
32
+ * length:
33
+ * description: The length of the Inventory Item. May be used in shipping rate calculations.
34
+ * type: number
35
+ * requires_shipping:
36
+ * description: Whether the item requires shipping.
37
+ * type: boolean
38
+ * metadata:
39
+ * type: object
40
+ * description: An optional key-value map with additional details
41
+ * example: {car: "white"}
42
+ * created_at:
43
+ * type: string
44
+ * description: "The date with timezone at which the resource was created."
45
+ * format: date-time
46
+ * updated_at:
47
+ * type: string
48
+ * description: "The date with timezone at which the resource was updated."
49
+ * format: date-time
50
+ * deleted_at:
51
+ * type: string
52
+ * description: "The date with timezone at which the resource was deleted."
53
+ * format: date-time
54
+ */
55
+ export declare type InventoryItemDTO = {
56
+ id: string;
57
+ sku?: string | null;
58
+ origin_country?: string | null;
59
+ hs_code?: string | null;
60
+ requires_shipping: boolean;
61
+ mid_code?: string | null;
62
+ material?: string | null;
63
+ weight?: number | null;
64
+ length?: number | null;
65
+ height?: number | null;
66
+ width?: number | null;
67
+ metadata?: Record<string, unknown> | null;
68
+ created_at: string | Date;
69
+ updated_at: string | Date;
70
+ deleted_at: string | Date | null;
71
+ };
72
+ /**
73
+ * @schema ReservationItemDTO
74
+ * title: "Reservation item"
75
+ * description: "Represents a reservation of an inventory item at a stock location"
76
+ * type: object
77
+ * required:
78
+ * - id
79
+ * - location_id
80
+ * - inventory_item_id
81
+ * - quantity
82
+ * properties:
83
+ * id:
84
+ * description: "The id of the reservation item"
85
+ * type: string
86
+ * location_id:
87
+ * description: "The id of the location of the reservation"
88
+ * type: string
89
+ * inventory_item_id:
90
+ * description: "The id of the inventory item the reservation relates to"
91
+ * type: string
92
+ * quantity:
93
+ * description: "The id of the reservation item"
94
+ * type: number
95
+ * metadata:
96
+ * type: object
97
+ * description: An optional key-value map with additional details
98
+ * example: {car: "white"}
99
+ * created_at:
100
+ * type: string
101
+ * description: "The date with timezone at which the resource was created."
102
+ * format: date-time
103
+ * updated_at:
104
+ * type: string
105
+ * description: "The date with timezone at which the resource was updated."
106
+ * format: date-time
107
+ * deleted_at:
108
+ * type: string
109
+ * description: "The date with timezone at which the resource was deleted."
110
+ * format: date-time
111
+ */
112
+ export declare type ReservationItemDTO = {
113
+ id: string;
114
+ location_id: string;
115
+ inventory_item_id: string;
116
+ quantity: number;
117
+ line_item_id?: string | null;
118
+ metadata: Record<string, unknown> | null;
119
+ created_at: string | Date;
120
+ updated_at: string | Date;
121
+ deleted_at: string | Date | null;
122
+ };
123
+ /**
124
+ * @schema InventoryLevelDTO
125
+ * type: object
126
+ * required:
127
+ * - inventory_item_id
128
+ * - location_id
129
+ * - stocked_quantity
130
+ * - reserved_quantity
131
+ * - incoming_quantity
132
+ * properties:
133
+ * location_id:
134
+ * description: the item location ID
135
+ * type: string
136
+ * stocked_quantity:
137
+ * description: the total stock quantity of an inventory item at the given location ID
138
+ * type: number
139
+ * reserved_quantity:
140
+ * description: the reserved stock quantity of an inventory item at the given location ID
141
+ * type: number
142
+ * incoming_quantity:
143
+ * description: the incoming stock quantity of an inventory item at the given location ID
144
+ * type: number
145
+ * metadata:
146
+ * type: object
147
+ * description: An optional key-value map with additional details
148
+ * example: {car: "white"}
149
+ * created_at:
150
+ * type: string
151
+ * description: "The date with timezone at which the resource was created."
152
+ * format: date-time
153
+ * updated_at:
154
+ * type: string
155
+ * description: "The date with timezone at which the resource was updated."
156
+ * format: date-time
157
+ * deleted_at:
158
+ * type: string
159
+ * description: "The date with timezone at which the resource was deleted."
160
+ * format: date-time
161
+ */
162
+ export declare type InventoryLevelDTO = {
163
+ id: string;
164
+ inventory_item_id: string;
165
+ location_id: string;
166
+ stocked_quantity: number;
167
+ reserved_quantity: number;
168
+ incoming_quantity: number;
169
+ metadata: Record<string, unknown> | null;
170
+ created_at: string | Date;
171
+ updated_at: string | Date;
172
+ deleted_at: string | Date | null;
173
+ };
174
+ export declare type FilterableReservationItemProps = {
175
+ id?: string | string[];
176
+ type?: string | string[];
177
+ line_item_id?: string | string[];
178
+ inventory_item_id?: string | string[];
179
+ location_id?: string | string[];
180
+ quantity?: number | NumericalComparisonOperator;
181
+ };
182
+ export declare type FilterableInventoryItemProps = {
183
+ id?: string | string[];
184
+ location_id?: string | string[];
185
+ q?: string;
186
+ sku?: string | string[] | StringComparisonOperator;
187
+ origin_country?: string | string[];
188
+ hs_code?: string | string[] | StringComparisonOperator;
189
+ requires_shipping?: boolean;
190
+ };
191
+ export declare type CreateInventoryItemInput = {
192
+ sku?: string;
193
+ origin_country?: string;
194
+ mid_code?: string;
195
+ material?: string;
196
+ weight?: number;
197
+ length?: number;
198
+ height?: number;
199
+ width?: number;
200
+ metadata?: Record<string, unknown> | null;
201
+ hs_code?: string;
202
+ requires_shipping?: boolean;
203
+ };
204
+ export declare type CreateReservationItemInput = {
205
+ line_item_id?: string;
206
+ inventory_item_id: string;
207
+ location_id: string;
208
+ quantity: number;
209
+ metadata?: Record<string, unknown> | null;
210
+ };
211
+ export declare type FilterableInventoryLevelProps = {
212
+ inventory_item_id?: string | string[];
213
+ location_id?: string | string[];
214
+ stocked_quantity?: number | NumericalComparisonOperator;
215
+ reserved_quantity?: number | NumericalComparisonOperator;
216
+ incoming_quantity?: number | NumericalComparisonOperator;
217
+ };
218
+ export declare type CreateInventoryLevelInput = {
219
+ inventory_item_id: string;
220
+ location_id: string;
221
+ stocked_quantity: number;
222
+ reserved_quantity?: number;
223
+ incoming_quantity?: number;
224
+ };
225
+ export declare type UpdateInventoryLevelInput = {
226
+ stocked_quantity?: number;
227
+ incoming_quantity?: number;
228
+ };
229
+ export declare type UpdateReservationItemInput = {
230
+ quantity?: number;
231
+ location_id?: string;
232
+ metadata?: Record<string, unknown> | null;
233
+ };
234
+ export declare type ReserveQuantityContext = {
235
+ locationId?: string;
236
+ lineItemId?: string;
237
+ salesChannelId?: string | null;
238
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/inventory/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ export * from "./inventory";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./inventory"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inventory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,8CAA2B"}
@@ -0,0 +1,27 @@
1
+ import { FindConfig } from "../common";
2
+ import { CreateInventoryItemInput, CreateInventoryLevelInput, CreateReservationItemInput, FilterableInventoryItemProps, FilterableInventoryLevelProps, FilterableReservationItemProps, InventoryItemDTO, InventoryLevelDTO, ReservationItemDTO, UpdateInventoryLevelInput, UpdateReservationItemInput } from "./common";
3
+ export interface IInventoryService {
4
+ listInventoryItems(selector: FilterableInventoryItemProps, config?: FindConfig<InventoryItemDTO>): Promise<[InventoryItemDTO[], number]>;
5
+ listReservationItems(selector: FilterableReservationItemProps, config?: FindConfig<ReservationItemDTO>): Promise<[ReservationItemDTO[], number]>;
6
+ listInventoryLevels(selector: FilterableInventoryLevelProps, config?: FindConfig<InventoryLevelDTO>): Promise<[InventoryLevelDTO[], number]>;
7
+ retrieveInventoryItem(inventoryItemId: string, config?: FindConfig<InventoryItemDTO>): Promise<InventoryItemDTO>;
8
+ retrieveInventoryLevel(inventoryItemId: string, locationId: string): Promise<InventoryLevelDTO>;
9
+ retrieveReservationItem(reservationId: string): Promise<ReservationItemDTO>;
10
+ createReservationItem(input: CreateReservationItemInput): Promise<ReservationItemDTO>;
11
+ createInventoryItem(input: CreateInventoryItemInput): Promise<InventoryItemDTO>;
12
+ createInventoryLevel(data: CreateInventoryLevelInput): Promise<InventoryLevelDTO>;
13
+ updateInventoryLevel(inventoryItemId: string, locationId: string, update: UpdateInventoryLevelInput): Promise<InventoryLevelDTO>;
14
+ updateInventoryItem(inventoryItemId: string, input: CreateInventoryItemInput): Promise<InventoryItemDTO>;
15
+ updateReservationItem(reservationItemId: string, input: UpdateReservationItemInput): Promise<ReservationItemDTO>;
16
+ deleteReservationItemsByLineItem(lineItemId: string): Promise<void>;
17
+ deleteReservationItem(reservationItemId: string | string[]): Promise<void>;
18
+ deleteInventoryItem(inventoryItemId: string): Promise<void>;
19
+ deleteInventoryItemLevelByLocationId(locationId: string): Promise<void>;
20
+ deleteReservationItemByLocationId(locationId: string): Promise<void>;
21
+ deleteInventoryLevel(inventoryLevelId: string, locationId: string): Promise<void>;
22
+ adjustInventory(inventoryItemId: string, locationId: string, adjustment: number): Promise<InventoryLevelDTO>;
23
+ confirmInventory(inventoryItemId: string, locationIds: string[], quantity: number): Promise<boolean>;
24
+ retrieveAvailableQuantity(inventoryItemId: string, locationIds: string[]): Promise<number>;
25
+ retrieveStockedQuantity(inventoryItemId: string, locationIds: string[]): Promise<number>;
26
+ retrieveReservedQuantity(inventoryItemId: string, locationIds: string[]): Promise<number>;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inventory.js","sourceRoot":"","sources":["../../src/inventory/inventory.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { Logger as _Logger } from "winston";
2
+ import { MedusaContainer } from "../common/medusa-container";
3
+ export declare type Constructor<T> = new (...args: any[]) => T;
4
+ export * from "../common/medusa-container";
5
+ export declare type LogLevel = "query" | "schema" | "error" | "warn" | "info" | "log" | "migration";
6
+ export declare type LoggerOptions = boolean | "all" | LogLevel[];
7
+ export declare type Logger = _Logger & {
8
+ progress: (activityId: string, msg: string) => void;
9
+ info: (msg: string) => void;
10
+ warn: (msg: string) => void;
11
+ };
12
+ export declare enum MODULE_SCOPE {
13
+ INTERNAL = "internal",
14
+ EXTERNAL = "external"
15
+ }
16
+ export declare enum MODULE_RESOURCE_TYPE {
17
+ SHARED = "shared",
18
+ ISOLATED = "isolated"
19
+ }
20
+ export declare type InternalModuleDeclaration = {
21
+ scope: MODULE_SCOPE.INTERNAL;
22
+ resources: MODULE_RESOURCE_TYPE;
23
+ dependencies?: string[];
24
+ resolve?: string;
25
+ options?: Record<string, unknown>;
26
+ };
27
+ export declare type ExternalModuleDeclaration = {
28
+ scope: MODULE_SCOPE.EXTERNAL;
29
+ server: {
30
+ type: "http";
31
+ url: string;
32
+ keepAlive: boolean;
33
+ };
34
+ };
35
+ export declare type ModuleResolution = {
36
+ resolutionPath: string | false;
37
+ definition: ModuleDefinition;
38
+ options?: Record<string, unknown>;
39
+ dependencies?: string[];
40
+ moduleDeclaration?: InternalModuleDeclaration | ExternalModuleDeclaration;
41
+ };
42
+ export declare type ModuleDefinition = {
43
+ key: string;
44
+ registrationName: string;
45
+ defaultPackage: string | false;
46
+ label: string;
47
+ canOverride?: boolean;
48
+ isRequired?: boolean;
49
+ dependencies?: string[];
50
+ defaultModuleDeclaration: InternalModuleDeclaration | ExternalModuleDeclaration;
51
+ };
52
+ export declare type LoaderOptions<TOptions = Record<string, unknown>> = {
53
+ container: MedusaContainer;
54
+ options?: TOptions;
55
+ logger?: Logger;
56
+ };
57
+ export declare type ModuleLoaderFunction = (options: LoaderOptions, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>;
58
+ export declare type ModulesResponse = {
59
+ module: string;
60
+ resolution: string | false;
61
+ }[];
62
+ export declare type ModuleExports = {
63
+ service: Constructor<any>;
64
+ loaders?: ModuleLoaderFunction[];
65
+ migrations?: any[];
66
+ models?: Constructor<any>[];
67
+ runMigrations?(options: LoaderOptions, moduleDeclaration: InternalModuleDeclaration): Promise<void>;
68
+ revertMigration?(options: LoaderOptions, moduleDeclaration: InternalModuleDeclaration): Promise<void>;
69
+ };
@@ -0,0 +1,29 @@
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
+ exports.MODULE_RESOURCE_TYPE = exports.MODULE_SCOPE = void 0;
18
+ __exportStar(require("../common/medusa-container"), exports);
19
+ var MODULE_SCOPE;
20
+ (function (MODULE_SCOPE) {
21
+ MODULE_SCOPE["INTERNAL"] = "internal";
22
+ MODULE_SCOPE["EXTERNAL"] = "external";
23
+ })(MODULE_SCOPE = exports.MODULE_SCOPE || (exports.MODULE_SCOPE = {}));
24
+ var MODULE_RESOURCE_TYPE;
25
+ (function (MODULE_RESOURCE_TYPE) {
26
+ MODULE_RESOURCE_TYPE["SHARED"] = "shared";
27
+ MODULE_RESOURCE_TYPE["ISOLATED"] = "isolated";
28
+ })(MODULE_RESOURCE_TYPE = exports.MODULE_RESOURCE_TYPE || (exports.MODULE_RESOURCE_TYPE = {}));
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,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"}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.indexTypes = void 0;
4
4
  exports.indexTypes = {
5
- PRODUCTS: "products"
5
+ PRODUCTS: "products",
6
6
  };
7
7
  //# sourceMappingURL=index-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/search/index-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC"}
1
+ {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/search/index-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,QAAQ,EAAE,UAAU;CACrB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const indexTypes: {
2
+ PRODUCTS: string;
3
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.indexTypes = void 0;
4
+ exports.indexTypes = {
5
+ PRODUCTS: "products"
6
+ };
7
+ //# sourceMappingURL=indexes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexes.js","sourceRoot":"","sources":["../../src/search/indexes.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC"}
@@ -0,0 +1,262 @@
1
+ import { StringComparisonOperator } from "../common/common";
2
+ /**
3
+ * @schema StockLocationAddressDTO
4
+ * title: "Stock Location Address"
5
+ * description: "Represents a Stock Location Address"
6
+ * type: object
7
+ * required:
8
+ * - address_1
9
+ * - country_code
10
+ * - created_at
11
+ * - updated_at
12
+ * properties:
13
+ * id:
14
+ * type: string
15
+ * description: The stock location address' ID
16
+ * example: laddr_51G4ZW853Y6TFXWPG5ENJ81X42
17
+ * address_1:
18
+ * type: string
19
+ * description: Stock location address
20
+ * example: 35, Jhon Doe Ave
21
+ * address_2:
22
+ * type: string
23
+ * description: Stock location address' complement
24
+ * example: apartment 4432
25
+ * company:
26
+ * type: string
27
+ * description: Stock location company' name
28
+ * example: Medusa
29
+ * city:
30
+ * type: string
31
+ * description: Stock location address' city
32
+ * example: Mexico city
33
+ * country_code:
34
+ * type: string
35
+ * description: Stock location address' country
36
+ * example: MX
37
+ * phone:
38
+ * type: string
39
+ * description: Stock location address' phone number
40
+ * example: +1 555 61646
41
+ * postal_code:
42
+ * type: string
43
+ * description: Stock location address' postal code
44
+ * example: HD3-1G8
45
+ * province:
46
+ * type: string
47
+ * description: Stock location address' province
48
+ * example: Sinaloa
49
+ * created_at:
50
+ * type: string
51
+ * description: "The date with timezone at which the resource was created."
52
+ * format: date-time
53
+ * updated_at:
54
+ * type: string
55
+ * description: "The date with timezone at which the resource was updated."
56
+ * format: date-time
57
+ * deleted_at:
58
+ * type: string
59
+ * description: "The date with timezone at which the resource was deleted."
60
+ * format: date-time
61
+ * metadata:
62
+ * type: object
63
+ * description: An optional key-value map with additional details
64
+ * example: {car: "white"}
65
+ */
66
+ export declare type StockLocationAddressDTO = {
67
+ id?: string;
68
+ address_1: string;
69
+ address_2?: string | null;
70
+ company?: string | null;
71
+ country_code: string;
72
+ city?: string | null;
73
+ phone?: string | null;
74
+ postal_code?: string | null;
75
+ province?: string | null;
76
+ metadata?: Record<string, unknown> | null;
77
+ created_at: string | Date;
78
+ updated_at: string | Date;
79
+ deleted_at: string | Date | null;
80
+ };
81
+ /**
82
+ * @schema StockLocationDTO
83
+ * title: "Stock Location"
84
+ * description: "Represents a Stock Location"
85
+ * type: object
86
+ * required:
87
+ * - id
88
+ * - name
89
+ * - address_id
90
+ * - created_at
91
+ * - updated_at
92
+ * properties:
93
+ * id:
94
+ * type: string
95
+ * description: The stock location's ID
96
+ * example: sloc_51G4ZW853Y6TFXWPG5ENJ81X42
97
+ * address_id:
98
+ * type: string
99
+ * description: Stock location address' ID
100
+ * example: laddr_05B2ZE853Y6FTXWPW85NJ81A44
101
+ * name:
102
+ * type: string
103
+ * description: The name of the stock location
104
+ * example: Main Warehouse
105
+ * address:
106
+ * description: "The Address of the Stock Location"
107
+ * allOf:
108
+ * - $ref: "#/components/schemas/StockLocationAddressDTO"
109
+ * - type: object
110
+ * metadata:
111
+ * type: object
112
+ * description: An optional key-value map with additional details
113
+ * example: {car: "white"}
114
+ * created_at:
115
+ * type: string
116
+ * description: "The date with timezone at which the resource was created."
117
+ * format: date-time
118
+ * updated_at:
119
+ * type: string
120
+ * description: "The date with timezone at which the resource was updated."
121
+ * format: date-time
122
+ * deleted_at:
123
+ * type: string
124
+ * description: "The date with timezone at which the resource was deleted."
125
+ * format: date-time
126
+ */
127
+ export declare type StockLocationDTO = {
128
+ id: string;
129
+ name: string;
130
+ metadata: Record<string, unknown> | null;
131
+ address_id: string;
132
+ address?: StockLocationAddressDTO;
133
+ created_at: string | Date;
134
+ updated_at: string | Date;
135
+ deleted_at: string | Date | null;
136
+ };
137
+ /**
138
+ * @schema StockLocationExpandedDTO
139
+ * allOf:
140
+ * - $ref: "#/components/schemas/StockLocationDTO"
141
+ * - type: object
142
+ * properties:
143
+ * sales_channels:
144
+ * $ref: "#/components/schemas/SalesChannel"
145
+ */
146
+ export declare type StockLocationExpandedDTO = StockLocationDTO & {
147
+ sales_channels?: any[];
148
+ };
149
+ export declare type FilterableStockLocationProps = {
150
+ id?: string | string[];
151
+ name?: string | string[] | StringComparisonOperator;
152
+ };
153
+ /**
154
+ * @schema StockLocationAddressInput
155
+ * title: "Stock Location Address Input"
156
+ * description: "Represents a Stock Location Address Input"
157
+ * type: object
158
+ * required:
159
+ * - address_1
160
+ * - country_code
161
+ * properties:
162
+ * address_1:
163
+ * type: string
164
+ * description: Stock location address
165
+ * example: 35, Jhon Doe Ave
166
+ * address_2:
167
+ * type: string
168
+ * description: Stock location address' complement
169
+ * example: apartment 4432
170
+ * city:
171
+ * type: string
172
+ * description: Stock location address' city
173
+ * example: Mexico city
174
+ * country_code:
175
+ * type: string
176
+ * description: Stock location address' country
177
+ * example: MX
178
+ * phone:
179
+ * type: string
180
+ * description: Stock location address' phone number
181
+ * example: +1 555 61646
182
+ * postal_code:
183
+ * type: string
184
+ * description: Stock location address' postal code
185
+ * example: HD3-1G8
186
+ * province:
187
+ * type: string
188
+ * description: Stock location address' province
189
+ * example: Sinaloa
190
+ * metadata:
191
+ * type: object
192
+ * description: An optional key-value map with additional details
193
+ * example: {car: "white"}
194
+ */
195
+ export declare type StockLocationAddressInput = {
196
+ address_1: string;
197
+ address_2?: string;
198
+ country_code: string;
199
+ city?: string;
200
+ phone?: string;
201
+ province?: string;
202
+ postal_code?: string;
203
+ metadata?: Record<string, unknown>;
204
+ };
205
+ /**
206
+ * @schema CreateStockLocationInput
207
+ * title: "Create Stock Location Input"
208
+ * description: "Represents the Input to create a Stock Location"
209
+ * type: object
210
+ * required:
211
+ * - name
212
+ * properties:
213
+ * name:
214
+ * type: string
215
+ * description: The stock location name
216
+ * address_id:
217
+ * type: string
218
+ * description: The Stock location address ID
219
+ * address:
220
+ * description: Stock location address object
221
+ * allOf:
222
+ * - $ref: "#/components/schemas/StockLocationAddressInput"
223
+ * - type: object
224
+ * metadata:
225
+ * type: object
226
+ * description: An optional key-value map with additional details
227
+ * example: {car: "white"}
228
+ */
229
+ export declare type CreateStockLocationInput = {
230
+ name: string;
231
+ address_id?: string;
232
+ address?: string | StockLocationAddressInput;
233
+ metadata?: Record<string, unknown>;
234
+ };
235
+ /**
236
+ * @schema UpdateStockLocationInput
237
+ * title: "Update Stock Location Input"
238
+ * description: "Represents the Input to update a Stock Location"
239
+ * type: object
240
+ * properties:
241
+ * name:
242
+ * type: string
243
+ * description: The stock location name
244
+ * address_id:
245
+ * type: string
246
+ * description: The Stock location address ID
247
+ * address:
248
+ * description: Stock location address object
249
+ * allOf:
250
+ * - $ref: "#/components/schemas/StockLocationAddressInput"
251
+ * - type: object
252
+ * metadata:
253
+ * type: object
254
+ * description: An optional key-value map with additional details
255
+ * example: {car: "white"}
256
+ */
257
+ export declare type UpdateStockLocationInput = {
258
+ name?: string;
259
+ address_id?: string;
260
+ address?: StockLocationAddressInput;
261
+ metadata?: Record<string, unknown>;
262
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/stock-location/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ export * from "./stock-location";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./stock-location"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stock-location/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,mDAAgC"}
@@ -0,0 +1,10 @@
1
+ import { FindConfig } from "../common/common";
2
+ import { CreateStockLocationInput, FilterableStockLocationProps, StockLocationDTO, UpdateStockLocationInput } from "./common";
3
+ export interface IStockLocationService {
4
+ list(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>): Promise<StockLocationDTO[]>;
5
+ listAndCount(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>): Promise<[StockLocationDTO[], number]>;
6
+ retrieve(id: string, config?: FindConfig<StockLocationDTO>): Promise<StockLocationDTO>;
7
+ create(input: CreateStockLocationInput): Promise<StockLocationDTO>;
8
+ update(id: string, input: UpdateStockLocationInput): Promise<StockLocationDTO>;
9
+ delete(id: string): Promise<void>;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=stock-location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-location.js","sourceRoot":"","sources":["../../src/stock-location/stock-location.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/types",
3
- "version": "0.0.2-next-20230323083446",
3
+ "version": "0.0.2-rc.0",
4
4
  "description": "Medusa Types definition",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -16,13 +16,12 @@
16
16
  ],
17
17
  "author": "Medusa",
18
18
  "license": "MIT",
19
- "dependencies": {
20
- "@medusajs/modules-sdk": "0.1.0-next-20230323083446"
21
- },
22
19
  "devDependencies": {
20
+ "awilix": "^8.0.0",
23
21
  "cross-env": "^5.2.1",
24
22
  "typeorm": "^0.3.11",
25
- "typescript": "^4.4.4"
23
+ "typescript": "^4.4.4",
24
+ "winston": "^3.8.2"
26
25
  },
27
26
  "scripts": {
28
27
  "prepare": "cross-env NODE_ENV=production yarn run build",