CX Cloud Core Services
A collection of tools to work with 3rd Party and Partner services & networks. This module is meant to be used in creating commerce services.
An example of implementation can be found in CX API Accelerator.
Installation and Usage
npm install @cxcloud/core
import { Commerce, Content } from '@cxcloud/core';
import { Cart } from '@cxcloud/core/dist/commerce';
Included Bundles
- Commerce (Powered by CommerceTools)
- Products
- Categories
- Shipping
- Carts
- Orders
- Customers
- Authentication
- Content (Powered by Contentful)
- Search (Powered by Algolia)
- Authentication (Powered by AWS Cognito)
- Login (Normal, MFA)
- Registration
- Edit Profile and Phone Number
- Session Update
- Password Forgot, Reset, Change
- Get Profile
Documentation
An automatically generated documentation can be found here.
Config Schema
Using this module requires configuration. You can do so by installing node-config in your project and setting up the following keys one of your json files:
{
"commerceTools": {
"projectKey": "PROJECT_KEY",
"admin": {
"clientId": "ADMIN_CLIENT_ID",
"clientSecret": "ADMIN_CLIENT_ID"
},
"user": {
"clientId": "USER_FACING_CLIENT_ID",
"clientSecret": "USER_FACING_CLIENT_SECRET"
}
},
"contentful": {
"sdkConfig": {
"space": "SPACE_ID",
"accessToken": "ACCESS_TOKEN"
}
},
"algolia": {
"applicationId": "APP_ID",
"apiKey": "API_KEY"
},
"cognito": {
"userPoolId": "USER_POOL_ID",
"clientId": "CLIENT_ID"
}
}
License
This project is licensed under The GPL v2 and is released merely for educational and internal purposes. The modules are not useful independently and require paid licenses from the vendors mentioned above.
Variables
Const CognitoUserPoolWrapper
CognitoUserPoolWrapper: any = require('cognito-user-pool')
Const Commerce
Commerce: "/Users/sallar/Projects/cxcloud/cxcloud-facade/src/commerce/index" = commerceServices
Const ENCRYPTION_KEY
ENCRYPTION_KEY: "wY[Ax)FC0AlQjruD$9J_tO3U+YiMZyL1" = "wY[Ax)FC0AlQjruD$9J_tO3U+YiMZyL1"
Const IV_LENGTH
IV_LENGTH: 16 = 16
Const TEXT_SEPARATOR
TEXT_SEPARATOR: ":" = ":"
Let __client
__client: any
Let __services
__services: any
createAuthMiddlewareForClientCredentialsFlow
createAuthMiddlewareForClientCredentialsFlow: any
createClient
createClient: any
createHttpMiddleware
createHttpMiddleware: any
createLoggerMiddleware
createLoggerMiddleware: any
createQueueMiddleware
createQueueMiddleware: any
createRequestBuilder
createRequestBuilder: any
createUserAgentMiddleware
createUserAgentMiddleware: any
Const customerCache
customerCache: NodeCache = new Cache({stdTTL: 60 * 15 // 15 mins})
Const packageInfo
packageInfo: any = require('../../../package.json')
Const userScopes
userScopes: string[] = ['manage_my_orders','manage_my_profile','manage_my_shopping_lists','view_products','manage_my_profile','manage_my_payments']