import type { ProductRow } from '../../../../types/db/index.js'; export interface AddedVariantItem { /** The product as it was before it joined (its `variant_group_id` is still empty). */ product: ProductRow; /** The product's values for the axes of the group: one row per axis it has a value for. */ attributes: Array<{ attribute_id: number; attribute_code: string; option_id: number; }>; } /** * Puts a product in a variant group, in one transaction. * * The product must exist and belong to the attribute group of the variant * group, else a `VariantGroupError` is thrown and nothing is written. * * A variant group ships in one box: all members have one `package_id` (see * wiki/package-management-design.md, Variants). It is made to agree when the * product joins. The joining product takes the package of a member that has * one; if no member has a package but the joining product has, its package * goes to the other members. Nothing changes when neither has one. * * The database trigger `update_attribute_index_and_variant_group_visibility` * runs at commit, because the join is an UPDATE of `product`: it deletes the * values of attributes that are not linked to the product's attribute group * and recomputes the visibility of the group. */ export default function addVariantItem(groupUuid: string, productUuid: string): Promise;