XuqmGroup-RNSDK/src/shims/watermelondb.ts
XuqmGroup 9e11a63144 feat(sdk): 更新 SDK 设计文档和 API 重构
- 添加 expiresAt 和 refreshUserSig 参数支持自动续签
- 修改 PushSDK 初始化方式,自动完成设备注册和厂商初始化
- 调整过期续签策略,从提前 15 分钟改为提前 5 分钟触发
- 重构 RN SDK 文档结构,简化安装和使用方式
- 更新统一登录流程,支持 profile 信息传递
- 添加 IM 数据库自动隔离功能
- 修复 Android 群消息聚合问题
- 补充自动化测试验证和错误处理机制
2026-05-01 21:27:39 +08:00

68 行
1.6 KiB
TypeScript

export class Model {
static table = ''
async update(updater: (record: this) => void | Promise<void>): Promise<this> {
await updater(this)
return this
}
async destroyPermanently(): Promise<void> {
return
}
}
export class Database {
constructor(_config: { adapter: unknown; modelClasses: Array<new (...args: unknown[]) => unknown> }) {}
async write<T>(action: () => Promise<T>): Promise<T> {
return action()
}
get<T>(_tableName: string): any {
return {
query: (..._queryParts: unknown[]) => ({
fetch: async () => [] as T[],
extend: () => ({
fetch: async () => [] as T[],
observe: () => ({ subscribe: () => undefined }),
}),
observe: () => ({ subscribe: () => undefined }),
}),
create: async (_builder: (record: T) => void | Promise<void>) => ({} as T),
}
}
}
export const Q: any = {
where: () => undefined,
take: () => undefined,
skip: () => undefined,
sortBy: () => undefined,
oneOf: () => undefined,
like: () => undefined,
gte: () => undefined,
lte: () => undefined,
sanitizeLikeString: (value: string) => value,
desc: undefined,
}
export function appSchema(input: unknown): any {
return input
}
export function tableSchema(input: unknown): any {
return input
}
export function field(_name: string): any {
return () => undefined
}
export function date(_name: string): any {
return () => undefined
}
export default class SQLiteAdapter {
constructor(_config: { schema: unknown; dbName: string; jsi?: boolean; onSetUpError?: (err: unknown) => void }) {}
}