Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@medusajs/types

Package Overview
Dependencies
Maintainers
2
Versions
2911
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medusajs/types - npm Package Compare versions

Comparing version 1.8.10 to 1.8.11-next-20230719155816

3

dist/common/common.d.ts

@@ -25,3 +25,3 @@ import { FindManyOptions, FindOneOptions, FindOperator, FindOptionsSelect, FindOptionsWhere, OrderByCondition } from "typeorm";

export interface FindConfig<Entity> {
select?: (keyof Entity)[];
select?: (keyof Entity | string)[];
skip?: number;

@@ -33,2 +33,3 @@ take?: number;

};
withDeleted?: boolean;
}

@@ -35,0 +36,0 @@ export declare type ExtendedFindConfig<TEntity> = (Omit<FindOneOptions<TEntity>, "where" | "relations" | "select"> | Omit<FindManyOptions<TEntity>, "where" | "relations" | "select">) & {

@@ -20,2 +20,3 @@ import { Dictionary, FilterQuery, Order } from "./utils";

};
export declare const SoftDeletableFilterKey = "softDeletable";
export * from "./repository-service";

@@ -17,3 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SoftDeletableFilterKey = void 0;
exports.SoftDeletableFilterKey = "softDeletable";
__exportStar(require("./repository-service"), exports);
//# sourceMappingURL=index.js.map
import { FindOptions } from "./index";
import { RepositoryTransformOptions } from "../common";
import { Context } from "../shared-context";
/**

@@ -9,4 +10,20 @@ * Data access layer (DAL) interface to implements for any repository service.

export interface RepositoryService<T = any> {
find(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<T[]>;
findAndCount(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<[T[], number]>;
transaction(task: (transactionManager: unknown) => Promise<any>, context?: {
isolationLevel?: string;
transaction?: unknown;
enableNestedTransactions?: boolean;
}): Promise<any>;
serialize<TData extends object, TResult extends object, TOptions = any>(data: TData, options?: TOptions): Promise<TResult>;
serialize<TData extends object[], TResult extends object[], TOptions = any>(data: TData[], options?: TOptions): Promise<TResult>;
find(options?: FindOptions<T>, context?: Context): Promise<T[]>;
findAndCount(options?: FindOptions<T>, context?: Context): Promise<[T[], number]>;
upsert?(data: any, context?: Context): Promise<T[]>;
create(data: unknown[], context?: Context): Promise<T[]>;
delete(ids: string[], context?: Context): Promise<void>;
softDelete(ids: string[], context?: Context): Promise<T[]>;
restore(ids: string[], context?: Context): Promise<T[]>;
}
export interface TreeRepositoryService<T = any> extends RepositoryService<T> {
find(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<T[]>;
findAndCount(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<[T[], number]>;
}

@@ -257,2 +257,6 @@ import { NumericalComparisonOperator, StringComparisonOperator } from "../common";

};
export declare type BulkUpdateInventoryLevelInput = {
inventory_item_id: string;
location_id: string;
} & UpdateInventoryLevelInput;
export declare type UpdateReservationItemInput = {

@@ -259,0 +263,0 @@ quantity?: number;

@@ -12,4 +12,11 @@ import { CreateInventoryItemInput, CreateInventoryLevelInput, CreateReservationItemInput, FilterableInventoryItemProps, FilterableInventoryLevelProps, FilterableReservationItemProps, InventoryItemDTO, InventoryLevelDTO, ReservationItemDTO, UpdateInventoryLevelInput, UpdateReservationItemInput } from "./common";

createReservationItem(input: CreateReservationItemInput, context?: SharedContext): Promise<ReservationItemDTO>;
createReservationItems(input: CreateReservationItemInput[], context?: SharedContext): Promise<ReservationItemDTO[]>;
createInventoryItem(input: CreateInventoryItemInput, context?: SharedContext): Promise<InventoryItemDTO>;
createInventoryItems(input: CreateInventoryItemInput[], context?: SharedContext): Promise<InventoryItemDTO[]>;
createInventoryLevel(data: CreateInventoryLevelInput, context?: SharedContext): Promise<InventoryLevelDTO>;
createInventoryLevels(data: CreateInventoryLevelInput[], context?: SharedContext): Promise<InventoryLevelDTO[]>;
updateInventoryLevels(updates: ({
inventory_item_id: string;
location_id: string;
} & UpdateInventoryLevelInput)[], context?: SharedContext): Promise<InventoryLevelDTO[]>;
updateInventoryLevel(inventoryItemId: string, locationId: string, update: UpdateInventoryLevelInput, context?: SharedContext): Promise<InventoryLevelDTO>;

@@ -20,5 +27,5 @@ updateInventoryItem(inventoryItemId: string, input: CreateInventoryItemInput, context?: SharedContext): Promise<InventoryItemDTO>;

deleteReservationItem(reservationItemId: string | string[], context?: SharedContext): Promise<void>;
deleteInventoryItem(inventoryItemId: string, context?: SharedContext): Promise<void>;
deleteInventoryItemLevelByLocationId(locationId: string, context?: SharedContext): Promise<void>;
deleteReservationItemByLocationId(locationId: string, context?: SharedContext): Promise<void>;
deleteInventoryItem(inventoryItemId: string | string[], context?: SharedContext): Promise<void>;
deleteInventoryItemLevelByLocationId(locationId: string | string[], context?: SharedContext): Promise<void>;
deleteReservationItemByLocationId(locationId: string | string[], context?: SharedContext): Promise<void>;
deleteInventoryLevel(inventoryLevelId: string, locationId: string, context?: SharedContext): Promise<void>;

@@ -25,0 +32,0 @@ adjustInventory(inventoryItemId: string, locationId: string, adjustment: number, context?: SharedContext): Promise<InventoryLevelDTO>;

import { MedusaContainer } from "../common";
import { Logger } from "../logger";
import { RepositoryService } from "../dal";
export declare type Constructor<T> = new (...args: any[]) => T;

@@ -66,1 +67,15 @@ export * from "../common/medusa-container";

};
export interface ModuleServiceInitializeOptions {
database: {
clientUrl: string;
schema?: string;
driverOptions?: Record<string, unknown>;
debug?: boolean;
};
}
export declare type ModuleServiceInitializeCustomDataLayerOptions = {
manager?: any;
repositories?: {
[key: string]: Constructor<RepositoryService>;
};
};

@@ -34,2 +34,3 @@ import { BaseFilterable } from "../dal";

options: ProductOptionDTO[];
images: ProductImageDTO[];
discountable?: boolean;

@@ -84,3 +85,3 @@ external_id?: string | null;

metadata?: Record<string, unknown> | null;
products: ProductDTO[];
products?: ProductDTO[];
}

@@ -93,2 +94,3 @@ export interface ProductCollectionDTO {

deleted_at?: string | Date;
products?: ProductDTO[];
}

@@ -109,2 +111,8 @@ export interface ProductTypeDTO {

}
export interface ProductImageDTO {
id: string;
url: string;
metadata?: Record<string, unknown> | null;
deleted_at?: string | Date;
}
export interface ProductOptionValueDTO {

@@ -155,1 +163,129 @@ id: string;

}
/**
* Write DTO (module API input)
*/
export interface CreateProductTypeDTO {
id?: string;
value: string;
}
export interface CreateProductTagDTO {
id?: string;
value: string;
}
export interface CreateProductOptionDTO {
title: string;
}
export interface CreateProductVariantOptionDTO {
value: string;
}
export interface CreateProductVariantDTO {
title: string;
sku?: string;
barcode?: string;
ean?: string;
upc?: string;
allow_backorder?: boolean;
inventory_quantity?: number;
manage_inventory?: boolean;
hs_code?: string;
origin_country?: string;
mid_code?: string;
material?: string;
weight?: number;
length?: number;
height?: number;
width?: number;
options?: CreateProductVariantOptionDTO[];
metadata?: Record<string, unknown>;
}
export interface CreateProductDTO {
title: string;
subtitle?: string;
description?: string;
is_giftcard?: boolean;
discountable?: boolean;
images?: string[] | {
id?: string;
url: string;
}[];
thumbnail?: string;
handle?: string;
status?: ProductStatus;
type?: CreateProductTypeDTO;
type_id?: string;
collection_id?: string;
tags?: CreateProductTagDTO[];
categories?: {
id: string;
}[];
options?: CreateProductOptionDTO[];
variants?: CreateProductVariantDTO[];
width?: number;
height?: number;
length?: number;
weight?: number;
origin_country?: string;
hs_code?: string;
material?: string;
mid_code?: string;
metadata?: Record<string, unknown>;
}
export interface CreateProductOnlyDTO {
title: string;
subtitle?: string;
description?: string;
is_giftcard?: boolean;
discountable?: boolean;
images?: {
id?: string;
url: string;
}[];
thumbnail?: string;
handle?: string;
status?: ProductStatus;
collection_id?: string;
width?: number;
height?: number;
length?: number;
weight?: number;
origin_country?: string;
hs_code?: string;
material?: string;
mid_code?: string;
metadata?: Record<string, unknown>;
tags?: {
id: string;
}[];
categories?: {
id: string;
}[];
type_id?: string;
}
export interface CreateProductVariantOnlyDTO {
title: string;
sku?: string;
barcode?: string;
ean?: string;
upc?: string;
allow_backorder?: boolean;
inventory_quantity?: number;
manage_inventory?: boolean;
hs_code?: string;
origin_country?: string;
mid_code?: string;
material?: string;
weight?: number;
length?: number;
height?: number;
width?: number;
options?: (CreateProductVariantOptionDTO & {
option: any;
})[];
metadata?: Record<string, unknown>;
}
export interface CreateProductOptionOnlyDTO {
product: {
id: string;
};
title: string;
}

