open-index/open-npm huggingface dataset:
npm package: @magn/express-decorator
Description: Typescript Decorators to use with Express Routing
Author: Matheus Catarino de Aguilar
Latest version: 1.0.4

## Express-Decorator

Typescript decorators for Node Express.

### Required to work

This package will need the packages:

```javascript
npm install reflect-metadata
```

```javascript
npm install express
```

Also don't forget to enable decorators inside tsconfig.json:

```javascript
{
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true,
}
```

### Decorators Methods
GET, POST, PUT, DELETE, PATCH, AUTH 

### Example

You can download this example at: https://github.com/matheusaguilar/express-decorator-example

```javascript
import * as http from 'http';
import express from 'express';
import bodyParser from 'body-parser';
import { Request, Response, NextFunction } from 'express';
import { Get, Post, Put, Delete, Patch, Auth, loadRoute } from '@magn/express-decorator';

function createErrorMessage(message: string) {
  return JSON.stringify({ message });
}
 
function validateId(req: Request, res: Response, next: NextFunction) {
  if (req.body?.id) {
    next();  
  } else {
    res.status(400).send(createErrorMessage('You need to provide an id on the body params to access this endpoint.'));
  }
}

function validatePassword(req: Request, res: Response, next: NextFunction) {
  if (req.body?.password) {
    next();  
  } else {
    res.status(400).send(createErrorMessage('You need to provide a password on the body params to access this endpoint.'));
  }
}
 
export class ExampleRoute {
  @Get('/') 
  async getInfo(req: Request, res: Response) {
    res.status(200).send("Info");
  }
 
  @Post('/')
  async createInfo(req: Request, res: Response) {
    res.status(200).send("Created");
  }
 
  @Put('/')
  async updateInfo(req: Request, res: Response) {
    res.status(200).send("Updated");
  }
 
  @Auth(validateId)
  @Auth(validatePassword)
  @Delete('/')
  async deleteInfo(req: Request, res: Response) {
    res.status(200).send("Deleted");
  }

  @Patch('/')
  async patchInfo(req: Request, res: Response) {
    res.status(200).send("Patched");
  }
}
 
const app = express();
app.use(bodyParser.json());
app.use('/', loadRoute(new ExampleRoute()));
const httpServer = new http.Server(app);
const PORT = 8080;
httpServer.listen(PORT, () => {
  console.log(`Server listening on port ${PORT}!`);
});
```
npm package: @magnaflow/chain-provider
Description: Chain provider abstraction library for unified blockchain interactions
Author: MagnaFlow Labs
Latest version: 1.0.2

# @magnaflow/chain-provider

Chain provider abstractions for unified EVM and Tron operations.

## What It Provides

- A shared `ChainProvider` interface for balances, transfers, receipts, and gas estimation
- `EvmProvider` backed by `viem`
- `TronProvider` backed by `tronweb`
- Factory helpers for creating providers from backend chain configuration

## Install

```bash
npm install @magnaflow/chain-provider
```

## Key Exports

- `createChainProvider`
- `createEvmProvider`
- `createTronProvider`
- `getChainType`
- `EvmProvider`
- `TronProvider`
- `createViemChainFromConfig`

## Example

```ts
import { createChainProvider } from '@magnaflow/chain-provider';

const provider = createChainProvider(
  {
    name: 'BSC Mainnet',
    chain: 'bsc',
    rpc_url: 'https://bsc-dataseed.binance.org',
    rest_url: 'https://bsc-dataseed.binance.org',
    payout_contract: '0x0000000000000000000000000000000000000000',
  },
  process.env.MNEMONIC,
);

const balances = await provider.getBalances('0x1234...', [
  '0x55d398326f99059fF775485246999027B3197955',
]);
```

## Notes

- The default EVM chain resolver is currently tuned for BSC and BSC testnet style configs.
- `TronProvider` supports native transfers and balance queries. Advanced Tron contract interaction lives outside this package.

## Development

