// npm 패키지
@tallyui/storage-sqlite
RxDB storage adapter for SQLite via expo-sqlite
버전
1
메인테이너
1
라이선스
MIT
최초 publish
2026-02-25
publisher
kilbot
tarball
74,698 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2026-02-25
// offending code· @0.2.0· no static-pattern hits
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
- @0.2.0··AUTO-PUBLISHED·publisher: kilbotheuristic 75/100static flags 0llm benign (0.85) via ollamafirst-version-of-packageosv-flagged:MAL-2026-3604
→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
// offending code· no static-pattern hits
--- package.json (entry) --- { "name": "@tallyui/storage-sqlite", "version": "0.2.0", "type": "module", "description": "RxDB storage adapter for SQLite via expo-sqlite", "main": "./dist/index.js", "types": "./dist/index.d.ts", "source": "./src/index.ts", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "source": "./src/index.ts" } }, "files": [ "dist", "src" ], "license": "MIT", "dependencies": { "rxdb": "16.21.1", "rxjs": "7.8.2" }, "peerDependencies": { "expo-sqlite": ">=15.0.0" }, "scripts": { "build": "tsup", "typecheck": "tsc --noEmit", "test": "vitest run" } } --- index.js (entry) --- // src/rx-storage-sqlite.ts import { ensureRxStorageInstanceParamsAreCorrect } from "rxdb"; import { RXDB_VERSION } from "rxdb/plugins/utils"; // src/storage-instance.ts import { categorizeBulkWriteRows, getQueryMatcher, getSortComparator } from "rxdb"; import { now, ensureNotFalsy } from "rxdb/plugins/utils"; import { Subject } from "rxjs"; // src/mango-to-sql.ts function mangoQueryToSQL(query) { const params = []; const conditions = []; conditions.push(`json_extract(data, '$._deleted') = 0`); if (query.selector && Object.keys(query.selector).length > 0) { const selectorSql = selectorToSQL(query.selector, params); if (selectorSql) { conditions.push(selectorSql); } } const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : ""; let orderBy = ""; if (query.sort && query.sort.length > 0) { const orderParts = query.sort.map((sortPart) => { const entries = Object.entries(sortPart); if (entries.length === 0) return ""; const [field, direction] = entries[0]; const jsonPath = fieldToJsonExtract(field); return `${jsonPath} ${direction === "desc" ? "DESC" : "ASC"}`; }).filter(Boolean); if (orderP --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- dist/index.d.ts (bundled) --- import { RxStorage } from 'rxdb'; interface SQLiteDatabase { execSync(source: string): void; getAllSync<T>(source: string, params?: any[]): T[]; runSync(source: string, params?: any[]): { changes: number; lastInsertRowId: number; }; } interface SQLiteStorageSettings { database: SQLiteDatabase; } interface SQLiteStorageInternals { database: SQLiteDatabase; tableName: string; } type RxStorageSQLite = RxStorage<SQLiteStorageInternals, SQLiteStorageSettings>; declare function getRxStorageSQLite(database: SQLiteDatabase): RxStorageSQLite; export { type SQLiteDatabase, type SQLiteStorageSettings, getRxStorageSQLite }; --- dist/index.js (bundled) --- // src/rx-storage-sqlite.ts import { ensureRxStorageInstanceParamsAreCorrect } from "rxdb"; import { RXDB_VERSION } from "rxdb/plugins/utils"; // src/storage-instance.ts import { categorizeBulkWriteRows, getQueryMatcher, getSortComparator } from "rxdb"; import { now, ensureNotFalsy } from "rxdb/plugins/utils"; import { Subject } from "rxjs"; // src/mango-to-sql.ts function mangoQueryToSQL(query) { const params = []; const conditions = []; conditions.push(`json_extract(data, '$._deleted') = 0`); if (query.selector && Object.keys(query.selector).length > 0) { const selectorSql = selectorToSQL(query.selector, params); if (selectorSql) { conditions.push(selectorSql); } } const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : ""; let orderBy = ""; if (query.sort && query.sort.length > 0) { const orderParts = query.sort.map((sortPart) => { const entries = Object.entries(sortPart); if (entries.length === 0) return ""; const [field, direction] = entries[0]; const jsonPath = fieldToJsonExtract(field); return `${jsonPath} ${direction === "desc" ? "DESC" : "ASC"}`; }).filter(Boolean); if (orderParts.length > 0) { orderBy = `ORDER BY ${orderParts.join(", ")}`; } } const limitParams = []; let limit = ""; if (query.limit !== void 0 && query.limit !== null) { limit = "LIMIT ?"; limitParams.push(query.limit); } if (query.skip && query.skip > 0) { if (!limit) { limit = "LIMIT -1"; } limit += " OFFSET ?"; limitParams.push(query.skip); } return { where, params, orderBy, limit, limitParams }; } function buildQuerySQL(tableName, query) { const result = mangoQueryToSQL(query); const allParams = [...result.params, ...result.limitParams]; const parts = [ `SELECT data FROM "${tableName}"`, result.where, result.orderBy, result.limit ].filter(Boolean); return { sql: parts.join(" "), params: allParams }; } function
