ImportParser
ImportParser
Validates and parses CSV files into a data structure which can then be used to created new entities. This is used internally by the Importer.
class ImportParser {
parseProducts(input: string | Stream, mainLanguage: LanguageCode = this.configService.defaultLanguageCode) => Promise<ParseResult<ParsedProductWithVariants>>;
}
parseProducts
(input: string | Stream, mainLanguage: LanguageCode = this.configService.defaultLanguageCode) => Promise<ParseResult<ParsedProductWithVariants>>
Parses the contents of the product import CSV file and returns a data structure which can then be used to populate Vendure using the FastImporterService.
ParsedOptionGroup
The intermediate representation of an OptionGroup after it has been parsed by the ImportParser.
interface ParsedOptionGroup {
translations: Array<{
languageCode: LanguageCode;
name: string;
values: string[];
}>;
}
translations
Array<{
languageCode: LanguageCode;
name: string;
values: string[];
}>
ParsedFacet
The intermediate representation of a Facet after it has been parsed by the ImportParser.
interface ParsedFacet {
translations: Array<{
languageCode: LanguageCode;
facet: string;
value: string;
}>;
}
translations
Array<{
languageCode: LanguageCode;
facet: string;
value: string;
}>
ParsedProductVariant
The intermediate representation of a ProductVariant after it has been parsed by the ImportParser.
interface ParsedProductVariant {
sku: string;
price: number;
taxCategory: string;
stockOnHand: number;
trackInventory: GlobalFlag;
assetPaths: string[];
facets: ParsedFacet[];
translations: Array<{
languageCode: LanguageCode;
optionValues: string[];
customFields: {
[name: string]: string;
};
}>;
}
sku
string
price
number
taxCategory
string
stockOnHand
number
trackInventory
GlobalFlag
assetPaths
string[]
facets
translations
Array<{
languageCode: LanguageCode;
optionValues: string[];
customFields: {
[name: string]: string;
};
}>
ParsedProduct
The intermediate representation of a Product after it has been parsed by the ImportParser.
interface ParsedProduct {
assetPaths: string[];
optionGroups: ParsedOptionGroup[];
facets: ParsedFacet[];
translations: Array<{
languageCode: LanguageCode;
name: string;
slug: string;
description: string;
customFields: {
[name: string]: string;
};
}>;
}
assetPaths
string[]
optionGroups
facets
translations
Array<{
languageCode: LanguageCode;
name: string;
slug: string;
description: string;
customFields: {
[name: string]: string;
};
}>
ParsedProductWithVariants
The data structure into which an import CSV file is parsed by the
ImportParser parseProducts()
method.
interface ParsedProductWithVariants {
product: ParsedProduct;
variants: ParsedProductVariant[];
}
ParseResult
The result returned by the ImportParser parseProducts()
method.
interface ParseResult<T> {
results: T[];
errors: string[];
processed: number;
}