open-index/open-npm huggingface dataset:
npm package: @puresec/sequelize-sync-cfn-custom-resource
Description: This library supplies a custom resource handler generator that uses your models and migrations in a webpackable way to sync/migrate your database.
Author: PureSec
Latest version: 1.0.0

# sequelize-sync-cfn-custom-resource

This library supplies a custom resource handler generator
that uses your models and migrations in a webpackable way
to sync/migrate your database.

## Usage

### Install

```bash
npm install --save @puresec/sequelize-sync-cfn-custom-resource
```

### Migration Preparation

For your migrations to be webpackable they must be `require`d by some module.

Use the `prepare-sequelize-migrations` binary that arrives with this module,
which creates a `.migrations.js` file that will soon be required by your custom resource.

```bash
./node_modules/.bin/prepare-sequelize-migrations
```

The generated file should probably be git ignored.

See [the script](./bin/prepare-sequelize-migrations.sh) for more complex usage.

### Custom Resource Handler

In your own JavaScript module:

```javascript
const createHandler = require('@puresec/sequelize-sync-cfn-custom-resource');

module.exports.handler = createHandler({
  requireModels: () => require('./models'),
  requireMigrations: () => require('./.migrations'),
  logging: (message) => { /* ... */ }, // optional
});
```

Use your module's handler for the function that is used as the custom resource.

## How it works

During the CloudFormation lifecycle, the custom resource will:

* **create**: Sync the initial schema and mark all migrations as executed.
* **update**: Run all pending migrations (make sure the resource has a UUID updated with every new migration).
* **delete**: Does nothing for now.

The `createHandler` function receives 2 functions:

* **requireModels**: returns your required models (must export `sequelize` and `Sequelize`).
* **requireMigrations**: returns your required migrations, generated using the `prepare-sequelize-migrations` binary.

These functions are supplied so that webpack can pack the relevant JavaScript files into the function's artifact, with your own code.

They are supplied as functions so that failure to require them will not prevent sending a response to CloudFormation
(using [safe-cfn-custom-resource](https://www.npmjs.com/package/safe-cfn-custom-resource)).

## Development

### Publish a new version

Set the `"version"` in `package.json`, then run:

```bash
npm publish --access public
```

(if you have permissions)
npm package: @puresignal/essl
Description: Algorithmic composition library
Latest version: 0.1.1

# @puresignal/essl

Algorithmic composition library named after the composer [Karlheinz Essl](https://en.wikipedia.org/wiki/Karlheinz_Essl_Jr.) and inspired by his [Real Time Composition Library](https://www.essl.at/works/rtc.html).

## Install

```sh
npm i @puresignal/essl
```

## API

### `Urn`

Cycles through a range of integers in random order, guaranteeing each value appears exactly once per cycle before repeating.

Inspired by the [urn](https://docs.cycling74.com/reference/urn/) object in Max/MSP.

```ts
import { Urn } from '@puresignal/algo'

const urn = new Urn(4) // values: 0, 1, 2, 3

urn.next() // e.g. 2
urn.next() // e.g. 0
urn.next() // e.g. 3
urn.next() // e.g. 1
urn.next() // new cycle begins
```

| Member                   | Description                             |
|--------------------------|-----------------------------------------|
| `new Urn(max, options?)` | Create an urn over the range `[0, max)` |
| `.next()`                | Draw the next value                     |
| `.max`                   | The range the urn was created with      |
| `.noRepeat`              | Whether no-repeat mode is enabled       |

**Options**

| Option     | Default | Description                                                                                        |
|------------|---------|----------------------------------------------------------------------------------------------------|
| `noRepeat` | `false` | Never return the same value twice in a row, even across cycle boundaries                           |
| `onCycle`  | —       | Callback invoked at the start of each new cycle, before the first value of that cycle is returned  |

```ts
const urn = new Urn(4, {
  noRepeat: true,
  onCycle: () => console.log('new cycle'),
})
```