@medusajs/types 0.0.2-rc.0 → 1.8.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.
@@ -1,27 +1,28 @@
1
- import { FindConfig } from "../common";
2
1
  import { CreateInventoryItemInput, CreateInventoryLevelInput, CreateReservationItemInput, FilterableInventoryItemProps, FilterableInventoryLevelProps, FilterableReservationItemProps, InventoryItemDTO, InventoryLevelDTO, ReservationItemDTO, UpdateInventoryLevelInput, UpdateReservationItemInput } from "./common";
2
+ import { FindConfig } from "../common";
3
+ import { SharedContext } from "..";
3
4
  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>;
5
+ listInventoryItems(selector: FilterableInventoryItemProps, config?: FindConfig<InventoryItemDTO>, context?: SharedContext): Promise<[InventoryItemDTO[], number]>;
6
+ listReservationItems(selector: FilterableReservationItemProps, config?: FindConfig<ReservationItemDTO>, context?: SharedContext): Promise<[ReservationItemDTO[], number]>;
7
+ listInventoryLevels(selector: FilterableInventoryLevelProps, config?: FindConfig<InventoryLevelDTO>, context?: SharedContext): Promise<[InventoryLevelDTO[], number]>;
8
+ retrieveInventoryItem(inventoryItemId: string, config?: FindConfig<InventoryItemDTO>, context?: SharedContext): Promise<InventoryItemDTO>;
9
+ retrieveInventoryLevel(inventoryItemId: string, locationId: string, context?: SharedContext): Promise<InventoryLevelDTO>;
10
+ retrieveReservationItem(reservationId: string, context?: SharedContext): Promise<ReservationItemDTO>;
11
+ createReservationItem(input: CreateReservationItemInput, context?: SharedContext): Promise<ReservationItemDTO>;
12
+ createInventoryItem(input: CreateInventoryItemInput, context?: SharedContext): Promise<InventoryItemDTO>;
13
+ createInventoryLevel(data: CreateInventoryLevelInput, context?: SharedContext): Promise<InventoryLevelDTO>;
14
+ updateInventoryLevel(inventoryItemId: string, locationId: string, update: UpdateInventoryLevelInput, context?: SharedContext): Promise<InventoryLevelDTO>;
15
+ updateInventoryItem(inventoryItemId: string, input: CreateInventoryItemInput, context?: SharedContext): Promise<InventoryItemDTO>;
16
+ updateReservationItem(reservationItemId: string, input: UpdateReservationItemInput, context?: SharedContext): Promise<ReservationItemDTO>;
17
+ deleteReservationItemsByLineItem(lineItemId: string, context?: SharedContext): Promise<void>;
18
+ deleteReservationItem(reservationItemId: string | string[], context?: SharedContext): Promise<void>;
19
+ deleteInventoryItem(inventoryItemId: string, context?: SharedContext): Promise<void>;
20
+ deleteInventoryItemLevelByLocationId(locationId: string, context?: SharedContext): Promise<void>;
21
+ deleteReservationItemByLocationId(locationId: string, context?: SharedContext): Promise<void>;
22
+ deleteInventoryLevel(inventoryLevelId: string, locationId: string, context?: SharedContext): Promise<void>;
23
+ adjustInventory(inventoryItemId: string, locationId: string, adjustment: number, context?: SharedContext): Promise<InventoryLevelDTO>;
24
+ confirmInventory(inventoryItemId: string, locationIds: string[], quantity: number, context?: SharedContext): Promise<boolean>;
25
+ retrieveAvailableQuantity(inventoryItemId: string, locationIds: string[], context?: SharedContext): Promise<number>;
26
+ retrieveStockedQuantity(inventoryItemId: string, locationIds: string[], context?: SharedContext): Promise<number>;
27
+ retrieveReservedQuantity(inventoryItemId: string, locationIds: string[], context?: SharedContext): Promise<number>;
27
28
  }
@@ -64,6 +64,6 @@ export declare type ModuleExports = {
64
64
  loaders?: ModuleLoaderFunction[];
65
65
  migrations?: any[];
66
66
  models?: Constructor<any>[];
67
- runMigrations?(options: LoaderOptions, moduleDeclaration: InternalModuleDeclaration): Promise<void>;
68
- revertMigration?(options: LoaderOptions, moduleDeclaration: InternalModuleDeclaration): Promise<void>;
67
+ runMigrations?(options: LoaderOptions, moduleDeclaration?: InternalModuleDeclaration): Promise<void>;
68
+ revertMigration?(options: LoaderOptions, moduleDeclaration?: InternalModuleDeclaration): Promise<void>;
69
69
  };
@@ -1,10 +1,11 @@
1
- import { FindConfig } from "../common/common";
2
1
  import { CreateStockLocationInput, FilterableStockLocationProps, StockLocationDTO, UpdateStockLocationInput } from "./common";
2
+ import { FindConfig } from "../common/common";
3
+ import { SharedContext } from "../shared-context";
3
4
  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>;
5
+ list(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>, context?: SharedContext): Promise<StockLocationDTO[]>;
6
+ listAndCount(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>, context?: SharedContext): Promise<[StockLocationDTO[], number]>;
7
+ retrieve(id: string, config?: FindConfig<StockLocationDTO>, context?: SharedContext): Promise<StockLocationDTO>;
8
+ create(input: CreateStockLocationInput, context?: SharedContext): Promise<StockLocationDTO>;
9
+ update(id: string, input: UpdateStockLocationInput, context?: SharedContext): Promise<StockLocationDTO>;
10
+ delete(id: string, context?: SharedContext): Promise<void>;
10
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/types",
3
- "version": "0.0.2-rc.0",
3
+ "version": "1.8.0",
4
4
  "description": "Medusa Types definition",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -1,11 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=event-bus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/interfaces/event-bus.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * as EventBus from "../event-bus/event-bus";
2
- export * as ITransactionBaseService from "../transaction-base/transaction-base";
@@ -1,29 +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 __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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmD;AACnD,gGAAgF"}
@@ -1,11 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=event-bus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../src/interfaces/services/event-bus.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=transaction-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../../src/interfaces/services/transaction-base.ts"],"names":[],"mappings":""}
File without changes
@@ -1 +0,0 @@
1
- //# sourceMappingURL=transaction-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../src/interfaces/transaction-base.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export declare const indexTypes: {
2
- PRODUCTS: string;
3
- };
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexes.js","sourceRoot":"","sources":["../../src/search/indexes.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC"}