open-index/open-npm huggingface dataset:
npm package: @slifercd/sli_cli
Description: ---
Latest version: 1.4.1

# sli_cli

---

## sli init_ts

-   To make the structer and you can use -g or --git to init git

-   To add github actions use -a --actions

-   To add license -l then the username

### and you can combine the all of them as long the l is the last like : -agl name

```bash

sli init_ts -gal slifer

```

## sli init_py

-   To make the structer and you can use -g or --git to init git

-   To add github actions use -a --actions

-   To add modules dir use -m --modules

-   To add license -l then the username

### and you can combine the all of them as long the l is the last like : -amgl name

```bash

sli init_py -gaml slifer

```

## sli init_next <name>

-   To use pnpm -p or --pnpm

## sli mit <name>

-   Used to generate the MIT license in a new file called `LICENSE` with the name of the user

-   To use git -g or --git

## sli mkdirs <name>

- Used to create a new directories inside each other (`<name>` => `first/second`)

## sli git

-   To init git in the current directory and make sure that the defaul branch name is main
npm package: @slightc/horiz-menu
Description: horizontal menu with response
Latest version: 1.0.0

# horizontal menu

@slightc/horiz-menu

horizontal menu with response

## API

| 参数名 | 说明 | 必填 | 类型 | 默认值 | 备注 |
| ------ | ---- | ---- | ---- | ------ | ---- |
|        |      |      |      |        |      |
npm package: @slightheat/slightheat-evp-common
Description: 天梯前端框架工具包
Author: slightheat
Latest version: 1.2.1

# slightheat-evp-common
一套常用的自行封装的工具类库，提供一些常用的方法

## 安装

```shell
npm install @slightheat-evp/slightheat-evp-common -S
```

## 使用

```javascript
import { CommonUtil, IdUtil } from '@slightheat-evp/slightheat-evp-common'

const currentTime = CommonUtil.getDateTime(0);
const id = IdUtil.getUUID();
```
npm package: @slightheat/slightheat-evp-core
Description: 前端框架核心包
Author: slightheat
Latest version: 1.2.1

# slightheat-evp-core
天梯前端框架核心包，包括权限认证、多主题、微应用、动态菜单等功能的集成。

## 安装

```shell
npm install @slightheat-evp/slightheat-evp-core -S
```

## 使用

```javascript
import EvpAdmin from '@slightheat/slightheat-evp-core';

Vue.use(EvpAdmin, { store, router });
```
npm package: @slightheat/slightheat-evp-ui
Description: 天梯前端框架组件包
Author: slightheat
Latest version: 1.2.1

# slightheat-evp-ui
一套常用的自行封装的基于elementUI的高度适配天梯框架的ui库

## 安装

```shell
npm install @slightheat-evp/slightheat-evp-ui -S
```

## 使用

```javascript
// main.js

import EvpUI from '@slightheat/slightheat-evp-ui';

Vue.use(EvpUI);
```
npm package: @slightheat/slightheat-page-designer
Description: A utility library for slightheat-evp various operations
Author: slightheat
Latest version: 0.0.9

# slightheat-page-designer
表单解析器

## 安装

```shell
npm install @slightheat-evp/slightheat-page-designer -S
```

## 使用

```javascript
import '@slightheat/slightheat-page-designer';
```
npm package: @slightlyoff/share-button
Description: A web component for sharing.
Author: Alex Russell
Latest version: 0.6.1

# `<share-button>`

