open-index/open-npm huggingface dataset:
npm package: @fmss/babel-preset
Description: FMSS's Babel preset configuration
Author: Gürkan Sevil
Latest version: 1.1.0

# `@fmss/babel-preset`

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](../../LICENSE.md) [![npm version](https://badge.fury.io/js/%40fmss%2Fbabel-preset.svg)](https://badge.fury.io/js/%40fmss%2Fbabel-preset.svg)

FMSS's Babel preset configuration

## Installation

```bash
npm install --save-dev @babel/core @fmss/babel-preset
```

## Usage

In your `babel.config.js` or `.babelrc` file:

```js
module.exports = {
  presets: ['@fmss/babel-preset', {typescript: true, react: false}],
};
```

### Features

- Supports modern JavaScript features (ES2015+)
- TypeScript support (with `typescript: true` option)
- React support (with `react: true` option)

### Configuration Options

```js
module.exports = {
  presets: [
    [
      '@fmss/babel-preset',
      {
        // TypeScript support
        typescript: false,

        // React support
        react: false,

        // CoreJS version
        corejs: 3,

        // Module format ('auto', 'commonjs', false, etc.)
        modules: 'auto',

        // Polyfill strategy ('entry', 'usage', false)
        useBuiltIns: 'entry',
      },
    ],
  ],
};
```

### Options

#### `corejs`, `debug`, `modules`, `useBuiltIns`

These options come from the `@babel/preset-env` preset and match the default values.

Read the [options](https://babeljs.io/docs/en/babel-preset-env#options) for more information on the possible values.

#### `typescript`

Enables `@babel/preset-typescript` to transfrom TypeScript into Javascript.

#### `typescriptOptions`

See all available [options](https://babeljs.io/docs/en/babel-preset-typescript).

#### `transformRuntime`

`boolean`, defaults to `false`

This option when `true` will enable the `@babel/plugin-transform-runtime` plugin.

#### `transformRuntimeOptions`

This option configures the `@babel/plugin-transform-runtime` plugin when the `transformRuntime` option has been enabled.

See available [options](https://babeljs.io/docs/en/babel-plugin-transform-runtime).

#### `react`

`boolean`, defaults to `false`.

This option when `true` will enable the `@babel/preset-react` preset.

#### `reactOptions`

See all available [options here](https://babeljs.io/docs/en/babel-preset-react).

##### `reactOptions.useBuiltIns`

`boolean`, defaults to `true`

Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.

---

For more detailed information, please refer to the [Babel documentation](https://babeljs.io/docs/en/presets).
npm package: @fmss/eslint-plugin
Description: FMSS's ESLint rules and configs
Author: Gürkan Sevil
Latest version: 1.3.0

# `@fmss/eslint-plugin`

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](../../LICENSE.md) [![npm version](https://badge.fury.io/js/%40fmss%2Feslint-plugin.svg)](https://badge.fury.io/js/%40fmss%2Feslint-plugin.svg)

FMSS's ESLint rules and configs

## Installation

You'll first need to install [ESLint](http://eslint.org):

**_With npm_**

```bash
$ npm install --save-dev @fmss/eslint-plugin
```

**_With yarn_**

```bash
$ yarn add --dev @fmss/eslint-plugin
```

**_With pnpm_**

```bash
$ pnpm add --save-dev @fmss/eslint-plugin
```

## Usage

From version 46.0.0, this package uses ESLint's "Flat Config" format. To upgrade, follow the, follow the [Configuration Migration Guide](https://eslint.org/docs/latest/use/configure/migration-guide).

---

FMSS’s ESLint configs are included in this package. Add the relevant configurations to your project's `eslint.config.js`. For example, to use the ESNext (ES2015 and later) config:

```js
import fmssEslintPlugin from '@fmss/eslint-plugin';

export default [...fmssEslintPlugin.configs.esnext];
```

You can augment the "core" config with additional ones. For example, to extend the ESNext config with React:

```js
import fmssEslintPlugin from '@fmss/eslint-plugin';

export default [
  ...fmssEslintPlugin.configs.esnext,
  ...fmssEslintPlugin.configs.react,
];
```

If using TypeScript and React, combine the TypeScript base config with React and Prettier:

```js
import fmssEslintPlugin from '@fmss/eslint-plugin';

export default [
  ...fmssEslintPlugin.configs.typescript,
  ...fmssEslintPlugin.configs.react,
  ...fmssEslintPlugin.configs.prettier,
];
```
npm package: @fmss/prettier-config
Description: FMSS's shared prettier config
Author: Gürkan Sevil
Latest version: 1.3.0

# `@fmss/prettier-config`

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](../../LICENSE.md) [![npm version](https://badge.fury.io/js/%40fmss%2Fprettier-config.svg)](https://badge.fury.io/js/%40fmss%2Fprettier-config.svg)

FMSS's shared prettier config

## Installation

```bash
$ npm install @fmss/prettier-config
```

## Usage

To enable these rules, add a `prettier` property in your `package.json` and reference this shared config as follows:

```
"prettier": "@fmss/prettier-config"
```
npm package: @fmss/typescript-config
Description: FMSS TypeScript configuration files for extending
Author: Gürkan Sevil
Latest version: 1.2.0

# `@fmss/typescript-config`

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](../../LICENSE.md) [![npm version](https://badge.fury.io/js/%40fmss%2Ftypescript-config.svg)](https://badge.fury.io/js/%40fmss%2Ftypescript-config.svg)

FMSS TypeScript configuration files for extending

## Installation

```bash
$ npm install @fmss/typescript-config
```

## Usage

The package includes several TypeScript configurations for different types of projects:

### Base (`base.json`)
Basic TypeScript configuration that other configs extend from. Use this as a starting point for custom configurations.

```json
{
  "extends": "@fmss/typescript-config/base.json",
  "compilerOptions": {
    "baseUrl": ".",
    "rootDir": "."
  }
}
```

### React Application (`application.json`)

```json
{
  "extends": "@fmss/typescript-config/application.json",
  "compilerOptions": {
    "baseUrl": ".",
    "rootDir": "."
  },
  "include": ["./app/**/*", "./tests/**/*"]
}
```

### React Library (`library.json`)

```json
{
  "extends": "@fmss/typescript-config/library.json",
  "compilerOptions": {
    "baseUrl": "./src",
    "rootDir": "."
  },
  "include": ["./src/**/*"]  
}
```

### Node Library (`node-library.json`)
Similar to library config but for Node.

```json
{
  "extends": "@fmss/typescript-config/node-library.json"
}
```

### Node Base (`node-base.json`)
Base configuration for Node.js applications.

```json
{
  "extends": "@fmss/typescript-config/node-base.json"
}
```

### Project that run in the browser (`dom.json`)
A configuration file is provided that included styles setup and a more conservative build target.

```json
{
  "extends": "@fmss/typescript-config/dom.json"
}
```
npm package: @fmtk/async-main
Description: Wrapper for async entrypoints
Author: Gordon Leigh
Latest version: 0.1.1

# @fmtk/async-main

Wrapper for async entry points.

## Quick Start

This package provides a function `run` which will execute an async main function:

```typescript
import {
  run,
  DefaultPrematureEndErrorCode,
  DefaultUnhandledRejectionErrorCode,
} from '@fmtk/async-main';

// can return PromiseLike<void> or PromiseLike<number>
async function main(args: string): Promise<number> {
  // args is is equal to process.argv.slice(2)
  console.log(`args: ${args.join('. ')}`);

  // use 1 as the exit code.
  return 1;
}

run(main, {
  // default options:
  continueOnUnhandledRejection: false,
  ignorePrematureEnd: false,
  onPrematureEnd: undefined,
  prematureEndErrorCode: DefaultPrematureEndErrorCode, // = 99
  unhandledRejectionErrorCode: DefaultUnhandledRejectionErrorCode, // = 100
});
```

## Options

```typescript
interface RunOptions {
  // don't bring the process down if an unhandled rejection occurs
  continueOnUnhandledRejection?: boolean;

  // don't use a non-zero return code if we run out async continuations
  ignorePrematureEnd?: boolean;

  // run a custom handler on premature end
  onPrematureEnd?: () => void;

  // error code to return if premature end is detected (default 99)
  prematureEndErrorCode?: number;

  // error code to return if there is an unhandled promise rejection
  unhandledRejectionErrorCode?: number;
}
```

## Unhandled promise rejection

By default the process will be ended with a non-zero exit code if an unhandled promise rejection occurs. This can be disabled by passing `true` for `continueOnUnhandledRejection` in the options parameter.

## Premature end detection

The `run` function expects for execution to return to it after awaiting your main function. If the process ends before this, it is because it has run out of things to do (run out of async continuations). This is usually indicative of an error, and is usually caused by incorrectly interfacing promises and traditional async code like streams.

By default such a case will cause the process to be exited with a non-zero exit code, unless disabled using the `ignorePrematureEnd`
npm package: @fmtk/cfntypes
Description: Typescript types for AWS CloudFormation types.
Author: Gordon Leigh
Latest version: 0.50.0

# @fmtk/cfntypes

Typescript types for AWS CloudFormation types.

## Specification Version

The specification version is available via the `ResourceSpecificationVersion` export and via `awsResourceSpecificationVersion` in `package.json`.

```typescript
import { ResourceSpecificationVersion } from '@fmtk/cfntypes';

console.log(`using version ${ResourceSpecificationVersion}`);
```

## Resource Types

The resource types are all defined individually as interfaces with predictable names, and also as properties of the `ResourceTypes` interface keyed by the CloudFormation resource type.

```typescript
import { ResourceTypes, ResourceType } from '@fmtk/cfntypes';

type ApiGatewayProps = ResourceTypes[ResourceType.ApiGatewayRestApi];
// also exported as ApiGatewayRestApi
```

## Attribute Types

The attribute types are all defined individually as interfaces with predictable names, and also as properties of the `AttributeTypes` interface keyed by the CloudFormation resource type. Note that not all resource types have attributes.

```typescript
import { AttributeTypes, AttributeTypeFor } from '@fmtk/cfntypes';

type ApiGatewayAttribs = AttributeTypes[ResourceType.ApiGatewayRestApi];
// also exported as ApiGatewayRestApiAttributes

// the AttributeTypeFor helper returns `never` for resources
// with no attributes defined
type NeverAttribs = AttributeTypeFor<ResourceType.ApiGatewayAccount>;
```
npm package: @fmtk/dbtest
Description: util for running tests in a database
Author: Gordon Leigh
Latest version: 0.2.0

# @fmtk/dbtest

This package creates a test database for jest tests.

Use it like this:

```javascript
import { connectTestDatabase } from '@fmtk/dbtest';

describe('my cool feature', () => {
  // don't destructure here
  const context = connectTestDatabase();

  it('does something', async () => {
    const result = context.pool.query('SELECT current_database()');
  });
});
```

## API

### Options

```typescript
interface Options {
  connection?: pg.ClientConfig; // from node-postgres
  eachTest?: boolean; // create a new database for each test
  initialDatabase?: string; // initial db to connect to (default 'postgres')
}
```

### connectTestDatabase

```typescript
function connectTestDatabase(options?: Options): { pool: pg.Pool };
```

This will register Jest `beforeAll` and `afterAll` handlers (or `beforeEach` and `afterEach` if `eachTest` is `true`) which create and delete a test database. The database is named `test_xxxxxx` where `xxxxxx` is a random string generated by [nanoid](https://github.com/ai/nanoid).

The connection parameters can be passed in the first argument. If `database` is specified, this will be used instead of the auto-generated name.

If no `user` is specified, it will default to `postgres`.
npm package: @fmtk/decoders
Description: Lightweight, composable validation and serialization library.
Author: Gordon Leigh
Latest version: 0.5.6

# @fmtk/decoders

Lightweight, composable validation and serialization library.

## What's it for?

Typescript lets you check your own code and nothing more. This library lets you check data flowing in and out of code that is under your control.

## Show me the code!

The following code creates a validator for an object then prints the results of a validation.

```typescript
const myModel = object({
  greeting: text,
  name: text,
  age: optional(integer),
});

const result = myModel(getValueFromSomewhere());

if (result.ok) {
  console.log(value);
} else {
  console.error(result.error);
}
```

## Documentation

See [documentation](https://futurematik.github.io/decoders/index.html).

## Influences

This project is the successor to the [@fmtk/validation package](https://www.npmjs.com/package/@fmtk/validation) which has seen use in numerous Futurematik projects. I wanted to make an API that was a bit clearer in intent compared to the original validation package.

The design of this project has been influenced by the [decoders package](https://www.npmjs.com/package/decoders) which I discovered early in the build. I considered abandoning this project in favour of the latter, but I decided I wanted to build a Typescript implementation.
npm package: @fmtk/graph
Description: Library for graph structures
Author: Gordon Leigh
Latest version: 0.2.1

# @fmtk/graph

This library includes some functions for working with graph structures.

## Basics

A graph is represented by a `Map<T, T[]>` – i.e. a map that has a key for each vertex, with the value being an array of children. Note that leaf nodes will be present with an empty array of children.

A graph can also be represented by a list of edges (`[T, T][]`). Each element in the array is a 2-element array with the source as the first element and the target as the second.

## Functions

### fromEdges

Build a `Map<T, T[]>` from a list of edges (`[T, T][]`).

```typescript
function fromEdges<T>(edges: [T, T][]): Map<T, T[]>;
```

### fromNodes

Build a `Map<T, T[]>` from an existing arbitrary graph structure.

```typescript
function fromNodes<T>(root: T, getChildren: (node: T) => T[]): Map<T, T[]>;
```

### getLeaves

Get an array of leaf nodes (nodes with no children) from the given graph.

```typescript
function getLeaves<T>(graph: Map<T, T[]>): T[];
```

### hasCycles

Returns true if the graph contains a cycle reachable from the given node.

```typescript
function hasCycles<T>(graph: Map<T, T[]>, from: T): boolean;
```

### toEdges

Build a list of edges (`[T, T][]`) from a graph map (`Map<T, T[]>`).

```typescript
function toEdges<T>(graph: Map<T, T[]>): [T, T][];
```

### topologicalSort

Build a list of all nodes, sorted in an order such that for any given node, all nodes which point to that node come first in the list.

```typescript
function topologicalSort<T>(graph: Map<T, T[]>): T[];
```
npm package: @fmtk/migrations
Description: Helper library for database migrations
Author: Gordon Leigh
Latest version: 0.2.0

# @fmtk/migrations

Simple tool to figure out which migrations to apply.

Start with some migrations:

```typescript
const usersMigration = new Migration(
  [],
  [
    `CREATE TABLE users(
    id int primary key, 
    name text
  )`,
  ],
);

const booksMigration = new Migration(
  [usersMigration],
  [
    `CREATE TABLE books(
    id int primary key,
    name text
  )`,
    `CREATE TABLE user_books(
    user_id int foreign key references users(id), 
    book_id int foreign key references books(id)
  )`,
  ],
);
```

Suppose developer Steve works on a feature to add the date that a user read a book:

```typescript
const bookReadDateMigration = new Migration(
  [booksMigration],
  [`ALTER TABLE user_books ADD COLUMN read_date date NULL`],
);
```

At the same time developer Jessica is working on a feature to add films:

```typescript
const filmsMigration = new Migration(
  [booksMigration],
  [
    `CREATE TABLE films(
    id int primary key,
    name text
  )`,
    `CREATE TABLE user_films(
    user_id int foreign key references users(id), 
    film_id int foreign key references films(id)
  )`,
  ],
);
```

With other migration systems that apply migrations in sequence, this would be annoying to merge even though the two changes are independent. Here we can just add another migration that has both migrations as a parents:

```typescript
const booksAndFilmsMigration = new Migration(
  [bookReadDateMigration, filmsMigration],
  [],
);
```

Migrations are identified by a SHA-1 hash of the SQL statements and parent hashes. It is suggested that a list of applied hashes are stored in a migrations table in the database. Given such a list of hashes, and the head migration, a list of migrations to apply (in order) can be obtained:

```typescript
const appliedMigrations = ['hash1', 'hash2'];

const migrations: Migration[] = getMigrationsToApply(
  appliedMigrations,
  booksAndFilmsMigration,
);
```

If `appliedMigrations` contains hashes not reachable from the given head migration, an error will be thrown.
npm package: @fmtk/package-path
Description: Get information about the package path.
Author: Gordon Leigh
Latest version: 0.1.2

# @fmtk/package-path

Get information about the package path.

## Quick start

In your module, add the following code:

```typescript
import { getModulePath } from '@fmtk/package-path';

export const source = getModulePath();

export function foo() {
  console.log('hello world');
}
```

In your dependent module, reference the function like this:

```typescript
// import the module from above
import * as mymodule from 'mymodule';

// the 'foo' argument is type-checked
const handler = getHandler(mymodule, 'foo');
```

```javascript
handler = {
  code: '/path/to/node_modules/mymodule/',
  handler: 'lib/filename.foo',
};
```
npm package: @fmtk/s3-put-object
Description: Write an object with the given content to an S3 bucket. If an object is supplied to the data prop, it will be serialized, but note that numbers and booleans are converted to strings by CloudFormation.
Author: Gordon Leigh
Latest version: 0.4.3

# S3PutObject

Write an object with the given content to an S3 bucket. If an object is supplied to the data prop, it will be serialized, but note that numbers and booleans are converted to strings by CloudFormation.

```typescript
const bucket = new s3.Bucket(this, 'Bucket');

new S3PutObject(this, 'PutObj', {
  bucket: bucket.bucketName,
  objectName: 'test/file.json',
  // the data object will be serialized
  data: {
    one: 1, // but this will be written as a string
    two: 'two',
  },
});
```
npm package: @fmtk/s3-unpack-asset
Description: Upload a zip and unpack it to the specified bucket.
Author: Gordon Leigh
Latest version: 0.3.3

# S3UnpackAsset

Upload a zip and unpack it to the specified bucket.

```typescript
const bucket = new s3.Bucket(this, 'Bucket');

const asset = makeFileAsset(this, 'path/to/folder/');

new S3UnpackAsset(this, 'Unpack', {
  sourceBucket: asset.s3BucketName,
  sourceObjectName: asset.s3ObjectKey,
  destinationBucket: bucket.bucketName,
  destinationPrefix: 'foo/bar',
});
```
npm package: @fmtk/value-collection
Description: A collection of types and utility functions for manipulating case-insensitive maps of values, such as HTTP headers.
Author: Gordon Leigh
Latest version: 0.1.2

# value-collection

A collection of types and utility functions for manipulating case-insensitive maps of values, such as HTTP headers.

## API

### ValueCollection<T>

```typescript
interface ValueCollection<T> {
  [key: string]: T;
}
```

A key-value map.

### addToValues()

```typescript
function addToValues<T>(values: T[] | T | undefined, value: T): T[] | T;
```

Adds `value` to the end of the `values` array, returning a new instead of modifying the original.

### addValue()

```typescript
function addValue<T>(
  values: ValueCollection<T[]>,
  key: string,
  value: T,
): ValueCollection<T[]>;
function addValue<T>(
  values: ValueCollection<T | T[]>,
  key: string,
  value: T,
): ValueCollection<T | T[]>;
```

Adds a `value` to a `key`, which may or may not already exist.

### findKey()

```typescript
function findKey<T>(
  headers: ValueCollection<T>,
  key: string,
): string | undefined;
```

Does a case-insensitive search for a key and returns the original case or undefined if not found.

### getLastValue()

```typescript
function getLastValue<T>(
  values: ValueCollection<T | T[]>,
  key: string,
): T | undefined;
function getLastValue<T>(
  values: ValueCollection<T[]>,
  key: string,
): T | undefined;
```

Get the last value for a given `key` in a map of arrays.

### getValue()

```typescript
function getValue<T>(values: ValueCollection<T>, key: string): T | undefined;
```

Does a case-insensitive search for a `key` and returns the value if it exists.

### normalize()

```typescript
function normalize<T>(values: ValueCollection<T[]>): ValueCollection<T | T[]>;
```

For a map with array values, returns the result of calling `normalizeValue()` to each value, removing undefined values.

### normalizeValue()

```typescript
function normalizeValue<T>(value: T[]): T | T[] | undefined;
```

If value has zero elements, return undefined; if value has 1 element, return the element; and otherwise return the array.

### overrideValues()

```typescript
function overrideValues<T>(
  ...collections: ValueCollection<T>[]
): ValueCollection<T>;
```

Process the collections from left to right, with later values overriding earlier ones.

### setValue()

```typescript
function setValue<T>(
  values: ValueCollection<T>,
  key: string,
  value: T,
): ValueCollection<T>;
```

Set a value in a collection with a case-insensitive key lookup.

### toArrayValue()

```typescript
function toArrayValue<T>(value: T | T[]): T[];
```

Ensure that `value` is an array.

### toArrayValues()

```typescript
function toArrayValues<T>(
  values: ValueCollection<T | T[]>,
): ValueCollection<T[]>;
```

Convert each value in the map into an array.
npm package: @fmvilas/oclif-plugin-spaced-commands
Description: convert an oclif CLI to use spaced commands
Author: Philipe Navarro @RasPhilCo, Tiago Nápoli @tiagonapoli, Fran Mendez @fmvilas
Latest version: 1.0.4

@oclif/plugin-spaced-commands
======

**WARNING: this is an experimental plugin**

convert an oclif CLI to use spaced commands

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/oclif-plugin-spaced-commands.svg)](https://npmjs.org/package/oclif-plugin-spaced-commands)

[![CircleCI](https://circleci.com/gh/RasPhilCo/oclif-plugin-spaced-commands/tree/master.svg?style=shield)](https://circleci.com/gh/RasPhilCo/oclif-plugin-spaced-commands/tree/master)

[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/RasPhilCo/oclif-plugin-spaced-commands?branch=master&svg=true)](https://ci.appveyor.com/project/RasPhilCo/oclif-plugin-spaced-commands/branch/master)
[![Codecov](https://codecov.io/gh/RasPhilCo/oclif-plugin-spaced-commands/branch/master/graph/badge.svg)](https://codecov.io/gh/RasPhilCo/oclif-plugin-spaced-commands)
[![Downloads/week](https://img.shields.io/npm/dw/oclif-plugin-spaced-commands.svg)](https://npmjs.org/package/oclif-plugin-spaced-commands)
[![License](https://img.shields.io/npm/l/oclif-plugin-spaced-commands.svg)](https://github.com/RasPhilCo/oclif-plugin-spaced-commands/blob/master/package.json)

Instead of oclif's standard colon-seperated commands:

```
$ mycli foo:bar:baz qux
```

this plugin converts oclif's command ID parsing to use spaced commands:

```
$ mycli foo bar baz qux
```

> Note: topic index commands (topic-commands) are therefore ignored

# Install

Add `@oclif/plugin-spaced-commands` as a package dependency and to oclif's plugins list in package.json