open-index/open-npm huggingface dataset:
npm package: @pocke/await-semaphore
Description: Awaitable semaphore/mutex
Author: Emma Kuo
Latest version: 0.2.0

# await-semaphore
Awaitable semaphore/mutex

A semaphore implementation using ES6 promises and supporting 3 styles:

* async/await style (needs typescript)
* thunk style (automatic acquire/release)
* promise style

Also includes `Mutex` as a convenience for `new Semaphore(1)`.

## API

### new Semaphore(count: number)

Create a new semaphore with the given count.

```javascript
import {Semaphore} from 'await-semaphore';

var semaphore = new Semaphore(10);
```

### semaphore.acquire(): Promise<() => void>

Acquire the semaphore and returns a promise for the release function. Be sure to handle release for exception case.

```javascript
semaphore.acquire()
.then(release => {
    //critical section...
    doSomething()
    .then(res => {
        //...
        release();
    })
    .catch(err => {
        //...
        release();
    });
});
```

### semaphore.use<T>(thunk: () => Promise<T>): Promise<T>

Alternate method for using the semaphore by providing a thunk. This automatically handles acquire/release.

```javascript
semaphore.use(() => {
    //critical section...
});
```

### new Mutex()

An alias for `new Semaphore(1)`. Mutex has the same methods as Semaphore.

```javascript
import {Mutex} from 'await-semaphore';

var mutex = new Mutex();
```

## Examples

Create a version of `fetch()` with concurrency limited to 10.

### async/await style (typescript)

```typescript
var semaphore = new Semaphore(10);

async function niceFetch(url) {
    var release = await semaphore.acquire();
    var result = await fetch(url);
    release();
    return result;
}
```

### thunk style (javascript)

```javascript
var semaphore = new Semaphore(10);

function niceFetch(url) {
    return semaphore.use(() => fetch(url));
}
```

### promise style (javascript)

```javascript
var semaphore = new Semaphore(10);

function niceFetch(url) {
    return semaphore.acquire()
    .then(release => {
        return fetch(url)
        .then(result => {
            release();
            return result;
        });
    });
}
```
npm package: @pocke/github-url-to-object
Description: Extract user, repo, and other interesting properties from GitHub URLs
Author: zeke
Latest version: 4.0.4

# github-url-to-object  [![Build Status](https://travis-ci.org/zeke/github-url-to-object.png?branch=master)](https://travis-ci.org/zeke/github-url-to-object)

A module for node.js and browsers that extracts useful properties like `user`,
`repo`, and `branch` from various flavors of GitHub URLs.

There's also a Bitbucket equivalent to this library: [bitbucket-url-to-object](https://github.com/zeke/bitbucket-url-to-object).

