open-index/open-npm huggingface dataset:
npm package: @marcura/portlog-common-ui
Description: PortLog Common UI
Author: Marcura
Latest version: 0.1.14

# PortLog Common UI

## Install
```sh
$ npm i --save @marcura/portlog-common-ui
```

## Usage
```javascript
angular.module('your.app.name', [
    //...
    'ui.marcura'
    //...
]);
```
npm package: @marcus-j-davies/node-red-semaphore-plus
Description: An advanced set of semaphore Nodes for Node RED, with a dynamic fail-safe
Author: Marcus Davies
Latest version: 3.4.0

# node-red-semaphore-plus
An advanced set of semaphore Nodes for Node RED, with a dynamic fail-safe.

## Uh... what is it

This is a set of Nodes for Node RED, that allows messages to be queued, and signalled to pass, once a message has reached the end of the flow.
But at the same time, allowing an optional fail-safe, that can be controlled dynamically.

Furthermore, messages can be flagged to bypass the semaphore and 'sneak' past the messages waiting for the lock to be released.  
This is achieved with either a single messge property, or a JSONata expression.
 

| Node | What's it for? |
|------|----------------|
|Semaphore Take | Queues and passes a message through when signalled (or when the optional fail-safe triggers) |
|Semaphore Release | Raises the signal to allow a message to pass   |
|Semaphore FS Reset | Alters the current fail-safe time |

## Message Properties

**Semaphore Take** and **Semaphore FS Reset** Optional Properties
| Property | What's it for? |
|----------|----------------|
|smp_failsafeTimeout (number) (IN) | Overrides the default fail-safe time |
|smp_appliedFailsafe (number) (OUT) | The  fail-safe time that was applied |
|smp_isFailsafe (boolean) (**Semaphore Take** only) (OUT) | If the release was due to a fail-safe condition |

**Semaphore Release** Optional Properties
| Property | What's it for? |
|----------|----------------|
|reset (boolean) (IN)     | Resets the queue state, and does not pass on the incoming `msg` |
|smp_reset (boolean) (IN) | Resets the queue state, and passes on the incoming `msg` |


## Yeah but why?

Working in an enterprise environment, where strict API access is enforced/monitored, I needed to come up with a way to control processing.
Having tried various nodes to accomplish this, i was either creating messy flows to try and emulate this approach, or using no longer maintained or buggy nodes.

## License
MIT License

Copyright (c) 2023 Marcus Davies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
npm package: @marcus-rise/next-api-interceptor
Description: Interceptor for serverless nextjs api
Author: Ilya Konstantinov
Latest version: 0.1.1

# Next api interceptor

Interceptor for serverless nextjs api

## Install

using `npm`

```bash
npm install @marcus-rise/next-api-interceptor
```

or using `yarn`

```bash
yarn add @marcus-rise/next-api-interceptor
```

## Usage

You can create several interceptors and apply them in train

Interceptor is a wrapper function, that runs before a wrapped function

```tsx
// src/interceptor/method-handlers.interceptor.ts
import type {Interceptor} from "@marcus-rise/next-api-interceptor";
import type {NextApiHandler} from "next";

enum RequestMethod {
  GET = "GET",
  POST = "POST",
}

type MethodHandler<Handler extends NextApiHandler = NextApiHandler> = {
  method: RequestMethod | string;
  handler: Handler;
};

const withMethodHandlers =
  (...allowedHandlers: Array<MethodHandler>): Interceptor =>
    (handler: NextApiHandler = () => {
    }) =>
      async (req, res) => {
        const allowedHandler = allowedHandlers.find((h) => h.method === req.method)?.handler;

        if (!allowedHandler) {
          res.status(405).end();
        } else {
          await allowedHandler(req, res);
        }

        return handler(req, res);
      };

export {withMethodHandlers};
```