```bash
bunx nx run chain-provider:lint
bunx nx run chain-provider:test
bunx nx run chain-provider:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/contract-sdk
Description: Standardized contract interaction SDK for multi-chain smart contracts
Author: MagnaFlow Labs
Latest version: 1.0.2

# @magnaflow/contract-sdk

Contract call helpers built on top of `@magnaflow/chain-provider`.

## What It Provides

- `ContractManager` for low-level read, write, and gas estimation
- `ContractCaller` as a thin convenience wrapper
- EIP-712 digest signing with `signDigest`
- Standard MagnaFlow error selector parsing
- Bundled ABIs for payout and ERC-20 flows

## Install

```bash
npm install @magnaflow/contract-sdk
```

## Key Exports

- `ContractManager`
- `ContractCaller`
- `signDigest`
- `parseEvmError`
- `parseContractError`
- `createFriendlyErrorMessage`
- `MAGNAFLOW_ERROR_SELECTORS`
- `payout_new_abi`
- `ORDER_STRUCT_TYPE`
- `ERC20_ABI`

## Example

```ts
import { ContractCaller, ERC20_ABI } from '@magnaflow/contract-sdk';
import { createChainProvider } from '@magnaflow/chain-provider';

const provider = createChainProvider(chainConfig, process.env.MNEMONIC);
const caller = new ContractCaller(provider);

const balance = await caller.call({
  address: '0x55d398326f99059fF775485246999027B3197955',
  abi: ERC20_ABI,
  functionName: 'balanceOf',
  args: ['0x1234...'],
});
```

## Notes

- EVM contract read/write is implemented.
- Tron contract read/write is not implemented in the current release and should be treated as unsupported.

## Development

```bash
bunx nx run contract-sdk:lint
bunx nx run contract-sdk:test
bunx nx run contract-sdk:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/eoa-wallet
Description: EOA wallet management library for multi-chain address generation and key derivation
Author: MagnaFlow Labs
Latest version: 1.0.2

# @magnaflow/eoa-wallet

Mnemonic validation and multi-chain address derivation utilities for EVM and Tron.

## What It Provides

- Mnemonic validation and normalization helpers
- EVM and Tron address derivation
- Standard derivation path helpers
- Tron address conversion utilities
- `viem` client creation from a mnemonic

## Install

```bash
npm install @magnaflow/eoa-wallet
```

## Key Exports

- `validateMnemonicPhrase`
- `normalizeMnemonic`
- `deriveEvmAddress`
- `deriveTronAddress`
- `deriveAddress`
- `deriveZeroAddress`
- `InvalidMnemonicError`
- `DerivationError`
- `InvalidInputError`
- `UnsupportedChainError`
- `DERIVATION_PATH_BASE`
- `buildDerivationPath`
- `tronAddressToEthereumAddress`
- `createEvmClientsFromMnemonic`

## Example

```ts
import { deriveAddress, createEvmClientsFromMnemonic } from '@magnaflow/eoa-wallet';
import { bsc } from 'viem/chains';

const derived = deriveAddress(process.env.MNEMONIC!, 'evm', { index: 0 });

const { account, publicClient, walletClient } = createEvmClientsFromMnemonic(
  process.env.MNEMONIC!,
  bsc,
  'https://bsc-dataseed.binance.org',
);
```

## Notes

- This package exposes only the APIs exported from `src/index.ts`.
- Some older examples that reference helpers such as `createAccountFromMnemonic` are no longer valid for the current package surface.

## Development

```bash
bunx nx run eoa-wallet:lint
bunx nx run eoa-wallet:test
bunx nx run eoa-wallet:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/keystore
Description: Standardized keystore management library for secure key storage
Author: MagnaFlow Labs
Latest version: 1.0.3

# @magnaflow/keystore

Keystore creation, import/export, and encrypted mnemonic storage helpers.

## What It Provides

- Ethereum-compatible keystore generation from a mnemonic or private key
- Keystore import and validation helpers
- Browser-friendly export support
- Secure text encryption with `@metamask/browser-passworder`
- Local storage and in-memory mnemonic persistence helpers

## Install

```bash
npm install @magnaflow/keystore
```

## Key Exports

- `createKeystore`
- `importKeystore`
- `validateKeystore`
- `keystoreHasMnemonic`
- `exportKeystore`
- `generateAndExportKeystore`
- `encryptTextSecure`
- `decryptTextSecure`
- `storeMnemonic`
- `getMnemonic`
- `removeMnemonic`
- `hasMnemonic`
- `setInMemoryMnemonic`
- `getInMemoryMnemonic`
- `clearInMemoryMnemonic`

## Example

```ts
import { createKeystore, importKeystore, storeMnemonic } from '@magnaflow/keystore';

