open-index/open-npm huggingface dataset:
npm package: @obel/restable
Description: Restable is a specification for communicating with databases via REST calls. It uses the [JSONAPI](https://jsonapi.org/) specification to define how to manage resources in the databases.
Author: nyabongo
Latest version: 0.0.5

# Restable (WIP)

Restable is a specification for communicating with databases via REST calls. It uses the [JSONAPI](https://jsonapi.org/) specification to define how to manage resources in the databases.

## Description

RESTABLE is a specification of a REST interface for communication with data stores using HTTP REST calls in a way that is datastore agnostic.
A basic implementation of the RESTABLE spec using the [Nest](https://github.com/nestjs/nest) framework. The implementation in this repo stores data in memory. To store data in other datastores and databases, you have to build plugins
## Building plugins
While you don't need to use NEST.js to build plugins, This Repo makes it easy to use it to build plugins. An example of a plugin built with nestjst is here https://github.com/nyabongo/restable-couchbase

1. To build a plugin, you can start by using the boostrapped NESTjs application created by running
```bash
$ npm i -g @nestjs/cli
$ nest new project-name
```
2. Install this npm package using 
```bash
$ npm i @nyabongo/restable
```
3. Replace the controller import in `app.module.ts` with the controller from `@nyabongo/restable` as done [here for couchbase](https://github.com/nyabongo/restable-couchbase/blob/main/src/app.service.ts) see example implementations 
```typescript
//app.controller.ts

//import { AppController } from './app.controller';
import { AppController } from '@obel/restable';
```
4. implement `IRestableService` in `app.service.ts` 
```typescript
//...
import { IRestableService} from '@obel/restable';
//...

@Injectable
export class AppService implements IRestableService{
    //...
}
```
## Installation

```bash
$ npm install
```

## Running locally
The app runs on port 3000
```bash
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```
## View the Spec and documentation
If you are running the app navigate to the path `/api_doc/` to view the swagger documentation and test the spec

## Test

```bash
# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
```
## License

Restable is [MIT licensed](LICENSE).
npm package: @obeliskbr/eslint-config
Description: ## Description
Latest version: 1.0.2

# Obelisk - Eslint Config

## Description

This is an internal project used for sharing common eslint rules across all the front-end packages at Obelisk.

## Installation

In your front-end package, run:

```
yarn add @obelisk/eslint-config -D
```

Make sure to create a `.eslintrc.json` file and place the content:

```
{
  "extends": ["@obelisk"]
}
```
npm package: @obeliskbr/prettier-config
Description: ## Description
Latest version: 1.0.0

# Kyte - Prettier Config

## Description

This is an internal project used for sharing common prettier rules across all the front-end packages at Kyte.

## Installation

In your front-end package, run:

```
yarn add @drivekyte/prettier-config -D
```

Now open your `package.json` file and place the content:

```
{
  "prettier": "@drivekyte/prettier-config"
}
```
npm package: @obelism/improve-sdk-next
Description: Obelism Improve NextJS SDK
Author: Obelism
Latest version: 0.4.0

# Obelism Improve NextJS SDK

The NextJS SDK sits around the [Javascript Server SDK](https://improve.obelism.studio/docs/sdk/javascript#server) and gives React specific handlers.

## Install

```bash
npm i @obelism/improve-sdk-next
```

## Generator

The main export exposes a generator to create the middleware handler using the passed configuration.

```ts
import { ImproveServerSDK } from '@obelism/improve-sdk/server'
import { generateImproveNextMiddleware } from '@obelism/improve-sdk-next'

const improveMiddlewareHandler = generateImproveNextMiddleware({
	improveSdk: new ImproveServerSDK(IMPROVE_ARGS),
	serverABtests: [],
})
```

### improveSdk

```ts
generateImproveNextMiddleware({
	improveSdk: ImproveServerSDK,
})
```

The [ImproveServerSDK](https://improve.obelism.studio/docs/sdk/javascript#server) to be used. Required to be loaded with a configuration in place before handlig requests.

### serverABtests

```ts
generateImproveNextMiddleware({
    serverABtests: ServerABTestConfig[]
})
```

Not every AB test from the config needs to be used be used for the middleware handler. For each one that does need to be used it needs to be passed in this argument. Each entry in this list resembles one server side AB test.

```ts
export type OptionConfig = {
	value: string // Should match the slug from the option
	slug: string // Slug to send people towards when this version is active
}

export type ServerABTestConfig = {
	// Needs to match an AB test in Improve
	slug: string

	// Route to run the AB test on, usually this matches the slug
	routeHandler: string

	// For more complicated rewrites pass a function to format a NextUrl based on the matching option
	formatSlug?: (url: NextURL, matchingOption: OptionConfig) => NextURL

	// List of options for the AB test
	options: OptionConfig[]
}
```

## MiddlewareHandler

```ts
const improveMiddlewareHandler = generateImproveNextMiddleware(...)

export const middleware = async (request: NextRequest) => {
	return improveMiddlewareHandler(request)
}
```

The generated handler based on your configuration. Receives a `NextRequest` and rewrites based on one of three reasons:

- Search parameters matching a valid test with option configuration. Recommended for development or testing purposes, shouldn't be used for real users since it will impact the distribution.
- AB test cookie value which matches a valid test for name with option for value, the `improveMiddlewareHandler` will both read and write this cookie
- Visitor ID cookie, for long running servers the `ImproveServerSDK` will also be able to store the saved decision for a visitor in memory and use that to serve the same result. For serverless or edge this won't work for this purpose.
npm package: @obelism/improve-sdk-react
Description: Obelism Improve React SDK
Author: Obelism
Latest version: 0.4.0

# Obelism Improve React SDK

The React SDK sits around the [Javascript Client SDK](https://improve.obelism.studio/docs/sdk/javascript#client) and gives React specific handlers.

## Install

```bash
npm i @obelism/improve-sdk-react
```

## Setup

In your config folder create the following file: `improveClient.ts`

```ts
import { generateImproveProvider } from '@obelism/improve-sdk-react'

export default generateImproveProvider(...)
```

## API

### generateImproveProvider

```ts
generateImproveProvider(improveArgs: {
	organizationId: string
	environment: 'develop' | 'staging' | 'production'
	config?: Configuration
	fetchTimeout?: number
}) => ({
    ImproveProvider,
    usePostAnalytic,
    useTestValue,
    useFlagValue
})
```

Setup function that generates the React component and hooks.

### ImproveProvider

```ts
<ImproveProvider>
    {children}
</ImproveProvider>
```

On mount this automatically fetches the ImproveSDK and the config if not provided initially. Exposes a context that is used to populate data to the hooks down the component tree.

### useFlagValue

```ts
const value: string = useFlagValue(flagSlug: string)
```

Wrapper around [getFlagValue](https://improve.obelism.studio/docs/sdk/javascript#getflagvalue) that's passed down when the context is setup.

### useTestValue

```ts
const value: string = useTestValue(testSlug: string)
```

Wrapper around [getTestValue](https://improve.obelism.studio/docs/sdk/javascript#gettestvalue) that's passed down when the context is setup.

### usePostAnalytic

```ts
const postAnalytic = usePostAnalytic()

<button onClick={() => postAnalytic(testSlug: string, eventSlug: string, message: string)} />
```

Wrapper around [postAnalytic](https://improve.obelism.studio/docs/sdk/javascript#postanalytic) that's passed down when the context is setup.

## NextJS App router

For NextJS we need to make sure the generated provider is marked as a client component. For this we need to declare the `ImproveProvider` within the file we declare `"use client"`.

This is needed because the ImproveProvider uses an `useEffect` to fetch load the JS SDK async and fetch the config async if needed. After it's setup it uses context to pass the data down.

```ts
'use client'

import { generateImproveProvider } from 'utils/generateImproveProvider'

const improveReact = generateImproveProvider(...)

export const ImproveProvider = improveReact.ImproveProvider
export const useTestValue = improveReact.useTestValue
export const useFlagValue = improveReact.useFlagValue
export const usePostAnalytic = improveReact.usePostAnalytic
```