```ts
// pages/api/test.ts
import type {NextApiHandler} from "next";
import {withMethodHandlers} from "../../src/interceptor/method-handlers.interceptor.ts";

const TestHandler: NextApiHandler = (req, response) => {
  return response.status(res.status).json({res: "hellow"});
};

export default withMethodHandlers({
  method: "GET",
  handler: TestHandler,
})();

// or

export default applyInterceptors(
  TestHandler,
  anotherInterceptor,
  withMethodHandlers({
    method: "GET",
    handler: TestHandler,
  }),
  yetAnotherOneInterceptor,
);
```

The execution order of example described above is: anotherInterceptor, withMethodHandlers,
yetAnotherOneInterceptor, TestHandler
npm package: @marcus-rise/react-theme
Description: react theme toggle hook
Author: Ilya Konstantinov
Latest version: 1.0.2

# React theme

Handle system color scheme and user preferences.

https://react-theme.marcus-rise.dev

## Install

using `npm`

```bash
npm install @marcus-rise/react-theme
```

or using `yarn`

```bash
yarn add @marcus-rise/react-theme
```

## Usage

First of all, we need to initialize `ThemeProvider` context, and after this we can get access with
hook `useTheme`.

```tsx
import {ThemeProvider, useTheme} from "@marcus-rise/react-theme";

const ThemeToggle = () => {
  const {isDarkTheme, preferences, toggleTheme} = useTheme();

  return (
    <>
      <button onClick={toggleTheme}>toggle</button>
      <br/>
      <span>preferences: {preferences ?? "system default"}</span>
      <br/>
      <span>isDarkTheme: {isDarkTheme ? "yes" : "no"}</span>
    </>
  );
};

const App = () => (
  <ThemeProvider>
    <ThemeToggle/>
  </ThemeProvider>
);

export {App};
```

## API

### Context provider `ThemeProvider`

To set custom localStorage key set `preferencesStorageKey` property for user preferences

```tsx
<ThemeProvider preferencesStorageKey={"OPTIONAL_APP_THEME_STORAGE_KEY"}>
```

To save user preferences in cookies, provide `cookiesKey` prop as a cookie key string

```tsx
<ThemeProvider cookiesKey={"theme-preferences"}>
```

### Hook `useTheme`

- `isDarkTheme` is a`boolean` what color scheme is selected, basing on user preferences and system
  settings
- `preferences` is a `string` form `enum`

```ts
enum ThemePreference {
  DARK = "dark",
  LIGHT = "light",
}
```

- `toggleTheme` toggle theme from system default to light, from light to dark and from dark to
  system default
- `setTheme` set theme (dark or light)
- `resetThemeToSystem` set theme to system default
npm package: @marcusfernstrom/asva-password
Description: Quickly check a password against OWASP ASVA v4. 2.1.1, 2.1.3, 2.1.7 / NIST 5.1.1.2 / CWE-521 requirements for minimum character count, spaces, and common passwords.
Latest version: 1.1.5

# ASVA JS Password check

Easily check a password against OWASP ASVA v4. 2.1.1, 2.1.3, 2.1.7 / NIST 5.1.1.2 / CWE-521 requirements for minimum character count and common passwords.

2.1.1 - Minimum character count 12 and top common passwords.

2.1.3 - Passwords CAN contain spaces. Multiple consecutive spaces are truncated to single spaces

2.1.7 - Password is checked against top 10.000 most common passwords sourced from https://github.com/danielmiessler/SecLists/tree/master/Passwords/Common-Credentials
(commit a3416ba on May 27)

## OWASP ASVA
https://owasp.org/www-project-application-security-verification-standard/ (v4.0.1 is the latest as of this package release)

## NIST
https://pages.nist.gov/800-63-3/sp800-63b.html

## CWE
https://cwe.mitre.org/data/definitions/521.html

## Install

`npm i @marcusfernstrom/asva-password`

## Use

Pass a string to check and get back a map.

```
const passwordCheck = require('@marcusfernstrom/asva-password')
const result = passwordCheck('sunshine')

{ passed: false, tooShort: true, tooCommon: true }
```

```
const passwordCheck = require('@marcusfernstrom/asva-password')
const result = passwordCheck('passwordsarecool')

{ passed: true }
```