SQL CREATE TABLE DDL to Zod Schema Converter
SQLテーブルスキーマ、データ型、制約条件、NULL許容列を厳密に型付けされたTypeScript Zodオブジェクトスキーマに変換します。
import { z } from 'zod';
// ============================================================================
// Enums
// ============================================================================
userRoleSchema = z.enum(['SUPERADMIN', 'ORG_ADMIN', 'MEMBER', 'BILLING', 'GUEST']);
UserRole = z.infer<typeof userRoleSchema>;
subscriptionStatusSchema = z.enum(['TRIALING', 'ACTIVE', 'PAST_DUE', 'CANCELED']);
SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>;
// ============================================================================
// Table: organizations
// ============================================================================
organizationsSchema = z.object({
id: z.string().uuid(),
slug: z.string().max(64),
name: z.string().max(255),
billingEmail: z.string().email().max(255),
status: subscriptionStatusSchema,
settings: z.record(z.string(), z.unknown()).nullable(),
isActive: z.boolean(),
createdAt: z.coerce.date(),
updatedAt: z.coerce.date(),
});
Organization = z.infer<typeof organizationsSchema>;
// ============================================================================
// Table: users
// ============================================================================
usersSchema = z.object({
id: z.string().uuid(),
organizationId: z.string().uuid(),
email: z.string().email().max(255),
fullName: z.string().max(120).nullable(),
avatarUrl: z.string().url().max(500).nullable(),
role: userRoleSchema,
phoneNumber: z.string().max(32).nullable(),
isVerified: z.boolean(),
lastLoginAt: z.coerce.date().nullable(),
createdAt: z.coerce.date(),
});
User = z.infer<typeof usersSchema>;
// ============================================================================
// Table: api_keys
// ============================================================================
apiKeysSchema = z.object({
id: z.coerce.number().int().positive(),
organizationId: z.string().uuid(),
userId: z.string().uuid().nullable(),
keyPrefix: z.string().max(12),
hashedSecret: z.string().max(128),
scopes: z.record(z.string(), z.unknown()),
expiresAt: z.coerce.date().nullable(),
revokedAt: z.coerce.date().nullable(),
createdAt: z.coerce.date(),
});
ApiKey = z.infer<typeof apiKeysSchema>;
// ============================================================================
// Table: audit_logs
// ============================================================================
auditLogsSchema = z.object({
id: z.coerce.number().int().positive(),
organizationId: z.string().uuid(),
actorId: z.string().uuid().nullable(),
eventName: z.string().max(100),
ipAddress: z.string().ip().nullable(),
userAgent: z.string().max(500).nullable(),
payload: z.record(z.string(), z.unknown()).nullable(),
createdAt: z.coerce.date(),
});
AuditLog = z.infer<typeof auditLogsSchema>;
ゼロナレッジ・完全ローカル実行
すべてのデータ処理、解析、コード生成はお使いのブラウザ内部メモリで完結します。外部サーバーへの送信はゼロです。
超高速・即時リアクティブ演算
最適化されたクライアント側解析パイプラインにより、キーストロークと同時に遅延なくリアルタイムで結果を生成します。
公式仕様準拠・高信頼アーキテクチャ
IETF RFCや公式業界仕様に厳格に準拠し、エッジケースの安全な処理とメモリリークのない堅牢な実行を保証します。