open-index/open-npm huggingface dataset:
npm package: @ork-orm/client
Description: Type-safe database client with CRUD operations for Ork ORM
Author: Ork Team
Latest version: 0.0.1-alpha.1

# @ork-orm/client

TypeScript-native client runtime for Ork ORM with two clean usage paths.

## Usage Patterns

### Recommended Path (Recommended)

Use `unplugin-ork` for automatic type discovery:

```typescript
// unplugin-ork makes this import work seamlessly
import { OrkClient } from '@ork-orm/client'
import { PostgresDialect } from 'kysely'

const client = new OrkClient(new PostgresDialect({ connectionString: process.env.DATABASE_URL! }))

// Types are automatically available via unplugin virtual modules
await client.user.findMany()
```

### Manual Fallback

When unplugin isn't available, import types explicitly:

```typescript
import { OrkClient } from '@ork-orm/client'
import { PostgresDialect } from 'kysely'
import type { DatabaseSchema } from './.ork/types'

const client = new OrkClient<DatabaseSchema>(
  new PostgresDialect({ connectionString: process.env.DATABASE_URL! })
)

await client.user.findMany()
```

## Relation Loading

Load related data using the `include` option:

```typescript
// Load user with their posts
const post = await client.post.findUnique({
  where: { id: 1 },
  include: { user: true }
})
// post.user is now populated with User data

// Load multiple posts with their authors
const posts = await client.post.findMany({
  where: { published: true },
  include: { user: true }
})
// Each post.user contains the related User
```

**Current Support (Phase 0)**:
- ✅ Many-to-one relations (e.g., Post → User)
- ✅ One-to-one relations
- ✅ One-to-many relations (e.g., User → Post[])
- ✅ Relation filters in `where` (`some`, `every`, `none`, `is`, `isNot`)
- ⏳ Nested includes - Coming in Phase 1

## Direct Kysely Access

Access the underlying Kysely instance for advanced queries:

```typescript
// Direct Kysely access for complex queries
const result = await client.$kysely.selectFrom('user').innerJoin('post', 'user.id', 'post.userId').selectAll().execute()
```

## Installation

```bash
npm install @ork-orm/client kysely
npm install unplugin-ork # Recommended for best experience
```

## Client Code Generation

- Runtime usage imports `OrkClient` from this package and passes a Kysely dialect directly.
- Build tools can emit client code ahead of time via the exported `ClientGenerator` class. This is what the CLI and `unplugin-ork` consume to bake CRUD operations and field translations ahead of time.
- Lower-level type generation utilities remain available through `TypeGenerator` for bespoke workflows.
npm package: @ork-orm/config
Description: Shared configuration and Kysely instance management for Ork
Latest version: 0.0.1-alpha.1

# @ork-orm/config

Shared configuration and Kysely instance management for Ork packages.

## Purpose

This package centralizes configuration loading and Kysely instance creation across all Ork packages (`cli`, `migrate`, `client`), eliminating duplication and ensuring consistent database setup.

## Key Features

- **Priority-based config resolution**: Explicit config > ork.config.ts > .config/ork.ts
- **Centralized provider support**: Easy to add new database providers
- **Kysely dialect creation**: Handles all provider-specific setup
- **Type-safe configuration**: Zod schema validation

## Usage

### Basic Kysely Creation

```typescript
import { createKyselyFromConfig } from '@ork-orm/config'

// Uses config file discovery
const { kysely, config } = await createKyselyFromConfig()

// With explicit config
const { kysely } = await createKyselyFromConfig({
  config: {
    datasource: { provider: 'postgresql', url: process.env.DATABASE_URL! },
    schema: './schema.prisma'
  }
})

// From URL (auto-detects provider)
import { createKyselyFromUrl } from '@ork-orm/config'
const { kysely } = await createKyselyFromUrl(process.env.DATABASE_URL!)
```

### Configuration Loading Only

```typescript
import { loadOrkConfig } from '@ork-orm/config'

const { config, configPath } = await loadOrkConfig({
  cwd: '/path/to/project'
})
```

### Dialect Creation Only

