2.3.0 • Published 4 years ago

@dankochetov/commercetools-serverless-plugin v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

CommerceTools Serverless plugin

Known Vulnerabilities contributions welcome

This plugin allows you to seamlessly integrate CommerceTools subscriptions and extensions with Serverless functions.

Installation npm version

npm i -D @dankochetov/commercetools-serverless-plugin

Configuration

custom:
  commerceTools:
    projectKey: string
    clientId: string
    clientSecret: string
    authHost: "https://auth.<region>.<provider>.commercetools.com/"
    apiHost: "https://api.<region>.<provider>.commercetools.com/"

Subscription

Only SQS destination is supported.

functions:
  Subscription:
    events:
      - commerceTools:
          subscription:
            createQueue: true # skip if queueArn is used
            batchSize: <number> # skip if queueArn is used
            queueArn: <arn> # skip if createQueue is used
            changes: # optional
              - resourceTypeId: product
              - ...
            messages: # optional
              - resourceTypeId: order
                types: # optional
                  - DeliveryAdded
                  - OrderStateChanged
                  - ...
              - ...
                

If you specify createQueue: true option, SQS queue will be created as a part of the current stack. Its batch size can be configured with the batchSize option and is set to 1 by default.

Extension

Only AWSLambda destination is supported.

functions:
  Extension:
    events:
      - commerceTools:
          extension:
            timeoutInMs: 1000 # optional
            triggers:
              - resourceTypeId: cart
                actions:
                  - Create
                  - Update
              - ...

How does it work?

For every subscription/extension configuration, the plugin adds the following list of resources to the template:

  • IAM user with minimal permissions and a set of security credentials;
  • CFN custom resource that manages the creation, modification and deletion of the subscription/extension;
  • (Subscriptions with createQueue: true only) SQS queue and corresponding sqs event to the function.

Contribution

After you change the code, don't forget to run npm run build to update the artifacts.

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago