mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
fix: add .next to eslint ignores
Build output directory was being linted causing false errors
This commit is contained in:
@@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist', 'node_modules', 'packages/*/dist', 'packages/*/node_modules'] },
|
||||
{ ignores: ['dist', 'node_modules', 'packages/*/dist', 'packages/*/node_modules', '.next/**', 'coverage/**'] },
|
||||
{
|
||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
|
||||
82
frontends/nextjs/src/lib/dbal-stub/blob/index.ts
Normal file
82
frontends/nextjs/src/lib/dbal-stub/blob/index.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* DBAL Blob Storage Stub
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
export interface BlobStorageConfig {
|
||||
type: 'filesystem' | 'memory' | 's3'
|
||||
basePath?: string
|
||||
}
|
||||
|
||||
export interface BlobMetadata {
|
||||
contentType?: string
|
||||
size?: number
|
||||
lastModified?: Date
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface BlobListItem {
|
||||
key: string
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface BlobListResult {
|
||||
items: BlobListItem[]
|
||||
}
|
||||
|
||||
export interface BlobStorage {
|
||||
upload(key: string, data: Buffer | string, metadata?: BlobMetadata): Promise<string>
|
||||
download(key: string): Promise<Buffer>
|
||||
delete(key: string): Promise<void>
|
||||
exists(key: string): Promise<boolean>
|
||||
list(options?: { prefix?: string }): Promise<BlobListResult>
|
||||
getMetadata(key: string): Promise<BlobMetadata | null>
|
||||
}
|
||||
|
||||
class InMemoryBlobStorage implements BlobStorage {
|
||||
private store = new Map<string, { data: Buffer; metadata: BlobMetadata }>()
|
||||
|
||||
async upload(key: string, data: Buffer | string, metadata?: BlobMetadata): Promise<string> {
|
||||
const buffer = typeof data === 'string' ? Buffer.from(data) : data
|
||||
this.store.set(key, {
|
||||
data: buffer,
|
||||
metadata: { ...metadata, size: buffer.length, lastModified: new Date() },
|
||||
})
|
||||
return key
|
||||
}
|
||||
|
||||
async download(key: string): Promise<Buffer> {
|
||||
const item = this.store.get(key)
|
||||
if (!item) throw new Error(`Blob not found: ${key}`)
|
||||
return item.data
|
||||
}
|
||||
|
||||
async delete(key: string): Promise<void> {
|
||||
this.store.delete(key)
|
||||
}
|
||||
|
||||
async exists(key: string): Promise<boolean> {
|
||||
return this.store.has(key)
|
||||
}
|
||||
|
||||
async list(options?: { prefix?: string }): Promise<BlobListResult> {
|
||||
const items: BlobListItem[] = []
|
||||
for (const key of this.store.keys()) {
|
||||
if (!options?.prefix || key.startsWith(options.prefix)) {
|
||||
items.push({ key })
|
||||
}
|
||||
}
|
||||
return { items }
|
||||
}
|
||||
|
||||
async getMetadata(key: string): Promise<BlobMetadata | null> {
|
||||
const item = this.store.get(key)
|
||||
return item?.metadata ?? null
|
||||
}
|
||||
}
|
||||
|
||||
export function createBlobStorage(_config: BlobStorageConfig): BlobStorage {
|
||||
return new InMemoryBlobStorage()
|
||||
}
|
||||
34
frontends/nextjs/src/lib/dbal-stub/core/kv-store.ts
Normal file
34
frontends/nextjs/src/lib/dbal-stub/core/kv-store.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* DBAL KV Store Stub
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import type { TenantContext } from './tenant-context'
|
||||
|
||||
export class InMemoryKVStore {
|
||||
private store = new Map<string, any>()
|
||||
|
||||
async get<T>(key: string, _context?: TenantContext): Promise<T | null> {
|
||||
return this.store.get(key) ?? null
|
||||
}
|
||||
|
||||
async set<T>(key: string, value: T, _context?: TenantContext, _ttl?: number): Promise<void> {
|
||||
this.store.set(key, value)
|
||||
}
|
||||
|
||||
async delete(key: string, _context?: TenantContext): Promise<boolean> {
|
||||
return this.store.delete(key)
|
||||
}
|
||||
|
||||
async listAdd(key: string, items: any[], _context?: TenantContext): Promise<void> {
|
||||
const existing = this.store.get(key) || []
|
||||
this.store.set(key, [...existing, ...items])
|
||||
}
|
||||
|
||||
async listGet(key: string, _context?: TenantContext, start = 0, end = -1): Promise<any[]> {
|
||||
const list = this.store.get(key) || []
|
||||
return end === -1 ? list.slice(start) : list.slice(start, end)
|
||||
}
|
||||
}
|
||||
31
frontends/nextjs/src/lib/dbal-stub/core/tenant-context.ts
Normal file
31
frontends/nextjs/src/lib/dbal-stub/core/tenant-context.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* DBAL Tenant Context Stub
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
export interface TenantContext {
|
||||
tenantId: string
|
||||
userId?: string
|
||||
}
|
||||
|
||||
export class InMemoryTenantManager {
|
||||
private currentTenant: string | null = null
|
||||
|
||||
setCurrentTenant(tenantId: string): void {
|
||||
this.currentTenant = tenantId
|
||||
}
|
||||
|
||||
getCurrentTenant(): string | null {
|
||||
return this.currentTenant
|
||||
}
|
||||
|
||||
async createTenant(_id: string, _metadata: Record<string, any>, ..._args: any[]): Promise<void> {
|
||||
// Stub implementation
|
||||
}
|
||||
|
||||
async getTenantContext(tenantId: string, userId?: string): Promise<TenantContext> {
|
||||
return { tenantId, userId }
|
||||
}
|
||||
}
|
||||
11
frontends/nextjs/src/lib/dbal-stub/core/types.ts
Normal file
11
frontends/nextjs/src/lib/dbal-stub/core/types.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* DBAL Core Types Stub
|
||||
*/
|
||||
|
||||
export interface User {
|
||||
id: string
|
||||
email: string
|
||||
name?: string
|
||||
level: number
|
||||
tenantId: string
|
||||
}
|
||||
94
frontends/nextjs/src/lib/dbal-stub/index.ts
Normal file
94
frontends/nextjs/src/lib/dbal-stub/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* DBAL Stub Module
|
||||
* This provides runtime stubs for the DBAL when the full module is not available.
|
||||
* Used in the frontend when DBAL is not fully configured.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export interface DBALConfig {
|
||||
mode?: 'development' | 'production'
|
||||
adapter?: string
|
||||
auth?: any
|
||||
database?: {
|
||||
url?: string
|
||||
}
|
||||
security?: {
|
||||
sandbox?: 'strict' | 'permissive' | 'disabled'
|
||||
enableAuditLog?: boolean
|
||||
}
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface DBALUser {
|
||||
id: string
|
||||
email: string
|
||||
name?: string
|
||||
username?: string
|
||||
level?: number
|
||||
role?: string
|
||||
tenantId?: string
|
||||
createdAt?: number | string | Date
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface ListResult<T> {
|
||||
data: T[]
|
||||
total?: number
|
||||
}
|
||||
|
||||
export interface UsersAPI {
|
||||
list(): Promise<ListResult<DBALUser>>
|
||||
create(data: Partial<DBALUser>): Promise<DBALUser>
|
||||
update(id: string, data: Partial<DBALUser>): Promise<DBALUser>
|
||||
delete(id: string): Promise<boolean>
|
||||
}
|
||||
|
||||
export class DBALClient {
|
||||
users: UsersAPI
|
||||
|
||||
constructor(_config: DBALConfig) {
|
||||
// Stub users API
|
||||
this.users = {
|
||||
list: async () => ({ data: [], total: 0 }),
|
||||
create: async (data) => ({ id: 'stub', email: data.email || '', ...data }),
|
||||
update: async (id, data) => ({ id, email: '', ...data }),
|
||||
delete: async () => true,
|
||||
}
|
||||
}
|
||||
|
||||
async query<T>(_sql: string, _params?: unknown[]): Promise<T[]> {
|
||||
console.warn('DBAL stub: query not implemented')
|
||||
return []
|
||||
}
|
||||
|
||||
async execute(_sql: string, _params?: unknown[]): Promise<void> {
|
||||
console.warn('DBAL stub: execute not implemented')
|
||||
}
|
||||
|
||||
async capabilities(): Promise<Record<string, boolean>> {
|
||||
return {
|
||||
users: true,
|
||||
tenants: false,
|
||||
kv: false,
|
||||
blob: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class DBALError extends Error {
|
||||
code: DBALErrorCode
|
||||
|
||||
constructor(message: string, code: DBALErrorCode) {
|
||||
super(message)
|
||||
this.code = code
|
||||
this.name = 'DBALError'
|
||||
}
|
||||
}
|
||||
|
||||
export enum DBALErrorCode {
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
CONNECTION_ERROR = 'CONNECTION_ERROR',
|
||||
QUERY_ERROR = 'QUERY_ERROR',
|
||||
VALIDATION_ERROR = 'VALIDATION_ERROR',
|
||||
}
|
||||
Reference in New Issue
Block a user