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

@ubio/job-input-bundler

v3.14.1

Published

Provides random job input for test job

Downloads

16

Readme

job-input-bundler

Collects data from different sources in order to run a test job (it doesn't run test job itself)

How this project does its job

  • asks data generation api to generate high-quality data fragments, such as person, account, payment method, address
  • generates some of the data itself (dates within range, numbers, boolean flags)
  • runs data extraction job in automation cloud to gather data from third-parties

Where this project can be used

  • test runner (running csi job)
  • dashboard (interactive docs)
  • backoffice / qa tooling frontend (scenario configuration)

API

Setup

Install

yarn add @ubio/job-input-bundler

Use

const init = require('@ubio/job-input-bundler');
const { getData, getSpecSchema } = await init(fetch, config);

See another usage example here.

Functions

getData

async getData(domain: String, spec: DataCollectionSpec): { [string]: any }

getSpecSchema

Return schema describing DataCollectionSpec for particular automation domain

getSpecSchema(domain: String): JsonSchema

Data Structures

DataCollectionSpec is an object which configures data collection procedures (input for various data generation step)

type DataCollectionSpec = {
   [string]: any
}

Config

{
    // secret key of automation cloud public client which will be used to authorize job creation requests
    automationcloudClientSecretKey: String,

    // url of automation cloud api, e.g. https://api.automationcloud.net
    automationcloudApiUrl: String,

    // url of protocol, e.g. https://protocol.automationcloud.net/schema.json
    automationcloudApiUrl: String,

    // url of automation cloud api, e.g. https://data-genenration.automationcloud.net
    dataGenerationApiUrl: String,

    // url of automation cloud api, e.g. https://vault.automationcloud.net
    automationcloudVaultUrl: String,

    // automation-cloud compliant progress reporter
    progressReporter: Function(
        progressReport: { [string]: any }
    ),

    // google-cloud compliant error reporter
    errorLogger: Function(
        message: String,
        {
            error: { message, stack },
            httpRequest: { method, url, userAgent, referrer, responseStatusCode, remoteIp }
        }
    )
}

Usage example

const init = require('@ubio/job-input-bundler');
const clientSecretKey = 'public client secret key';

async function main() {
    const bundler = await init(fetch, {
        protocolUrl: 'https://protocol.automationcloud.net/',
        automationcloudApiUrl: 'https://api-staging.automationcloud.net',
        automationcloudVaultUrl: 'https://vault-staging.automationcloud.net',
        dataGenerationApiUrl: 'https://data-generation-next-staging.automationcloud.net',
        // old-school auth
        authHeader: 'Basic ' + btoa(clientSecretKey + ':')
        // alternative, jwt auth
        // authHeader: 'Bearer ' + jwt
    });

    const { getData } = bundler;

    console.info(JSON.stringify(await getData('HotelBooking', {
        staticData: {},
        generatorInput: {
            mainGuest: { dateOfBirth: { age: 19 } }
        }
    }), null, '  '));


    console.info(JSON.stringify(await getData('FlightBooking', {
        staticData: { url: 'https://ubioair-staging.automationcloud.net' },
        generatorInput: {
            inboundMonthYear: 10,
            outboundMonthYear: 20,
            passengers: {
                items: [
                    {
                        dateOfBirth: { age: 33 },
                        document: { number: '123' }
                    }
                ]
            },
            extractionServiceId: 'e44a4f1b-aa5c-4b36-8db3-a7c78c404b90' // ubio-air extract on staging
        },
    }), null, '  '));
}

/* peer dependencies for backend

const btoa = str => new Buffer(str.toString(), 'binary').toString('base64');
const fetch = require('node-fetch');

*/