open-index/open-npm huggingface dataset:
npm package: @paychex/adapter-mock
Description: A data adapter that returns mock Responses based on conditions matching Requests.
Author: Paychex, Inc.
Latest version: 2.1.20

# @paychex/adapter-mock

A data adapter that returns mock Responses based on conditions matching Requests. This package
is intended for use with [@paychex/core](https://github.com/paychex/core) data pipelines.

## Installation

```bash
npm install @paychex/adapter-mock
```

## Importing

### esm

```js
import * as Mock from '@paychex/adapter-mock';
import { delay, success, failure, mock } from '@paychex/adapter-mock';
```

### cjs

```js
const Mock = require('@paychex/adapter-mock');
const { delay, success, failure, mock } = require('@paychex/adapter-mock');
```

### amd

```js
define(['@paychex/adapter-mock'], function(Mock) { ... });
define(['@paychex/adapter-mock'], function({ delay, success, failure, mock }) { ... });
```

```js
require(['@paychex/adapter-mock'], function(Mock) { ... });
require(['@paychex/adapter-mock'], function({ delay, success, failure, mock }) { ... });
```

### iife

```js
const Mock = window['@paychex/adapter-mock'];
const { delay, success, failure, mock } = window['@paychex/adapter-mock'];
```

## Usage

```js
import {
  proxy,
  fetch,
  setAdapter,
  createRequest,
} from '~/path/to/datalayer';

// --- the code below can be removed when real endpoints exist --- //

import {
  delay,
  success,
  failure,
  mock,
} from '@paychex/adapter-mock';

const otherwise = () => true;
const item = { id: 123, key: 'value' };
const items = [item];

setAdapter('mock-endpoint', mock([
  [ { path: '/items' },      delay(20, success(items)) ],
  [ { path: '/items/123' },  delay(50, success(item)) ],
  [ otherwise,               failure(404) ];
]));

proxy.use({
  adapter: 'mock-endpoint',
  match: {
    base: 'my-endpoint'
  }
});

// --- the code below stays the same --- //

proxy.use({
  protocol: 'https',
  host: process.env.MY_ENDPOINT_HOST,
  match: {
    base: 'my-endpoint',
  }
});

const operation = {
  method: 'GET',
  path: '/items',
  base: 'my-endpoint',
};

export async function loadItems() {
  const request = createRequest(operation);
  const response = await fetch(request);
  return response.data; // [ { id: 123, key: 'value' } ]
}
```
npm package: @paychex/adapter-node
Description: A data adapter that uses the NodeJS built-in https library to convert a Request into a Response.
Author: Paychex, Inc.
Latest version: 2.1.7

# @paychex/adapter-node

A data adapter that uses the NodeJS built-in [https](https://nodejs.org/api/https.html) library to convert a Request into a Response. Can be passed to the [@paychex/core](https://github.com/paychex/core) createDataLayer factory method to enable data operations on NodeJS.

## Installation

```bash
npm install @paychex/adapter-node
```

## Importing

### esm

```js
import { node } from '@paychex/adapter-node';
```

### cjs

```js
const { node } = require('@paychex/adapter-node');
```

## Usage

```js
import { data } from '@paychex/core';
import { node } from '@paychex/adapter-node';

const proxy = data.createProxy();
const { createRequest, fetch, setAdapter } = data.createDataLayer(proxy, node);
```
npm package: @paychex/adapter-xhr
Description: A data adapter that uses the XMLHttpRequest object in web browsers to convert a Request into a Response.
Author: Paychex, Inc.
Latest version: 2.1.9

# @paychex/adapter-xhr

A data adapter that uses the [XMLHttpRequest](https://xhr.spec.whatwg.org/) object to convert a Request into a Response. Can be passed to the [@paychex/core](https://github.com/paychex/core) createDataLayer factory method to enable data operations on NodeJS.

## Installation

```bash
npm install @paychex/adapter-xhr
```

## Importing

### esm

```js
import { xhr } from '@paychex/adapter-xhr';
```

### cjs

```js
const { xhr } = require('@paychex/adapter-xhr');
```

### amd

```js
define(['@paychex/adapter-xhr'], function({ xhr }) { ... });
```

```js
require(['@paychex/adapter-xhr'], function({ xhr }) { ... });
```

### iife

```js
const { xhr } = window['@paychex/adapter-xhr'];
```

## Usage

```js
import { data } from '@paychex/core';
import { xhr } from '@paychex/adapter-xhr';

const proxy = data.createProxy();
const { createRequest, fetch, setAdapter } = data.createDataLayer(proxy, xhr);
```
npm package: @paychex/collector-azure
Description: Provides an Azure Event Bus collector for use with a @paychex/core Tracker.
Author: Paychex, Inc.
Latest version: 2.1.5

# @paychex/collector-azure

Provides an Azure Event Bus collector for use with a [@paychex/core](https://github.com/paychex/core) Tracker.

## Installation

```bash
npm install @paychex/collector-azure
```

## Importing

### esm

```js
import { eventHubs } from '@paychex/collector-azure';
```

### cjs

```js
const { eventHubs } = require('@paychex/collector-azure');
```

### amd

```js
define(['@paychex/collector-azure'], function(collectors) { ... });
define(['@paychex/collector-azure'], function({ eventHubs }) { ... });
```

```js
require(['@paychex/collector-azure'], function(collectors) { ... });
require(['@paychex/collector-azure'], function({ eventHubs }) { ... });
```

### iife (browser)

```js
const { eventHubs } = window['@paychex/collector-azure'];
```

## Usage

Construct a new Azure Event Hub collector for use in the `@paychex/core` Tracker by passing a configuration object with the following keys:

| key | type | description |
| --- | --- | --- |
| name | `string` | **required** The name of the Event Hub to connect to. |
| connection | `string` | **required** The full connection string of the Event Hub to connect to. |
| formatter | `Function` | _optional_ Function to use to format the `TrackingInfo` instance into an Azure Event Hub entry. |

```js
import { trackers } from '@paychex/core';
import { eventHubs } from '@paychex/collector-azure';

const hub = eventHubs({
  name: process.env.HUB_NAME,
  connection: process.env.HUB_CONNECTION
});

const tracker = trackers.create(hub);
```
npm package: @paychex/collector-ga
Description: Provides a GoogleAnalytics collector for use with a @paychex/core Tracker.
Author: Paychex, Inc.
Latest version: 2.0.9

# @paychex/collector-ga

Provides a GoogleAnalytics collector for use with a [@paychex/core](https://github.com/paychex/core) Tracker.

## Installation

```bash
npm install @paychex/collector-ga
```

## Importing

### esm

```js
import { googleAnalytics } from '@paychex/collector-ga';
```

### cjs

```js
const { googleAnalytics } = require('@paychex/collector-ga');
```

### amd

```js
define(['@paychex/collector-ga'], function(collectors) { ... });
define(['@paychex/collector-ga'], function({ googleAnalytics }) { ... });
```

```js
require(['@paychex/collector-ga'], function(collectors) { ... });
require(['@paychex/collector-ga'], function({ googleAnalytics }) { ... });
```

### iife (browser)

```js
const { googleAnalytics } = window['@paychex/collector-ga'];
```

## Usage

Construct a new GoogleAnalytics collector for use in the `@paychex/core` Tracker by passing the global `ga` object to the factory function:

```js
import { trackers } from '@paychex/core';
import { googleAnalytics } from '@paychex/collector-ga';

import { createRequest, fetch } from '~/path/to/datalayer.js';

async function send(payload, operation) {
  // optionally, extend fetch to provide custom logic
  // such as retries, connectivity checks, etc...
  await fetch(createRequest(operation, null, payload));
}

const collector = googleAnalytics(send, ga);
export const tracker = trackers.create(collector);
```

You can combine this functionality with other utility methods. For example,
we can batch calls to Google Analytics to run at most once every 5 seconds,
and also replace keys and values with parameters Google Analytics expects:

```js
// combining with utility methods

import { googleAnalytics } from '@paychex/collector-ga';
import { functions, signals, trackers } from '@paychex/core';

async function send(payload, operation) { ... }

const signal = signals.autoReset(false);

let collector = googleAnalytics(send, ga);

collector = trackers.utils.withReplacement(collector, new Map([
  [/\ben\b/i, 'English'],
  [/\bes\b/i, 'Spanish'],
  [/^lang$/i, 'language'],
]));

collector = functions.buffer(collector, [signal]);
collector.flush = signal.set;

// automatically flush the queue every 5 seconds;
// consumers can also manually invoke `flush` (e.g.
// when the user is navigating away from the site)

setInterval(collector.flush, 5000);

export default collector;
```
npm package: @paychex/core
Description: Provides framework-agnostic functionality for use in applications.
Author: Paychex, Inc.
Latest version: 2.2.11

# @paychex/core

Provides framework-agnostic functionality for use in applications.

## Commands

To install the necessary dependencies:

```bash
npm install
```

To generate documentation files:

```bash
npm run docs
```

To create distributable bundles:

```bash
npm run build
```

## Modules

The @paychex/core library contains functionality separated into various modules:

name | description
:--- | :---
[data]{@link module:data} | Provides methods for creating and configuring a data layer, providing applications the ability to invoke data operations for various endpoints.
[data/utils]{@link module:data/utils} | Functionality used to customize a DataLayer pipeline.
[errors]{@link module:errors} | Provides utility methods for working with Errors.
[events]{@link module:events} | Provides an event bus for publish/subscribe behavior.
[functions]{@link module:functions} | Provides wrappers for functions to extend behavior.
[models]{@link module:models} | Provides utilities for working with collections of structured data.
[models/utils]{@link module:models/utils} | Extends ModelCollection instances with helpful functionality.
[process]{@link module:process} | Provides utilities for running complex, asynchronous processes.
[signals]{@link module:signals} | Provides utilities for synchronizing blocks of code.
[stores]{@link module:stores} | Provides client-side storage. How long data is persisted for depends on the store type and configuration options.
[stores/utils]{@link module:stores/utils} | Utility methods for working with Stores.
[trackers]{@link module:trackers} | Provides event, error, and performance logging for applications.
[trackers/utils]{@link module:trackers/utils} | Provides utility methods for working with Tracker instances or collectors.
[test]{@link module:test} | Provides functionality useful during unit testing.

All code is exported through a top-level namespace you can access in the following ways:

### esm

```js
import * as core from '@paychex/core';
import { events } from '@paychex/core';
```

### commonjs

```js
const core = require('@paychex/core');
const { events } = require('@paychex/core');
```

### amd

```js
define(['@paychex/core'], function(core) {});
define(['@paychex/core'], function({ events }) {});
```

```js
require(['@paychex/core'], function(core) {});
require(['@paychex/core'], function({ events }) {});
```

### iife (web browser)

```js
const core = window['@paychex/core'];
const { events } = window['@paychex/core'];
```

## Contributing

Before creating a new feature for the `@paychex/core` library, please read [CONTRIBUTING.md](https://github.com/paychex/core/blob/master/CONTRIBUTING.md).
npm package: @paychex/platform-browser
Description: Provides agnostic JavaScript functionality for use in all browser-based applications.
Author: Paychex
Latest version: 2.0.8

# @paychex/platform-browser

Provides agnostic JavaScript functionality for use in all browser-based applications.

## Installation

```bash
npm install @paychex/platform-browser
```

## Importing

### esm

```js
import { crossOrigin, stores } from '@paychex/platform-browser';
```

### cjs

```js
const { crossOrigin, stores } = require('@paychex/platform-browser');
```

### amd

```js
define(['@paychex/platform-browser'], function(browser) { ... });
define(['@paychex/platform-browser'], function({ crossOrigin, stores }) { ... });
```

```js
require(['@paychex/platform-browser'], function(browser) { ... });
require(['@paychex/platform-browser'], function({ crossOrigin, stores }) { ... });
```

### iife (browser)

```js
const { crossOrigin, stores } = window['@paychex/platform-browser'];
```

## Commands

To install the necessary dependencies:

```bash
npm install
```

To generate documentation files:

```bash
npm run docs
```

## Modules

The @paychex/platform-browser library contains functionality separated into various modules:

name | description
:--- | :---
[crossOrigin]{@link module:crossOrigin} | Enables safe asynchronous communication across different origins.
[stores]{@link module:stores} | Provides browser-specific Stores to persist and retrieve data on the user's machine.