open-index/open-npm huggingface dataset:
npm package: @shipper/fastway
Description: > Please note, this module makes use of the `--harmony_async_await` flag of node
Author: Fabian Cook
Latest version: 2.0.1

# @shipper/fastway

> Please note, this module makes use of the `--harmony_async_await` flag of node

You must register an implementation of `promise-any` to use this module

## Usage

### Definitions

We want to be able to validate our requests, to do this we use [https://spacetelescope.github.io/understanding-json-schema/](JSON Schema)

We need a definition file to to this, it is defined as

```js
const definition = {
  "<controller>": {
    "<version>": {
      "<action>": {
         /* Definition */
         "type": "object"
      }
    }
  }
}
```

You can see an example definition in the root directory of this module

If you don't want to use a definition file you will just need to use `invokeWithVersion` or `getControllerVersioned`

### Methods

#### init

Returns an instance of `Fastway`

```js
const Definition = require('./fastway-definition.json'),
    Fastway = require('@shipper/fastway').init(Definition);
```

#### Fastway.invoke(context, controller, action, data)

Invokes the given action, the highest API version for the controller will be used

```js
async function getConsignmentsForManifest(context, manifestID) {
    const response = Fastway.invoke(context, 'FastLabel', 'ListConsignments', {
        ManifestID: manifestID
    });
    return response.getResult();
}
const context = {
  apiKey: 'Provided by Fastway',
  url: 'http://nz.api.fastway.org/' // Your country specific url
};
getConsignmentsForManifest(1234)
    .then(console.log)
    .catch(console.error);
```

#### Fastway.invokeWithVersion(context, version, controller, action, data)

Same as above, except we will use an explicit API version

```js
async function getConsignmentsForManifest(context, manifestID) {
    const response = Fastway.invokeWithVersion(context, 'v2', 'FastLabel', 'ListConsignments', {
        ManifestID: manifestID
    });
    return response.getResult();
}
const context = {
  apiKey: 'Provided by Fastway',
  url: 'http://nz.api.fastway.org/' // Your country specific url
};
getConsignmentsForManifest(1234)
    .then(console.log)
    .catch(console.error);
```

#### Fastway.getControllerVersioned

You can explicitly define a controller and action if you wish, this is essentially the same as `invokeWithVersion`

```js
Fastway.getControllerVersioned(2, 'FastLabel')
    .invoke(
        context,
        'ListConsignments',
        {
            ManifestID: 1234
        }
    )
    .then(function(response) {
        console.log(response.getResult());
    })
    .catch(console.error);
```

## License

Copyright © 2016 Fabian Cook.

This module (@shipper/fastway) is licenced under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.
npm package: @shipper/pdfkit-html-simple
Description: Create a PDF from simple HTML text elements
Latest version: 1.0.3

# PDFKit HTML Simple

Create a PDF from simple HTML text elements


Usage: 

```js
const PDFKitHTML = require('@shipper/pdfkit-html-simple'),
    html = ```
    <html>
        <head>
          <style type="text/css">
            .underline,
            .underline * {
              text-decoration: underline;
            }
          </style>
        </head>
        <body>
          <h1>H1</h1>
          <h2>H2</h2>
          <h3>H3</h3>
          <h4>H4</h4>
          <h5>H5</h5>
          <h6>H6</h6>
          <strong>This is bold</strong>
          <span class="underline">
            <strong>This is bold and underlined</strong>
          </span>
          <em>This is italic</em>
          <span style="text-decoration: underline;">This is underlined</span>
          <span class="underline">This is also underlined</span>
        </body>
    </html>
    ```;
    
PDFKitHTML.parse(html)
    .then(function(transformations) {
      // We now have an array of functions to invoke with a document
    });
```

The result of the promise being an array of functions, each of which expect one parameter, `document`, and 
will return a promise resolving with that document

To apply the transformations to the document you can do something like this:

```js
const promise = transformations.reduce(function(promise, transformation) {
  return promise.then(transformation);
}, Promise.resolve(document));
```

Once the promise is resolved all transformations will be complete and you will have your document.

See [examples/simple](examples/simple) for example usage