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

lazarus-forms

v1.1.15

Published

Lazarus Forms is a Node.js library that was created to ease the use of integrating Lazarus's Forms API to one's applications.

Downloads

29

Readme

Lazarus Forms

Lazarus Forms is a Node.js library that was created to ease the use of integrating Lazarus's Forms API to one's applications.

Prerequisites

To be able to make use of this library, you must have an active Lazarus Forms account. To get started, head over to our website.

Installing

Using npm:

npm install lazarus-forms

Using Lazarus Forms in your app

import forms from 'lazarus-forms'

//TODO: Replace the orgId and authKey with your organzation's credentials
forms.init('orgId','authKey')
  .then(response => {
    if (response['state'] === 'Success') {
      //...
    } else {
      //...
    }
  })
  .catch(error => {
    //...
  })

Methods

Upload a file directly, get back a json.

How to call the function:

forms.analyzeFileForJson(sourceType, file)

| Parameter | Required | Type | Description | | --- | --- | --- | --- | | sourceType | Yes | string | Used to determine how the file is being passed to the function. Currently only supported values are 'path' and 'file'.| | file | Yes | string/object | If sourceType is 'path' expects to receive a path string to the file. If the sourceType is 'file', it expects to receive a file object.|

Expected response:

If success:

{
  "state": "Success",
  "response": {...} 
}

The response value is the data retrieved from a successful API call as seen in the docs

If there was a failure initializing the API call:

{
  "state": "Error",
  "response": "Reason for error" 
}

If there was a failure making the API call:

{
  "state": "Error",
  "response": "Reason for error" 
  "responseStatus": Int
}

Upload a file via url, get back a json.

forms.analyzeUrlForJson(inputUrl, fileId, metadata, webhook)

| Parameter | Required | Type | Description | | --- | --- | --- | --- | | inputUrl | Yes | string | Url to file to extract from: Must be a PDF, JPEG, PNG, or TIFF. | | fileId | No | string | Custom ID for document. If not present, will default to file name. | | metadata | No | object | Custom JSON to be passed as part of the response data. | | webhook | No | string | Webhook to ping after API runs. |

Expected response:

If success:

{
  "state": "Success",
  "response": {...} 
}

The response value is the data retrieved from a successful API call as seen in the docs

If there was a failure initializing the API call:

{
  "state": "Error",
  "response": "Reason for error" 
}

If there was a failure making the API call:

{
  "state": "Error",
  "response": "Reason for error" 
  "responseStatus": Int
}

Upload a file directly, get back a zip file.

forms.analyzeFileForZip(sourceType, file)

| Parameter | Required | Type | Description | | --- | --- | --- | --- | | sourceType | Yes | string | Used to determine how the file is being passed to the function. Currently only supported values are 'path' and 'file'.| | file | Yes | string/object | If sourceType is 'path' expects to receive a path string to the file. If the sourceType is 'file', it expects to receive a file object.|

Expected response:

If success:

{
  "state": "Success",
  "response": {...} 
}

The response value is the data retrieved from a successful API call as seen in the docs

To save the file if it is being returned client-side: using a package such as file-saver can be used to integrate the process:

import {saveAs} from 'file-saver';

forms.analyzeFileForZip('file', file)
  .then((res) => {
    return res.response.data
  })
  .then((data) => {
    let extension = 'zip';
    let tempFileName = `test`
    let fileName = `${tempFileName}.${extension}`;

    const blob = new Blob([data], {
      type: 'application/octet-stream'
    })

    saveAs(blob, fileName)
  })
  .catch(error => {
    console.log('error', error)
  })

If there was a failure initializing the API call:

{
  "state": "Error",
  "response": "Reason for error" 
}

If there was a failure making the API call:

{
  "state": "Error",
  "response": "Reason for error" 
  "responseStatus": Int
}

Upload a file via url, get back a zip file.

forms.analyzeUrlForZip(inputUrl, fileId, metadata, webhook)

| Parameter | Required | Type | Description | | --- | --- | --- | --- | | inputUrl | Yes | string | Url to file to extract from: Must be a PDF, JPEG, PNG, or TIFF. | | fileId | No | string | Custom ID for document. If not present, will default to file name. | | metadata | No | object | Custom JSON to be passed as part of the response data. | | webhook | No | string | Webhook to ping after API runs. |

Expected response:

If success:

{
  "state": "Success",
  "response": {...} 
}

The response value is the data retrieved from a successful API call as seen in the docs

To save the file if it is being returned client-side: using a package such as file-saver can be used to integrate the process:

import {saveAs} from 'file-saver';

forms.analyzeFileForZip('file', file)
  .then((res) => {
    return res.response.data
  })
  .then((data) => {
    let extension = 'zip';
    let tempFileName = `test`
    let fileName = `${tempFileName}.${extension}`;

    const blob = new Blob([data], {
      type: 'application/octet-stream'
    })

    saveAs(blob, fileName)
  })
  .catch(error => {
    console.log('error', error)
  })

If there was a failure initializing the API call:

{
  "state": "Error",
  "response": "Reason for error" 
}

If there was a failure making the API call:

{
  "state": "Error",
  "response": "Reason for error" 
  "responseStatus": Int
}

Async queue a url via json, send a zip file to an output url.

forms.queueUrlForZip(inputUrl, outputUrl, outputUrlHeaders, fileId, metadata, webhook)

| Parameter | Required | Type | Description | | --- | --- | --- | --- | | inputUrl | Yes | string | Url to file to extract from: Must be a PDF, JPEG, PNG, or TIFF. | | outputUrl | Yes | string | Url where to send output zip file. Must be open to PUT requests. | | outputUrlHeaders | No | object | Json with headers to be sent to your outputUrl. | | fileId | No | string | Custom ID for document. If not present, will default to file name. | | metadata | No | object | Custom JSON to be passed as part of the response data. | | webhook | No | string | Webhook to ping after API runs. |

Expected response:

If success:

{
  "state": "Success",
  "response": {...} 
}

The response value is the data retrieved from a successful API call as seen in the docs

If there was a failure initializing the API call:

{
  "state": "Error",
  "response": "Reason for error" 
}

If there was a failure making the API call:

{
  "state": "Error",
  "response": "Reason for error" 
  "responseStatus": Int
}

Common Errors

| Response | Status | Meaning | Description | | --- | --- | --- | --- | | 400 | FAILURE | Bad Request | bad request and failure to read | | 401 | AUTH_FAILURE | Unauthorized | unauthorized attempt | | 403 | FAILURE | Forbidden | invalid subscription | | 418 | FAILURE | Unknown | Something went wrong that we don't understand. |