const keystoreJson = await createKeystore(process.env.MNEMONIC!, {
  password: 'strong-password',
  walletName: 'merchant-wallet',
});

const imported = await importKeystore(keystoreJson, 'strong-password');
await storeMnemonic(imported.mnemonic ?? '', {
  walletId: 'merchant-wallet',
  encryptionPassword: 'user-provided-secret',
});

// Legacy compatibility is still available when you only provide walletId.
await storeMnemonic(imported.mnemonic ?? '', 'merchant-wallet');
```

## Notes

- Browser export uses `Blob` and DOM APIs when they are available.
- Storage helpers fall back to in-memory storage when `localStorage` is unavailable.
- Storage helpers accept the legacy walletId-only signature for backward compatibility.
- Prefer providing an explicit encryption password for stronger protection instead of reusing a public wallet identifier.

## Development

```bash
bunx nx run keystore:lint
bunx nx run keystore:test
bunx nx run keystore:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/merchant-utils
Description: Merchant shared utilities
Author: MagnaFlow Labs
Latest version: 1.0.4

# @magnaflow/merchant-utils

Shared merchant-facing helpers on top of the core chain and Tron tooling.

## What It Provides

- Cross-chain transaction waiting and friendly error helpers
- Tron transaction polling helpers
- TronWeb instance creation from merchant chain config
- EVM selector-based error formatting
- Payout order display helpers
- EIP-712 digest signing utility

## Install

```bash
npm install @magnaflow/merchant-utils
```

## Key Exports

- `waitForTransactionCrossChain`
- `createCrossChainFriendlyErrorMessage`
- `pollTronTransaction`
- `pollTronTransaction2`
- `pollTronTransactionWithBackoff`
- `createTronWebInstance`
- `parseEvmError`
- `createFriendlyErrorMessage`
- `isTronLikeChain`
- `isBscLikeChain`
- `signDigest`
- `formatPayoutOrderTime`
- `getPayoutTypeColor`
- `getPayoutStatusColor`
- `ORDER_TITLES`
- `TYPE_DISPLAY_NAMES`

## Example

```ts
import {
  createCrossChainFriendlyErrorMessage,
  waitForTransactionCrossChain,
} from '@magnaflow/merchant-utils';

const result = await waitForTransactionCrossChain({
  chainType: 'evm',
  hash: '0x1234...',
  client: publicClient,
  confirmations: 1,
});

const message = createCrossChainFriendlyErrorMessage('evm', new Error('Operation failed'));
```

## Notes

- This package is intentionally a helper layer. Full merchant workflows should still live in application services.
- `@magnaflow/tronsave` remains a separate package for Tron energy rental APIs.

## Development

```bash
bunx nx run merchant-utils:lint
bunx nx run merchant-utils:test
bunx nx run merchant-utils:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/passkey
Description: Standardized passkey management library for WebAuthn authentication
Author: MagnaFlow Labs
Latest version: 1.0.4

# @magnaflow/passkey

Browser-side WebAuthn helpers for passkey registration and verification flows.

## What It Provides

- `registerPasskey` to create a passkey credential from server-provided challenge data
- `verifyPasskey` to complete an authentication challenge
- Environment capability checks for WebAuthn and platform authenticators
- Utility helpers for automatic RP ID detection and ArrayBuffer/Base64 conversion

## Install

```bash
npm install @magnaflow/passkey
```

## Key Exports

- `registerPasskey`
- `verifyPasskey`
- `isPasskeyAvailable`
- `getRelyingPartyId`
- `arrayBufferToBase64`
- `base64ToArrayBuffer`
- `isWebAuthnSupported`
- `isPlatformAuthenticatorAvailable`

## Example

```ts
import { registerPasskey, verifyPasskey } from '@magnaflow/passkey';

const registerResult = await registerPasskey({
  challenge: 'register-challenge',
  rp_name: 'MagnaFlow',
  user_id: 'merchant-123',
});

const verifyResult = await verifyPasskey({
  challenge: 'verify-challenge',
  rp_name: 'MagnaFlow',
  user_id: 'merchant-123',
  registered_ids: ['credential-id-base64'],
});