```typescript
import { createKyselyDialect } from '@ork-orm/config'

const dialect = await createKyselyDialect(config)
const kysely = new Kysely({ dialect })
```

## Configuration Priority

1. **Explicit config parameter** (highest priority)
2. **Explicit configFile parameter**
3. **ork.config.ts/js/mjs** 
4. **.config/ork.ts/js/mjs** (lowest priority)

## Supported Providers

- `postgresql` - Standard PostgreSQL
- `mysql` - MySQL
- `sqlite` - SQLite
- `d1` - Cloudflare D1

## Adding New Providers

1. Add to `SUPPORTED_PROVIDERS` in `src/constants.ts`
2. Add URL pattern to `PROVIDER_URL_PATTERNS`
3. Add metadata to `PROVIDER_METADATA`
4. Add case in `src/dialect-factory.ts`
5. Add peer dependency to `package.json`

## Package Dependencies

This package uses peer dependencies for database drivers, so only install what you need:

```bash
# PostgreSQL
npm install pg @types/pg

# MySQL  
npm install mysql2

# SQLite
npm install better-sqlite3 @types/better-sqlite3

# Cloudflare D1
npm install kysely-d1
```
npm package: @ork-orm/field-translator
Description: Build-time database-specific field transformation code generators for Ork ORM
Latest version: 0.0.1-alpha.1

# @ork-orm/field-translator

Build-time database-specific field transformation code generators for Ork.

This package is used by the client generator and migration tooling to map Prisma schema field types to
Dialect-specific database types and to emit transformation code strings. It is not intended for direct
runtime use.

## Usage

Most users should not import this package directly. It is consumed by:

- `@ork-orm/client` (client generation)
- `@ork-orm/migrate` (schema diffing and DDL mapping)

If you do need it for custom tooling, use the dialect helpers:

```ts
import { createFieldTranslator, detectDialect } from '@ork-orm/field-translator'

const dialect = detectDialect({ database: { provider: 'postgresql' } })
const translator = createFieldTranslator(dialect)
```
npm package: @ork-orm/schema-parser
Description: TypeScript-native Prisma Schema Language parser for Ork ORM
Author: Ork Team
Latest version: 0.0.1-alpha.1

# @ork-orm/schema-parser

TypeScript-native Prisma Schema Language parser for Ork ORM.

## Overview

This package provides a complete TypeScript-native implementation for parsing Prisma Schema Language (PSL) files, replacing the Rust-based schema engine with a lightweight, extensible TypeScript solution.

## Features

- **Pure TypeScript**: No binary dependencies, runs anywhere Node.js runs
- **AST Generation**: Converts PSL into structured Abstract Syntax Trees
- **Code Generation**: Generates TypeScript interfaces and types from schemas
- **Error Handling**: Comprehensive error reporting with source locations
- **ESM-only**: Modern ES module architecture

## Installation

```bash
pnpm add @ork-orm/schema-parser
```

## Usage

```typescript
import { parseSchema } from '@ork-orm/schema-parser'

const schema = `
datasource db {
  provider = "postgresql"
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}
`

const result = parseSchema(schema)

if (result.errors.length === 0) {
  console.log('Schema parsed successfully:', result.ast)
} else {
  console.error('Parse errors:', result.errors)
}
```

## API Reference

### `parseSchema(schema: string, options?: ParseOptions): ParseResult`

Main parsing function that converts PSL source code into an AST.

#### Parameters

- `schema`: The Prisma schema source code as a string
- `options`: Optional parsing configuration

#### Returns

- `ParseResult` containing the AST and any parsing errors

### Classes

- `Lexer`: Tokenizes PSL source code
- `Parser`: Converts tokens into AST nodes
- `CodeGenerator`: Generates TypeScript code from AST

## Development

This package is part of the Ork ORM project and follows its development conventions:

```bash
# Build the package
pnpm build

# Run tests
pnpm test

# Development mode with watching
pnpm dev
```

## Architecture

The parser consists of three main phases:

1. **Lexical Analysis** (`Lexer`): Converts source text into tokens
2. **Parsing** (`Parser`): Builds AST from tokens
3. **Code Generation** (`CodeGenerator`): Generates TypeScript from AST

## License

Apache-2.0