@medusajs/types
Advanced tools
Comparing version 1.8.7-snapshot-20230530073145 to 1.8.7
@@ -5,3 +5,2 @@ export * as CacheTypes from "./cache"; | ||
export * as InventoryTypes from "./inventory"; | ||
export * as ProductTypes from "./product"; | ||
export * as ModulesSdkTypes from "./modules-sdk"; | ||
@@ -11,2 +10,1 @@ export * as SearchTypes from "./search"; | ||
export * as TransactionBaseTypes from "./transaction-base"; | ||
export * as DAL from "./dal"; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DAL = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.ProductTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0; | ||
exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0; | ||
exports.CacheTypes = __importStar(require("./cache")); | ||
@@ -32,3 +32,2 @@ exports.CommonTypes = __importStar(require("./common")); | ||
exports.InventoryTypes = __importStar(require("./inventory")); | ||
exports.ProductTypes = __importStar(require("./product")); | ||
exports.ModulesSdkTypes = __importStar(require("./modules-sdk")); | ||
@@ -38,3 +37,2 @@ exports.SearchTypes = __importStar(require("./search")); | ||
exports.TransactionBaseTypes = __importStar(require("./transaction-base")); | ||
exports.DAL = __importStar(require("./dal")); | ||
//# sourceMappingURL=bundles.js.map |
@@ -87,4 +87,2 @@ import { FindManyOptions, FindOneOptions, FindOperator, FindOptionsSelect, FindOptionsWhere, OrderByCondition } from "typeorm"; | ||
} | ||
export interface RepositoryTransformOptions { | ||
} | ||
export interface DateComparisonOperator { | ||
@@ -91,0 +89,0 @@ lt?: Date; |
@@ -1,7 +0,56 @@ | ||
import { Dictionary, FilterQuery, Order } from "./utils"; | ||
export { FilterQuery } from "./utils"; | ||
export interface BaseFilterable<T> { | ||
$and?: T; | ||
$or?: T; | ||
} | ||
/// <reference types="node" /> | ||
declare type Dictionary<T = any> = { | ||
[k: string]: T; | ||
}; | ||
declare type Query<T> = T extends object ? T extends Scalar ? never : FilterQuery<T> : FilterValue<T>; | ||
declare type EntityProps<T> = { | ||
-readonly [K in keyof T as ExcludeFunctions<T, K>]?: T[K]; | ||
}; | ||
declare type ExpandScalar<T> = null | (T extends string ? string | RegExp : T extends Date ? Date | string : T); | ||
declare type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Buffer | { | ||
toHexString(): string; | ||
}; | ||
declare type ExcludeFunctions<T, K extends keyof T> = T[K] extends Function ? never : K extends symbol ? never : K; | ||
declare type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T; | ||
declare const PrimaryKeyType: unique symbol; | ||
declare type Primary<T> = T extends { | ||
[PrimaryKeyType]?: infer PK; | ||
} ? ReadonlyPrimary<PK> : T extends { | ||
_id?: infer PK; | ||
} ? ReadonlyPrimary<PK> | string : T extends { | ||
uuid?: infer PK; | ||
} ? ReadonlyPrimary<PK> : T extends { | ||
id?: infer PK; | ||
} ? ReadonlyPrimary<PK> : never; | ||
export declare type OperatorMap<T> = { | ||
$and?: Query<T>[]; | ||
$or?: Query<T>[]; | ||
$eq?: ExpandScalar<T> | ExpandScalar<T>[]; | ||
$ne?: ExpandScalar<T>; | ||
$in?: ExpandScalar<T>[]; | ||
$nin?: ExpandScalar<T>[]; | ||
$not?: Query<T>; | ||
$gt?: ExpandScalar<T>; | ||
$gte?: ExpandScalar<T>; | ||
$lt?: ExpandScalar<T>; | ||
$lte?: ExpandScalar<T>; | ||
$like?: string; | ||
$re?: string; | ||
$ilike?: string; | ||
$fulltext?: string; | ||
$overlap?: string[]; | ||
$contains?: string[]; | ||
$contained?: string[]; | ||
$exists?: boolean; | ||
}; | ||
declare type FilterValue2<T> = T | ExpandScalar<T> | Primary<T>; | ||
declare type FilterValue<T> = OperatorMap<FilterValue2<T>> | FilterValue2<T> | FilterValue2<T>[] | null; | ||
declare type ExpandObject<T> = T extends object ? T extends Scalar ? never : { | ||
-readonly [K in keyof T as ExcludeFunctions<T, K>]?: Query<any> | FilterValue<any> | null; | ||
} : never; | ||
declare type ObjectQuery<T> = ExpandObject<T> & OperatorMap<T>; | ||
export declare type FilterQuery<T> = ObjectQuery<T> | NonNullable<ExpandScalar<Primary<T>>> | NonNullable<EntityProps<T> & OperatorMap<T>> | FilterQuery<T>[]; | ||
declare type Order<T> = { | ||
[key in keyof T]?: "ASC" | "DESC" | Order<T[key] extends Array<any> ? T[key][0] : T[key]>; | ||
}; | ||
export interface OptionsQuery<T, P extends string = never> { | ||
@@ -16,3 +65,3 @@ populate?: string[]; | ||
} | ||
export declare type FindOptions<T = any> = { | ||
export declare type FindOptions<T> = { | ||
where: FilterQuery<T>; | ||
@@ -19,0 +68,0 @@ options?: OptionsQuery<T, any>; |
import { FindOptions } from "./index"; | ||
import { RepositoryTransformOptions } from "../common"; | ||
/** | ||
@@ -8,5 +7,5 @@ * 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]>; | ||
export interface RepositoryService<S = any> { | ||
find<T = S>(options?: FindOptions<T>): Promise<T[]>; | ||
findAndCount<T = S>(options?: FindOptions<T>): Promise<[T[], number]>; | ||
} |
@@ -7,4 +7,2 @@ export * from "./bundles"; | ||
export * from "./modules-sdk"; | ||
export * from "./product"; | ||
export * from "./product-category"; | ||
export * from "./search"; | ||
@@ -14,2 +12,1 @@ export * from "./shared-context"; | ||
export * from "./transaction-base"; | ||
export * from "./dal"; |
@@ -23,4 +23,2 @@ "use strict"; | ||
__exportStar(require("./modules-sdk"), exports); | ||
__exportStar(require("./product"), exports); | ||
__exportStar(require("./product-category"), exports); | ||
__exportStar(require("./search"), exports); | ||
@@ -30,3 +28,2 @@ __exportStar(require("./shared-context"), exports); | ||
__exportStar(require("./transaction-base"), exports); | ||
__exportStar(require("./dal"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -29,3 +29,3 @@ import { Logger as _Logger } from "winston"; | ||
scope: MODULE_SCOPE.EXTERNAL; | ||
server?: { | ||
server: { | ||
type: "http"; | ||
@@ -42,3 +42,2 @@ url: string; | ||
moduleDeclaration?: InternalModuleDeclaration | ExternalModuleDeclaration; | ||
moduleDefinition?: any; | ||
}; | ||
@@ -45,0 +44,0 @@ export declare type ModuleDefinition = { |
@@ -1,3 +0,2 @@ | ||
import { BaseFilterable } from "../dal"; | ||
import { OperatorMap } from "../dal/utils"; | ||
import { OperatorMap } from "../dal"; | ||
export declare enum ProductStatus { | ||
@@ -28,7 +27,6 @@ DRAFT = "draft", | ||
material?: string | null; | ||
collection: ProductCollectionDTO; | ||
categories?: ProductCategoryDTO[] | null; | ||
type: ProductTypeDTO[]; | ||
tags: ProductTagDTO[]; | ||
variants: ProductVariantDTO[]; | ||
collection?: any; | ||
categories?: any; | ||
type: any; | ||
tags: any; | ||
options: ProductOptionDTO[]; | ||
@@ -67,34 +65,11 @@ discountable?: boolean; | ||
} | ||
export interface ProductCategoryDTO { | ||
export interface ProductTagDTO { | ||
id: string; | ||
name: string; | ||
description?: string; | ||
handle?: string; | ||
is_active?: boolean; | ||
is_internal?: boolean; | ||
rank?: number; | ||
parent_category?: ProductCategoryDTO; | ||
category_children: ProductCategoryDTO[]; | ||
created_at: string | Date; | ||
updated_at: string | Date; | ||
} | ||
export interface ProductTagDTO { | ||
export interface ProductVariantDTO { | ||
id: string; | ||
value: string; | ||
metadata?: Record<string, unknown> | null; | ||
products: ProductDTO[]; | ||
} | ||
export interface ProductCollectionDTO { | ||
id: string; | ||
title: string; | ||
handle: string; | ||
metadata?: Record<string, unknown> | null; | ||
deleted_at?: string | Date; | ||
} | ||
export interface ProductTypeDTO { | ||
id: string; | ||
value: string; | ||
metadata?: Record<string, unknown> | null; | ||
deleted_at?: string | Date; | ||
} | ||
export interface ProductOptionDTO { | ||
@@ -104,5 +79,4 @@ id: string; | ||
product: ProductDTO; | ||
values: ProductOptionValueDTO[]; | ||
values: ProductOptionValueDTO; | ||
metadata?: Record<string, unknown> | null; | ||
deleted_at?: string | Date; | ||
} | ||
@@ -115,3 +89,2 @@ export interface ProductOptionValueDTO { | ||
metadata?: Record<string, unknown> | null; | ||
deleted_at?: string | Date; | ||
} | ||
@@ -121,4 +94,3 @@ /** | ||
*/ | ||
export interface FilterableProductProps extends BaseFilterable<FilterableProductProps> { | ||
handle?: string | string[]; | ||
export interface FilterableProductProps { | ||
id?: string | string[]; | ||
@@ -129,15 +101,16 @@ tags?: { | ||
categories?: { | ||
id?: string | OperatorMap<string>; | ||
id?: { | ||
[Operator in keyof OperatorMap<any>]: string[]; | ||
} | string[]; | ||
}; | ||
category_ids?: string | string[] | OperatorMap<string>; | ||
} | ||
export interface FilterableProductTagProps extends BaseFilterable<FilterableProductTagProps> { | ||
export interface FilterableProductTagProps { | ||
id?: string | string[]; | ||
value?: string; | ||
} | ||
export interface FilterableProductCollectionProps extends BaseFilterable<FilterableProductCollectionProps> { | ||
export interface FilterableProductCollectionProps { | ||
id?: string | string[]; | ||
title?: string; | ||
} | ||
export interface FilterableProductVariantProps extends BaseFilterable<FilterableProductVariantProps> { | ||
export interface FilterableProductVariantProps { | ||
id?: string | string[]; | ||
@@ -149,9 +122,1 @@ sku?: string; | ||
} | ||
export interface FilterableProductCategoryProps extends BaseFilterable<FilterableProductCategoryProps> { | ||
id?: string | string[]; | ||
parent_category_id?: string | string[] | null; | ||
handle?: string | string[]; | ||
is_active?: boolean; | ||
is_internal?: boolean; | ||
include_descendants_tree?: boolean; | ||
} |
import { FilterableProductCollectionProps, FilterableProductProps, FilterableProductTagProps, FilterableProductVariantProps, ProductCollectionDTO, ProductDTO, ProductTagDTO, ProductVariantDTO } from "./common"; | ||
import { FindConfig } from "../common"; | ||
import { SharedContext } from "../shared-context"; | ||
export interface IProductService<TProduct = any, TProductVariant = any, TProductTag = any, TProductCollection = any> { | ||
list(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<ProductDTO[]>; | ||
listAndCount(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<[ProductDTO[], number]>; | ||
listTags(filter: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, context?: SharedContext): Promise<ProductTagDTO[]>; | ||
listVariants(filter: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, context?: SharedContext): Promise<ProductVariantDTO[]>; | ||
listCollections(filter: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, context?: SharedContext): Promise<ProductCollectionDTO[]>; | ||
export interface IProductService { | ||
list<T = unknown>(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<T[]>; | ||
listAndCount<T = unknown>(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<[T[], number]>; | ||
listTags<T = unknown>(filter: FilterableProductTagProps, config?: FindConfig<ProductVariantDTO>, context?: SharedContext): Promise<T[]>; | ||
listVariants<T = unknown>(filter: FilterableProductVariantProps, config?: FindConfig<ProductTagDTO>, context?: SharedContext): Promise<T[]>; | ||
listCollections<T = unknown>(filter: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, context?: SharedContext): Promise<T[]>; | ||
} |
{ | ||
"name": "@medusajs/types", | ||
"version": "1.8.7-snapshot-20230530073145", | ||
"version": "1.8.7", | ||
"description": "Medusa Types definition", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
72551
124
1698
1