const registerAcrossSubdomains = await registerPasskey(
  {
    challenge: 'register-challenge',
    rp_name: 'MagnaFlow',
    user_id: 'merchant-123',
  },
  {
    rootDomains: ['example-payments.test', 'sample-wallet.test'],
  },
);

const registerWithAutoDomain = await registerPasskey({
  challenge: 'register-challenge',
  rp_name: 'Sample Wallet',
  user_id: 'merchant-123',
});
// On https://dev.sample-wallet.test/console/auth/sign-in this will use rpId = 'sample-wallet.test'
```

## Notes

- This package only performs browser-side WebAuthn work. Backend API requests must be handled by the caller.
- All public APIs in this package require a browser environment.
- By default, the package derives the RP ID from the current hostname using the registrable domain, so `https://dev.sample-wallet.test/...` resolves to `sample-wallet.test`.
- If you need strict overrides, pass `rootDomains` or `customRpId`.

## Development

```bash
bunx nx run passkey:lint
bunx nx run passkey:test
bunx nx run passkey:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/tronsave
Description: TRON energy rental service (TronSave) SDK
Author: MagnaFlow Labs
Latest version: 1.0.2

# @magnaflow/tronsave

Helpers for integrating with the TronSave resource rental API.

## What It Provides

- Mainnet and testnet TronSave config resolution
- Estimate requests for energy and bandwidth purchase cost
- Signed TRX transfer transaction construction
- Order creation helpers for the TronSave HTTP API

## Install

```bash
npm install @magnaflow/tronsave
```

## Key Exports

- `TRONSAVE_MAINNET`
- `TRONSAVE_TESTNET`
- `getTronSaveConfig`
- `tronsaveGetEstimate`
- `tronsaveGetSignedTransaction`
- `tronsaveCreateOrder`
- `TronSaveConfig`
- `TronSaveEstimateParams`
- `TronSaveCreateOrderParams`

## Example

```ts
import { TronWeb } from 'tronweb';
import {
  getTronSaveConfig,
  tronsaveCreateOrder,
  tronsaveGetEstimate,
  tronsaveGetSignedTransaction,
} from '@magnaflow/tronsave';

const config = getTronSaveConfig({
  chain: 'tron',
  rest_url: 'https://api.trongrid.io',
});

const estimate = await tronsaveGetEstimate(config, {
  resourceAmount: 1000,
  durationSec: 86400,
});

const tronWeb = new TronWeb({ fullHost: 'https://api.trongrid.io' });
const signedTx = await tronsaveGetSignedTransaction(
  config,
  tronWeb,
  estimate.data!.estimateTrx,
  'TYourAddress...',
);

await tronsaveCreateOrder(config, {
  resourceAmount: 1000,
  signedTx,
  receiverAddress: 'TYourAddress...',
  unitPrice: estimate.data!.unitPrice,
  durationSec: 86400,
});
```

## Development

```bash
bunx nx run tronsave:lint
bunx nx run tronsave:test
bunx nx run tronsave:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnaflow/ws-client
Description: WebSocket client library with message queue, reconnection, and push message handling
Author: MagnaFlow Labs
Latest version: 1.0.3

# @magnaflow/ws-client

WebSocket client primitives with queueing, heartbeat, reconnection, and push-message handling.

## What It Provides

- `WebSocketService` as the high-level client
- `WebSocketCore` for low-level connection lifecycle
- `MessageManager` for request/response matching
- `TasksService` for scheduled maintenance tasks
- `PushMessageService` for typed push-message registration

## Install

```bash
npm install @magnaflow/ws-client
```

## Key Exports

- `WebSocketService`
- `WebSocketCore`
- `MessageManager`
- `TasksService`
- `PushMessageService`
- `EventEmitter`
- `generateUniqueId`
- `WEBSOCKET_EVENTS`
- `HEARTBEAT_CONFIG`
- `RECONNECTION_CONFIG`
- `MESSAGE_CONFIG`
- `TASK_CONFIG`
- `ERROR_MESSAGES`
- `LOG_MESSAGES`

## Example

```ts
import { WebSocketService, WEBSOCKET_EVENTS } from '@magnaflow/ws-client';

const ws = new WebSocketService({
  reconnect: {
    maxAttempts: 5,
    baseDelay: 1000,
    maxDelay: 30000,
  },
});

await ws.connectAsync('wss://example.com/ws');
ws.on(WEBSOCKET_EVENTS.CONNECT, () => {
  console.log('connected');
});
```

