open-index/open-npm huggingface dataset:
npm package: @hydrofoil/knossos
Description: Knossos is a high level Hydra server, which allows rapidly deploying Hydra-powered APIs backed by a triplestore.
Latest version: 0.9.11

# @hydrofoil/knossos

Knossos is a high level Hydra server, which allows rapidly deploying Hydra-powered APIs backed by a triplestore.

### Low friction

No initial setup, you only need to create an RDF database with SPARQL Query/Update functionality.

### Turtles all the way down

The entire API is stored as RDF graph:

- The proper API resources 
- Hydra API Documentation
- The data models, using SHACL Shapes

### Eating its own dog food

The API itself is also controlled using HTTP interface:

- Creating data models
- Exposing functionality as Hydra Supported Operations
- Fine-grained access control
  
## TODOs

- Control the implicit `PUT` on per-class basis
npm package: @hydrofoil/labyrinth
Description: Build Hydra APIs on top of hydra-box
Latest version: 0.4.5

# @hydrofoil/labyrinth

Labyrinth is an opinionated, batteries-included middleware for setting up a Hydra API with ease in data-centric manner.

It uses [`hydra-box`](https://npm.im/hydra-box) internally and extends it to provide ready to use building blocks for rapid RDF-base API development.

## Installation

```
npm i --save @hydrofoil/labyrinth
```

## Setting up

Labyrinth exports an async factory function which creates an express handler.

```js
import express from 'express'
import * as path from 'path'
import { hydraBox } from '@hydrofoil/labyrinth'

// base path to load JavaScript code referenced in Api Documentation
const codePath = path.join(__dirname, 'lib')
// path to load the Api Documentation from Turtle files
const apiPath = path.join(__dirname, 'hydra')
// base resource namespace
const baseUri = 'http://example.com/'

async function main() {
  const app = express()
    
  app.use(await hydraBox({
    codePath,
    apiPath,
    baseUri,
    path,        // (optional) ApiDocumentation URL path
    defaultBase, // (optional) base URI to parse API Documentation
    loader,      // (optional) hydra-box resource loader
    // SPARQL endpoint
    sparql: {
      endpointUrl, // Query
      updateUrl,   // (optional) Update 
      storeUrl,    // (optional) Graph Protocol,
      user,        // (optional) endpoint user name
      password     // (optional) endpoint password
    },
    options: {
      collection: {
        pageSize   // (optional) default page size of paged collections   
      }  
    },
    errorMappers: [] // (optional) map errors into problem+json
    middleware: {    // (optional) hydra-box middleware (arrays or function)
      operations,    // runs before final operation is selected. modify `req.hydra.operations` here
      resource,      // runs before operation is invoked. modify `req.hydra.resource` here
    }
  }))
  
  app.listen(8080)
}

main()
```

## Features

* Generic handlers for getting individual resources
  * Eager loading linked resources
  * Resource preprocessor for custom resource logic before handler
* Generic `hydra:Collection` handler
  * Create any collection using `hydra:manages` block
  * Custom filtering
  * Ordering using property paths
  * Paging using `hydra:pageIndex`
* Secured using JWT tokens
  * Permission-based restrictions to operations
  * Restricting select properties or entire classes
* Error handling using `Problem Details for HTTP APIs` ([RFC 7807](https://tools.ietf.org/html/rfc7807))
  * See [PDMLab/http-problem-details-mapper](https://github.com/PDMLab/http-problem-details-mapper) for instructions

## Difference from hydra-box

In contrast to `hydra-box` it also makes some limiting assumptions:

1. All resources are stored in triple store in named graph-per resource fashion
2. Labyrinth provides its own loader which does SPARQL `CONSTRUCT` query to load said resources
   * Another loader can be used
3. At the moment ApiDocumentation is only loaded from the filesystem. In the future loading from other sources may be added
npm package: @hydrofoil/minotaur
Description: Local filesystem Api Documentation loader for [labyrinth](https://npm.im/@hydrofoil/labyrinth)
Latest version: 0.2.6

# @hydrofoil/minotaur

Local filesystem Api Documentation loader for [labyrinth](https://npm.im/@hydrofoil/labyrinth)

## Preparation

You create a directory with Turtle files containing the whole `hydra:ApiDocumentation` resource which will be served linked to all API responses served by `labyrinth`. These files will be parsed when the app starts. A minimal API could be a single file, but multiple are supported loaded form all subdirectories.

```turtle
@base <urn:hydra-box:api> .
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

</api> 
  a hydra:ApiDocumentation ;
  hydra:supportedClass </api/TodoList>, </api/TodoItem> ;
.

</api/TodoItem>
  a hydra:Class ;
  hydra:title "To-do item" ;
.

</api/TodoList>
  a hydra:Class ;
  rdfs:subClassOf hydra:Collection ;
  hydra:title "To-do list" ;
.
```

## Setup

```typescript
import express from 'express'
import { hydraBox } from '@hydrofoil/labyrinth'
import { fromFilesystem } from '@hydrofoil/minotaur'

const app = express()

app.use(await hydraBox({
  loadApi: fromFilesystem({
    apiPath, // directory with the API Documentation sources
    baseUri, // base resource URI
    defaultBase, // (optional) base URL used in RDF sources
  })
}))
```

If the `defaultBase` is provided, use it instead of `@base <urn:hydra-box:api> .` in the API turtle files.
npm package: @hydrofoil/shape-to-query
Description: Generate SPARQL queries from SHACL Node Shapes.
Latest version: 0.15.0

# @hydrofoil/shape-to-query

Generate SPARQL queries from SHACL Node Shapes.

## TL;DR;

```shell
npm i --save @hydrofoil/shape-to-query
```

```ts
import type { GraphPointer } from 'clownface'
import { constructQuery } from '@hydrofoil/shape-to-query'

let shape: GraphPointer

const queryString = constructQuery(shape).build()
```

For full documentation, see [https://github.com/hypermedia-app/shape-to-query](https://github.com/hypermedia-app/shape-to-query)