Catalog npm
Back to packageRELEASE DETAILS

1.0.6

npm

@0xproject/sra-report

Generate reports for standard relayer API compliance

Published24 Aug 2018
Direct dependencies29
Transitive dependenciesNot calculated

README

Current package documentation

SRA Report

This tool allows you to generate reports that detail an endpoint's standard relayer API HTTP specification compliance. The tool will perform a Postman collection run and either print a report to the console or save it to disk as a json file. SRA report can also output a Postman collection file and Postman environment file in order to facilitate replication and debugging of collection runs using the Postman native app.

The tool currently performs the following checks for each endpoint:

  • application/json Content-Type header validation
  • JSON schema validation
  • Correct filtering when a query paramater is provided (ex. when querying for a specific maker address, all orders returned have the same maker address that was provided by the query)

Features to come:

  • Correct sorting (ex. the /orderbook endpoint should return orders in order of price)
  • Tests for pagination
  • Tests for the POST /order endpoint
  • Tests for failure cases and errors

Installation

yarn add -g @0xproject/sra-report

Options

sra-report
Options:
  --help                      Show help                                [boolean]
  --version                   Show version number                      [boolean]
  --endpoint-url, -e          API endpoint url to test for standard relayer API
                              compliance                     [string] [required]
  --output, -o, --out         The relative path to write the report generated by
                              the collection run, prints to console by default
                                                                        [string]
  --network-id, -n            ID of the network that the API is serving orders
                              from                         [number] [default: 1]
  --environment, --env        The relative path to a postman environment file
                              for the collection run                    [string]
  --export-collection, --ec   The relative path to write the postman collection
                              file used by the collection run           [string]
  --export-environment, --ee  The relative path to write the postman environment
                              file used by the collection run           [string]

Example Usage

Print report to console

sra-report --endpoint-url 'http://api.example.com'

Save a report to disk

sra-report --endpoint-url 'http://api.example.com' --output 'path/to/report.json'

Generate report for an endpoint that serves kovan testnet orders

sra-report --endpoint-url 'http://kovan.api.example.com' --network-id 42

Write Postman collection and environment files for use in the Postman native app

sra-report --endpoint-url 'http://.api.example.com' --export-collection 'path/to/collection.json' --export-environment 'path/to/environment.json'

Run the report using a custom environment

sra-report --endpoint-url 'http://.api.example.com' --environment 'path/to/custom/environment.json'

Custom environments

When testing your standard relayer API endpoint in development, it may be useful to modify the Postman environment file generated by this tool such that specific query parameters are used during the collection run. For example, by default, this tool will grab the first order it can from the /orders endpoint and use properties from that order as query parameters for the rest of the run. Another example is the tool will default to the WETH and ZRX token contracts when querying some endpoints but you may want to specify these.

In order to provide a custom environment to the tool, perform the following steps:

  1. Export a Postman environment file using the tool: example
  2. Open the Postman environment file using your favorite text editor or in the Postman native app
  3. Modify the specific values you want
  4. Save the environment file and export it if using the Postman native app
  5. Run the tool and supply a path to your modified environment file: example

Contributing

We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.

Please read our contribution guidelines before getting started.

Install dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

yarn config set workspaces-experimental true

Then install dependencies

yarn install

Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

PKG=@0xproject/sra-report yarn build

Or continuously rebuild on change:

PKG=@0xproject/sra-report yarn watch

Clean

yarn clean

Lint

yarn lint

Run Tests

yarn test

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 29

Native requirements
29 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xproject/assert
Environment
{
  "local_name": "@0xproject/assert",
  "alias": false,
  "peer_metadata": null
}
^1.0.6runtime
@0xproject/connect
Environment
{
  "local_name": "@0xproject/connect",
  "alias": false,
  "peer_metadata": null
}
1.0.4runtime
@0xproject/json-schemas
Environment
{
  "local_name": "@0xproject/json-schemas",
  "alias": false,
  "peer_metadata": null
}
^0.8.3runtime
@0xproject/order-utils
Environment
{
  "local_name": "@0xproject/order-utils",
  "alias": false,
  "peer_metadata": null
}
^0.0.9runtime
@0xproject/types
Environment
{
  "local_name": "@0xproject/types",
  "alias": false,
  "peer_metadata": null
}
^0.8.2runtime
@0xproject/typescript-typings
Environment
{
  "local_name": "@0xproject/typescript-typings",
  "alias": false,
  "peer_metadata": null
}
^1.0.5runtime
@0xproject/utils
Environment
{
  "local_name": "@0xproject/utils",
  "alias": false,
  "peer_metadata": null
}
^1.0.6runtime
chalk
Environment
{
  "local_name": "chalk",
  "alias": false,
  "peer_metadata": null
}
^2.3.0runtime
lodash
Environment
{
  "local_name": "lodash",
  "alias": false,
  "peer_metadata": null
}
^4.17.5runtime
newman
Environment
{
  "local_name": "newman",
  "alias": false,
  "peer_metadata": null
}
^3.9.3runtime
yargs
Environment
{
  "local_name": "yargs",
  "alias": false,
  "peer_metadata": null
}
^10.0.3runtime
@0xproject/tslint-config
Environment
{
  "local_name": "@0xproject/tslint-config",
  "alias": false,
  "peer_metadata": null
}
^1.0.6development
@types/lodash
Environment
{
  "local_name": "@types/lodash",
  "alias": false,
  "peer_metadata": null
}
4.14.104development
@types/mocha
Environment
{
  "local_name": "@types/mocha",
  "alias": false,
  "peer_metadata": null
}
^2.2.48development
@types/nock
Environment
{
  "local_name": "@types/nock",
  "alias": false,
  "peer_metadata": null
}
^9.1.2development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^8.0.53development
@types/yargs
Environment
{
  "local_name": "@types/yargs",
  "alias": false,
  "peer_metadata": null
}
^10.0.0development
chai
Environment
{
  "local_name": "chai",
  "alias": false,
  "peer_metadata": null
}
^4.0.1development
chai-as-promised
Environment
{
  "local_name": "chai-as-promised",
  "alias": false,
  "peer_metadata": null
}
^7.1.0development
copyfiles
Environment
{
  "local_name": "copyfiles",
  "alias": false,
  "peer_metadata": null
}
^2.0.0development
dirty-chai
Environment
{
  "local_name": "dirty-chai",
  "alias": false,
  "peer_metadata": null
}
^2.0.1development
make-promises-safe
Environment
{
  "local_name": "make-promises-safe",
  "alias": false,
  "peer_metadata": null
}
^1.1.0development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^4.1.0development
nock
Environment
{
  "local_name": "nock",
  "alias": false,
  "peer_metadata": null
}
^9.2.3development
npm-run-all
Environment
{
  "local_name": "npm-run-all",
  "alias": false,
  "peer_metadata": null
}
^4.1.2development
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
^11.0.1development
shx
Environment
{
  "local_name": "shx",
  "alias": false,
  "peer_metadata": null
}
^0.2.2development
tslint
Environment
{
  "local_name": "tslint",
  "alias": false,
  "peer_metadata": null
}
5.11.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
3.0.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "3136848435e515568ad63c4787b1a82f4b9ad8a4",
  "tarball": "https://registry.npmjs.org/@0xproject/sra-report/-/sra-report-1.0.6.tgz",
  "integrity": "sha512-93Zo47PGqX6EvdVLYWy3XgoK2uug8pIy3fesioXqUzdzSDzbYO/7LalaE3zWOMUJADHisBiRkZ2LQCKO9PKz8w==",
  "fileCount": 55,
  "unpackedSize": 365299,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbgEpxCRA9TVsSAnZWagAA5LIP/3Ox706WDuGf+/FEwNXh\nMse6eiqzvoP6hG/hrDzGroHsHKvfDSBrxP32ptFDvdrXPWR2mv3rlZ6fqLTu\nejn37FNq7wEMVzPcNaJpPLHs4jlUnT3G5hSzn8k80PuHRzRGwt4buzL4abWT\niEgagHK/u6FE6iQ1U+8a3/6F/MbHtSvfRLKfhwUPUF705xwmLLezX6I9dLYE\nJdXeYVMPgmnvOsCT8UaFhnPyFPr94J/lIT1gaXD9IBBmS9V9iKRdU2dd010E\nKIGH65TkbOfMywY31i7UxXBNG2B+cHsvMi+G/GIeLhWX5LfEMdu7LYYGyJUa\n3xU7+gdhen0YbmVT4VbLymvE802pjbhc1pC5ZvZyyw0i1U4Ob/t1iL4lIKwv\nGPEgyjkfDcxLOVcrMvRQqpngIQJUNbMzPPGkbgH6Vq4DPoWywWq+TtsiAGNz\nF6YQgttOY91jGqK2ZpJMPsc6cJM5g7P1gMLXSF3xEKD1KlR+hQGREgYgYZHW\nffJydI2GnEkFMO0k6D9VBRBcB6uBQHga9poGit6F+1gAlRRmcLKXCXD2N8E2\nGy5XJ5t/8wFPncKLv0RsuqX1M97RbGDI01L8xv6jbUOBKlP2yXs8meUvaGLP\nHq6R/n7EslBpwyEowUCPBdANxbTr7LOQORLALlP/s9FhTcYTcYM7VsF2676x\ndPAs\r\n=oqDO\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIQCs1faUACueZM9L5SoA8luegr4tjZd047wsAHv6GzKTeQIgCSGJvw2RXqwPXi1/9TdcIVZvDTe+4bp8wM6+9oGk1k8="
    }
  ]
}

Repository

PENDING
0xproject/0x-monorepo

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:34 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:fb5428bdb696aabc5d14ca09e114e98fab920fcdca6847eb31803489b9acef4b

Other collected versions

1.0.134 Oct1.0.1228 Sept1.0.1125 Sept1.0.1025 Sept1.0.921 Sept1.0.85 SeptView all collected versions →