Check out the demo at [zeke.github.io/github-url-to-object](https://zeke.github.io/github-url-to-object).

## Installation

For Node.js or Browserify usage:

```sh
npm i github-url-to-object
```

For bower usage:

```sh
bower install github-url-to-object
```

## Usage

Use whatever flavor of GitHub URL you like:

```js
const gh = require('github-url-to-object')

gh('github:monkey/business')
gh('https://github.com/monkey/business')
gh('https://github.com/monkey/business/tree/master')
gh('https://github.com/monkey/business/tree/master/nested/file.js')
gh('https://github.com/monkey/business.git')
gh('http://github.com/monkey/business')
gh('git://github.com/monkey/business.git')
gh('git+https://github.com/monkey/business.git')
```

Here's what you'll get:

```js
{
  user: 'monkey',
  repo: 'business',
  branch: 'master',
  tarball_url: 'https://api.github.com/repos/monkey/business/tarball/master',
  clone_url: 'https://github.com/monkey/business',
  https_url: 'https://github.com/monkey/business',
  travis_url: 'https://travis-ci.org/monkey/business',
  api_url: 'https://api.github.com/repos/monkey/business'
  zip_url: 'https://github.com/monkey/business/archive/master.zip'
}
```

The shorthand form lets you specify a branch:

```js
gh('github:monkey/business#nachos')
```

```js
{
  user: 'monkey',
  repo: 'business',
  branch: 'nachos',
  https_url: 'https://github.com/monkey/business/blob/nachos',
  tarball_url: 'https://api.github.com/repos/monkey/business/tarball/nachos',
  clone_url: 'https://github.com/monkey/business',
  travis_url: 'https://travis-ci.org/monkey/business?branch=nachos',
  api_url: 'https://api.github.com/repos/monkey/business'
  zip_url: 'https://github.com/monkey/business/archive/nachos.zip'
}
```

If you provide a non-GitHub URL or a falsey value, you'll get `null`.

### GitHub Enterprise

If you're using GitHub Enterprise, pass the `enterprise` option to allow
your non-`github.com` URL to be parsed:

```js
gh('https://ghe.example.com:heroku/heroku-flags.git', { enterprise: true })
```

## Test

```sh
npm install
npm test
```

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

## License

MIT
npm package: @pocke/react-native-puree
Description: A log collector for React Native
Latest version: 0.1.0

# react-native-puree
[![Build Status](https://travis-ci.org/cookpad/react-native-puree.svg?branch=master)](https://travis-ci.org/cookpad/react-native-puree) [![npm](https://img.shields.io/npm/v/react-native-puree.svg)](https://www.npmjs.com/package/react-native-puree)

A log collector for React Native.

Features:

- Buffering: Store logs to AsyncStorage and send them later
- Batching: Send logs in a single request
- Retrying: Retry to send logs after backoff time if sending logs fails

```js
import Puree from 'react-native-puree'

function epochTime () {
  return Math.floor(new Date().getTime() / 1000)
}

const puree = new Puree()
puree.addFilter(function addTableName(log) {
  return Object.assign({ table_name: 'table' }, log)
});

puree.addFilter(function addEventTime(log) {
  return Object.assign({ time: epochTime() }, log)
})

puree.addOutput(async (logs) => {
  console.log(logs)
})

puree.start()

// send log
puree.send({ event: 'click', recipe_id: 1234 })
```


## Usage
### Configure
```js
const puree = new Puree({
  flushInterval: 2 * 60 * 1000, // the interval to flush logs in milli second
  maxRetry: 5                   // try to send logs until max retry count
  firstRetryInterval: 1 * 1000  // the interval between the fail to send logs and the first retry
})
```

### Record logs
```js
puree.send({ event: 'click', recipe_id: 1234 })
```

A log is stored into persistent storage ( [AsyncStorage](https://facebook.github.io/react-native/docs/asyncstorage.html) ) after applying filters to it. 

### Flush logs
You can automatically send logs every interval with `puree.start()`.

```js
puree.start()
```

or manually:

```js
puree.flush()
```


## Recipe

### Flush logs on resume

Use `AppState` and `puree.flush()`.

See also: https://facebook.github.io/react-native/docs/appstate.html

```js
import { AppState } from 'react-native'

class AppRoot extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      appState: AppState.currentState
    };
  }

  componentDidMount() {
    AppState.addEventListener('change', this._handleAppStateChange);
  }

  componentWillUnmount() {
    AppState.removeEventListener('change', this._handleAppStateChange);
  }

  onForeground () {
    puree.flush();
  }

  // https://facebook.github.io/react-native/docs/appstate.html
  _handleAppStateChange = (nextAppState: string) => {
    if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
      this.onForeground();
    }

    this.setState({ appState: nextAppState });
  }

  render() {
    return (
      <App/>
    );
  }
}
```

## Link
- [puree-android](https://github.com/cookpad/puree-android)
- [puree-ios](https://github.com/cookpad/puree-ios)

## License
MIT
npm package: @pocket-ace/core
Description: An Experimental GrpahQL framework
Latest version: 0.0.4

![test](https://github.com/acro5piano/PocketAce/workflows/test/badge.svg)
[![npm version](https://badge.fury.io/js/%40pocket-ace%2Fcore.svg)](https://badge.fury.io/js/%40pocket-ace%2Fcore)

# PocketAce

An Experimental GrpahQL framework

Note: under heavy development. Do not use in production.

# Features to build

The following features **will** be implemented:

- **GraphQL First**: Built for making GraphQL server without hassle
- **High Performance**: Efficient data loading by default
- **Opinionated**: No worry about directory structure, library, testing
- **Realtime**: Built-in subscriptions, live queries
- **Ergonomic**: Less code, great DX
- **Free DB choice**: Can support major databases (PG, MySQL, and so on)
- **Type Safe**: 100% Written in TypeScript (or Deno)

# Getting Started

Install:

```
yarn add @pocket-ace/core graphql sqlite3
```

Define your app:

```javascript
// app.js

const PocketAce = require('@pocket-ace/core')

PocketAce.registerResolver('hello', () => 'world')

PocketAce.configureDatabase({
  client: 'sqlite',
  connection: {
    filename: ':memory:',
  },
})

PocketAce.buildSchema(`
  type Query {
    hello: String!
    users: [User!]! @all(table: "users")
  }

  type Mutation {
    createUser(name: String!): User @create(table: "users")
  }

  type User {
    id: ID!
    name: String!
  }
`)

PocketAce.initialize()

const sql = `
  create table users (
    id integer not null primary key autoincrement,
    name string not null default ''
  )
`

PocketAce.sql(sql).then(() => {
  PocketAce.runApplication()
})
```

I know the above code is ugly. We'll improve it soon.

Then run `node app.js`.

You can now run GraphQL queries to http://localhost:3000

```bash
curl -XPOST localhost:3000/graphql -d query='{ hello }'
```

# Directory structure for the Framework

```
.
|-- cmd              # CLI command
|  |-- SomeTask.ts
|  `-- index.ts
|-- config           # App configuration
|-- jobs             # Async jobs
|-- middlewares      # HTTP Middlewares
|-- policies         # Policies
|-- resolvers        # Custom resolvers
|-- schema           # GraphQL Schema (every file in this dir loaded)
|  `-- index.gql
`-- tests            # Tests
   |-- feature
   | `-- LoginUserTest.ts #
   `-- unit #
     `-- LoginUserTest.ts #
```

# Built with

Main dependencies:

- Koa
- GraphQL
- Knex
- TypeDI
- Dataloader

Development:

- TypeScript, ts-node
- Ava
- Supertest
- SQLite
- Lerna
- Rollup

Heavily inspired by https://github.com/nuwave/lighthouse