npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lather

v0.2.0

Published

A terrible library to convert a JS object to XML and wrap it in a SOAP envelope

Downloads

7

Readme

Lather

A terrible library to convert a JS object to XML and wrap it in a SOAP envelope

Usage

Standalone conversion of a javascript object to XML:

  lather.body(object);

To send a SOAP Request:

  lather.up({
    body : jsObject,
    headers : { Authorization : lather.basicAuth(username, password) },
    additionalNamespaces : additionalNamespaces,
    method : method,
    url : url,
  }, function(error, response, body) {
    ...
  });

Examples

This was built to work with Exchange Web Services so here are some examples

EWS Calendar GetUserAvailability

var lather = require('lather');

var getUserAvailabilityRequest = {
  GetUserAvailabilityRequest : {
    attributes : [
      { xmlns : 'http://schemas.microsoft.com/exchange/services/2006/messages' },
      { 'xmlns:t' : 'http://schemas.microsoft.com/exchange/services/2006/types' },
    ],
    't:TimeZone' : {
      attributes : [
        { xmlns : 'http://schemas.microsoft.com/exchange/services/2006/types' },
      ],
      Bias : '480',
      StandardTime : {
        Bias : '0',
        Time : '02:00:00',
        DayOrder : '5',
        Month : '10',
        DayOfWeek : 'Sunday',
      },
      DaylightTime : {
        Bias : '-60',
        Time : '02:00:00',
        DayOrder : '1',
        Month : '4',
        DayOfWeek : 'Sunday',
      },
    },
    MailboxDataArray : [
      {
        't:MailboxData' : {
          't:Email' : {
            't:Address' : '[email protected]',
          },
          't:AttendeeType' : 'Required',
          't:ExcludeConflicts' : 'false',
        },
      },
    ],
    't:FreeBusyViewOptions' : {
      't:TimeWindow' : {
        't:StartTime' : '2015-03-16T00:00:00',
        't:EndTime' : '2015-05-16T23:59:59',
      },
      't:MergedFreeBusyIntervalInMinutes' : '60',
      't:RequestedView' : 'DetailedMerged',
    },
  },
};

lather.up({
  body : getUserAvailabilityRequest,
  headers : {
    Authorization : lather.basicAuth(exchangeUsername, exchangePassword),
  },
  method : 'POST',
  url : 'https://outlook.office365.com/EWS/Exchange.asmx',
}, function(error, res, body) {
  ...
});

EWS Calendar Add Event (m:createItem)

var lather = require('lather');

var createCalendarEvent = {
  'm:CreateItem' : {
    attributes : [
      { SendMeetingInvitations : 'SendToAllAndSaveCopy' },
    ],
    'm:Items' : [
      {
        't:CalendarItem' : {
          't:Subject' : 'Meeting in ThinkTank',
          't:Body' : {
            attributes : [
              { BodyType : 'Text' },
            ],
            value : 'Discuss ways to move away from SOAP',
          },
          't:Start' : '2015-06-02T00:00:00Z',
          't:End' : '2015-06-03T00:00:00Z',
          't:Location' : 'Conf Room',
          't:RequiredAttendees' : [
            {
              't:Attendee' : {
                't:Mailbox' : {
                  't:EmailAddress' : '[email protected]',
                },
              },
            },
          ],
        },
      },
    ],
  },
};

lather.up({
  body : createCalendarEvent,
  headers : {
    Authorization : lather.basicAuth(exchangeUserName, exchangePassword),
  },
  additionalNamespaces : [
    'xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"',
    'xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"',
  ],
  method : 'POST',
  url : 'https://outlook.office365.com/EWS/Exchange.asmx',
}, function(error, res, body) {
  ...
});

EWS Calendar Remove Event (m:DeleteItem)

var lather = require('lather');

var removeCalendarEvent = {
  'm:DeleteItem' : {
    attributes : [
      { DeleteType : 'MoveToDeletedItems' },
      { SendMeetingCancellations : 'SendToAllAndSaveCopy' },
    ],
    'm:ItemIds' : [
      {
        't:ItemId' : {
          attributes : [
            { Id : ItemId.Id },
            { ChangeKey : ItemId.ChangeKey },
          ],
        },
      },
    ],
  },
};

lather.up({
  body : removeCalendarEvent,
  headers : {
    Authorization : lather.basicAuth(exchangeUsername, exchangePassword),
  },
  additionalNamespaces : [
    'xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"',
    'xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"',
  ],
  method : 'POST',
  url : 'https://outlook.office365.com/EWS/Exchange.asmx',
}, function(error, res, body) {
  ...
});