open-index/open-npm huggingface dataset:
npm package: @harperdb/astro
Description: A HarperDB Component for running Astro apps.
Author: Harper
Latest version: 0.0.2

# @harperdb/astro

A [Harper Component](https://docs.harperdb.io/docs/developers/components) for running [Astro](https://astro.build/) applications.

## Getting Started

1. Add the [`@astrojs/node`](https://docs.astro.build/en/guides/integrations-guide/node/) integration to the Astro application, and set the mode to `'middleware'`.

   1. For example:

   ```js
   import { defineConfig } from 'astro/config';
   import node from '@astrojs/node';

   export default defineConfig({
   	adapter: node({
   		mode: 'middleware',
   	}),
   });
   ```

2. Create a `config.yaml` in the root of the Astro app containing:
   ```yaml
   '@harperdb/astro':
     package: '@harperdb/astro'
     files: './'
   ```
3. Run the application using Harper. For more information reference the [Harper Component documentation](https://docs.harperdb.io/docs/developers/components).

## Options

> All configuration options are optional

### `buildCommand: string`

Specify a custom build command. Defaults to `astro build`.

> Note: the extension will skip building if the `prebuilt` option is set to `true`.

### `port: number`

Specify a port for the Astro handlers. Defaults to the Harper default port (generally 9926).

### `prebuilt: boolean`

When enabled, the extension will look for a `dist` directory in the root of the component, and skip executing the `buildCommand` if detected. Defaults to `false`.

### `securePort: number`

Specify a secure port for the Astro handlers. Defaults to the Harper default secure port.

## Example

This repo contains an example Astro app that is already configured to work with Harper.

1. Clone the repo, and navigate to the example directory
   ```sh
   cd example
   ```
2. Install dependencies
   ```sh
   npm install
   ```
3. Run the example with Harper
   ```sh
   harperdb run .
   ```
npm package: @harperdb/create-component
Description: ```js npx @harperdb/create-component [directory] // or npm init @harperdb/component [directory] ```
Author: HarperDB
Latest version: 0.2.1

# @harperdb/create-component

```js
npx @harperdb/create-component [directory]
// or
npm init @harperdb/component [directory]
```
npm package: @harperdb/hdb-cf-auth-azuread
Description: Azure AD auth for HarperDB Custom Functions
Author: kevin@harperdb.io
Latest version: 1.0.1

# HarperDB Azure Active Directory Authentication
This package is an Active Directory authentication validator for a HaperDB Custom Function.

This adds the ability to secure database access with an Azure Active Directory application to validate against AD Users and Roles.
## How To Use
1. Create an Azure Active Directory application with the desired users and roles.
2. Include the ClientID, AuthorityURL, and ClientSecret as environment variables.
3. Include this package in the routes defition file (i.e. `$CUSTOM_FUNCTION_DIR/routes/index.js`)
4. Add the validate function to the prevalidation handler for endpoints that should use AAD Authentication.

## Environment Variables
AAD_CLIENT_ID="the client id for the AAD app"
AAD_AUTH_URL="the authority url for the AAD app"
AAD_CLIENT_SECRET="the client secret for the AAD app"

## Example Route and POST
### Route Definition
```
// /routes/index.js

const aadAuth = require('harperdb-active-directory-auth')

module.exports = async (server, { hdbCore, logger }) => {
  // CREATE A DATA RECORD
  server.route({
    url: '/:schema/:table',
    preValidation: (request, response, next) => aadAuth.validate(request, response, next, hdbCore, logger),
    method: 'POST',
    handler: (request) => {
      const { schema, table } = request.params;
      const { records } = request.body;
      request.body = {
         operation: 'insert',
         schema,
         table,
         records,
         hdb_user: request.body.hdb_user,
      }

      return hdbCore.request(request)
    }
  })
})
```
### cURL POST
```
curl -X POST http://127.0.0.1:9926/cool-app/dev_schema/dogs_table \
   -H 'Content-Type: application/json' \
   -d '{
      "username":"dog@harperdb.io",
      "password":"D0G5RUL3!",
      "records":[{"name": "Bruno", "breed": "awesome"}]
   }'
   
```