open-index/open-npm huggingface dataset:
npm package: @journeyapps-solutions/cc-twilio
Description: Twilio wrapper
Author: Anton Van Zyl
Latest version: 1.0.1

# cc-twilio

This is a wrapping class for twilio SMS
This will enable Cloud Code to send a sms safely in the enviroment.

@see https://www.twilio.com/docs/libraries/node

## Documentation
All code is clearly documented, please see code for more details.
View an example below.

## Installation

#### Per machine

```
# Once as setup
npm login
 > journeyapps-solutions-user
 > see password on 1Password
 > infrastructure+npmsolutions@journeyapps.com

yarn add @journeyapps-solutions/cc-sendgrid --save
```

#### Per CloudCode app

```
NPM_TOKEN=... # Token for journeyapps-solutions-user from 1Password
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./app/cloudcode/.npmrc
```

#### Per CloudCode task

```
yarn add @journeyapps-solutions/cc-sendgrid
```

## Deploying

```
yarn version
```

## Usage

#### Environment Variables
The send function will check the environment in which it is running by using the `config.env` variable passed in on the `constructor`. Default environment is 'testing'.

Note:
* In testing and staging it will only send sms to numbers in the whitelist.
* In production it will not filter any mails.

To add a whitelist number, see example below

#### Constructing a SMS
cc-twilio is essentially a wrapper for the twilio node module. We add some validation and reporting. That being said, to construct a sms, you can directly follow the twilio documentation:

https://www.twilio.com/docs/libraries/node

### Cloud Code:

config.js:

```js
// Credentials used
let config = {};

config.accountSid = '<something>';
config.authToken = '<something>';
config.textFrom = '<something>'; // This needs to be the twilio from number from journeys twilio account

config.whiteList : ['+27741234567'];

```

index.js:

```js
// make sure config.js has the relevant credentials
const config = require('./config');
const ccTwilio = require('@journeyapps-solutions/cc-twilio');

export async function run() {


	let _twilio = new ccTwilio(config.accountSid, config.authToken, config.textFrom, CloudCode.task.env, config.whiteList);
  try {
    await _twilio.sms(['+27741413459'], "This is a twilio Unit Test, test message. Please ignore.");
  } catch(error) {
    log.error(error);
    //ROLLBAR HERE
  }
}
```

## Testing

To test the module tape is used.

```js

yarn test
```
npm package: @journeyapps-solutions/pdfgen-sol
Description: Pdf reports generator and mailer
Author: JourneyApps
Latest version: 2.0.4

# pdfgen-sol [DEPRECATED]
Pdf reports generator and mailer

Note, docraptor use has been deprecated in favour of the Journey Apps Document conversion in version 2.0.0.
Updating your documents:
1. Install latest version of pdfGen
2. Update you page margins to ensure the correct margins by using `config.print` to set the margins on the pdf generation and removing @page in the styles.
3. Add `process.env.JOURNEY_PDF_KEY = this.backend.token;` to your task to ensure the PDF generator gets the current running token

It should be noted that upgrading the v2.0.0 will likely cause some stylistic differences, as PDFGen is now using a new processor for the PDF generation. We've seen font and border weights, as well as padding, change, so make sure you plan in some time to process those differences.

# Usage

In the task:

config.js:

```js
config.EXPIRES_AFTER = 86400 * 7;
config.AWS_ACCESS_KEY = '...';
config.AWS_SECRET_KEY = '...';
config.DOCUMENT_BUCKET_NAME = 'journey-docraptor';
config.DOCRAPTOR_API_KEY = '...';
config.SENDGRID_API_KEY = '...';
```

index.js:

```js
// make sure config.js has the relevant credentials
const config = require('./config');
const PdfGen = require('@journeyapps-solutions/pdfgen');

export async function run() {
    const pdfGen = new PdfGen(config);
    const pdfHtml = '...';
    const emailHtml = '...';
    pdfGen.addReport(pdfHtml, 'JourneyApps Test Report');
    const recipients = [
      {
        name: 'Test User',
        email_address: 'user@example.com'
      }
    ];
    await pdfGen.mailReports(recipients, emailHtml);
}
```


# Development

Publish a new version requires:
1. Updating the package.json version
2. PR into master if code not already in master branch
3. Creating a release on github. This will trigger a Github Action to publish the package.
npm package: @journeyapps/domparser
Description: Basic XML DOM parsing
Latest version: 0.4.1

# domparser

This is a pure JS implementation of DOM parsing, to be used instead of DOMParser in a browser. We use [sax.js](https://github.com/isaacs/sax-js/) for
the low-level parsing, and convert it to the browser's native Document object, or xmldom.

## Why not use the built-in DOMParser?

The built-in DOMParser in modern browsers should be sufficient for most use cases, and has very good performance. However, it does have some limitations:

1. Error reporting is very different on the different browsers. The browser typically stops after the first error.
2. It's not possible to get access to position info (what line/column an element is on).

This project aims to be a lightweight replacement for the built-in parser, with better error handling and position
reporting.

## Usage

    const { DOMParser } = require('@journeyapps/domparser');
    var doc = new DOMParser().parseFromString("<test>xml</test>");

## Supported environments

Should work on any browser that supports ES6.

Tested on recent versions of Node, Chrome and Firefox.

When running in Node, a recent version of xmldom is required.

# License

All files in this project are licensed under the MIT license.
npm package: @journeyapps/journeyapps-console
Description: Experimental interactive console for JourneyApps database access.
Author: JourneyApps
Latest version: 0.0.5

# Usage

Experimental interactive console for JourneyApps database access.

Node 8.10.0 or later is recommended.

## Install and run

Using npx:

    npx @journeyapps/journeyapps-console --url <backend-url> --token O:<token>

For example:

    npx @journeyapps/journeyapps-console --url  https://run-staging.journeyapps.com/api/v4/586f624f22020e10fa5ca0f5 --token O:Niegai7eicaih2shohKai2eileelo9zeu3Ieghav

Or install locally:

    npm install -g @journeyapps/journeyapps-console
    journeyapps-console --url <backend-url> --token O:<token>

## License

MIT