A performance-first web component for content sharing. Initially developed for (and you can see it used on) [infrequently.org](https://infrequently.org/)

Provides:

  - Sharing via [Web Share API](https://web.dev/web-share/) as well as direct link copy and toot/tweet buttons
  - Themeing through CSS variables and Web Component `::part()`s
  - Tiny footprint; a single file, ~4KiB gzipped, and traced to death by someone who knows their way around a browser

## Using/Configuring

See `share.html` for examples.

Basic use is to import the (single) script file (no dependencies), prefereably with modern syntax so as to avoid browsers that can't support it:

```html
<script type="module">
  import "./share-button.js";
</script>
<share-button
  title="Infrequently Noted"
  url="https://infrequently.org/">
</share-button>
```

Styling is handled via CSS `::part()` directives and variables, e.g.:

```css
share-button.blue {
  --color: darkblue;
  --hover-bg-color: rgba(53, 49, 181, 0.219);
  --transition-duration: 0.2s;
  --hover-scale: 1.5;
}

share-button.never-tweet::part(tweet-button) {
  display: none;
}
```

The important `::part()`s are:

  - `share-button`
  - `tweet-button`
  - `toot-button`
  - `copy-link-button`

## Building/Hacking

This thing is a super bare-bones, no-frills, no-frameworks.

Building requires a functional linux environment (WSL and Crostini work great) with [`fonttools`](https://github.com/fonttools/fonttools) in your `PATH`. On Debian-derived distros, a quick `sudo apt install fonttools` should be enough.

The design works by:

  - Subsetting from the checked-in [fontawesome](https://fontawesome.com/) glyphs; see `subset.sh` to add a glyph.
  - The resulting combined font is then subsetted, which considerably reduces resulting binary size
  - That subset is then base64 encoded and dropt on disk at `combined.woff2`
  - We then manually copy this into the URL injected by `share-button.js` (yes, yes, I know)
  - This is then loaded in a singleton way as the script loads. This might cause a global style recalc! Caveat emptor.
  - When instantiated, the web components reply on this font for their glyphs.

The care taken to minimize dependencies for the component (no framework) and binary size means the whole shebang should come down the wire in less than 4KiB, making it suitable for inlining in aggressive setups.
npm package: @slightlytyler/react-formal-bootstrap
Description: react-formal-bootstrap ===
Author: 4Catalyzer
Latest version: 1.1.0

react-formal-bootstrap
===

A `react-bootstrap` form input adapter for react-formal

```js
import Form from 'react-formal'
import types from 'react-formal-bootstrap';

Form.addInputTypes(types);
```

You can also use each input individually outside of the react-formal context by importing the
input from `react-formal-bootstrap/lib`, to take advantage of the value parsing logic not present in native inputs.


## Example

```js
import React from 'react';
import Form from 'react-formal';
import * as yup from 'yup';

import ControlLabel from 'react-bootstrap/lib/ControlLabel';

import FormGroup from 'react-formal-bootstrap/lib/FormGroup';

const schema = yup.object({
  name: yup.string(),
  age: yup.number(),
  favoriteColor: yup.array(
    yup.string()
  )
})

function MyForm() {
  return (
    <Form schema={schema}>
      <FormGroup for="name" controlId="field--name">
        <ControlLabel>Name</ControlLabel>
        <div>
          <Form.Field name="name" />
          <Form.Message for="name" />
        </div>
      </FormGroup>
      <FormGroup for="age" controlId="field--age">
        <ControlLabel>Age</ControlLabel>
        <div>
          <Form.Field name="age" />
          <Form.Message for="age" />
        </div>
      </FormGroup>
      <FormGroup for="favoriteColor" controlId="field--age">
        <ControlLabel>Favorite color</ControlLabel>
        <div>
          <Form.Field name="favoriteColor">
            <option value={null}> </option>
            <option value="red">Red</option>
            <option value="blue">blue</option>
            <option value="green">green</option>
          </Form.Field>
          <Form.Message for="favoriteColor" />
        </div>
      </FormGroup>
    </Form>   
  )
}
```
npm package: @slightlytyler/react-slot-fill
Description: React tool for composing complex UIs. Like a portal gun for your components.
Author: slightlytyler
Latest version: 1.0.0-alpha-9

# @slightlytyler/react-slot-fill

> React tool for composing complex UIs. Like a portal gun for your components

[![NPM](https://img.shields.io/npm/v/@slightlytyler/react-slot-fill.svg)](https://www.npmjs.com/package/@slightlytyler/react-slot-fill) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save @slightlytyler/react-slot-fill
```

## Usage

```tsx
import React, { Component } from 'react'

import MyComponent from '@slightlytyler/react-slot-fill'
import '@slightlytyler/react-slot-fill/dist/index.css'

class Example extends Component {
  render() {
    return <MyComponent />
  }
}
```

## License

MIT © [slightlytyler](https://github.com/slightlytyler)
npm package: @slightlytyler/webpack-shell-plugin
Description: Run shell commands before and after webpack builds
Latest version: 0.4.5

[![npm version](https://badge.fury.io/js/webpack-shell-plugin.svg)](https://badge.fury.io/js/webpack-shell-plugin)
![](https://reposs.herokuapp.com/?path=1337programming/webpack-shell-plugin)
[![npm](https://img.shields.io/npm/dm/webpack-shell-plugin.svg)]()
# Webpack Shell Plugin

This plugin allows you to run any shell commands before or after webpack builds. This will work for both webpack and webpack-dev-server.

Goes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.

## Installation

`npm install --save-dev webpack-shell-plugin`

## Setup
In `webpack.config.js`:

```js
const WebpackShellPlugin = require('webpack-shell-plugin');

module.exports = {
  ...
  ...
  plugins: [
    new WebpackShellPlugin({onBuildStart:['echo "Webpack Start"'], onBuildEnd:['echo "Webpack End"']})
  ],
  ...
}
```

## Example

Insert into your webpack.config.js:

```js
const WebpackShellPlugin = require('webpack-shell-plugin');
const path = require('path');

var plugins = [];

plugins.push(new WebpackShellPlugin({
  onBuildStart: ['echo "Starting"'],
  onBuildEnd: ['python script.py && node script.js']
}));

var config = {
  entry: {
    app: path.resolve(__dirname, 'src/app.js')
  },
  output: {
    path: path.resolve(__dirname, 'dist'), // regular webpack
    filename: 'bundle.js'
  },
  devServer: {
    contentBase: path.resolve(__dirname, 'src') // dev server
  },
  plugins: plugins,
  module: {
    loaders: [
      {test: /\.js$/, loaders: 'babel'},
      {test: /\.scss$/, loader: 'style!css!scss?'},
      {test: /\.html$/, loader: 'html-loader'}
    ]
  }
}

module.exports = config;

```
Once the build finishes, a child process is spawned firing both a python and node script.

### API
* `onBuildStart`: array of scripts to execute on the initial build. **Default: [ ]**
* `onBuildEnd`: array of scripts to execute after files are emitted at the end of the compilation. **Default: [ ]**
* `onBuildExit`: array of scripts to execute after webpack's process is complete. **Default: [ ]**
* `dev`: switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. **Default: true**
* `verbose`: enable for verbose output. **Default: false**

### Developing

If opening a pull request, create an issue describing a fix or feature. Have your pull request point to the issue by writing your commits with the issue number in the message.

Make sure you lint your code by running `npm run lint` and you can build the library by running `npm run build`.

I appreciate any feed back as well, Thanks for helping!

### Other Webpack Plugins
Also checkout our other webpack plugin [WebpackBrowserPlugin](https://github.com/1337programming/webpack-browser-plugin).

### Contributions
Yair Tavor
npm package: @sliit-foss/actions-exec-wrapper
Description: A wrapper around the @actions/exec module which promisifies the console output of a command
Author: SLIIT FOSS
Latest version: 2.0.0

# @sliit-foss/actions-exec-wrapper

### A wrapper around the [@actions/exec](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiZ6tHV0Mr4AhXhTGwGHUPnBJ0QFnoECAoQAQ&url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40actions%2Fexec&usg=AOvVaw26dWB7pmcPpZtcQ8teo8Qe) module which promisifies the console output of a command

<br/>

---

## Installation

```js
# using npm
npm install @sliit-foss/actions-exec-wrapper

# using yarn
yarn add @sliit-foss/actions-exec-wrapper
```

## Usage

```js
# using require
const exec = require("@sliit-foss/actions-exec-wrapper").default;

# using import
import exec from "@sliit-foss/actions-exec-wrapper";
```

## Example<br/>

```js
exec("npm --version")
  .then((result) => {
    console.log(result);
  })
  .catch((error) => {
    console.log(error);
  });
```
npm package: @sliit-foss/babel-plugin-transform-trace
Description: Adds tracing to the source code during transformation
Author: SLIIT FOSS
Latest version: 0.3.0

# @sliit-foss/babel-plugin-transform-trace

> Adds tracing to the source code during transpilation

> The transformed code will need the following package installed to be able to successfully run :- [@sliit-foss/functions]('https://www.npmjs.com/package/@sliit-foss/functions')

<br/>

## Install

<br/>

Using npm:

```sh
npm install --save-dev @sliit-foss/babel-plugin-transform-trace
```

or using yarn:

```sh
yarn add @sliit-foss/babel-plugin-transform-trace --dev
```

<br/>

## Options

- **ignore-functions**: Array of function names to ignore when adding tracing
- **clean**: Boolean value which when `true` omits the default behaviour of tracing anonymous functions which can pollute the logs

---

- Example babel config:-

  ```json
  {
    "plugins": [
      [
        "@sliit-foss/babel-plugin-transform-trace",
        {
          "ignore-functions": ["foo", "bar"],
          "clean": true
        }
      ]
    ]
  }
  ```
npm package: @sliit-foss/clusterizer
Description: A wrapper around the node cluster module to make it easier to bootstrap a clusterized application
Author: SLIIT FOSS
Latest version: 2.0.1

# @sliit-foss/clusterizer

### A wrapper around the node cluster module to make it easier to bootstrap a clusterized application<br><br>

## Installation

```js
# using npm
npm install @sliit-foss/clusterizer

# using yarn
yarn add @sliit-foss/clusterizer
```

## Usage

```js
const { default: clusterize } = require("@sliit-foss/clusterizer");

// or

import clusterize from "@sliit-foss/clusterizer";

.....
.....

const server = () => {
    const app = express();

    app.get("/", (req, res) => {
        res.send("Hello World");
    });

    app.listen(3000, () => {
        console.log("Server started on port 3000");
    });
};

clusterize(server);

```

## Custom Options

- `workers` - number of workers to spawn
  - default: `os.cpus().length`
- `onMaster` - callback to run on master process
  - default: `() => logger.info(`\`Clusterizer - Master ${process.pid} is running\``)`
- `onWorker` - callback to run on worker process
  - default: `() => logger.info(`\`Clusterizer - Process ${process.pid} started\``)`
- `onWorkerExit` - callback to run on worker exit
  - default: `() => logger.info(`\`Clusterizer - Worker \${process.pid} died - code: \${code} - signal: ${signal}\``)`
- `logger` - custom logger to use if default callback handlers are used
  - default: `console`

```js
clusterize(server, {
  workers: 4,
  onMaster: () => {
    console.log("Master process started");
  },
  onWorker: () => {
    console.log("Worker process started");
  },
  onExit: (worker, code, signal) => {
    console.log("Worker process exited");
  }
});
```
npm package: @sliit-foss/eslint-config-internal
Description: Custom ESLint config for SLIIT FOSS
Author: SLIIT FOSS
Latest version: 1.1.6

# @sliit-foss/eslint-config-internal

> Custom ESLint config for SLIIT FOSS

## Install

Using npm:

```sh
npm install --save-dev @sliit-foss/eslint-config-internal
```

or using yarn:

```sh
yarn add @sliit-foss/eslint-config-internal --dev
```
npm package: @sliit-foss/express-http-context
Description: A rework of the express-http-context package to use the new async_hooks API
Author: SLIIT FOSS
Latest version: 2.0.0

# @sliit-foss/express-http-context

#### A rework of the [express-http-context](https://www.npmjs.com/package/express-http-context) package to use the new async_hooks API <br><br>

**Built as the existing package does not work alongside the [Bun](https://bun.sh/) runtime**

---

Get and set request-scoped context anywhere. This is just an unopinionated, idiomatic ExpressJS implementation of [AsyncLocalStorage](https://nodejs.org/api/async_context.html#new-asynclocalstorage). It's a great place to store user state, claims from a JWT, request/correlation IDs, and any other request-scoped data. Context is preserved even over async/await.

## How to use it

Install: `bun install --save @sliit-foss/express-http-context`

Use the middleware immediately before the first middleware that needs to have access to the context.
You won't have access to the context in any middleware "used" before this one.

Note that some popular middlewares (such as body-parser, express-jwt) may cause context to get lost.
To workaround such issues, you are advised to use any third party middleware that does NOT need the context
BEFORE you use this middleware.

```js
const express = require("express");
const httpContext = require("@sliit-foss/express-http-context");

const app = express();
// Use any third party middleware that does not need access to the context here, e.g.
// app.use(some3rdParty.middleware);
app.use(httpContext.middleware);
// all code from here on has access to the same context for each request
```

Set values based on the incoming request:

```js
// Example authorization middleware
app.use((req, res, next) => {
  userService.getUser(req.get("Authorization"), (err, result) => {
    if (err) {
      next(err);
    } else {
      httpContext.set("user", result.user);
      next();
    }
  });
});
```

Get them from code that doesn't have access to the express `req` object:

```js
const httpContext = require("@sliit-foss/express-http-context");

// Somewhere deep in the Todo Service
function createTodoItem(title, content, callback) {
  const user = httpContext.get("user");
  db.insert({ title, content, userId: user.id }, callback);
}
```

You can access the store directly as follows

```js
const store = require("@sliit-foss/express-http-context").store;
```

## Troubleshooting

For users of Node below version 14

1. Unfortunatly, this package does not work with any version of Node below 14. This is due to the fact that the AsyncLocalStorage API was introduced in Node 14. If you are using Node below version 14, you can use the original [express-http-context](https://www.npmjs.com/package/express-http-context) package but as of writing this, it will not work with [Bun](https://bun.sh/).
npm package: @sliit-foss/firebase
Description: A wrapper around the Firebase JS SDK with firestore and realtime database support for filtering sorting, limiting, error handling, and success scenarios
Author: SLIIT FOSS
Latest version: 1.1.1

# @sliit-foss/firebase

### A wrapper around the [Firebase JS SDK](https://www.npmjs.com/package/firebase) with firestore and realtime database support for filtering sorting, limiting, error handling, and success scenarios

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/firebase

# using yarn
yarn add @sliit-foss/firebase
```

## Usage

```js
# using require
const { firestoreService } = require("@sliit-foss/firebase");

# using import
import { firestoreService } from "@sliit-foss/firebase";
```

## Example - Firestore<br/>

```js
// read
const users = await firestoreService.read({ collection: "users" });

// write
const result = await firestoreService.write({
  collection: "users",
  payload: { name: "Ciri", age: 19 },
});

// update
const result = await firestoreService.update({
  collection: "users",
  payload: { age: 20 },
  filters: [
    {
      key: "name",
      operator: "==",
      value: "Ciri",
    },
  ],
});

// delete
const result = await firestoreService.remove({ collection: "users" });
```

## Additional Options

- The read, update and delete functions can take in the additional parameter **filters** which is an array of objects indicating the filtering criteria of the results. The supported operators are the same as the ones provided in the **firebase docs** (https://cloud.google.com/firestore/docs/query-data/queries#query_operators)

- The read function can take in the additional parameters **sorts** and **recordLimit** where sorts is an array of objects indicating the sorting criteria of the results and recordLimit is an integer which limits the number of records returned from the query.

- The write function can take in the additional parameters **documentId** which will allow you to create documents with a provided documentId as opposed to its auto generated behavior and **merge** which will allow you to merge the newly provided payload with the existing data at the provided path if it exists.

- All functions can take in the additional parameters **onSuccess** and **onError** which are callback functions which will get executed on success and failure scenarios respectively. **The onSuccess callback is passed the result of the operation as a parameter by default** whereas **the onError function is passed the error or details of the error which occurred**.<br/><br/>

---

<br/>Based on the original cloud firebase package by Google (https://www.npmjs.com/package/firebase)
npm package: @sliit-foss/http-logger
Description: Http logging middleware for Express.js
Author: SLIIT FOSS
Latest version: 2.0.0

# @sliit-foss/http-logger

### Http logging middleware for Express.js

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/http-logger

# using yarn
yarn add @sliit-foss/http-logger
```

## Usage

```js
# using require
const httpLogger = require("@sliit-foss/http-logger").default;

# using import
import httpLogger from "@sliit-foss/http-logger";
```

## Example<br/><br/>

```js
import app from "express";

app.use(httpLogger());
```

## Usage With Options<br/><br/>

```js
import app from 'express';

app.use(httpLogger({
  whitelists: ["/public/*"] // An array of paths to exclude being logged if needed
  loggable: [
    "body"
  ], // An array of extra propeties in the request object to log. Defaults to the following: ['path', 'method', 'query', 'params']
}));

// or
import { pick, omit} from 'loadash';

app.use(httpLogger({
  whitelists: ["/public/*"],
  loggable: ( (req) => {
    // Pick the properties you want to log
    return {
      headers: pick(req.headers, ['x-user-email', 'user-agent']),
      payload: omit(req.body, ['password', 'new_password', 'old_password'])
    }
  }),
}));
```
npm package: @sliit-foss/leaderboard
Description: A utility package for fetching a list of contributor scores to a GitHub organization or repository
Author: SLIIT FOSS
Latest version: 1.2.1

# @sliit-foss/leaderboard

### A utility package for fetching a list of contributor scores to a GitHub organization or repository

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/leaderboard

# using yarn
yarn add @sliit-foss/leaderboard
```

## Usage

```js
# using require
const leaderboard = require('@sliit-foss/leaderboard').default;

# using import
import leaderboard from '@sliit-foss/leaderboard';
```

## Example

```js
leaderboard.initialize("GITHUB_ACCESS_TOKEN");

// Fetch organization leaderboard
leaderboard
  .getOrganizationLeaderboard({
    orgs: "sliit-foss",
    filters: {
      between: "2021-10-14..2021-10-31",
      label: "hacktoberfest-accepted"
    }
  })
  .then((results) => console.log(results));

// Fetch repository leaderboard
leaderboard
  .getRepositoryLeaderboard({
    owner: "sliit-foss",
    repository: "sliitfoss",
    filters: {
      between: "2021-10-14..2021-10-31",
      label: "hacktoberfest-accepted"
    }
  })
  .then((results) => console.log(results));

// With Page Size and Page Limit
leaderboard
  .getOrganizationLeaderboard({
    orgs: "sliit-foss",
    filters: {
      pageSize: 10,
      pageLimit: 2
    }
  })
  .then((results) => console.log(results)); //returns 20 results
```
npm package: @sliit-foss/module-logger
Description: A modularized logger wrapped around winston to make working with nodeJS microservices easier.
Author: SLIIT FOSS
Latest version: 2.0.0

# @sliit-foss/module-logger

### A modularized logger to make working with NodeJS microservices easier. <br/> <br/> <small>This package is wrapped around [winston](https://www.npmjs.com/package/winston) and exposes all of its functions and properties through an import named `winston`.</small>

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/module-logger

# using yarn
yarn add @sliit-foss/module-logger
```

## Usage

```js
# using require
const { configure, moduleLogger } = require("@sliit-foss/module-logger");

# using import
import { configure, moduleLogger } from "@sliit-foss/module-logger";
```

## Examples<br/><br/>

### Default configuration

```js
const logger = moduleLogger("MY-MODULE-NAME");

logger.info("This is a modularized info log");

/*
  {"correlationId":"correlation-id-from-context","level":"info","message":"[MY-MODULE-NAME] - This is a modularized info log","timestamp":"2023-02-22T16:44:53.711Z"}
*/
```

### Custom configuration

```js
// configure the logger at the start of the application
configure({
  console: { enabled: false },
  file: {
    enabled: true,
    options: {
      filename: "my-custom-log-file.log"
    }
  }
});

const logger = moduleLogger("MY-MODULE-NAME");

logger.info("This is a modularized info log written to a file");

/* 
  logs to my-custom-log-file.log
  {"correlationId":"correlation-id-from-context","level":"info","message":"[MY-MODULE-NAME] - This is a modularized info log written to a file","timestamp":"2023-02-22T16:44:53.711Z"}
*/
```

### Default options which can be overridden by configure

```js
{
  console: {
    enabled: true,
    options: {
      handleRejections: true,
      handleExceptions: true,
    },
  },
  file: {
    enabled: true,
    options: {
      filename: '%DATE%.log',
      datePattern: 'YYYY-MM-DD',
      zippedArchive: false,
      maxFiles: '7d',
      dirname: './logs',
    },
  },
  transportOverrides: [], // array of transport overrides
  globalAttributes: {}, // attributes which will be added to all logs,
  traceKey: "correlationId", // key to be used for tracing
}
```
npm package: @sliit-foss/mongoose-audit
Description: A rework of the mongoose-audit-log package to support newer versions of mongoose and more flexible options
Author: SLIIT FOSS
Latest version: 1.0.4

# @sliit-foss/mongoose-audit

#### A rework of the [mongoose-audit-log](https://www.npmjs.com/package/mongoose-audit-log) package to support newer versions of mongoose and more flexible options<br>

#### IMPORTANT - The behaviour of this is different from the original `mongoose-audit-log` package and cannot be considered as a drop in replacement for it.

It is a mongoose plugin to manage an audit log of changes to a MongoDB database.

## Features

- Store changes to entities on persist (save, update, delete)
- Remember the user, that executed the change
- Log when the change has been done

## Storing the current user

In order to collect the information about who actually did a change to an entity, the user information is required.
This can be set on a per usage (1) or global (2) level:

1. Set the current user on an entity right before persisting:

```javascript
Order.findById(123)
  .then((order) => {
    order.__user = "me@test.de";
    order.amount = 1000;
  })
  .save();
```

2. Set it as an option when registering the plugin:

```javascript
const { plugin } = require("@sliit-foss/mongoose-audit");

SomeSchema.plugin(plugin, {
  getUser: () => "user details from wherever you wish to get it"
});
```

## Query history

Please find below an example express route, to request the history of a given type and id:

```javascript
const { plugin, Audit } = require("@sliit-foss/mongoose-audit");

router.get("/api/users/:id/history", (req, res, next) => {
  Audit.find({ entity_id: req.params.id, entity: "User" })
    .then((history) => res.json(history))
    .catch(next);
});
```

## All supported plugin options

- getUser - () => any

  - The user extractor function to use. This probably will be fetching the current user from a context or something similar.

- types - AuditType[]

  - The types of audit to record.

- include - string[]

  - The fields to consider for the audit. Cannot be used along with exclude.

- exclude - string[]

  - The fields to exclude from the audit. Cannot be used along with include.

- onAudit - (audit) => Promise<void>

  - Called before persisting the audit is saved. Use this to use your own audit model instead of the default one.

- background - boolean
  - By default audit logs are persisted asynchronously in the background. Change this to false if you want it to be synchronous.
npm package: @sliit-foss/request-query-utils
Description: A package to isolate filters and sorts from a given request's query parameters
Author: SLIIT FOSS
Latest version: 1.1.1

# @sliit-foss/request-query-utils

### A package to isolate filters and sorts from a given request's query parameters

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/request-query-utils

# using yarn
yarn add @sliit-foss/request-query-utils
```

## Usage

```js
# using require
const { getRequestFilters, getRequestSorts, getRequestQueryParams } = require("@sliit-foss/request-query-utils");

# using import
import { getRequestFilters, getRequestSorts, getRequestQueryParams } from "@sliit-foss/request-query-utils";
```

## Example<br/>

- ### Example request uri - ?filter[name]=Ciri&filter[age]=19&sort=-id&sort=height

```js
const params = getRequestQueryParams({
  req, // node.js request object
});

console.log(params); // output: [{ key: 'filter[name]', value: 'Ciri' }, { key: 'filter[age]', value: '19' }, { key: 'sort', value: '-id' }, { key: 'sort', value: 'height' } ]

const filters = getRequestFilters({
  req, // node.js request object
});

console.log(filters); // output - [ { key: 'name', value: 'Ciri' }, { key: 'age', value: '19' } ]

const sorts = getRequestSorts({
  req, // node.js request object
});

console.log(sorts); // output - [ { key: 'id', value: -1 }, { key: 'height', value: 1 } ]
```

## Additional Options

- All functions can take in an addition boolean parameter **returnObject** which will return a single object with the merged values isolated from the function. The return type by default is an array.

- For example, requests to above three functions with returnObject provided as true will result in the following outputs:

```js
// getRequestQueryParams - { 'filter[name]': 'Ciri', 'filter[age]': '19', sort: '-id', 'sort-1652632797392': 'height'  }

// getRequestFilters - { name: 'Ciri', age: '19' }

// getRequestSorts - { id: -1, height: 1 }
```

- The getRequestFilters function can take in the parameter mongooseSupport which will modify the filter object in certain ways to match a mongoose filter query:

- For example, requests to above three functions with returnObject provided as true will result in the following outputs:

```js
// Request uri - ?filter[name]=Ciri&filter[age]=19,20,21,22&sort=-id&sort=height

// getRequestFilters - { name: 'Ciri', age: { $in: ['19', '20', '21', '22'] } }
```
npm package: @sliit-foss/service-connector
Description: A package to isolate filters and sorts from a given request's query parameters
Author: SLIIT FOSS
Latest version: 3.0.0

# @sliit-foss/service-connector

### A microservice connector for node.js that uses axios under the hood and makes the process of debugging and logging API requests easier.

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/service-connector

# using yarn
yarn add @sliit-foss/service-connector
```

## Usage

```js
# using require
const serviceConnector = require("@sliit-foss/service-connector").default;

# using import
import serviceConnector from "@sliit-foss/service-connector";
```

## Example<br/>

```js
const connector = serviceConnector({
  // any configuration you want to pass to axios

  baseUrl: "http://localhost:3000",
  timeout: 1000,

  // optional module specific configurations

  service: "service-name",
  headerIntercepts: () => ({
    "x-api-key": "1234567890"
  }),
  loggable: (response) => {
    // do something with the response, both success and error
  }
});

// use the service connector as you would use axios
const response = await connector.get("/api/v1/users");
```

## Resolver function

- The connector has a resolver function that can be used to directly resolve the data from the API response if it comes in the following format.

  ```json
  {
    "data": { ... }, // data coming from the API inside a nested data object
    "message": "Data retrieved successfully"
  }
  ```

- The following will return the above data object directly without the need of calling **response.data.data** manually.

  ```js
  const data = await connector.get("/api/v1/users").then(connector.resolve);
  ```
npm package: @sliit-foss/templates
Description: A simple template generator which can be invoked via the CLI
Author: SLIIT FOSS
Latest version: 1.0.5

# @sliit-foss/templates

### A simple template generator which can be invoked via the CLI

<br/>

## Installation

```bash
# using npm
npm install -g @sliit-foss/templates

# using yarn
yarn global add @sliit-foss/templates
```

## Usage

- Execute the following command in your terminal to see a list of available options

```bash
sft
```