<commit_before># Sphere Product Importer
Accepts a list of products in a valid [JSON Schema](https://github.com/sphereio/sphere-json-schemas/tree/master/schema). Processes them in batches (of default: 30 products).
 Assumes the following to be existing in the concerned project:
 * `Product Types` with correct names used by the products to be imported
  * All the attributes should be existing with the correct types
  * All the enums should be existing with the correct keys
 * All the `categories` with the correct external ids used by the data to be imported
 * All `tax categories` be existing with the correct names to be used by the date to be imported

Note that this tool can import only products which have at least one variant with SKU so it can check whether this product already exists on the API.

### Configuration
 The constructor requires the following:
  * logger instance
  * configuration object
    * sphere client (sphere-node-sdk) configuration
      * project credentials
      * user-agent
    * errorDir: error directory path (absolute), default: `../errors`
    * errorLimit: maximum number of errors to log, default: 30. If set to 0, logs all errors
    * blackList: array of action groups of Product Sync which are to be black listed. This is to ignore all the update actions generated for the specified action groups. Possible Values:
      * images
      * references
      * prices
      * attributes
      * variants
      * categories
    * ensureEnums: when set to `true`, any new enum keys will be added to existing enums. Default: `false`
    * failOnDuplicateAttr: when set to `true` import will fail when importing product with duplicate attributes, otherwise will take only the first occurrence and log a warning message. Default: `false` 
    * logOnDuplicateAttr: when set to `true` import will log out duplicate attribute message. Default: `true` 
    * filterUnknownAttributes: when set to `true` will ignore any attributes not defined in the product type of the product being imported. Default: `false`
    * ignoreSlugUpdates: when set to `true` will ignore all slug updates for existing product updates. Default: `false`
    * batchSize: number of products to be processed in each batch. Default: 30
    * errorCallback: when set to a custom function, all log messages will be sent to this function. Otherwise, a default logger function will be used
    * defaultAttributes: a list of attributes to be added to all variants if not existing
    * filterActions: can be one of the following:
      * a _function_ that gets called for each action, that the product sync returns. See [here](https://github.com/sphereio/sphere-node-sdk/blob/master/src/coffee/sync/base-sync.coffee#L96) for an example filter. It get's passed the following arguments:
        * the action that should be performed
        * the product that should be updated
        * the product that is being imported
      * an _array_ of update actions that should be ignored<commit_msg>feat(productImport): add reassignment option to readme<commit_after># Sphere Product Importer
Accepts a list of products in a valid [JSON Schema](https://github.com/sphereio/sphere-json-schemas/tree/master/schema). Processes them in batches (of default: 30 products).
 Assumes the following to be existing in the concerned project:
 * `Product Types` with correct names used by the products to be imported
  * All the attributes should be existing with the correct types
  * All the enums should be existing with the correct keys
 * All the `categories` with the correct external ids used by the data to be imported
 * All `tax categories` be existing with the correct names to be used by the date to be imported

Note that this tool can import only products which have at least one variant with SKU so it can check whether this product already exists on the API.

### Configuration
 The constructor requires the following:
  * logger instance
  * configuration object
    * sphere client (sphere-node-sdk) configuration
      * project credentials
      * user-agent
    * errorDir: error directory path (absolute), default: `../errors`
    * errorLimit: maximum number of errors to log, default: 30. If set to 0, logs all errors
    * blackList: array of action groups of Product Sync which are to be black listed. This is to ignore all the update actions generated for the specified action groups. Possible Values:
      * images
      * references
      * prices
      * attributes
      * variants
      * categories
    * ensureEnums: when set to `true`, any new enum keys will be added to existing enums. Default: `false`
    * failOnDuplicateAttr: when set to `true` import will fail when importing product with duplicate attributes, otherwise will take only the first occurrence and log a warning message. Default: `false` 
    * logOnDuplicateAttr: when set to `true` import will log out duplicate attribute message. Default: `true` 
    * filterUnknownAttributes: when set to `true` will ignore any attributes not defined in the product type of the product being imported. Default: `false`
    * ignoreSlugUpdates: when set to `true` will ignore all slug updates for existing product updates. Default: `false`
    * batchSize: number of products to be processed in each batch. Default: 30
    * errorCallback: when set to a custom function, all log messages will be sent to this function. Otherwise, a default logger function will be used
    * defaultAttributes: a list of attributes to be added to all variants if not existing
    * filterActions: can be one of the following:
      * a _function_ that gets called for each action, that the product sync returns. See [here](https://github.com/sphereio/sphere-node-sdk/blob/master/src/coffee/sync/base-sync.coffee#L96) for an example filter. It get's passed the following arguments:
        * the action that should be performed
        * the product that should be updated
        * the product that is being imported
      * an _array_ of update actions that should be ignored
    * variantReassignmentOptions
      * enabled: when set to `true`, [reassignment module](https://github.com/commercetools/commercetools-node-variant-reassignment) will run before product import.
{'fraction_non_alphanumeric': 0.056918390251723586, 'fraction_numerical': 0.002886002886002886, 'mean_word_length': 3.7329286798179058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '205599', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1474, 'n_words': 831}