## Notes

- This package assumes a browser-like WebSocket runtime.
- Request/response matching is based on `nonce` values managed by `MessageManager`.

## Development

```bash
bunx nx run ws-client:lint
bunx nx run ws-client:test
bunx nx run ws-client:build
```

## License

This package is part of the `merchant-v2-sdk` monorepo and is covered by the root MIT license.

See [../../LICENSE](../../LICENSE) for details.
npm package: @magnal/prettier-config
Description: Prettier config for my projects
Latest version: 4.4.0

# @magnal/prettier-config

My personal shared prettier config.

## How to use in a project

- install
  - with npm: `npm i @magnal/prettier-config prettier --save-dev`
  - with yarn: `yarn add @magnal/prettier-config prettier --dev`
- create `.prettierrc` in project root with content `"@magnal/prettier-config"`
- done

Can also be used together with husky to format files. To do so, see husky docs.
npm package: @magnatag/canvas-captcha
Description: a nodejs captcha module based on node-canvas
Author: ZHAO Xudong
Latest version: 3.0.1

# canvas-captcha

[![Build Status](https://travis-ci.org/zxdong262/canvas-captcha.svg?branch=master)](https://travis-ci.org/zxdong262/canvas-captcha)

a captcha module for nodejs based on [node-canvas](https://www.npmjs.org/package/canvas)

## note

- install Cairo first, For system-specific installation view the  <a href="https://github.com/LearnBoost/node-canvas/wiki/_pages">Wiki</a> from [node-canvas](https://www.npmjs.org/package/canvas)
- if you can see the captcha image, but empty, try another font your server has or install proper font pack in your server, such as `sudo apt-get install ttf-mscorefonts-installer`.

## Installation

```bash
npm install canvas-captcha
```

## use

```javascript
//captcha 
var captcha = require('canvas-captcha')
,captchaOptions = {
	charPool: ('abcdefghijklmnopqrstuvwxyz' + 'abcdefghijklmnopqrstuvwxyz'.toUpperCase() + '1234567890').split('') //char pool Array
	,size: {
		width: 100
		,height: 32
	} //image size
	,textPos: {
		left: 15
		,top: 26
	} //text drawing start position
	,rotate: .01 //text ratate
	,charLength: 4 //how many chars
	,font: '26px Unifont' //font size
	,strokeStyle: '#0088cc' //style
	,bgColor: '#eeeeee' //bg color
	,confusion: true //draw another group background text to mangle the text
	,cFont: '30px Arial' //bg text style
	,cStrokeStyle: '#adc' //bg text color
	,cRotate: -.05 //bg text rotate
}

//callback style
app.get('/captcha', function(req, res) {
	captcha(captchaOptions, function(err, data) {
		if(err) {
			res.send(err)
		}
		else {
			req.session.captcha = data.captchaStr
			res.end(data.captchaImg)
		}
	})
})

//use promise
var captchaPromise = function(options) {
	return new Promise(function(resolve, reject) {
		captcha(options, function(err, data) {
			if(err) reject(err)
			else resolve(data)
		})
	})
}

//in express
app.get('/captcha', function(req, res) {

	captchaPromise(captchaOptions)
	.then(function(data) {
		req.session.captcha = data.captchaStr
		res.end(data.captchaImg)
	}, function(err) {
		res.send(err)
	})

})

//in koa
app.get('/captcha', function* (next) {

	var data = yield captchaPromise(captchaOptions)
	this.session.captcha = data.captchaStr
	this.body = data.captchaImg

})


```

## test && example

```bash
git clone https://github.com/zxdong262/canvas-captcha.git
cd canvas-captcha
sudo npm install

# test
npm run test

#example
node test/app.js
# then visit http://127.0.0.1:5001
```


## changelog
- 2.1.0 use canvas 1.3.15, support node 6.2+
- 2.0.1 use canvas 1.3.12, a little rewrite
- 2.0.0 use canvas 1.2.9, compatible with nodejs v4
- 1.2.8 use 'Unifont' as default font
- 1.2.7 use 'system' as default font
- 1.2.6 just fix readme koa example
- 1.2.5 add some example to readme, use canvas version `1.2.1`
- 1.2.4 make `err` the first callback param
- 1.2.3 use canvas version `1.1.6` version instead of version `*`

## license

MIT
npm package: @magne4000/apollo-link-dedup
Description: Deduplicates queries that are currently on the wire
Author: Evans Hauser
Latest version: 1.0.19

---
title: apollo-link-dedup
description: Deduplicate matching requests before making a request
---

*NOTE* This link is included by default when using apollo-client so you don't need to add it to your link chain if using apollo-client.

## Installation

`npm install apollo-link-dedup --save`

## Usage
```js
import { DedupLink } from "apollo-link-dedup";

const link = new DedupLink();
```

## Options
The Dedup Link does not take any options when creating the link.

## Context
The Dedup Link can be overridden by using the context on a per operation basis:
- `forceFetch`: a true or false (defaults to false) to bypass deduplication per request

```js
import { createHttpLink } from "apollo-link-http";
import ApolloClient from "apollo-client";
import InMemoryCache from "apollo-cache-inmemory";

const client = new ApolloClient({
  link: createHttpLink({ uri: "/graphql" }),
  cache: new InMemoryCache()
});

// a query with apollo-client that will not be deduped
client.query({
  query: MY_QUERY,
  context: {
    forceFetch: true
  }
})
```
npm package: @magne4000/electron-process-reporter
Description: Utility to extract interesting process reports of an Electron application.
Latest version: 2.0.0

# electron-process-reporter
Utility to extract interesting process reports of an Electron application.

## Installation 
```bash
# For Electron < 7
$ npm install --save electron-process-reporter@0.7.1
# For Electron >= 7
$ npm install --save electron-process-reporter
```

## Usage

### onExtendedProcessMetrics
Returns an Rx.Observable that emits reports of `ExtendedProcessMetric` every `options.samplingInterval` ms.
```js
import { app } from 'electron';
import { onExtendedProcessMetrics } from 'electron-process-reporter';

onExtendedProcessMetrics(app, { samplingInterval: 1000 }) // returns a rx.Observable
  .subscribe(report => console.log(report))
```

### onExcessiveCPUUsage
Will emit `ExtendedProcessMetric[]` when a process exceeds the `options.percentCPUUsageThreshold` on more than `options.samplesCount` samples.
```js
import { app } from 'electron';
import { onExcessiveCPUUsage } from 'electron-process-reporter';

onExcessiveCPUUsage(
  app,
  {
    samplesCount: 1,
    percentCPUUsageThreshold: 90,
  }) // returns a rx.Observable
  .subscribe(report => console.log(report))
```

### onProcessTreeMetricsForPid
Returns an Rx.Observable that emits `PidUsage[]` every `options.samplingInterval` ms.
```js
import { onProcessTreeMetricsForPid } from 'electron-process-reporter';

onProcessTreeMetricsForPid(process.pid, { samplingInterval: 1000 }) // returns a rx.Observable
  .subscribe(report => console.log(report))
```

### onExcessiveCPUUsageInProcessTree
Will emit `PidUsage[]` when a process of the tree exceeds the `options.percentCPUUsageThreshold` on more than `options.samplesCount` samples.
```js
import { onExcessiveCPUUsageInProcessTree } from 'electron-process-reporter';

onExcessiveCPUUsageInProcessTree(
  process.pid, // in the main process
  {
    samplesCount: 1,
    percentCPUUsageThreshold: 90,
  }) // returns a rx.Observable
  .subscribe(report => console.log(report))
```
npm package: @magne4000/macos-notification-state
Description: macOS notification state as a native node addon
Author: Felix Rieseberg
Latest version: 1.2.1

## macos-notification-state
Do you want to check if you should display a notification to your user on macOS? This native module checks if the user is active, if the screen is locked, or if "do not disturb" is enabled.

```
npm install macos-notification-state
```

```
const { getNotificationState, getSessionState, getDoNotDisturb } = require('macos-notification-state`)

// This will brint a boolean (true if enabled, false if not)
console.log(getDoNotDisturb())

// This will print a string indiciating the current state, being one of the following:
// 'SESSION_SCREEN_IS_LOCKED'
// 'SESSION_ON_CONSOLE_KEY'
// 'DO_NOT_DISTURB'
// 'UNKNOWN'
// 'UNKNOWN_ERROR'
//
// If "do not disturb" is enabled, it takes precedence.
console.log(getNotificationState())

// This will print a string indiciating the current session state, being one of the following:
// 'SESSION_SCREEN_IS_LOCKED'
// 'SESSION_ON_CONSOLE_KEY'
// 'UNKNOWN'
console.log(getSessionState())
```

#### License
MIT, please see LICENSE for details. Copyright (c) 2017 Felix Rieseberg.
npm package: @magne4000/windows-notification-state
Description: SHQueryUserNotificationState as a native Node addon
Author: Felix Rieseberg
Latest version: 1.3.1

## windows-notification-state
[SHQueryUserNotificationState](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762242(v=vs.85).aspx), implemented as a native Node addon. If you're looking for a simple solution to check whether or not you should send your user a notification, this is it.

```
npm install windows-notification-state
```

```
const { shQueryUserNotificationState, getNotificationState } = require('windows-quiet-hours`)

// This will print a number (corresponding with QUERY_USER_NOTIFICATION_STATE)
console.log(shQueryUserNotificationState())

// If you prefer your code to be more readable, you can use the string-based variant.
// This will print the name of the enum (so "QUNS_ACCEPTS_NOTIFICATIONS" instead of 5)
console.log(getNotificationState())
```

#### License
MIT, please see LICENSE for details. Copyright (c) 2017 Felix Rieseberg.
npm package: @magneds/hapi-plugin-pdf
Description: Hapi plugin to create PDF's from webpages
Author: Rogier Spieker
Latest version: 1.0.7

# Hapi PDF Plugin

Create a PDF file from any web page

## Installation

```
$ npm install --save @magneds/hapi-plugin-pdf
```

## Usage

As the name might have suggested already, this package is a plugin for the Hapi framework, simply registering the package as plugin will suffice.

### Using `@magneds/hapi-server`

```js
const HapiServer = require('@magneds/node-hapi-server');
const HapiPluginPDF = require('@magneds/hapi-plugin-pdf');

new HapiServer()
	.configure({ host: 'localhost', port: 3000 })
	.plugin(HapiPluginPDF)
	.start()
	.then(() => console.log(`Running @${server.info.uri}`));
```

### Using `hapi`

```js
const Hapi = require('hapi');
const HapiPluginPDF = require('@magneds/hapi-plugin-pdf');

const server = Hapi.server({ host: 'localhost', port: 3000 });

const init = async () => {
	await server.register(HapiPluginPDF);
	await server.start();

	console.log(`Running @${server.info.uri}`);
};

init();
```

## API

The pdf plugins registers a single route and works with both the `GET` and `POST` request methods.

### `/pdf/render`

The request is delegated to the provided url using the method used to call the `/pdf/render` endpoint, any GET and/or POST parameter as well as all headers are added to the delegated request.

#### GET request

A GET request only requires a (properly encoded) `url` parameter, which contains the url to the web page to render as PDF.

Any header provided will be provided to the final destination.

#### POST request

Like the GET request, a POST request also only requires the `url` parameter, which may be provided in either the payload (body) or as parameter to the url.

All headers and payload data will be provided to the final destination.

#### Changing the path prefix

The '/pdf' portion of the route is a so-called route prefix, it can be changed to whatever you'd like during registration to Hapi by specifying an alternative.

##### Using `@magneds/hapi-server`

```js
	//...
	//  rename the /pdf/render path to /my-custom/pdf/render
	.plugin({ ...HapiPluginPDF, routes: { prefix: '/my-custom/pdf' } })
	//..
```

##### Using `hapi`

```js
	//...
	//  rename the /pdf/render path to /my-custom/pdf/render
	await server.register({ ...HapiPluginPDF, routes: { prefix: '/my-custom/pdf' } });
	//...
};

init();
```

## Change log

Please see [Changelog](CHANGELOG.md)

## Testing

```bash
$ npm test
```

## Contributing

Please see [Contributing](CONTRIBUTING.md)

## Credits

-   [All Contributors][link-contributors]

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[link-contributors]: ../../contributors
npm package: @magnesium/core
Description: The Magnesium Design components for the web core system.
Latest version: 1.16.0

# @magnesium/core

The Magnesium Design core system.

## Installing

```shell
npm install @magnesium/core
```

## Usage

```scss
@use "@magnesium/core";
```

### Configuration

You can extend default options before importing any Magnesium components:

```scss
@use "@magnesium/core" with (
    $extend: (
        // ...
    )
);
```

### Options

| Name      | Default                                | Description                                  |
|-----------|----------------------------------------|----------------------------------------------|
| `screens` | `()`                                   | Sets a map of token rules for media queries. |
| `core`    | `("responsive": true, "states": true)` | Sets a map of token rules for core rules.    |

### Screens

```scss
@use "@magnesium/core" with (
    $extend: (
        "screens": (
            "lg": 1024px
        )
    )
);
```

### Core

```scss
@use "@magnesium/core" with (
    $extend: (
        "core": (
            "responsive": false
        )
    )
);
```

## API

### Sass functions

| Function                       | Description                                           |
|--------------------------------|-------------------------------------------------------|
| `create-var($name, $fallback)` | Sets new CSS custom property, with optional fallback. |

#### Color with `core.create-var()`

The following Sass...

```scss
@use "@magnesium/core";

.foo {
    color: core.create-var(foo, #2674a2);
}
```

...will produce the following CSS...

```css
.foo {
    color: var(--mg-foo, #2674a2);
}
```
npm package: @magnesium/theme
Description: The Sass Framework for Web Design Systems.
Latest version: 4.9.0

<div align="center">

![Magnesium Design](.github/banner.svg)

</div>

[![Version](https://flat.badgen.net/npm/v/@magnesium/theme)](https://www.npmjs.com/package/@magnesium/theme)
[![Downloads](https://flat.badgen.net/npm/dt/@magnesium/theme)](https://www.npmjs.com/package/@magnesium/theme)
[![License](https://flat.badgen.net/npm/license/@magnesium/theme)](https://www.npmjs.com/package/@magnesium/theme)

## Introduction

The Magnesium Sass Framework helps you easily develop your Web Design System.

## Installing

```shell
npm install @magnesium/theme
```

## Usage

The theme component helps you easily manage theme styles by generating CSS custom properties declarations from
a user-provided theme tokens map.

## Options

| Option    | Description                                                                                |
|-----------|--------------------------------------------------------------------------------------------|
| `$prefix` | Add a global prefix name on any custom properties. Default `mg`. Set to `false` to disable. |

```scss
@use "@magnesium/theme" with (
    $prefix: "foo" // Set to `false` to disable.
);
```

## Mixins

### `emit-custom-props($tokens, $prefix)`

Emits CSS custom properties declarations from a user-provided theme.

```scss
@use "@magnesium/theme";

$tokens: (
    "text-color": darkcyan
);

.foo {
    @include theme.emit-custom-props($tokens, "button");
}
```

### Result

```scss
.foo {
    --mg-button-text-color: darkcyan;
}
```

## Functions

### `emit-variable($tokens, $token, $fallback, $prefix)`

Emits CSS variable declaration from a user-provided theme.

```scss
@use "@magnesium/theme";

$tokens: (
    "text-color": darkcyan
);

.foo {
    color: theme.emit-variable($tokens, "text-color", false, "button");
}
```

### Result

```css
.foo {
    color: var(--mg-button-text-color);
}
```

### `validation($reference, $tokens)`

Validates a user-provided theme's token and throws an error if tokens are invalid.

```scss
@use "@magnesium/theme";

$reference: (
    "text-color": darkcyan
);

$tokens: (
    "text-color": darkorange
);

$tokens: theme.validation($reference, $tokens); // Return `$tokens` map if true or error if false.
```

## Top-level config override

If variables are already configured on top-level using `@use ... with`, by another dependency for example, you can't use
this solution anymore, because the module can only be setup once, this is a Sass restriction with **Module System**, but
another solution exists for overriding the main configuration, with a mixin!

See [official documentation](https://sass-lang.com/documentation/at-rules/use#with-mixins) about override configuration
with mixins.

| Mixin             | Description                                |
|-------------------|:-------------------------------------------|
| `config($prefix)` | Override top-level `prefix` configuration. |

#### Configuration rule with `theme.config()`

The following Sass will configure new parameters:

```scss
@use "@magnesium/theme";

@include theme.config("fr");
```