The data set comprises the following resources:
- Test users for back office and customers
- Master data such as VAT rates for Europe
- Shop catalog with thousands of products based on a Flipkart data set
The data is partially generated with a set of generator scripts which reside under generator.
This data set comes with a set of scripts which import JSON and YAML data. Resources are imported using the gql-bot which is an automated task processor with a GraphQL Client. All data is imported via the GraphQL API exposed by the facade-srv.
All possible operations are exposed through JS scripts.
These scripts either execute GraphQL mutations/ queries through the import.js
script.
The import.js
also includes command-line options such as specifying if we wish
to import the data locally or into the production environment.
- master (imports
organizations
,addresses
,contact_points
,shops
,customers
) - identity (imports
users
) - catalog (imports
price_group
,manufacturer
,product_category
,product_prototype
,product
) - samples (imports
orders
)
NOTE: Resources should be imported in a specific order! Master > Identity > Catalog.
For the case when importing resources returns "Access denied", one way to fix this is to restart
facade-srv
in order to sync the api key with the other upstream services.
-
Extract the API-KEY from the logs of
facade-srv
. -
Either export the API-KEY, paste it to an
.env
file or paste as command argument. -
Generate catalog datasets using
transform.js script
:node ./transform.js
-
Import datasets using
dataset.js script
:node ./dataset.js import -t <access_token> -d demo-shop -j <job>
-
Examples:
node ./dataset.js import -t <access_token> -d demo-shop -j master
node ./dataset.js import -t <access_token> -d demo-shop -j identity
node ./dataset.js import -t <access_token> -d demo-shop -j catalog
node ./dataset.js import -t <access_token> -d demo-shop -j samples
All flags are optional, and they can be listed by typing node ./import.js -h
.
The API key can be obtained from the facade-srv
configuration.
The API key is generated during system startup from the facade-srv
(Check the log message of facade-srv Bootstrap API Key is
).
In case facade-srv
is a local container use the following command to extract the Bootstrap API-KEY
:
npm run env:token
By default, the GraphQL importer uses the configuration file config.json
to read data regarding endpoints for retrieving the API key
and executing mutations/ queries.
To import the files, following settings needs to be configured in config.json:
- The base directory for import,
- GraphQL endpoint
- Bucket name for the storage-server
Prerequisite: object importer should be built using npm run build
command before importing objects.
# Run import in production-mode:
npm run import:demoshop:objects -- --apiKey=<access_token> -- --NODE_ENV=local
# Run import in production-mode:
npm run import:demoshop:objects -- --apiKey=<access_token> -- --NODE_ENV=production
# or:
npm run import:demoshop:objects -- --apiKey=<access_token> # default is development
For login as any existing user of this dataset, the credentials are as follows:
Root Admin (all permission in domain)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Shop Admin 000 (all permission in shop)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Sales 000 (permission to maintain shop)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Moderator 000 (permission to maintain customer organization 000)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Moderator 001 (permission to maintain customer organization 001)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Member 000 (permission to make orders for organization 000)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
Member 001 (permission to make orders for organization 001)
User: [email protected]
Password: CNQJrH%KAayeDpf3h
User 000 (permission to make orders as individual)
User: [email protected]
Password: CNQJrH%KAayeDpf3h