UNPKG

@medusajs/product

Version:
472 lines • 20.1 kB
import { Context, DAL, InferEntityType, ProductCategoryTransformOptions, ProductTypes } from "@medusajs/framework/types"; import { DALUtils } from "@medusajs/framework/utils"; import { SqlEntityManager } from "@mikro-orm/postgresql"; import { ProductCategory } from "../models"; import { UpdateCategoryInput } from "../types"; export declare class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeRepository<typeof ProductCategory> { buildFindOptions(findOptions?: DAL.FindOptions<typeof ProductCategory>, familyOptions?: ProductCategoryTransformOptions): { where: import("@medusajs/types/dist/dal/utils").FilterQueryProperties<{ id: string; name: string; description: string; handle: string; mpath: string; is_active: boolean; is_internal: boolean; rank: number; metadata: Record<string, unknown> | null; parent_category: any; category_children: any[]; products: { id: string; title: string; handle: string; subtitle: string | null; description: string | null; is_giftcard: boolean; status: import("@medusajs/framework/utils").ProductStatus; thumbnail: string | null; weight: string | null; length: string | null; height: string | null; width: string | null; origin_country: string | null; hs_code: string | null; mid_code: string | null; material: string | null; discountable: boolean; external_id: string | null; metadata: Record<string, unknown> | null; variants: { id: string; title: string; sku: string | null; barcode: string | null; ean: string | null; upc: string | null; allow_backorder: boolean; manage_inventory: boolean; hs_code: string | null; origin_country: string | null; mid_code: string | null; material: string | null; weight: number | null; length: number | null; height: number | null; width: number | null; metadata: Record<string, unknown> | null; variant_rank: number | null; product: any; options: { id: string; value: string; metadata: Record<string, unknown> | null; option: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }; variants: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; option_id: string | null; }[]; raw_weight: Record<string, unknown> | null; raw_length: Record<string, unknown> | null; raw_height: Record<string, unknown> | null; raw_width: Record<string, unknown> | null; raw_variant_rank: Record<string, unknown> | null; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string | null; }[]; type: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; tags: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }[]; options: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; images: { id: string; url: string; metadata: Record<string, unknown> | null; rank: number; product: any; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; collection: { id: string; title: string; handle: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; categories: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; type_id: string | null; collection_id: string | null; }[]; created_at: Date; updated_at: Date; deleted_at: Date | null; parent_category_id: string | null; }, 3> & DAL.BaseFilterable<import("@medusajs/types/dist/dal/utils").FilterQueryProperties<{ id: string; name: string; description: string; handle: string; mpath: string; is_active: boolean; is_internal: boolean; rank: number; metadata: Record<string, unknown> | null; parent_category: any; category_children: any[]; products: { id: string; title: string; handle: string; subtitle: string | null; description: string | null; is_giftcard: boolean; status: import("@medusajs/framework/utils").ProductStatus; thumbnail: string | null; weight: string | null; length: string | null; height: string | null; width: string | null; origin_country: string | null; hs_code: string | null; mid_code: string | null; material: string | null; discountable: boolean; external_id: string | null; metadata: Record<string, unknown> | null; variants: { id: string; title: string; sku: string | null; barcode: string | null; ean: string | null; upc: string | null; allow_backorder: boolean; manage_inventory: boolean; hs_code: string | null; origin_country: string | null; mid_code: string | null; material: string | null; weight: number | null; length: number | null; height: number | null; width: number | null; metadata: Record<string, unknown> | null; variant_rank: number | null; product: any; options: { id: string; value: string; metadata: Record<string, unknown> | null; option: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }; variants: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; option_id: string | null; }[]; raw_weight: Record<string, unknown> | null; raw_length: Record<string, unknown> | null; raw_height: Record<string, unknown> | null; raw_width: Record<string, unknown> | null; raw_variant_rank: Record<string, unknown> | null; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string | null; }[]; type: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; tags: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }[]; options: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; images: { id: string; url: string; metadata: Record<string, unknown> | null; rank: number; product: any; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; collection: { id: string; title: string; handle: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; categories: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; type_id: string | null; collection_id: string | null; }[]; created_at: Date; updated_at: Date; deleted_at: Date | null; parent_category_id: string | null; }, 3>>; options?: DAL.OptionsQuery<{ id: string; name: string; description: string; handle: string; mpath: string; is_active: boolean; is_internal: boolean; rank: number; metadata: Record<string, unknown> | null; parent_category: any; category_children: any[]; products: { id: string; title: string; handle: string; subtitle: string | null; description: string | null; is_giftcard: boolean; status: import("@medusajs/framework/utils").ProductStatus; thumbnail: string | null; weight: string | null; length: string | null; height: string | null; width: string | null; origin_country: string | null; hs_code: string | null; mid_code: string | null; material: string | null; discountable: boolean; external_id: string | null; metadata: Record<string, unknown> | null; variants: { id: string; title: string; sku: string | null; barcode: string | null; ean: string | null; upc: string | null; allow_backorder: boolean; manage_inventory: boolean; hs_code: string | null; origin_country: string | null; mid_code: string | null; material: string | null; weight: number | null; length: number | null; height: number | null; width: number | null; metadata: Record<string, unknown> | null; variant_rank: number | null; product: any; options: { id: string; value: string; metadata: Record<string, unknown> | null; option: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }; variants: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; option_id: string | null; }[]; raw_weight: Record<string, unknown> | null; raw_length: Record<string, unknown> | null; raw_height: Record<string, unknown> | null; raw_width: Record<string, unknown> | null; raw_variant_rank: Record<string, unknown> | null; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string | null; }[]; type: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; tags: { id: string; value: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }[]; options: { id: string; title: string; metadata: Record<string, unknown> | null; product: any; values: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; images: { id: string; url: string; metadata: Record<string, unknown> | null; rank: number; product: any; created_at: Date; updated_at: Date; deleted_at: Date | null; product_id: string; }[]; collection: { id: string; title: string; handle: string; metadata: Record<string, unknown> | null; products: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; }; categories: any[]; created_at: Date; updated_at: Date; deleted_at: Date | null; type_id: string | null; collection_id: string | null; }[]; created_at: Date; updated_at: Date; deleted_at: Date | null; parent_category_id: string | null; }> | undefined; }; find(findOptions?: DAL.FindOptions<typeof ProductCategory>, transformOptions?: ProductCategoryTransformOptions, context?: Context): Promise<InferEntityType<typeof ProductCategory>[]>; sortCategoriesByRank(categories: InferEntityType<typeof ProductCategory>[]): InferEntityType<typeof ProductCategory>[]; buildProductCategoriesWithTree(include: { descendants?: boolean; ancestors?: boolean; }, productCategories: InferEntityType<typeof ProductCategory>[], findOptions?: DAL.FindOptions<typeof ProductCategory> & { serialize?: boolean; }, context?: Context): Promise<InferEntityType<typeof ProductCategory>[]>; findAndCount(findOptions?: DAL.FindOptions<typeof ProductCategory>, transformOptions?: ProductCategoryTransformOptions, context?: Context): Promise<[InferEntityType<typeof ProductCategory>[], number]>; delete(ids: string[], context?: Context): Promise<string[]>; softDelete(ids: string[], context?: Context): Promise<[ InferEntityType<typeof ProductCategory>[], Record<string, unknown[]> ]>; restore(ids: string[], context?: Context): Promise<[ InferEntityType<typeof ProductCategory>[], Record<string, unknown[]> ]>; baseDelete(ids: string[], context?: Context): Promise<void>; create(data: ProductTypes.CreateProductCategoryDTO[], context?: Context): Promise<InferEntityType<typeof ProductCategory>[]>; update(data: UpdateCategoryInput[], context?: Context): Promise<InferEntityType<typeof ProductCategory>[]>; protected rerankSiblingsAfterDeletion(manager: SqlEntityManager, removedSibling: Partial<InferEntityType<typeof ProductCategory>>): Promise<void>; protected rerankSiblingsAfterCreation(manager: SqlEntityManager, addedSibling: Partial<InferEntityType<typeof ProductCategory>>): Promise<void>; protected rerankAllSiblings(manager: SqlEntityManager, originalSibling: Partial<InferEntityType<typeof ProductCategory>> & { rank: number; }, updatedSibling: Partial<InferEntityType<typeof ProductCategory>> & { rank: number; }): Promise<void>; } //# sourceMappingURL=product-category.d.ts.map