open-index/open-npm huggingface dataset:
npm package: @flicknote/hono-middlewares
Description: Shared middleware for FlickNote workers
Author: FlickNote Team
Latest version: 1.2.0

# @flicknote/hono-middlewares

Shared authentication middlewares for FlickNote Cloudflare Workers.

## Installation

```bash
npm install @flicknote/hono-middlewares
# or
bun add @flicknote/hono-middlewares
```

## Middlewares

### `jwtMiddleware`

JWT authentication middleware. Validates Bearer token and extracts `userId` from the JWT payload.

```typescript
import { jwtMiddleware } from "@flicknote/hono-middlewares";

app.use("/api/*", jwtMiddleware);
```

### `internalAuthMiddleware`

Internal API key authentication. Validates `X-API-KEY` header against `INTERNAL_API_KEY` secret.

- Skips validation in dev environment (when `WORKER_URL` contains "dev-")

```typescript
import { internalAuthMiddleware } from "@flicknote/hono-middlewares";

app.use("/internal/*", internalAuthMiddleware);
```

### `combinedAuthMiddleware`

Accepts either JWT or internal API key authentication:

1. `X-API-KEY` header - internal auth, `userId` must be in request body
2. `Authorization: Bearer <jwt>` - JWT auth, `userId` extracted from token
3. `Authorization: Bearer <api-key>` - fallback to internal auth

```typescript
import { combinedAuthMiddleware } from "@flicknote/hono-middlewares";

app.use("/api/*", combinedAuthMiddleware);
```

## Context Variables

All middlewares set these variables in the Hono context:

- `userId` - The authenticated user's ID
- `authType` - `"jwt"` | `"internal"` | `"apikey"`

```typescript
app.get("/api/me", combinedAuthMiddleware, (c) => {
  const userId = c.get("userId");
  const authType = c.get("authType");
  return c.json({ userId, authType });
});
```

## Required Bindings

Your worker must have these bindings configured:

```typescript
interface Env {
  Bindings: {
    JWT_SECRET: SecretStoreBinding;      // Required for JWT auth
    INTERNAL_API_KEY: SecretStoreBinding; // Required for internal auth
    WORKER_URL?: string;                  // Optional, for dev environment detection
    DISABLE_AUTH?: string;                // Optional, set to "true" to disable auth
  };
}
```

## Types

```typescript
import type {
  AuthEnv,
  AuthBindings,
  AuthVariables,
  SecretStoreBinding,
} from "@flicknote/hono-middlewares";
```

## License

MIT
npm package: @flicknote/integration-utils
Description: Shared KV utilities for FlickNote integrations
Author: FlickNote Team
Latest version: 6.0.0

# @flicknote/integration-utils

Shared KV utilities for FlickNote integrations with Cloudflare Workers.

## Installation

```bash
npm install @flicknote/integration-utils
```

## Usage

### Core Setup

```typescript
import { KeyBuilder } from '@flicknote/integration-utils/core';

// Initialize KeyBuilder with your key patterns
const keyBuilder = new KeyBuilder(yourKeyPatterns);
```

### Telegram Integration

```typescript
import { TelegramKVOperations } from '@flicknote/integration-utils/integrations/telegram';

const telegramOps = new TelegramKVOperations(kv, keyBuilder);

// Generate binding code
const { code, expiresIn } = await telegramOps.generateBinding(userId);

// Link Telegram user
await telegramOps.linkTelegramUser(userId, telegramId, username);

// Get user mappings
const telegramId = await telegramOps.getTelegramId(userId);
const userId = await telegramOps.getUserId(telegramId);

// Settings management
const settings = await telegramOps.getSettings(userId);
await telegramOps.updateSettings(userId, { send_confirmation: false });
```

## Key Patterns

Each integration provides key patterns for KV storage:

```typescript
import { telegramKeyPatterns } from '@flicknote/integration-utils/integrations/telegram';
import { discordKeyPatterns } from '@flicknote/integration-utils/integrations/discord';

// Register patterns with your KeyBuilder
const keyBuilder = new KeyBuilder({
  ...telegramKeyPatterns,
  ...discordKeyPatterns,
  // your custom patterns
});
```

## TypeScript Support

Full TypeScript support with exported types:

```typescript
import type {
  TelegramIntegrationData,
  TelegramSettings,
  BindingCodeData
} from '@flicknote/integration-utils/integrations/telegram';
```

## Cloudflare Workers Integration

This package is designed for Cloudflare Workers:

```typescript
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const kv = env.INTEGRATION_BINDING; // Your KV namespace
    const keyBuilder = new KeyBuilder(keyPatterns);

    const telegramOps = new TelegramKVOperations(kv, keyBuilder);
    // Use the operations...
  }
};
```

## License

MIT

## Contributing

Issues and pull requests are welcome at [GitHub](https://github.com/GuionAI/flicknote-integration-util).
npm package: @flicknote/notion-uploader
Description: Convert markdown to Notion pages
Author: FlickNote Team
Latest version: 1.2.0

# @flicknote/notion-uploader

Convert markdown to Notion pages.

## Installation

```bash
npm install @flicknote/notion-uploader
```

## Usage

```typescript
import { markdownToNotion } from '@flicknote/notion-uploader';

await markdownToNotion({
  markdown: '# Hello\n\nSome **bold** text',
  notionPageId: 'your-page-id',
  notionApiKey: 'secret_xxx',
  mode: 'replace', // or 'append'
});
```

## Options

| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| `markdown` | `string` | Yes | - | The markdown content to convert |
| `notionPageId` | `string` | Yes | - | The Notion page ID to update |
| `notionApiKey` | `string` | Yes | - | Your Notion API key (integration token) |
| `mode` | `'replace' \| 'append'` | No | `'replace'` | Update mode |

## Supported Markdown Features

- Headings (H1-H6)
- Paragraphs
- **Bold**, *italic*, ~~strikethrough~~, `code`
- Lists (ordered and unordered, with nesting)
- Blockquotes
- Code blocks (with language highlighting)
- Tables
- Images (external URLs only)
- Links
- Horizontal rules
- LaTeX equations (inline and block)
- GitHub-style callouts (`> [!NOTE]`, `> [!TIP]`, etc.)

## Limitations

- Only external image URLs are supported (no local file uploads)
- Front-matter is not parsed
- Raw HTML blocks are ignored
npm package: @flicknote/types
Description: Shared TypeScript types for FlickNote workers
Author: FlickNote Team
Latest version: 3.14.0

# @flicknote/types

[![Release](https://github.com/GuionAI/flicknote-types/actions/workflows/release.yml/badge.svg)](https://github.com/GuionAI/flicknote-types/actions/workflows/release.yml)

Shared TypeScript types for FlickNote workers.

## Installation

```bash
npm install @flicknote/types
```

## Usage

```ts
import { AudioStatus, NoteType, Database } from "@flicknote/types";
import { Database } from "@flicknote/types/db";
```