@@ -1,11 +0,22 @@

import { FilterableProductCategoryProps, FilterableProductCollectionProps, FilterableProductProps, FilterableProductTagProps, FilterableProductVariantProps, ProductCategoryDTO, ProductCollectionDTO, ProductDTO, ProductTagDTO, ProductVariantDTO } from "./common";
import { CreateProductDTO, FilterableProductCategoryProps, FilterableProductCollectionProps, FilterableProductProps, FilterableProductTagProps, FilterableProductVariantProps, ProductCategoryDTO, ProductCollectionDTO, ProductDTO, ProductTagDTO, ProductVariantDTO } from "./common";
import { FindConfig } from "../common";
import { SharedContext } from "../shared-context";
export interface IProductModuleService<TProduct = any, TProductVariant = any, TProductTag = any, TProductCollection = any, TProductCategory = any> {
list(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: SharedContext): Promise<ProductDTO[]>;
listAndCount(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: SharedContext): Promise<[ProductDTO[], number]>;
listTags(filters?: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, sharedContext?: SharedContext): Promise<ProductTagDTO[]>;
listVariants(filters?: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, sharedContext?: SharedContext): Promise<ProductVariantDTO[]>;
listCollections(filters?: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, sharedContext?: SharedContext): Promise<ProductCollectionDTO[]>;
listCategories(filters?: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: SharedContext): Promise<ProductCategoryDTO[]>;
import { Context } from "../shared-context";
export interface IProductModuleService {
retrieve(productId: string, sharedContext?: Context): Promise<ProductDTO>;
list(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: Context): Promise<ProductDTO[]>;
listAndCount(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: Context): Promise<[ProductDTO[], number]>;
listTags(filters?: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, sharedContext?: Context): Promise<ProductTagDTO[]>;
retrieveVariant(productVariantId: string, config?: FindConfig<ProductVariantDTO>, sharedContext?: Context): Promise<ProductVariantDTO>;
listVariants(filters?: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, sharedContext?: Context): Promise<ProductVariantDTO[]>;
listAndCountVariants(filters?: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, sharedContext?: Context): Promise<[ProductVariantDTO[], number]>;
retrieveCollection(productCollectionId: string, config?: FindConfig<ProductCollectionDTO>, sharedContext?: Context): Promise<ProductCollectionDTO>;
listCollections(filters?: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, sharedContext?: Context): Promise<ProductCollectionDTO[]>;
listAndCountCollections(filters?: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, sharedContext?: Context): Promise<[ProductCollectionDTO[], number]>;
retrieveCategory(productCategoryId: string, config?: FindConfig<ProductCategoryDTO>, sharedContext?: Context): Promise<ProductCategoryDTO>;
listCategories(filters?: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: Context): Promise<ProductCategoryDTO[]>;
listAndCountCategories(filters?: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: Context): Promise<[ProductCategoryDTO[], number]>;
create(data: CreateProductDTO[], sharedContext?: Context): Promise<ProductDTO[]>;
delete(productIds: string[], sharedContext?: Context): Promise<void>;
softDelete(productIds: string[], sharedContext?: Context): Promise<ProductDTO[]>;
restore(productIds: string[], sharedContext?: Context): Promise<ProductDTO[]>;
}

@@ -5,1 +5,6 @@ import { EntityManager } from "typeorm";

};
export declare type Context<TManager = unknown> = {
transactionManager?: TManager;
isolationLevel?: string;
enableNestedTransactions?: boolean;
};
{
"name": "@medusajs/types",
"version": "1.8.10",
"version": "1.8.11-next-20230719155816",
"description": "Medusa Types definition",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {

@@ -7,0 +8,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc