@constructor-io/constructorio-connect-cli
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

Constructor.io Connect CLI

npm MIT licensed

Constructor.io is an e-commerce first product discovery service that optimizes results using artificial intelligence (including natural language processing, re-ranking to optimize for business metrics, and end user personalization).

This package is a CLI tool that helps you build, test and deploy your connector templates. By using templates, you can customize your catalog integration to shape your data the way you want it.

If you're looking for a package to consume our API, please use @constructor-io/constructorio-node instead. Alternatively, if you want a JavaScript client for client side (i.e. front end) integrations please use @constructor-io/constructorio-client-javascript.

1. Review the Requirements

Before you begin, note that this package is intended for use with partner connections. If you don't have a connector running yet, please take a look at our documentation to see how you can get started.

Finally, make sure you have your connect auth token available. If you don't have this yet, please get in touch with our team and we'll set this up.

2. Install

You can initialize a new working repo with the following command:

npx @constructor-io/constructorio-connect-cli init my-repo

Where my-repo is the name of the folder and repository you want to create.

With the new repository initialized, you can start developing your catalog integration. Please refer to our documentation for more information on how to build your templates.

3. Commands

constructorio-connect-cli deploy ENV

Deploys all templates defined on the connectrc.js file to the specified environment.

USAGE
  $ constructorio-connect-cli deploy ENV

ARGUMENTS
  ENV  (development|qa|production|demo) The target Constructor environment to deploy to.

DESCRIPTION

  Deploys all templates defined on the `connectrc.js` file to the specified environment.

  The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.

EXAMPLES
  $ constructorio-connect-cli deploy development

  $ constructorio-connect-cli deploy qa

  $ constructorio-connect-cli deploy production

constructorio-connect-cli execute

Execute a template against a connection and fixture to see the resulting transformed data. Each value not provided as a flag will be prompted for when the command is executed.

USAGE
  $ constructorio-connect-cli execute [--template-path <value>] [--fixture-path <value>]
    [--external-data-path <value>] [--connection-id <value>]

FLAGS
  --connection-id=<value>       The ID of the connection to execute the template against.
  --external-data-path=<value>  The path to the external data to execute the template against. Must be in the
                                'src/fixtures/external_data' directory.
  --fixture-path=<value>        The path to the fixture to execute the template against. Must be in the 'src/fixtures'
                                directory.
  --template-path=<value>       The path to the template to execute. Must be in the 'src/templates' directory.

DESCRIPTION
  Execute a template against a connection and fixture to see the resulting transformed data. Each value not provided as
  a flag will be prompted for when the command is executed.

EXAMPLES
  $ constructorio-connect-cli execute

  $ constructorio-connect-cli execute --template-path=item/item.jsonata

  $ constructorio-connect-cli execute --template-path=variation/variation.jsonata

  $ constructorio-connect-cli execute --template-path=item_group/item_group.jsonata --fixture-path=item_group.json

  $ constructorio-connect-cli execute --template-path=grouping/grouping.jsonata --connection-id=example-connection-id

  $ constructorio-connect-cli execute --template-path=mapping/mapping.jsonata

constructorio-connect-cli generate-fixture

This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.

USAGE
  $ constructorio-connect-cli generate-fixture

DESCRIPTION

  This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an
  example of how the data would be passed to the connector when executing the templates.

  You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item
  with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover
  different scenarios.

  Finally, if the file already exists you'll be prompted to overwrite it.


EXAMPLES
  $ constructorio-connect-cli generate-fixture

constructorio-connect-cli help [COMMAND]

Display help for constructorio-connect-cli.

USAGE
  $ constructorio-connect-cli help [COMMAND...] [-n]

ARGUMENTS
  COMMAND...  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for constructorio-connect-cli.

constructorio-connect-cli init NAME

Bootstrap a new Constructor.io Connect CLI repository.

USAGE
  $ constructorio-connect-cli init NAME

ARGUMENTS
  NAME  name of the new folder

DESCRIPTION
  Bootstrap a new Constructor.io Connect CLI repository.

EXAMPLES
  $ constructorio-connect-cli init

  $ constructorio-connect-cli init new-repo-name

Development

Here's some useful npm scripts:

npm run lint            # run lint on source code and tests
npm run test            # run tests
npm run test:cov        # run tests with coverage report

Package Sidebar

Install

npm i @constructor-io/constructorio-connect-cli

Weekly Downloads

305

Version

1.4.4

License

MIT

Unpacked Size

159 kB

Total Files

139

Last publish

Collaborators

  • esezen
  • pedrobini
  • sblaurock
  • jimmyli921
  • danmcc
  • rubikzube
  • crgee1