0.3.5 • Published 4 years ago

espace v0.3.5

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

EstateSpace command line utility

This project defines a utility for interacting with an estatespace server. Various commands are supported. Various files are supported.

Usage

csv format

Examples may be seen here. The utility will attempt to map the CSV columns into the respective Estatespce datamodels, cleaning the data as it loads. This utulity is meant to be idempotent, whereas it won't everwrite existing data on the server with subsequent calls. IE, this handles initial initial data loads only, not updates.

data cleansing:

  • spell check various field data
  • strip newlines from cell content
  • replace ';' in cells with ','
  • upload files that are referenced
    • the filenames that are referenced must match those found on the local disk, exactly
  • maps multiple values per cell, for instance, files or SOP Template steps with the '|'
    • the '|" is used to separate multiple values within the same cell.

directory structure:

When using csv formats, the utility expects a specific directory structures. Namely, the directory that holds the csv must have a files directory that holds all the files referenced in the csv.

Spell check

The utility will attempt to spell check most free text fields in files. There is a built in dictionary, but due to the nature of the equipment and SOP information, there may be many words that are not known to normal dictionaries that are prevelant in this space. Therefore the user is able to define their own dictionary. Simply create a newline delimited text file called esdict.txt and put in in your home directory.

Loading or Updating Policies, Roles and Groups

The utility can be run against an authenticated on unauthenticated dispatcher to load newly added policies, roles and groups. Use the --unauth option for unauthenticated dispatcher. Use the --host option to specify the hostname:port of the dispatcher, the --x-es-tenantid option to specify the tenant name and the --file flag to specify the json file to load the policies from. e.g.

Unauthenticated sample command:

espace --unauth --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd policy create
espace --unauth --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd role create
espace --unauth --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd group create

Authenticated sample command:

espace --user emailId --password YourPassword --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd policy create
espace --user emailId --password YourPassword --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd role create
espace --user emailId --password YourPassword --file path/to/file --host localhost:443 --x-es-tenantid wildwolf-abcd group create

Running locally to load/update policy:

npm run load-unauth-policy

npm run load-auth-policy

Options

Usage: espace [options] [command]

A command line utility for interacting with an estatespace server.
More information found on Github, https://github.com/GriffinGroupGlobal/gpdata_loader

Options:
  -V, --version                               output the version number
  -v, --validate                              perform the command in validation mode. Don't communicate with the server. Don't prompt for user and password.
  -d, --deprecated                            use deprecated services
  -h, --host <host>                           the estatespace host to communicate with
  -xet, --x-es-tenantid <xestenantid>         the tenant to communicate with
  -u, --user <user>                           the user on the estatespace host. If not specified and no -v, you will be prompted.
  -p, --password <password>                   the password for the user (It is unsecure to use this parameter!). If not specified and no -v, you will be prompted.
  -f, --file <filename>                       the file to process
  -h, --help                                  output usage information
  --unauth                                    Flag to set the server to communicate with as not requiring authorization

Commands:
  equipment|eq <action>      process equipment
  soptemplate|sopt <action>  process SOP templates
  policy|pol <action>        process policies
  role|rol <action>          process roles
  group|gro <action>         process groups

node installation

npm install -g espace
espace --help

local development

npm run build
npm link
espace --help

docker

docker pull g3dev/espace
docker container run -it --rm -v `pwd`:/data --workdir=/data g3dev/espace:latest --help