🚨 Announcing Vendure v2 Beta

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.

Signature

class ImportParser {
  async parseProducts(input: string | Stream, mainLanguage: LanguageCode = this.configService.defaultLanguageCode) => Promise<ParseResult<ParsedProductWithVariants>>;
}

Members

parseProducts

async method
type:
(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.

Signature

interface ParsedOptionGroup {
  translations: Array<{
        languageCode: LanguageCode;
        name: string;
        values: string[];
    }>;
}

Members

translations

property
type:
Array<{ languageCode: LanguageCode; name: string; values: string[]; }>

ParsedFacet

The intermediate representation of a Facet after it has been parsed by the ImportParser.

Signature

interface ParsedFacet {
  translations: Array<{
        languageCode: LanguageCode;
        facet: string;
        value: string;
    }>;
}

Members

translations

property
type:
Array<{ languageCode: LanguageCode; facet: string; value: string; }>

ParsedProductVariant

The intermediate representation of a ProductVariant after it has been parsed by the ImportParser.

Signature

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;
        };
    }>;
}

Members

sku

property
type:
string

price

property
type:
number

taxCategory

property
type:
string

stockOnHand

property
type:
number

trackInventory

property
type:
GlobalFlag

assetPaths

property
type:
string[]

facets

property
type:
ParsedFacet[]

translations

property
type:
Array<{ languageCode: LanguageCode; optionValues: string[]; customFields: { [name: string]: string; }; }>

ParsedProduct

The intermediate representation of a Product after it has been parsed by the ImportParser.

Signature

interface ParsedProduct {
  assetPaths: string[];
  optionGroups: ParsedOptionGroup[];
  facets: ParsedFacet[];
  translations: Array<{
        languageCode: LanguageCode;
        name: string;
        slug: string;
        description: string;
        customFields: {
            [name: string]: string;
        };
    }>;
}

Members

assetPaths

property
type:
string[]

optionGroups

property

facets

property
type:
ParsedFacet[]

translations

property
type:
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.

Signature

interface ParsedProductWithVariants {
  product: ParsedProduct;
  variants: ParsedProductVariant[];
}

Members

product

property

variants

property

ParseResult

The result returned by the ImportParser parseProducts() method.

Signature

interface ParseResult<T> {
  results: T[];
  errors: string[];
  processed: number;
}

Members

results

property
type:
T[]

errors

property
type:
string[]

processed

property
type:
number