New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

capgen

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capgen

A package to generate Common Alerting Protocol XML Payload

latest
Source
npmnpm
Version
1.0.8
Version published
Maintainers
1
Created
Source

capgen

A package to generate Common Alerting Protocol XML Payload

CAP 1.2 is a popular Common Alerting protocol/specification.

Find the CAP Specification details at CAP Stanard

npm version GitHub license GitHub stars GitHub issues GitHub forks

Code

  • Simply import Capgen from capgen package. NPM URL: https://www.npmjs.com/package/capgen npm install capgen
  • create instance of Capgen class by passing the config object to the constructor.
  • generate the cap xml using the 'createUsing' method.
import { Capgen} from 'capgen';


const config={
  strictMode:false,
  comment:false,
  xmlOptions:{
    headless:true,
    prettyPrint:true
  }
}

const gen = new Capgen(config);
const xml =gen.createUsing({
  
  sender: 'Abhijeet',
  sent: 'Monday 09 feb 2021 21:38:00 +8:00',
  status: 'Active',
  msgType: 'Alert',
  source: 'FeedJar',
  scope: 'Public',
  code: ['2.1', '2.2'],
  info: [
    {
      category: ["A","B"],
      eventCode:["e1","e2"],
      parameter: [
        {
          valueName: 'same',
          value: 'CEM',
        },
        {
          valueName: 'ISOK',
          value: 'OK',
        },
      ],
      resource:[{
        resourceDesc:"IWS",
        mimeType:"html"
      },
      {
        resourceDesc:"IWS",
        mimeType:"image" ,
        digest:'SHA1'
      }
    ],
    area:[
      {
        areaDesc:"Taylor; Clark",
        geocode:[
          {
            valueName:"UGC",
            value:"WIZ017"
          },
          {
            valueName:"UGC",
            value:"WIZ017"
          },
          {
            valueName:"UGC",
            value:"WIZ017"
          }
        ]
      }
    ]
    },
  ],
});

console.log(xml);

ChangeLog

see change log here

Keywords

CAP

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts