ac-payloadinspector
A simple tool to show trace to a given IP, including country
Last updated a year ago by mmpro .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ac-payloadinspector 
SYNC missed versions from official npm registry.

AC Payload Inspector

A simple tool that inspects JSON payload for properties.

Usage

node index.js --payload FILE --schema FILE [--pathToPayload STRING] [--pathToProperties STRING]

Options

  • pathToPayload - path to payload in JSON file (e.g. hits.hits for ES response)
  • pathToProperties - path to properties in each item of JSON file (e.g. _source in ES response)

Schema File

The schema file contains information on the expected properties and the path to the property that shall be used as identifier in console.logs

Example

const _ = require('lodash')

module.exports = {
  identifierPath: 'id',
  fields: [
    { property: 'type', type: _.isString, enum: ['image', 'video'] },
    { property: 'id', type: _.isInteger },
    { property: 'createdAt', type: _.isString },
    { property: 'updatedAt', type: _.isString },
    { property: 'settings', type: _.isObject },
    { property: 'container_name', type: _.isString },
    { property: 'meta_copyright', type: _.isString },
    { property: 'container_description', type: _.isString },
    { property: 'links', type: _.isArray },
  ]
}

Payload File

This is an example payload file from an ES response

{  
  "took":2,
  "timed_out":false,
  "hits":{  
     "total":1234,
     "max_score":1,
     "hits":[  
        {  
           "_index":"myindex",
           "_type":"item",
           "_id":"12345",
           "_score":1,
           "_source":{  
              "container_name":"My demo content"
           }
        }
     ]
  }
}

"pathToPayload" must be set to hits.hits as we want to inspect the hits array. "pathToProperties" must be set to "_source" as the actual payload per item is not on root of each hit but within the _source object.

Installation

Install this tool using "npm install ac-payloadInspector"

Links

License

MIT License Copyright © 2009-present, AdmiralCloud, Mark Poepping

Current Tags

  • 0.0.1                                ...           latest (a year ago)

1 Versions

  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |