open-index/open-npm huggingface dataset:
npm package: @fonoster/apiserver
Description: APIServer for Fonoster
Author: Pedro Sanders
Latest version: 0.18.3

[![Discord](https://img.shields.io/discord/1016419835455996076?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/4QWgSz4hTC) ![GitHub](https://img.shields.io/github/license/fonoster/fonoster?color=%2347b96d) ![Twitter Follow](https://img.shields.io/twitter/follow/fonoster?style=social)

This module is part of the [Fonoster](https://fonoster.com) open-source. By itself, it does not do much. It is intended to be used as a dependency for other modules. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster).
npm package: @fonoster/authz
Description: Authorization module for Fonoster
Author: Pedro Sanders
Latest version: 0.18.2

authz
=================

[![Authz](https://img.shields.io/badge/authz-server-brightgreen.svg)](https://fonoster.com)
[![Version](https://img.shields.io/npm/v/@fonoster/authz.svg)](https://npmjs.org/package/@fonoster/authz)
[![Downloads/week](https://img.shields.io/npm/dw/@fonoster/authz.svg)](https://npmjs.org/package/@fonoster/authz)
[![License](https://img.shields.io/npm/l/@fonoster/authz.svg)](https://github.com/fonoster/fonoster/blob/main/package.json)

Authz is a simple and extensible authorization module for Fonoster. It provides a way to authorize incoming phone and API calls. 

The module has a simple interface that allows you to create authorization strategies. That includes verifying if a session is authorized, if a GRPC method is authorized, charging an account, and getting the account balance.

The interface is defined as follows:

```typescript
type AuthzHandler = {
  checkSessionAuthorized(request: VoiceRequest): Promise<boolean>;
  checkMethodAuthorized(
    request: CheckMethodAuthorizedRequest
  ): Promise<boolean>;
  addBillingMeterEvent(request: AddBillingMeterEventRequest): Promise<void>;
};
```

Please look at the [DummyAuthzHandler](./src/server/DummyAuthzHandler.ts) for an example of implementing your authorization strategy.

## Enabling the Authz module

To enable the Authz module you need to set the `AUTHZ_SERVICE_ENABLED` environment variable to `true`. Also, you need the `AUTHZ_SERVICE_HOST` (required), `AUTHZ_SERVICE_PORT` (defaults), and `AUTHZ_SERVICE_METHODS` (default is `/fonoster.calls.v1beta2.Calls/CreateCall`) environment variables.

Imagine you want to authorize the creation of new Workspaces. You can add the `/fonoster.identity.v1beta2.Identity/CreateWorkspace` method to the `AUTHZ_SERVICE_METHODS` environment variable and implement the `checkMethodAuthorized` method in your AuthzHandler.
npm package: @fonoster/common
Description: Common library for Fonoster projects
Author: Pedro Sanders
Latest version: 0.18.2

[![Discord](https://img.shields.io/discord/1016419835455996076?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/4QWgSz4hTC) ![GitHub](https://img.shields.io/github/license/fonoster/fonoster?color=%2347b96d) ![Twitter Follow](https://img.shields.io/twitter/follow/fonoster?style=social)

This module is part of the [Fonoster](https://fonoster.com) open-source. By itself, it does not do much. It is intended to be used as a dependency for other modules. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster).
npm package: @fonoster/grpc-health-check
Description: An implementation of gRPC health checks, written in typescript.
Latest version: 3.1.6

# gRPC Health Check

An implementation of gRPC health checks, for node.js-based apps that uses `@grpc/grpc-js` as a base.

## Installation

```sh
yarn add git+https://github.com/fonoster/grpc-health-check.git
```

## Usage

```typescript
/**
 * server.ts
 */
import * as grpc from '@grpc/grpc-js';
import { useHealth } from '@fonoster/grpc-health-check';

const server = useHealth(new grpc.Server());

server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => server.start());
```

```typescript
/**
 * client.ts
 */
import * as grpc from '@grpc/grpc-js';
import { HealthClient } from '@fonoster/grpc-health-check';

const health = new HealthClient('localhost:50051');

const { status } = await health.check('SERVICE');

console.info('The app is ready to serve!', status);
```

## Authors

This repository is a clone of [kalos](https://github.com/nicolaspearson/kalos/tree/main/packages/grpc-ts-health-check),
thanks to [Nicolas Pearson](https://github.com/nicolaspearson) for his implementation.

## License

Released under the [MIT License](/LICENSE). Extended from [kalos repository.](https://github.com/nicolaspearson/kalos/blob/main/LICENSE)
npm package: @fonoster/logger
Description: Logger module
Author: Pedro Sanders
Latest version: 0.18.2

[![Discord](https://img.shields.io/discord/1016419835455996076?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/4QWgSz4hTC) ![GitHub](https://img.shields.io/github/license/fonoster/fonoster?color=%2347b96d) ![Twitter Follow](https://img.shields.io/twitter/follow/fonoster?style=social)

This module is part of the [Fonoster](https://fonoster.com) open-source. By itself, it does not do much. It is intended to be used as a dependency for other modules. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster).
npm package: @fonoster/plugin-phone
Description: ☎️ Phone Plugin
Author: Pedro Sanders
Latest version: 0.2.2
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Phone Plugin
☎️ Phone Plugin

Phone simular plugin.

## Installing the plugin

```bash
fonoster plugins:install @fonoster/plugin-phone
```
npm package: @fonoster/types
Description: Common types for Fonoster projects
Author: Pedro Sanders
Latest version: 0.18.2

[![Discord](https://img.shields.io/discord/1016419835455996076?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/4QWgSz4hTC) ![GitHub](https://img.shields.io/github/license/fonoster/fonoster?color=%2347b96d) ![Twitter Follow](https://img.shields.io/twitter/follow/fonoster?style=social)

This module is part of the [Fonoster](https://fonoster.com) open-source. By itself, it does not do much. It is intended to be used as a dependency for other modules. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster).
npm package: @fons/fons
Description: Fons Javascript Library
Author: fons.io
Latest version: 6.2.5

# fons.js [![Circle CI](https://circleci.com/gh/getfons/fons.js.svg?style=svg&circle-token=941556a87f7597e40cc51f48d9ffe93385c57cf6)](https://circleci.com/gh/getfons/fons.js)
Javascript SDK Library

### Using

Example confirming an existing appointment
```
var Fons = require("@fons/fons");

var fons = new Fons();
fons.login("username", "password");

fons.appointment.confirm.v2("appointmentId").then(function(){
    return fons.appointment.get.v2("appointmentId");
}).then(function(confirmedAppointment) {
    // Update your local copy with a now confirmed appointment
}).catch(function(err) {
    console.log(err);
});
```

## Tests

### Node.js

1. `npm install -g mocha`
2. `npm install`
3. `mocha`
npm package: @font-face/browser
Description: Simple CSS @font-face injector for browser
Author: Piyush Lodaya
Latest version: 1.0.2

# @font-face/browser

Simple CSS @font-face Stylesheet injector for browser.

## Install
```javascript
npm i @font-face/browser
OR
yarn add @font-face/browser
```

## API usage
**@font-face/browser** library exports simple function to pass font configs and injects @font-face CSS stylesheet into document head.

## Usage

```javascript
import fontFaceBrowser from '@font-face/browser';

fontFaceBrowser({
    fontDirContext: require.context('./fonts'),
    fonts: [
        {
            name: 'Roboto',
            weight: 200,
            style: 'normal',
            file: 'Roboto-Light',
        },
        {
            name: 'Roboto',
            weight: 400,
            style: 'normal',
            file: 'Roboto-Regular',
        },
        {
            name: 'Roboto',
            weight: 600,
            style: 'bold',
            file: 'Roboto-Medium',
        }
    ]
});
```

This will inject a style tag into document head with following contents:

```CSS
@font-face { font-family: 'Roboto'; font-weight: 200; font-style: normal; src: url('/static/media/Roboto-Light.88823c20.ttf') format('truetype'); }
@font-face { font-family: 'Roboto'; font-weight: 400; font-style: normal; src: url('/static/media/Roboto-Regular.11eabca2.ttf') format('truetype'); }
@font-face { font-family: 'Roboto'; font-weight: 600; font-style: bold; src: url('/static/media/Roboto-Medium.58aef543.ttf') format('truetype'); }
```

* fontDirContext - Webpack require context. This is the base fonts directory.
* fonts - Array of fonts configs.
* name, weight, style are self explanatory
* file - Font file name without extension. Appropriate url will be formed based on file format available in base directory. 

## Caveats
Currently this library could only be worked with webpack based projects.
If you have any idea to make it bundle agnostic, please feel free to raise an issue.
npm package: @fontanus/logger
Description: Logger service
Author: Viktor Nagy
Latest version: 1.5.18

## Usage

The logger implements the [loglevel](https://www.npmjs.com/package/loglevel) API

- `logger.info(msg: string, data?: any)`
- `logger.debug(msg: string, data?: any)`
- `logger.warn(msg: string, data?: any)`
- `logger.error(msg: string, data?: any)`
- `logger.trace(msg: string, data?: any)`
- `logger.setLevel(msg: string, data?: any)`
- `logger.getLoggers(msg: string, data?: any)`
- `logger.getLogger(msg: string, data?: any)`

Logger adds the following features:

- using a the URL search string `lr` switches on remote logging, saved in the SessionStorage
- using the URL search string `ll=LOGLEVEL` sets all log levels to `LOGLEVEL`
- using the URL search string `lc` passes an initial context, mostly used in iframes
- creates `window.logger=loglevel`
- `logger.setupLogger`: The remote log url can be set by calling `logger.setupLogger(url, defaultLogger="default", logContextGetter=false)`
- `logger.getSetupString`: returns a query string to be passed on into iframes

## Extra API methods

### logger.setupLogger

`setupLogger(url, defaultLogger="default", logContextGetter=false)` is used set up remote logging.

- `defaultLogger`- string, specifies the `loggerName` for the default logger of `loglevel`. e.g: `com-webapp`. You can start new loggers using `logget.getLogger("mylogger")`. A recommended logger naming convention is to use `defaultLogger.myLogger` for custom loggers.
- `logContextGetter` - function or false, takes a function that returns extra data to be passed as context for the log message. By default no context is passed with the log message. If `loglevel.<method>` is called with a second data attribute that has a `context` key, then the `logContextGetter` is ignored and `data.context` is passed on as the log context.

### logger.getSetupString

`logger.getSetupString()` is used to retrieve the current logger settings as a search query url.

The primary usecase of `getSetupString` is to pass it to an iframe to retain the same remote logging and loglevel settings that the main frame has.

## Example

```js
import * as log from "@nagyv/logger"

log.setupLogger('https://www.example.com', 'example-logs', () => ({hello: 'world'}))
log.warn('A warning')
/*
posts the following to https://www.example.com when remote logging is enabled:
{
  'message': 'A warning',
  'loggerName': 'example-logs',
  'context': {
    'hello': 'world'
  }
}
*/

log.warn('A warning', {context: 'mycontext'})
/*
posts the following to https://www.example.com when remote logging is enabled:
{
  'message': 'A warning',
  'loggerName': 'example-logs',
  'context': 'mycontext',
  'data': {'context': 'mycontext'}
}
*/

const otherLog = log.getLogger('otherLog')
log.warn('A warning')
/*
posts the following to https://www.example.com when remote logging is enabled:
{
  'message': 'A warning',
  'loggerName': 'otherLog',
  'context': {
    'hello': 'world'
  }
}
*/
```