open-index/open-npm huggingface dataset:
npm package: @specter-labs/eslint-config
Description: ESLint configuration used by SpecterLabs
Author: Wayne Souto
Latest version: 1.1.7

<h1 align="center">@specter-labs/eslint-config</h1>
<p align="center">🧹 ESLint Config used in all project from Specter Labs 🧹</p>

[![NPM Downloads](https://img.shields.io/npm/d18m/%40specter-labs%2Feslint-config?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/eslint-config)
[![NPM License](https://img.shields.io/npm/l/%40specter-labs%2Feslint-config?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/eslint-config)
[![NPM Version](https://img.shields.io/npm/v/%40specter-labs%2Feslint-config?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/eslint-config)
[![NPM Last Update](https://img.shields.io/npm/last-update/%40specter-labs%2Feslint-config?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/eslint-config)

## 🚀 Setup

1. Install with your favorite package manager:
   - pnpm : `pnpm add -D eslint @specter-labs/eslint-config`
   - npm : `npm i -D eslint @specter-labs/eslint-config`
   - yarn : `yarn add -D eslint @specter-labs/eslint-config`
   - bun : `bun add -D eslint @specter-labs/eslint-config`

2. Create a `eslint.config.mjs` in the project root:
```js
// eslint.config.mjs
import { linterConfig } from '@specter-labs/eslint-config'

export default linterConfig()
```

3. Add lint scripts to `package.json`:
```json
{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}
```

4. Add the following configuration to `.vscode/settings.json`:
```json
{
  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,

  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off" },
    { "rule": "format/*", "severity": "off" },
    { "rule": "*-indent", "severity": "off" },
    { "rule": "*-spacing", "severity": "off" },
    { "rule": "*-spaces", "severity": "off" },
    { "rule": "*-order", "severity": "off" },
    { "rule": "*-dangle", "severity": "off" },
    { "rule": "*-newline", "severity": "off" },
    { "rule": "*quotes", "severity": "off" },
    { "rule": "*semi", "severity": "off" }
  ],

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "typescript",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml",
    "toml",
    "xml",
    "gql",
    "graphql",
  ]
}
```
npm package: @specter-labs/fastify-logger
Description: Fastify logger plugin for logging requests
Author: Wayne Souto
Latest version: 1.0.5

# Fastify Logger

[![NPM Downloads](https://img.shields.io/npm/d18m/%40specter-labs%2Ffastify-logger?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/fastify-logger)
[![NPM License](https://img.shields.io/npm/l/%40specter-labs%2Ffastify-logger?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/fastify-logger)
[![NPM Version](https://img.shields.io/npm/v/%40specter-labs%2Ffastify-logger?style=flat-square&logo=npm)](https://www.npmjs.com/package/@specter-labs/fastify-logger)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

Advanced HTTP request logging plugin for Fastify with support for custom contexts and flexible configuration.

## Install

```bash
npm i @specter-labs/fastify-logger
```

## Usage

```js
import Fastify from 'fastify'
import logger from '@specter-labs/fastify-logger'

const fastify = Fastify()

// Register the plugin with default options
await fastify.register(logger)

// Or with custom options
await fastify.register(logger, {
  level: 'info',
  prefix: 'api',
  ignoreStatusCodes: [400],
  adapter: {
    log: (message) => console.log(message),
    error: (message) => console.error(message)
  }
})
```

## Options

| Option | Default | Description |
|--------|---------|-------------|
| `level` | `'info'` | The logging level. Can be `'info'` or `'error'` |
| `prefix` | `undefined` | Optional prefix for log messages |
| `ignoreStatusCodes` | `[]` | Array of HTTP status codes to ignore |
| `ignorePaths` | `[]` | Array of URL paths to ignore. If a request URL starts with any of these paths, it won't be logged |
| `adapter` | `{ log: fastify.log.info, error: fastify.log.error }` | Custom logging adapter implementation |
| `logUserAgent` | `false` | When enabled, logs the user agent after the ip |
| `logRequestPayload` | `false` | When enabled, logs the request payload for error responses |

### Custom Adapter

You can provide a custom adapter to handle logging:

```js
const customAdapter = {
  log: (message) => {
    // Handle regular logs
  },
  error: (message) => {
    // Handle error logs
  }
}

await fastify.register(logger, { adapter: customAdapter })
```

## Log Format

The plugin logs requests in the following format:

```
[prefix] timestamp | statusCode | responseTime | ip | method | url
```

For errors, the error message is appended:

```
[prefix] timestamp | statusCode | responseTime | ip | method | url | errorMessage
```

## License

Licensed under [MIT](./LICENSE).
npm package: @specter/redux-effects-specter
Description: redux middleware of specter client
Author: Kento TSUJI
Latest version: 0.7.4

# redux-effects-specter

[specter](https://github.com/recruit-tech/specter)
binding for
[redux-effects](https://www.npmjs.com/package/redux-effects)
family.

## Installation

```
npm install --save redux-effects-specter
```

## Usage

Installing the middleware:

```javascript
import { createStore, applyMiddleware } from 'redux';
import { Client } from '@specter/specter';
import stepsMiddleware from 'redux-effects-steps';
import specterMiddleware from '@specter/redux-effects-specter';
import rootReducer from './reducers';

const client = new Client({
  base: '/xhr'
});

const store = createStore(
  rootReducer,
  applyMiddleware(
    stepsMiddleware,
    fetchrMiddleware(fetchr)
  )
);
```

Defining action creators:

```javascript
import { createAction } from 'redux-actions';
import { steps } from 'redux-effects-steps';
import { specterRead } from '@specter/redux-effects-specter';

const fetchUserRequest = createAction('FETCH_USER_REQUEST');
const fetchUserSuccess = createAction('FETCH_USER_SUCCESS');
const fetchUserFail = createAction('FETCH_USER_FAIL');

function fetchUser(user) {
  return steps(
    fetchUserRequest(),
    specterRead('users', { user }),
    [fetchUserSuccess, fetchUserFail]
  );
}
```

## API (Action Creators)

### specterCreate

- types

```
(service: string, options: { query?: object; body?: object; headers?: object } = {}): Promise
```

### specterUpdate

- types

```
(service: string, options: { query?: object; body?: object; headers?: object } = {}): Promise
```

### specterDelete

- types

```
(service: string, options: { query?: object; headers?: object } = {}): Promise
```

### specterRead

- types

```
(service: string, options: { query?: object; headers?: object } = {}): Promise
```
npm package: @specter/redux-effects-specter-cache
Description: cache structure for redux middleware of specter
Author: Kento TSUJI
Latest version: 0.5.5

# redux-effects-specter-cache

Caching middleware for
[@specter/redux-effects-specter](https://www.npmjs.com/package/@specter/redux-effects-specter).

## Installation

```
npm install --save @specter/specter  \                  # peer dependency
                   @specter/storage \                   # peer dependency
                   @specter/redux-effects-specter \     # peer dependency
                   @specter/redux-effects-specter-cache
```

## Usage

Installing the middleware:

```javascript
import { createStore, applyMiddleware } from 'redux';
import { Client } from '@specter/specter';
import stepsMiddleware from 'redux-effects-steps';
import specterMiddleware from '@specter/redux-effects-specter';
import specterCacheMiddleware from '@specter/redux-effects-specter-cache';
import rootReducer from './reducers';

const client = new Client({
  base: '/xhr'
});

const cacheConfig = {
  max: 500,
  maxAge: 1000 * 60 * 60
};

const cacheMiddlewareConfig = {
  excludes: [
    "greet" // expected service name of specter
  ]
}

const store = createStore(
  rootReducer,
  applyMiddleware(
    stepsMiddleware,
    specterCacheMiddleware({ cacheConfig, cacheMiddlewareConfig }),
    specterMiddleware(client)
  )
);

```
redux-effects-specter-cache must be applied **before** redux-effects-specter.

## API

### Middleware

#### `specterCacheMiddleware(cacheConfig, [options])`

Creates redux middleware.

##### Arguments

* `options` *(Object)* : LRE-cache option and middleware option
  * `cacheConfig` *(Object)*: See
    [lru-cahce API docs](https://www.npmjs.com/package/lru-cache)
    for more info.
  * `middlewareOption` *(Object)*:
      * `excludes` *(Array)*: An array of the resource names to not use the cache.
        Defaults `[]`.
      * `fromCache` *(Function)*: Checks whether an action is target to obtain from cache.
        Defaults `() => true`.
          * Arguments:
              * `action` *(Object)*: An action.
              * `state` *(Object)*: The current state of the Store.
          * Returns:
              * *(Boolean)*: If `true`, uses cache to obtain the resource.
      * `toCache` *(Function)*: Checks whether an action is target to store to cache.
        Defaults `() => true`.
          * Arguments:
              * `action` *(Object)*: An action.
              * `state` *(Object)*: The current state of the Store.
          * Returns:
              * *(Boolean)*: If `true`, saves the obtaining resource to cache.
      * `resetCache` *(Function)*: reset cache if resetCache function returns true.
        Defaults `() => false`.
          * Arguments:
              * `action` *(Object)*: An action.
              * `state` *(Object)*: The current state of the Store.
          * Returns:
              * *(Boolean)*: If `true`, reset all cache.

##### Returns

* *(Function)*: Redux middleware.