diff --git a/.clang-format-ignore b/.clang-format-ignore index c1749097f..fc590f579 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -1 +1 @@ -packages/react-native-nitro-sqlite/cpp/sqlite/* +packages/nitro-sqlite-core/cpp/sqlite/* diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 56a2a2879..895371474 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -8,28 +8,28 @@ reviews: # release-please PRs only bump versions and changelogs. ignore_title_keywords: ['chore: release'] path_filters: - - '!packages/react-native-nitro-sqlite/nitrogen/generated/**' - - '!packages/react-native-nitro-sqlite/cpp/sqlite/sqlite3.{c,h}' - - '!packages/react-native-nitro-sqlite-vec/cpp/sqlite-vec/**' + - '!packages/{react-native-nitro-sqlite,nitro-sqlite}/nitrogen/generated/**' + - '!packages/{react-native-nitro-sqlite,nitro-sqlite,nitro-sqlite-core}/cpp/sqlite/sqlite3.{c,h}' + - '!packages/integrations/{react-native,nitro-ui}/vec/cpp/sqlite-vec/**' path_instructions: - - path: 'packages/react-native-nitro-sqlite/cpp/**' + - path: 'packages/{react-native-nitro-sqlite,nitro-sqlite,nitro-sqlite-core}/{cpp,platform/cpp}/**' instructions: > Trace ownership of connections, prepared statements, and row buffers across queued work, errors, and close. Flag an interleaving that can finalize a statement while it is in use or let one connection act on another connection's transaction. - - path: 'packages/react-native-nitro-sqlite/src/**' + - path: 'packages/{react-native-nitro-sqlite,nitro-sqlite,nitro-sqlite-core}/{src,platform/src}/**' instructions: > Trace queue and transaction changes through both sync and async callers. Look for same-connection deadlocks and pending statements that can run after rollback. For a public contract change, compare the Nitro spec, native implementation, and Node mock wherever they expose that behavior. - - path: 'packages/react-native-nitro-sqlite-drizzle/src/**' + - path: 'packages/{nitro-sqlite-drizzle-core,integrations/{react-native,nitro-ui}/drizzle}/src/**' instructions: > Check parameter binding and result column order against Drizzle's expectations. For transaction or migration changes, trace the failure path for partial writes or prematurely recorded migrations. - - path: 'packages/react-native-nitro-sqlite*/{*.podspec,android/**,ios/**,plugin/**,app.plugin.js,cpp/*Register*}' + - path: 'packages/{react-native-nitro-sqlite,nitro-sqlite,integrations/{react-native,nitro-ui}/vec}/{*.podspec,Package.swift,android/**,ios/**,plugin/**,app.plugin.js,cpp/*Register*}' instructions: > Follow changed SQLite build options through Gradle, CocoaPods, and Expo prebuild where supported. Check that bundled builds use private SQLite diff --git a/.github/ci-paths.json b/.github/ci-paths.json index 0878d912a..f35a76898 100644 --- a/.github/ci-paths.json +++ b/.github/ci-paths.json @@ -10,15 +10,15 @@ "package.json", "bun.lock", "patches/**", - "example/**/*.ts", - "example/**/*.tsx", - "example/**/*.js", - "example/**/*.jsx", - "example/**/*.mjs", - "example/tsconfig.json", - "example/app.json", - "example/package.json", - "example/macos/package.json", + "examples/react-native/**/*.ts", + "examples/react-native/**/*.tsx", + "examples/react-native/**/*.js", + "examples/react-native/**/*.jsx", + "examples/react-native/**/*.mjs", + "examples/react-native/tsconfig.json", + "examples/react-native/app.json", + "examples/react-native/package.json", + "examples/react-native/macos/package.json", "packages/react-native-nitro-sqlite/**/*.ts", "packages/react-native-nitro-sqlite/**/*.tsx", "packages/react-native-nitro-sqlite/**/*.js", @@ -28,23 +28,43 @@ "packages/react-native-nitro-sqlite/tsconfig.build.json", "packages/react-native-nitro-sqlite/package.json", "packages/react-native-nitro-sqlite/nitro.json", - "packages/react-native-nitro-sqlite-vec/**/*.ts", - "packages/react-native-nitro-sqlite-vec/**/*.tsx", - "packages/react-native-nitro-sqlite-vec/**/*.js", - "packages/react-native-nitro-sqlite-vec/**/*.jsx", - "packages/react-native-nitro-sqlite-vec/tsconfig.json", - "packages/react-native-nitro-sqlite-vec/package.json", - "packages/react-native-nitro-sqlite-drizzle/**/*.ts", - "packages/react-native-nitro-sqlite-drizzle/**/*.js", - "packages/react-native-nitro-sqlite-drizzle/tsconfig.json", - "packages/react-native-nitro-sqlite-drizzle/package.json", - "packages/react-native-nitro-sqlite-kysely/**", - "packages/react-native-nitro-sqlite-mikro-orm/**", + "packages/integrations/react-native/vec/**/*.ts", + "packages/integrations/react-native/vec/**/*.tsx", + "packages/integrations/react-native/vec/**/*.js", + "packages/integrations/react-native/vec/**/*.jsx", + "packages/integrations/react-native/vec/tsconfig.json", + "packages/integrations/react-native/vec/package.json", + "packages/integrations/react-native/drizzle/**/*.ts", + "packages/integrations/react-native/drizzle/**/*.js", + "packages/integrations/react-native/drizzle/tsconfig.json", + "packages/integrations/react-native/drizzle/package.json", "scripts/**/*.ts", - "scripts/typeorm-package.test.mjs", - "example/jest*.js", + "examples/react-native/jest*.js", "packages/react-native-nitro-sqlite/plugin/**", - "packages/react-native-nitro-sqlite-typeorm/**" + "packages/react-native-nitro-sqlite/scripts/**", + "packages/nitro-sqlite-core/**/*.ts", + "packages/nitro-sqlite-core/**/*.tsx", + "packages/nitro-sqlite-core/**/*.js", + "packages/nitro-sqlite-core/**/*.jsx", + "packages/nitro-sqlite-core/package.json", + "scripts/prepare-workspace-sources.mjs", + "shared/orm/**", + "packages/integrations/{nitro-ui,react-native}/{kysely,mikro-orm,typeorm}/**", + "examples/shared/**", + "examples/nitro-ui/**", + "packages/integrations/react-native/kysely/**", + "packages/integrations/react-native/mikro-orm/**", + "scripts/typeorm-package.test.mjs", + "packages/integrations/react-native/typeorm/**", + "scripts/materialize-sqlite-sources.test.mjs", + "scripts/companion-materialize.test.mjs", + "packages/nitro-sqlite/{src/**,platform/**,scripts/**,*.json}", + "packages/nitro-sqlite-drizzle-core/**", + "packages/integrations/{nitro-ui,react-native}/{drizzle,vec}/scripts/**", + "packages/integrations/nitro-ui/{drizzle,vec}/{src/**,*.json}", + "packages/nitro-sqlite-core/scripts/**", + "packages/nitro-sqlite-core/src/**/*.ts", + "packages/nitro-sqlite-core/src/**/*.tsx" ], "cpp_format": [ ".github/workflows/**", @@ -54,18 +74,19 @@ ".clang-format", "scripts/clang-format.sh", "packages/react-native-nitro-sqlite/cpp/**", - "packages/react-native-nitro-sqlite/tests/cpp/**" + "packages/react-native-nitro-sqlite/tests/cpp/**", + "packages/nitro-sqlite-core/cpp/**", + "packages/react-native-nitro-sqlite/platform/cpp/**", + "packages/react-native-nitro-sqlite/scripts/**", + "packages/nitro-sqlite/platform/cpp/**", + "packages/nitro-sqlite/cpp/**", + "packages/integrations/nitro-ui/vec/cpp/**" ], "cpp_tests": [ ".github/workflows/**", ".github/actions/**", ".github/ci-paths.json", "scripts/ci*", - "package.json", - "bun.lock", - "packages/react-native-nitro-sqlite/package.json", - "packages/react-native-nitro-sqlite/cpp/NativeQueryResult.cpp", - "packages/react-native-nitro-sqlite/cpp/results/**", "packages/react-native-nitro-sqlite/cpp/SQLiteDatabaseMigration.*", "packages/react-native-nitro-sqlite/cpp/SQLiteDatabaseConnections.*", "packages/react-native-nitro-sqlite/cpp/SQLiteExecuteBatch.*", @@ -76,13 +97,48 @@ "packages/react-native-nitro-sqlite/cpp/SQLiteStatementTail.hpp", "packages/react-native-nitro-sqlite/cpp/sqlite/sqlite3.*", "packages/react-native-nitro-sqlite/cpp/sqlite/sqlite3-symbol-prefix.h", - "packages/react-native-nitro-sqlite-vec/cpp/**", + "packages/integrations/react-native/vec/cpp/**", "packages/react-native-nitro-sqlite/tests/cpp/**", "scripts/generate-sqlite-symbol-prefix.py", "scripts/test-private-sqlite-symbols.sh", "scripts/test-cpp.sh", + "packages/nitro-sqlite-core/cpp/SQLiteDatabaseMigration.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteDatabaseMigration.*", + "packages/nitro-sqlite-core/cpp/SQLiteDatabaseConnections.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteDatabaseConnections.*", + "packages/nitro-sqlite-core/cpp/SQLiteExecuteBatch.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteExecuteBatch.*", + "packages/nitro-sqlite-core/cpp/SQLiteJSON.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteJSON.*", + "packages/nitro-sqlite-core/cpp/SQLiteOperations.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteOperations.*", + "packages/nitro-sqlite-core/cpp/SQLiteQueryResults.*", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteQueryResults.*", + "packages/nitro-sqlite-core/cpp/SQLiteStatementGroup.hpp", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteStatementGroup.hpp", + "packages/nitro-sqlite-core/cpp/SQLiteStatementTail.hpp", + "packages/react-native-nitro-sqlite/platform/cpp/SQLiteStatementTail.hpp", + "packages/nitro-sqlite-core/cpp/sqlite/sqlite3.*", + "packages/react-native-nitro-sqlite/platform/cpp/sqlite/sqlite3.*", + "packages/nitro-sqlite-core/cpp/sqlite/sqlite3-symbol-prefix.h", + "packages/react-native-nitro-sqlite/platform/cpp/sqlite/sqlite3-symbol-prefix.h", + "packages/react-native-nitro-sqlite/scripts/**", + "packages/nitro-sqlite-core/cpp/apple/**", + "packages/react-native-nitro-sqlite/cpp/NativeQueryResult.cpp", + "packages/react-native-nitro-sqlite/cpp/results/**", + "packages/nitro-sqlite-core/cpp/NativeQueryResult.cpp", + "packages/nitro-sqlite-core/cpp/results/**", + "packages/react-native-nitro-sqlite/platform/cpp/NativeQueryResult.cpp", + "packages/react-native-nitro-sqlite/platform/cpp/results/**", + "package.json", + "bun.lock", + "packages/react-native-nitro-sqlite/package.json", "scripts/test-cpp-hermes.sh", - "scripts/setup-hermes-host.mjs" + "scripts/setup-hermes-host.mjs", + "packages/nitro-sqlite/package.json", + "packages/nitro-sqlite/nitro.json", + "packages/nitro-sqlite/platform/cpp/**", + "packages/nitro-sqlite/src/specs/**" ], "docs": [ ".github/workflows/**", @@ -92,129 +148,177 @@ "docs/**", "packages/react-native-nitro-sqlite/src/**", "packages/react-native-nitro-sqlite/package.json", - "packages/react-native-nitro-sqlite-vec/src/**", - "packages/react-native-nitro-sqlite-vec/package.json", - "packages/react-native-nitro-sqlite-drizzle/src/**", - "packages/react-native-nitro-sqlite-kysely/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/src/**", - "packages/react-native-nitro-sqlite-kysely/package.json", - "packages/react-native-nitro-sqlite-mikro-orm/package.json", - "packages/react-native-nitro-sqlite-drizzle/package.json", + "packages/integrations/react-native/vec/src/**", + "packages/integrations/react-native/vec/package.json", + "packages/integrations/react-native/drizzle/src/**", + "packages/integrations/react-native/drizzle/package.json", "config/tsconfig.json", "package.json", "bun.lock", "packages/react-native-nitro-sqlite/plugin/src/**", - "packages/react-native-nitro-sqlite-typeorm/**" + "packages/nitro-sqlite-core/src/**", + "packages/react-native-nitro-sqlite/platform/src/**", + "packages/react-native-nitro-sqlite/scripts/**", + "scripts/prepare-workspace-sources.mjs", + "shared/orm/**", + "packages/integrations/{nitro-ui,react-native}/{kysely,mikro-orm,typeorm}/{src/**,scripts/**,*.js,package.json}", + "packages/integrations/react-native/kysely/src/**", + "packages/integrations/react-native/mikro-orm/src/**", + "packages/integrations/react-native/kysely/package.json", + "packages/integrations/react-native/mikro-orm/package.json", + "packages/integrations/react-native/typeorm/**", + "scripts/materialize-sqlite-sources.test.mjs", + "scripts/companion-materialize.test.mjs", + "packages/nitro-sqlite/{src/**,platform/src/**,scripts/**,*.json}", + "packages/nitro-sqlite-drizzle-core/**", + "packages/integrations/nitro-ui/{drizzle,vec}/{src/**,scripts/**,*.json}", + "packages/integrations/react-native/{drizzle,vec}/scripts/**", + "packages/nitro-sqlite-core/scripts/**", + "packages/nitro-sqlite-core/package.json" ], "android": [ ".github/workflows/**", ".github/actions/**", ".github/ci-paths.json", "scripts/ci*", - "example/android/**", - "example/src/tests/**", - "example/tests/**", - "example/rn-harness.config.mjs", - "example/jest.config.js", + "examples/react-native/android/**", + "examples/react-native/src/tests/**", + "examples/react-native/tests/**", + "examples/react-native/rn-harness.config.mjs", + "examples/react-native/jest.config.js", "packages/react-native-nitro-sqlite/cpp/**", "packages/react-native-nitro-sqlite/android/**", "packages/react-native-nitro-sqlite/src/**", "packages/react-native-nitro-sqlite/nitrogen/generated/shared/**", "packages/react-native-nitro-sqlite/nitrogen/generated/android/**", - "packages/react-native-nitro-sqlite-vec/cpp/**", + "packages/integrations/react-native/vec/cpp/**", "bun.lock", "package.json", - "example/package.json", + "examples/react-native/package.json", "packages/react-native-nitro-sqlite/package.json", - "packages/react-native-nitro-sqlite-vec/package.json", + "packages/integrations/react-native/vec/package.json", "patches/react-native-nitro-modules*", "patches/@react-native-harness*", - "example/react-native.config.js", + "examples/react-native/react-native.config.js", "packages/react-native-nitro-sqlite/react-native.config.js", - "packages/react-native-nitro-sqlite-vec/react-native.config.js", + "packages/integrations/react-native/vec/react-native.config.js", "packages/react-native-nitro-sqlite/nitro.json", "!packages/react-native-nitro-sqlite/src/__tests__/**", "scripts/android-sqlite-flags/**", - "example/index.js", - "example/babel.config*.js", - "example/metro.config.js", - "example/app.json", - "packages/react-native-nitro-sqlite-vec/src/**", - "!packages/react-native-nitro-sqlite-vec/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/**", - "packages/react-native-nitro-sqlite-kysely/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/metro.js", - "packages/react-native-nitro-sqlite-kysely/package.json", - "packages/react-native-nitro-sqlite-mikro-orm/package.json", - "packages/react-native-nitro-sqlite-drizzle/package.json", - "!packages/react-native-nitro-sqlite-drizzle/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/__tests__/fixtures/**", - "packages/react-native-nitro-sqlite-typeorm/**" + "examples/react-native/index.js", + "examples/react-native/babel.config*.js", + "examples/react-native/metro.config.js", + "examples/react-native/app.json", + "packages/integrations/react-native/vec/src/**", + "!packages/integrations/react-native/vec/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/**", + "packages/integrations/react-native/drizzle/package.json", + "!packages/integrations/react-native/drizzle/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/__tests__/fixtures/**", + "packages/nitro-sqlite-core/cpp/**", + "packages/react-native-nitro-sqlite/platform/cpp/**", + "packages/nitro-sqlite-core/src/**", + "packages/react-native-nitro-sqlite/platform/src/**", + "!packages/nitro-sqlite-core/src/__tests__/**", + "!packages/react-native-nitro-sqlite/platform/src/__tests__/**", + "packages/react-native-nitro-sqlite/scripts/**", + "scripts/prepare-workspace-sources.mjs", + "shared/orm/**", + "packages/integrations/{nitro-ui,react-native}/{kysely,mikro-orm,typeorm}/{src/**,scripts/**,*.js,package.json}", + "examples/shared/**", + "packages/integrations/react-native/kysely/src/**", + "packages/integrations/react-native/mikro-orm/src/**", + "packages/integrations/react-native/mikro-orm/metro.js", + "packages/integrations/react-native/kysely/package.json", + "packages/integrations/react-native/mikro-orm/package.json", + "packages/integrations/react-native/typeorm/**", + "scripts/materialize-sqlite-sources.test.mjs", + "scripts/companion-materialize.test.mjs", + "packages/nitro-sqlite-drizzle-core/**", + "packages/integrations/react-native/{drizzle,vec}/scripts/**", + "packages/nitro-sqlite-core/scripts/**", + "packages/nitro-sqlite-core/package.json" ], "ios": [ ".github/workflows/**", ".github/actions/**", ".github/ci-paths.json", "scripts/ci*", - "example/ios/**", - "example/src/tests/**", - "example/tests/**", - "example/rn-harness.config.mjs", - "example/jest.config.js", + "examples/react-native/ios/**", + "examples/react-native/src/tests/**", + "examples/react-native/tests/**", + "examples/react-native/rn-harness.config.mjs", + "examples/react-native/jest.config.js", "packages/react-native-nitro-sqlite/cpp/**", "packages/react-native-nitro-sqlite/ios/**", "packages/react-native-nitro-sqlite/src/**", "packages/react-native-nitro-sqlite/nitrogen/generated/shared/**", "packages/react-native-nitro-sqlite/nitrogen/generated/apple/**", - "packages/react-native-nitro-sqlite-vec/cpp/**", + "packages/integrations/react-native/vec/cpp/**", "packages/react-native-nitro-sqlite/RNNitroSQLite.podspec", - "packages/react-native-nitro-sqlite-vec/RNNitroSqliteVec.podspec", + "packages/integrations/react-native/vec/RNNitroSqliteVec.podspec", "packages/react-native-nitro-sqlite/Package.swift", - "packages/react-native-nitro-sqlite-vec/Package.swift", + "packages/integrations/react-native/vec/Package.swift", "bun.lock", "package.json", - "example/package.json", + "examples/react-native/package.json", "packages/react-native-nitro-sqlite/package.json", - "packages/react-native-nitro-sqlite-vec/package.json", + "packages/integrations/react-native/vec/package.json", "patches/react-native-nitro-modules*", "patches/@react-native-harness*", "patches/react-native-screens*", "patches/@react-native-clipboard*", - "example/react-native.config.js", + "examples/react-native/react-native.config.js", "packages/react-native-nitro-sqlite/react-native.config.js", - "packages/react-native-nitro-sqlite-vec/react-native.config.js", + "packages/integrations/react-native/vec/react-native.config.js", "packages/react-native-nitro-sqlite/nitro.json", "!packages/react-native-nitro-sqlite/src/__tests__/**", "scripts/sqlite-package-config.test.ts", - "example/index.js", - "example/babel.config*.js", - "example/metro.config.js", - "example/app.json", - "packages/react-native-nitro-sqlite-vec/src/**", - "!packages/react-native-nitro-sqlite-vec/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/**", - "packages/react-native-nitro-sqlite-kysely/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/metro.js", - "packages/react-native-nitro-sqlite-kysely/package.json", - "packages/react-native-nitro-sqlite-mikro-orm/package.json", - "packages/react-native-nitro-sqlite-drizzle/package.json", - "!packages/react-native-nitro-sqlite-drizzle/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/__tests__/fixtures/**", - "packages/react-native-nitro-sqlite-typeorm/**" + "examples/react-native/index.js", + "examples/react-native/babel.config*.js", + "examples/react-native/metro.config.js", + "examples/react-native/app.json", + "packages/integrations/react-native/vec/src/**", + "!packages/integrations/react-native/vec/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/**", + "packages/integrations/react-native/drizzle/package.json", + "!packages/integrations/react-native/drizzle/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/__tests__/fixtures/**", + "packages/nitro-sqlite-core/cpp/**", + "packages/react-native-nitro-sqlite/platform/cpp/**", + "packages/nitro-sqlite-core/src/**", + "packages/react-native-nitro-sqlite/platform/src/**", + "!packages/nitro-sqlite-core/src/__tests__/**", + "!packages/react-native-nitro-sqlite/platform/src/__tests__/**", + "packages/react-native-nitro-sqlite/scripts/**", + "scripts/prepare-workspace-sources.mjs", + "shared/orm/**", + "packages/integrations/{nitro-ui,react-native}/{kysely,mikro-orm,typeorm}/{src/**,scripts/**,*.js,package.json}", + "examples/shared/**", + "packages/integrations/react-native/kysely/src/**", + "packages/integrations/react-native/mikro-orm/src/**", + "packages/integrations/react-native/mikro-orm/metro.js", + "packages/integrations/react-native/kysely/package.json", + "packages/integrations/react-native/mikro-orm/package.json", + "packages/integrations/react-native/typeorm/**", + "scripts/materialize-sqlite-sources.test.mjs", + "scripts/companion-materialize.test.mjs", + "packages/nitro-sqlite-drizzle-core/**", + "packages/integrations/react-native/{drizzle,vec}/scripts/**", + "packages/nitro-sqlite-core/scripts/**", + "packages/nitro-sqlite-core/package.json" ], "macos": [ ".github/workflows/**", ".github/actions/**", ".github/ci-paths.json", "scripts/ci*", - "example/macos/**", - "example/src/**", - "example/tests/**", - "example/app.json", - "example/index.js", - "example/babel.config*.js", + "examples/react-native/macos/**", + "examples/react-native/src/**", + "examples/react-native/tests/**", + "examples/react-native/app.json", + "examples/react-native/index.js", + "examples/react-native/babel.config*.js", "packages/react-native-nitro-sqlite/src/**", "packages/react-native-nitro-sqlite/cpp/**", "packages/react-native-nitro-sqlite/ios/**", @@ -224,30 +328,47 @@ "packages/react-native-nitro-sqlite/react-native.config.js", "packages/react-native-nitro-sqlite/nitro.json", "packages/react-native-nitro-sqlite/package.json", - "packages/react-native-nitro-sqlite-vec/src/**", - "packages/react-native-nitro-sqlite-vec/cpp/**", - "packages/react-native-nitro-sqlite-vec/RNNitroSqliteVec.podspec", - "packages/react-native-nitro-sqlite-vec/react-native.config.js", - "packages/react-native-nitro-sqlite-vec/package.json", + "packages/integrations/react-native/vec/src/**", + "packages/integrations/react-native/vec/cpp/**", + "packages/integrations/react-native/vec/RNNitroSqliteVec.podspec", + "packages/integrations/react-native/vec/react-native.config.js", + "packages/integrations/react-native/vec/package.json", "patches/**", - "example/macos/Podfile.lock", - "example/Gemfile*", + "examples/react-native/macos/Podfile.lock", + "examples/react-native/Gemfile*", "bun.lock", "package.json", - "example/package.json", - "example/macos/package.json", - "example/react-native.config.js", - "example/macos/react-native.config.js", + "examples/react-native/package.json", + "examples/react-native/macos/package.json", + "examples/react-native/react-native.config.js", + "examples/react-native/macos/react-native.config.js", "!packages/react-native-nitro-sqlite/src/__tests__/**", - "!packages/react-native-nitro-sqlite-vec/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/**", - "packages/react-native-nitro-sqlite-kysely/src/**", - "packages/react-native-nitro-sqlite-mikro-orm/src/**", - "packages/react-native-nitro-sqlite-kysely/package.json", - "packages/react-native-nitro-sqlite-mikro-orm/package.json", - "packages/react-native-nitro-sqlite-drizzle/package.json", - "!packages/react-native-nitro-sqlite-drizzle/src/__tests__/**", - "packages/react-native-nitro-sqlite-drizzle/src/__tests__/fixtures/**", - "packages/react-native-nitro-sqlite-typeorm/**" + "!packages/integrations/react-native/vec/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/**", + "packages/integrations/react-native/drizzle/package.json", + "!packages/integrations/react-native/drizzle/src/__tests__/**", + "packages/integrations/react-native/drizzle/src/__tests__/fixtures/**", + "packages/nitro-sqlite-core/src/**", + "packages/react-native-nitro-sqlite/platform/src/**", + "packages/nitro-sqlite-core/cpp/**", + "packages/react-native-nitro-sqlite/platform/cpp/**", + "!packages/nitro-sqlite-core/src/__tests__/**", + "!packages/react-native-nitro-sqlite/platform/src/__tests__/**", + "packages/react-native-nitro-sqlite/scripts/**", + "scripts/prepare-workspace-sources.mjs", + "shared/orm/**", + "packages/integrations/{nitro-ui,react-native}/{kysely,mikro-orm,typeorm}/{src/**,scripts/**,*.js,package.json}", + "examples/shared/**", + "packages/integrations/react-native/kysely/src/**", + "packages/integrations/react-native/mikro-orm/src/**", + "packages/integrations/react-native/kysely/package.json", + "packages/integrations/react-native/mikro-orm/package.json", + "packages/integrations/react-native/typeorm/**", + "scripts/materialize-sqlite-sources.test.mjs", + "scripts/companion-materialize.test.mjs", + "packages/nitro-sqlite-drizzle-core/**", + "packages/integrations/react-native/{drizzle,vec}/scripts/**", + "packages/nitro-sqlite-core/scripts/**", + "packages/nitro-sqlite-core/package.json" ] } diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 299145bc9..84f2ea467 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,7 +17,7 @@ updates: - package-ecosystem: 'gradle' directories: - '/packages/react-native-nitro-sqlite/android/' - - '/example/android/' + - '/examples/react-native/android/' schedule: interval: 'weekly' day: 'monday' @@ -37,7 +37,7 @@ updates: - package-ecosystem: 'npm' directories: - '/packages/react-native-nitro-sqlite/' - - '/example/' + - '/examples/react-native/' schedule: interval: 'weekly' day: 'monday' diff --git a/.github/workflows/build-android-release.yml b/.github/workflows/build-android-release.yml index 54f6c80ff..c7c8ef067 100644 --- a/.github/workflows/build-android-release.yml +++ b/.github/workflows/build-android-release.yml @@ -46,8 +46,8 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - - name: Run Gradle Build for example/android/ - working-directory: example/android + - name: Run Gradle Build for examples/react-native/android/ + working-directory: examples/react-native/android run: ./gradlew assembleRelease --no-daemon --build-cache - name: Upload APK to Release @@ -55,10 +55,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release upload "${{ inputs.tag || github.event.release.tag_name }}" \ - example/android/app/build/outputs/apk/release/app-release.apk#NitroSQLiteExample-${{ inputs.tag || github.event.release.tag_name }}.apk \ + examples/react-native/android/app/build/outputs/apk/release/app-release.apk#RNNitroSQLiteExample-${{ inputs.tag || github.event.release.tag_name }}.apk \ --clobber # Gradle cache doesn't like daemons - name: Stop Gradle Daemon - working-directory: example/android + working-directory: examples/react-native/android run: ./gradlew --stop diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b0f95718..ae86de323 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,8 @@ on: paths: &ci_paths - '.github/**' - 'packages/**' - - 'example/**' + - 'shared/orm/**' + - 'examples/**' - 'docs/**' - 'scripts/**' - 'config/**' @@ -98,7 +99,7 @@ jobs: name: ci-lockfiles path: | bun.lock - example/macos/Podfile.lock + examples/react-native/macos/Podfile.lock retention-days: 1 - name: Require committed dependency resolutions if: steps.select.outputs.dependencies == 'true' @@ -130,27 +131,28 @@ jobs: - name: Lint TypeScript if: steps.select.outputs.typescript == 'true' run: | - bun --cwd example lint - bun --cwd packages/react-native-nitro-sqlite lint - bun --cwd packages/react-native-nitro-sqlite-vec lint - bun --cwd packages/react-native-nitro-sqlite-drizzle lint - bun --cwd packages/react-native-nitro-sqlite-kysely lint - bun --cwd packages/react-native-nitro-sqlite-mikro-orm lint - bun --cwd packages/react-native-nitro-sqlite-typeorm lint + bun --cwd examples/react-native lint + bun --cwd packages/react-native-nitro-sqlite lint:check + bun --cwd packages/integrations/react-native/vec lint + bun --cwd packages/integrations/react-native/drizzle lint + bun --cwd packages/integrations/react-native/kysely lint + bun --cwd packages/integrations/react-native/mikro-orm lint + bun --cwd packages/integrations/react-native/typeorm lint git diff --exit-code HEAD -- . ':(exclude)bun.lock' - name: Test JavaScript wrappers and example runners if: steps.select.outputs.typescript == 'true' run: | + node --test scripts/materialize-sqlite-sources.test.mjs scripts/companion-materialize.test.mjs node --test scripts/mikro-orm-metro.test.mjs bun --cwd packages/react-native-nitro-sqlite build - bun --cwd packages/react-native-nitro-sqlite-typeorm build + bun --cwd packages/integrations/react-native/typeorm build node --test scripts/typeorm-package.test.mjs (cd packages/react-native-nitro-sqlite && ../../node_modules/.bin/jest --coverage --runInBand) - (cd packages/react-native-nitro-sqlite-vec && ../../node_modules/.bin/jest --coverage --runInBand) - (cd packages/react-native-nitro-sqlite-drizzle && ../../node_modules/.bin/jest --coverage --runInBand) - bun --cwd packages/react-native-nitro-sqlite-mikro-orm test - (cd example && ../node_modules/.bin/jest --config jest.mocha.config.js --runInBand --watchman=false) - node --test example/macos/scripts/test-macos.test.mjs + (cd packages/integrations/react-native/vec && ../../../../node_modules/.bin/jest --coverage --runInBand) + (cd packages/integrations/react-native/drizzle && ../../../../node_modules/.bin/jest --coverage --runInBand) + bun run test:orm + (cd examples/react-native && ../../node_modules/.bin/jest --config jest.mocha.config.js --runInBand --watchman=false) + node --test examples/react-native/macos/scripts/test-macos.test.mjs bun --cwd packages/react-native-nitro-sqlite test:plugin (cd packages/react-native-nitro-sqlite && bun run build) - name: Format C++ @@ -184,9 +186,14 @@ jobs: bun-version: 1.3.1 - name: Install dependencies run: bun install --frozen-lockfile + - name: Prepare both hosts from the clean checkout + run: | + bun run prepare + bun --cwd packages/react-native-nitro-sqlite specs + bun --cwd packages/nitro-sqlite specs - name: Prepare pinned host Hermes run: node scripts/setup-hermes-host.mjs "$RUNNER_TEMP/hermes-host" - - name: Run both Hermes conversion executables + - name: Run Hermes conversion executables for both hosts run: bash scripts/test-cpp-hermes.sh expo-plugin: @@ -218,8 +225,8 @@ jobs: if: matrix.sdk == 58 run: | (cd packages/react-native-nitro-sqlite && bun run build) - bun --cwd example/expo typecheck - bun --cwd example/expo prebuild + bun --cwd examples/react-native/expo typecheck + bun --cwd examples/react-native/expo prebuild android: name: Android diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3137dbe00..f05210f4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -145,7 +145,7 @@ jobs: with: ruby-version: 3.3.0 bundler-cache: true - working-directory: example + working-directory: examples/react-native - name: Select Xcode if: false run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer" @@ -193,7 +193,7 @@ jobs: run: node scripts/merge-release.ts publish: - name: Publish both packages from the release tag + name: Publish React Native packages from the release tag needs: [preflight, merge, release-please] if: ${{ always() && needs.preflight.result == 'success' && (needs.merge.result == 'success' || needs.release-please.outputs.tag != '' || inputs.release_tag != '') }} runs-on: ubuntu-24.04 diff --git a/.github/workflows/test-harness-android.yml b/.github/workflows/test-harness-android.yml index 426f4cba1..6e4b71372 100644 --- a/.github/workflows/test-harness-android.yml +++ b/.github/workflows/test-harness-android.yml @@ -43,7 +43,7 @@ jobs: run: bun install --frozen-lockfile - name: Set minSdk in build.gradle - run: sed -i "s/minSdkVersion = 24/minSdkVersion = ${{ matrix.min_sdk }}/g" example/android/build.gradle + run: sed -i "s/minSdkVersion = 24/minSdkVersion = ${{ matrix.min_sdk }}/g" examples/react-native/android/build.gradle - name: Setup JDK 17 uses: actions/setup-java@v6 @@ -62,11 +62,11 @@ jobs: restore-keys: | ${{ runner.os }}-gradle-v2- - name: Test Android SQLite build flags - run: example/android/gradlew --project-dir scripts/android-sqlite-flags testSqliteFlags --no-daemon + run: examples/react-native/android/gradlew --project-dir scripts/android-sqlite-flags testSqliteFlags --no-daemon - name: Check Gradle configuration cache if: matrix.min_sdk == '24' && (inputs.full || inputs.configuration) - working-directory: example/android + working-directory: examples/react-native/android run: | # React Native creates the autolinking file on the first run. ./gradlew :react-native-nitro-sqlite:help --configuration-cache --no-daemon @@ -75,7 +75,7 @@ jobs: grep -q 'Configuration cache entry reused' "$RUNNER_TEMP/nitro-sqlite-configuration-cache.log" - name: Build Android app - working-directory: example/android + working-directory: examples/react-native/android run: ./gradlew :app:assembleDebug --no-daemon --build-cache -PreactNativeArchitectures=${{ env.TARGET_ANDROID_ARCH }} - name: Run Android integration tests @@ -83,10 +83,10 @@ jobs: with: app: android/app/build/outputs/apk/debug/app-debug.apk runner: android - projectRoot: example + projectRoot: examples/react-native packageManager: bun cacheAvd: false - name: Stop Gradle Daemon if: always() - working-directory: example/android + working-directory: examples/react-native/android run: ./gradlew --stop diff --git a/.github/workflows/test-harness-ios.yml b/.github/workflows/test-harness-ios.yml index 129156f76..f422fdc18 100644 --- a/.github/workflows/test-harness-ios.yml +++ b/.github/workflows/test-harness-ios.yml @@ -53,18 +53,18 @@ jobs: run: sudo xcode-select -s "/Applications/Xcode_${{ matrix.config.xcode }}.app/Contents/Developer" - name: Generate Swift packages - working-directory: example + working-directory: examples/react-native run: bun spm - name: Build App - working-directory: example/ios + working-directory: examples/react-native/ios run: | set -o pipefail xcodebuild \ CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \ -derivedDataPath build/DerivedData -UseModernBuildSystem=YES \ - -project NitroSQLiteExample.xcodeproj \ - -scheme NitroSQLiteExample \ + -project RNNitroSQLiteExample.xcodeproj \ + -scheme RNNitroSQLiteExample \ -sdk iphonesimulator \ -configuration Debug \ -destination 'generic/platform=iOS Simulator' \ @@ -98,7 +98,7 @@ jobs: # react-native-harness 1.5.0 fails on Xcode 27, where `simctl appinfo` errors for apps that are not installed. - name: Install app on the iOS simulator - run: xcrun simctl install "$IOS_SIMULATOR_UDID" example/ios/build/DerivedData/Build/Products/Debug-iphonesimulator/NitroSQLiteExample.app + run: xcrun simctl install "$IOS_SIMULATOR_UDID" examples/react-native/ios/build/DerivedData/Build/Products/Debug-iphonesimulator/RNNitroSQLiteExample.app - name: Run iOS integration tests uses: callstackincubator/react-native-harness@v1.7.0 @@ -106,9 +106,9 @@ jobs: HARNESS_DEBUG: "1" RN_HARNESS_DIAGNOSTICS: "1" with: - app: ios/build/DerivedData/Build/Products/Debug-iphonesimulator/NitroSQLiteExample.app + app: ios/build/DerivedData/Build/Products/Debug-iphonesimulator/RNNitroSQLiteExample.app runner: ios - projectRoot: example + projectRoot: examples/react-native packageManager: bun - name: Upload iOS test diagnostics @@ -116,7 +116,7 @@ jobs: uses: actions/upload-artifact@v7 with: name: harness-ios-diagnostics-xcode${{ matrix.config.xcode }} - path: example/.harness/diagnostics/** + path: examples/react-native/.harness/diagnostics/** include-hidden-files: true if-no-files-found: ignore retention-days: 7 diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index be206e089..416d7be88 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -51,7 +51,7 @@ jobs: with: ruby-version: 3.3.0 bundler-cache: true - working-directory: example + working-directory: examples/react-native - name: Select Xcode 26.5 run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer" @@ -59,14 +59,14 @@ jobs: - name: Restore Pods cache uses: actions/cache@v6 with: - path: example/macos/Pods - key: ${{ runner.os }}-pods-macos-${{ hashFiles('example/macos/Podfile.lock', 'example/Gemfile.lock') }} + path: examples/react-native/macos/Pods + key: ${{ runner.os }}-pods-macos-${{ hashFiles('examples/react-native/macos/Podfile.lock', 'examples/react-native/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-pods-macos- - name: Clean generated macOS codegen - run: rm -rf example/macos/build/generated + run: rm -rf examples/react-native/macos/build/generated - name: Install Pods - run: bun --cwd example pods:macos + run: bun --cwd examples/react-native pods:macos - name: Attach refreshed native lockfiles if: always() && inputs.lockfile @@ -74,23 +74,23 @@ jobs: with: name: native-lockfiles-macos path: | - example/macos/Podfile.lock - example/Gemfile.lock + examples/react-native/macos/Podfile.lock + examples/react-native/Gemfile.lock retention-days: 1 - name: Require committed native dependency resolutions if: inputs.lockfile run: | - ruby scripts/ci-pod-lockfiles.rb example/macos/Podfile.lock - git diff --exit-code -- example/Gemfile.lock + ruby scripts/ci-pod-lockfiles.rb examples/react-native/macos/Podfile.lock + git diff --exit-code -- examples/react-native/Gemfile.lock - name: Build App - working-directory: example/macos + working-directory: examples/react-native/macos run: | set -o pipefail xcodebuild \ -derivedDataPath build/DerivedData -UseModernBuildSystem=YES \ - -workspace NitroSQLiteExample.xcworkspace \ - -scheme NitroSQLiteExample-macOS \ + -workspace RNNitroSQLiteExample.xcworkspace \ + -scheme RNNitroSQLiteExample-macOS \ -configuration Debug \ -destination 'platform=macOS,arch=arm64' \ -showBuildTimingSummary \ @@ -98,7 +98,7 @@ jobs: build \ CODE_SIGNING_ALLOWED=NO | xcbeautify --renderer github-actions - name: Run macOS integration tests - working-directory: example/macos + working-directory: examples/react-native/macos env: - MACOS_APP_PATH: build/DerivedData/Build/Products/Debug/NitroSQLiteExample.app + MACOS_APP_PATH: build/DerivedData/Build/Products/Debug/RNNitroSQLiteExample.app run: bun run test diff --git a/.gitignore b/.gitignore index 9287a3388..a43d758b0 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,7 @@ local.properties *.iml *.hprof .cxx/ -example/.cxx/ +examples/react-native/.cxx/ *.keystore !debug.keystore .kotlin/ @@ -51,7 +51,7 @@ vendor/ # Cocoapods # **/Pods -example/vendor/bundle +examples/react-native/vendor/bundle # Temporary files created by Metro to check the health of the file watcher 63 .metro-health-check* diff --git a/.prettierignore b/.prettierignore index a037f45e5..44629c9ff 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,7 +7,7 @@ *.markdown packages/react-native-nitro-sqlite/lib -packages/react-native-nitro-sqlite-drizzle/src/__tests__/fixtures/drizzle +packages/integrations/react-native/drizzle/src/__tests__/fixtures/drizzle .well-known android diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c56f4d00..bf5e54b6c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,35 @@ To get started with the project, run `bun` in the root directory to install the bun ``` -While developing, you can run the [example app](/example/) to test your changes. +While developing, you can run the [example app](/examples/react-native/) to test your changes. + +### Source layout + +`packages/nitro-sqlite-core` owns the shared TypeScript API, Nitro specifications, C++ database implementation, and bundled SQLite source. Make shared changes in its `src/` and `cpp/` directories. + +`packages/react-native-nitro-sqlite/platform` contains React Native's platform context and native object creation. The package's Android, Apple, and generated Nitro bindings stay in `packages/react-native-nitro-sqlite`. + +Shared native sources use the `margelo::nitro::nitrosqlite` namespace and `NitroSQLite` header module. The React Native preparation step maps these two names back to its existing `rnnitrosqlite` namespace and `RNNitroSQLite` header module. This keeps its native ABI and JavaScript registry keys compatible with existing React Native binaries. Its generated Android package is `com.margelo.nitro.nitrosqlite`, independent of that registry namespace. + +The source preparation script copies the shared implementation into the React Native package, then applies its platform files. Installation, package builds, type checks, and Nitro generation run this step automatically. To refresh the copies before editing the native app in an IDE, run: + +```sh +node packages/react-native-nitro-sqlite/scripts/prepare-sources.mjs +``` + +For live editing, keep the same source preparation script running with `--watch` in a second terminal. It updates the copies when shared or platform files change. + +Do not edit the copied `src/` or `cpp/` directories inside `packages/react-native-nitro-sqlite`. Preparation replaces them. Published React Native packages include those directories, so consumers keep the same package imports, native build inputs, and SQLite configuration. + +### Optional integrations and NitroUI + +The host-specific companions live under `packages/integrations/react-native` and `packages/integrations/nitro-ui`. Shared Drizzle implementation lives in `packages/nitro-sqlite-drizzle-core`. Shared Kysely and MikroORM implementation lives in `shared/orm`. Their preparation scripts copy shared sources into each companion before packaging. Edit the shared source or the host's platform files rather than the generated copies. + +The NitroUI example lives in `examples/nitro-ui` and has its own lockfile and SDK dependencies. Follow the [NitroUI installation guide](docs/content/docs/nitro-ui/index.mdx) to run it with SDK 0.2.0. React Native's example and Nitro dependencies remain separate. + +The [release workflow](docs/releases/README.md) publishes the six React Native packages together. NitroUI publication requires separate maintainer approval and is disabled by default. + +### Run the example To start the packager: @@ -31,17 +59,17 @@ bun example spm bun example ios ``` -The [Expo example](/example/expo/) uses the Expo config plugins from both packages. Run it on iOS or Android with: +The [Expo example](/examples/react-native/expo/) uses the Expo config plugins from both packages. Run it on iOS or Android with: ```sh -bun --cwd example/expo ios -bun --cwd example/expo android +bun --cwd examples/react-native/expo ios +bun --cwd examples/react-native/expo android ``` Make sure your code passes TypeScript and ESLint. Run the following to verify: ```sh -bun typescript +bun typecheck bun lint ``` @@ -57,9 +85,9 @@ Remember to add tests for your change if possible. Run the unit tests by: bun test ``` -To edit the Objective-C++ and C++ files, open `example/ios/NitroSQLiteExample.xcodeproj` in Xcode and find the source files in the `RNNitroSQLite` package. +To edit the Objective-C++ and C++ files, open `examples/react-native/ios/RNNitroSQLiteExample.xcodeproj` in Xcode and find the source files in the `RNNitroSQLite` package. -To edit the Kotlin files, open `example/android` in Android studio and find the source files at `rnnitrosqlite` under `Android`. +To edit the Kotlin files, open `examples/react-native/android` in Android studio and find the source files at `rnnitrosqlite` under `Android`. ### Commit message convention diff --git a/README.md b/README.md index 4db52682b..44566c947 100644 --- a/README.md +++ b/README.md @@ -8,27 +8,50 @@
-Nitro SQLite is a SQLite library for React Native on iOS and Android, built with [Nitro Modules](https://nitro.margelo.com/). The stable 10.x line also supports macOS and visionOS. It provides synchronous and asynchronous queries, transactions, and batch operations. +Nitro SQLite is a SQLite library built with [Nitro Modules](https://nitro.margelo.com/). It shares its database implementation and TypeScript API across React Native and NitroUI. It provides synchronous and asynchronous queries, transactions, prepared statements, and batch operations. -The bundled SQLite build enables [R\*Tree indexes](https://sqlite.margelo.com/docs/concepts/queries-and-indexes#query-spatial-ranges) by default on Apple platforms and Android. Set `nitroSQLite.enableRTree` to `false` in your app's `package.json` to omit it from the native build. +Choose the package for your app's runtime: -**[Read the documentation](https://sqlite.margelo.com/docs)** for setup, guides, integrations, and the API reference. +| Runtime | Package | Setup | +| --- | --- | --- | +| React Native | `react-native-nitro-sqlite` | [React Native guide](docs/content/docs/react-native/index.mdx) | +| NitroUI | `nitro-sqlite` | [NitroUI guide](docs/content/docs/nitro-ui/index.mdx). Pre-release source with local archive and checkout installation. | + +Both runtimes support [Drizzle ORM](docs/content/docs/integrations/orms/drizzle.mdx), [TypeORM](docs/content/docs/integrations/orms/typeorm.mdx), [MikroORM](docs/content/docs/integrations/orms/mikro-orm.mdx), [Kysely](docs/content/docs/integrations/orms/kysely.mdx), and [vector search](docs/content/docs/integrations/vector-search.mdx) through optional companion packages. + +| Integration | React Native | NitroUI | +| --- | --- | --- | +| Drizzle | `react-native-nitro-sqlite-drizzle` | `nitro-sqlite-drizzle` | +| TypeORM | `react-native-nitro-sqlite-typeorm` | `nitro-sqlite-typeorm` | +| MikroORM | `react-native-nitro-sqlite-mikro-orm` | `nitro-sqlite-mikro-orm` | +| Kysely | `react-native-nitro-sqlite-kysely` | `nitro-sqlite-kysely` | +| Vector search | `react-native-nitro-sqlite-vec` | `nitro-sqlite-vec` | + +These pre-release companion packages use the matching SQLite adapter for the same host. Install them from local archives after preparing the source checkout. See the [ORM setup guide](docs/content/docs/integrations/orms/index.mdx). The TypeORM export in each SQLite adapter remains available for compatibility and is deprecated in favor of its companion package. + +Read [Supported platforms](docs/content/docs/supported-platforms.mdx) for platform status, runtime versions, and integration limits. The React Native documentation is also available at [sqlite.margelo.com](https://sqlite.margelo.com/docs). If you use a coding agent, give it the [NitroSQLite skill](https://github.com/margelo/react-native-skills/blob/main/skills/react-native-nitro-sqlite/SKILL.md). It links to focused guidance for connections, queries, transactions, concurrency, and migration. See the [AI agent guide](https://sqlite.margelo.com/docs/guides/ai-agents) for what to check in generated code. -## Installation +Published React Native releases remain available, including 10.x and the `nitro-v1` prereleases. The instructions below install this source checkout from local archives. Its React Native package versions remain provisional. Use the documentation for your installed release when staying on an existing version. + +## React Native installation The Nitro V1 prerelease requires React Native 0.88 or newer. iOS requires a deployment target of 16.0 or later, Swift Package Manager, and Xcode with Swift 6.4 or newer. +Prepare the source checkout and build the SQLite archive from `packages/react-native-nitro-sqlite` with its packing script. The packing step prints the archive filename with its recorded package version. Replace `VERSION` below with that version and install it in your app: + ```sh -npm install react-native-nitro-sqlite@nitro-v1 react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101 +npm install /path/to/react-native-nitro-sqlite-VERSION.tgz react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101 ``` For iOS, follow the [React Native SwiftPM setup](https://sqlite.margelo.com/docs/configuration/ios#set-up-swift-package-manager), including the steps for keeping other CocoaPods, or the [Expo prebuild setup](https://sqlite.margelo.com/docs/configuration/expo#generate-and-rebuild). For macOS and visionOS, use Nitro SQLite 10.x with Nitro Modules 0.37.2. See the [macOS setup](https://sqlite.margelo.com/docs/configuration/macos) for the macOS example and build options. -Rebuild the native app after installing. Expo projects need a development build; Expo Go cannot load this native module. See [Getting Started](https://sqlite.margelo.com/docs) for details. +Rebuild the native app after installing. Expo projects need a development build; Expo Go cannot load this native module. See the [React Native guide](docs/content/docs/react-native/index.mdx) for details. NitroUI uses its own [setup guide](docs/content/docs/nitro-ui/index.mdx) and Nitro version. + +The React Native SQLite build enables [R\*Tree indexes](docs/content/docs/concepts/queries-and-indexes.mdx#query-spatial-ranges) by default on Apple platforms and Android. Set `nitroSQLite.enableRTree` to `false` in your app's `package.json` to omit it from the native build. Expo projects can set up FTS5, App Groups, and system SQLite during prebuild or EAS Build by adding `react-native-nitro-sqlite` to the app config's plugins. For vector search, add `react-native-nitro-sqlite-vec` too. See [Expo configuration](https://sqlite.margelo.com/docs/configuration/expo). Existing manual [iOS](https://sqlite.margelo.com/docs/configuration/ios) and [Android](https://sqlite.margelo.com/docs/configuration/android) configuration remains supported. Native setting changes require a rebuild. diff --git a/bun.lock b/bun.lock index d97026a60..78ca6801d 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "react-native-nitro-sqlite-workspace", @@ -67,7 +68,7 @@ "typescript": "6.0.3", }, }, - "example": { + "examples/react-native": { "name": "react-native-nitro-sqlite-example", "version": "10.4.0", "dependencies": { @@ -132,7 +133,7 @@ "react-test-renderer": "19.3.1", }, }, - "example/expo": { + "examples/react-native/expo": { "name": "react-native-nitro-sqlite-expo-example", "dependencies": { "expo": "~58.0.26", @@ -147,7 +148,7 @@ "typescript": "^6.0.3", }, }, - "example/macos": { + "examples/react-native/macos": { "name": "react-native-nitro-sqlite-macos-example", "dependencies": { "@react-native-clipboard/clipboard": "^1.16.3", @@ -185,36 +186,86 @@ "babel-plugin-inline-import": "3.0.0", }, }, - "packages/react-native-nitro-sqlite": { - "name": "react-native-nitro-sqlite", - "version": "10.4.0", + "packages/integrations/nitro-ui/drizzle": { + "name": "nitro-sqlite-drizzle", + "version": "11.0.0", "devDependencies": { - "@react-native/jest-preset": "0.88.1", - "@types/better-sqlite3": "^9.6.0", - "better-sqlite3": "^13.0.3", - "expo": "~58.0.26", - "jest": "^30.2.0", - "nitrogen": "1.0.0-alpha.nightly.138.g43e09c161101", - "react": "19.3.1", - "react-native": "0.88.1", - "react-native-builder-bob": "^0.44.1", - "react-native-nitro-modules": "1.0.0-alpha.nightly.138.g43e09c161101", - "typeorm": "1.1.2", + "drizzle-orm": "0.45.4", + "typescript": "^5.8.3", }, "peerDependencies": { - "better-sqlite3": "^12.11.1 || ^13.0.3", - "expo": ">=55.0.0", + "drizzle-orm": ">=0.45.4 <1.0.0", + "nitro-sqlite": ">=11.0.0-0", "react": ">=17.0.0", - "react-native": ">=0.88.0", - "react-native-nitro-modules": "1.0.0-alpha.nightly.138.g43e09c161101", }, - "optionalPeers": [ - "better-sqlite3", - "expo", - "react-native-nitro-modules", - ], }, - "packages/react-native-nitro-sqlite-drizzle": { + "packages/integrations/nitro-ui/kysely": { + "name": "nitro-sqlite-kysely", + "version": "11.0.0", + "dependencies": { + "kysely-generic-sqlite": "^2.0.1", + }, + "devDependencies": { + "@types/node": "^25.0.0", + "better-sqlite3": "^12.11.1", + "kysely": "0.29.9", + "nitro-sqlite": "workspace:*", + "typescript": "^6.0.3", + }, + "peerDependencies": { + "kysely": "^0.29.9", + "nitro-sqlite": ">=11.0.0-0", + }, + }, + "packages/integrations/nitro-ui/mikro-orm": { + "name": "nitro-sqlite-mikro-orm", + "version": "11.0.0", + "dependencies": { + "kysely-generic-sqlite": "^2.0.1", + "nitro-sqlite-kysely": "11.0.0", + }, + "devDependencies": { + "@mikro-orm/sql": "7.2.13", + "@types/node": "^25.0.0", + "better-sqlite3": "^12.11.1", + "kysely": "0.29.9", + "nitro-sqlite": "workspace:*", + "typescript": "^6.0.3", + }, + "peerDependencies": { + "@mikro-orm/sql": "~7.2.13", + "kysely": "^0.29.9", + "nitro-sqlite": ">=11.0.0-0", + }, + }, + "packages/integrations/nitro-ui/typeorm": { + "name": "nitro-sqlite-typeorm", + "version": "11.0.0", + "devDependencies": { + "nitro-sqlite": "workspace:*", + "typeorm": "1.1.2", + "typescript": "^6.0.3", + }, + "peerDependencies": { + "nitro-sqlite": ">=11.0.0-0", + "typeorm": "^1.1.2", + }, + }, + "packages/integrations/nitro-ui/vec": { + "name": "nitro-sqlite-vec", + "version": "11.0.0", + "dependencies": { + "nitro-core": "1.0.0-alpha.nightly.137.gd4793c40b8b8", + }, + "devDependencies": { + "nitrogen": "1.0.0-alpha.nightly.137.gd4793c40b8b8", + "typescript": "^6.0.3", + }, + "peerDependencies": { + "nitro-sqlite": ">=11.0.0-0", + }, + }, + "packages/integrations/react-native/drizzle": { "name": "react-native-nitro-sqlite-drizzle", "version": "10.4.0", "devDependencies": { @@ -231,22 +282,25 @@ "react-native-nitro-sqlite": ">=10.3.0", }, }, - "packages/react-native-nitro-sqlite-kysely": { + "packages/integrations/react-native/kysely": { "name": "react-native-nitro-sqlite-kysely", "version": "10.4.0", "dependencies": { "kysely-generic-sqlite": "^2.0.1", }, "devDependencies": { + "@types/node": "^25.0.0", + "better-sqlite3": "^12.11.1", "kysely": "0.29.9", "react-native-nitro-sqlite": "10.4.0", + "typescript": "^6.0.3", }, "peerDependencies": { "kysely": "^0.29.9", "react-native-nitro-sqlite": ">=10.4.0", }, }, - "packages/react-native-nitro-sqlite-mikro-orm": { + "packages/integrations/react-native/mikro-orm": { "name": "react-native-nitro-sqlite-mikro-orm", "version": "10.4.0", "dependencies": { @@ -255,8 +309,11 @@ }, "devDependencies": { "@mikro-orm/sql": "7.2.13", + "@types/node": "^25.0.0", + "better-sqlite3": "^12.11.1", "kysely": "0.29.9", "react-native-nitro-sqlite": "10.4.0", + "typescript": "^6.0.3", }, "peerDependencies": { "@mikro-orm/sql": "~7.2.13", @@ -264,20 +321,21 @@ "react-native-nitro-sqlite": ">=10.4.0", }, }, - "packages/react-native-nitro-sqlite-typeorm": { + "packages/integrations/react-native/typeorm": { "name": "react-native-nitro-sqlite-typeorm", "version": "10.4.0", "devDependencies": { "react-native-builder-bob": "^0.44.1", "react-native-nitro-sqlite": "10.4.0", "typeorm": "1.1.2", + "typescript": "^6.0.3", }, "peerDependencies": { "react-native-nitro-sqlite": ">=10.4.0", "typeorm": "^1.1.2", }, }, - "packages/react-native-nitro-sqlite-vec": { + "packages/integrations/react-native/vec": { "name": "react-native-nitro-sqlite-vec", "version": "10.4.0", "devDependencies": { @@ -292,6 +350,63 @@ "expo", ], }, + "packages/nitro-sqlite": { + "name": "nitro-sqlite", + "version": "11.0.0", + "dependencies": { + "nitro-core": "1.0.0-alpha.nightly.137.gd4793c40b8b8", + }, + "devDependencies": { + "nitrogen": "1.0.0-alpha.nightly.137.gd4793c40b8b8", + "typeorm": "1.1.2", + }, + "peerDependencies": { + "better-sqlite3": "^12.11.1", + }, + "optionalPeers": [ + "better-sqlite3", + ], + }, + "packages/nitro-sqlite-core": { + "name": "nitro-sqlite-core", + "version": "11.0.0", + "dependencies": { + "nitro-core": "1.0.0-alpha.nightly.86.g15e19db42041", + }, + }, + "packages/nitro-sqlite-drizzle-core": { + "name": "nitro-sqlite-drizzle-core", + "version": "11.0.0", + }, + "packages/react-native-nitro-sqlite": { + "name": "react-native-nitro-sqlite", + "version": "10.4.0", + "devDependencies": { + "@react-native/jest-preset": "0.88.1", + "@types/better-sqlite3": "^9.6.0", + "better-sqlite3": "^13.0.3", + "expo": "~58.0.26", + "jest": "^30.2.0", + "nitrogen": "1.0.0-alpha.nightly.138.g43e09c161101", + "react": "19.3.1", + "react-native": "0.88.1", + "react-native-builder-bob": "^0.44.1", + "react-native-nitro-modules": "1.0.0-alpha.nightly.138.g43e09c161101", + "typeorm": "1.1.2", + }, + "peerDependencies": { + "better-sqlite3": "^12.11.1 || ^13.0.3", + "expo": ">=55.0.0", + "react": ">=17.0.0", + "react-native": ">=0.88.0", + "react-native-nitro-modules": "1.0.0-alpha.nightly.138.g43e09c161101", + }, + "optionalPeers": [ + "better-sqlite3", + "expo", + "react-native-nitro-modules", + ], + }, }, "packages": { "2g": ["2g@1.0.1", "", { "peerDependencies": { "typescript": ">=5.8.0" }, "optionalPeers": ["typescript"], "bin": { "2g": "bin/cli.js" } }, "sha512-+uViadKOS/wwR4pFu5g8TPn3QHpKqoX19JHCnp8k/3cLpImdcXozwvZA6Q/5PeW3AcU8neL8faaMidBcv7o8CA=="], @@ -704,8 +819,6 @@ "@expo/sudo-prompt": ["@expo/sudo-prompt@9.3.2", "", {}, "sha512-HHQigo3rQWKMDzYDLkubN5WQOYXJJE2eNqIQC2axC2iO3mHdwnIR7FgZVvHWtBwAdzBgAP0ECp8KqS8TiMKvgw=="], - "@expo/ws-tunnel": ["@expo/ws-tunnel@2.0.1", "", { "peerDependencies": { "ws": "^8.0.0" } }, "sha512-mljsRffbOHzmSimYQbQu9h9NR3alwCCwEEouRGFL4QRTt8dNvsNtKEPa/5jHmtDLDtsh4xXsWKwzjN9BTpeXHQ=="], - "@expo/xcpretty": ["@expo/xcpretty@4.4.7", "", { "dependencies": { "@babel/code-frame": "^7.20.0", "chalk": "^4.1.0", "js-yaml": "^4.1.0" }, "bin": { "excpretty": "build/cli.js" } }, "sha512-EbxYllZ7/ozONVZd425cm4XnolfW+AmSFT5aP7Jdno6oc3WrYQcHz2CO20z/2rwWwYgztmV2PXvYH+BQ8YFjqg=="], "@floating-ui/core": ["@floating-ui/core@1.8.0", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="], @@ -1562,7 +1675,7 @@ "before-after-hook": ["before-after-hook@2.2.3", "", {}, "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="], - "better-sqlite3": ["better-sqlite3@13.2.0", "", { "dependencies": { "node-addon-api": "^8.0.0" } }, "sha512-Z8Q/9x/uNyKxA1v4FNodyItRVRw1TeKBrmj32JhxhR0ceNcBY+wMobt/Bv7M7TzwPAXjnZRtNaEsATnUZSKWZQ=="], + "better-sqlite3": ["better-sqlite3@12.11.1", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-dq9AtApgg5PGFtBzPFSBl3HZQjHok5gaQCM6zh2Yk0aSmDCs1CbnVI8/HgASQkNKsWFpseIO9beg5xxpYhbIfA=="], "big-integer": ["big-integer@1.6.52", "", {}, "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg=="], @@ -2670,7 +2783,23 @@ "next-themes": ["next-themes@0.4.6", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="], - "nitro-core": ["nitro-core@1.0.0-alpha.nightly.138.g43e09c161101", "", {}, "sha512-PTOpc4jUIzfsyWUWJgXT+3of9xqbOBCenS6dkhrEmYPvHsZ+VKMK61RO+ph38UKVZLAd/zLij3uh2ZU0g1AtYQ=="], + "nitro-core": ["nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8", "", {}, "sha512-9qahcBuzPx+yhhtL4whV798AQ3XtaI5aFUPGE59dNHIT6UDHxGb2jq1BhVNPIGP8wFKd724nIL8KW5fAmWb/jA=="], + + "nitro-sqlite": ["nitro-sqlite@workspace:packages/nitro-sqlite"], + + "nitro-sqlite-core": ["nitro-sqlite-core@workspace:packages/nitro-sqlite-core"], + + "nitro-sqlite-drizzle": ["nitro-sqlite-drizzle@workspace:packages/integrations/nitro-ui/drizzle"], + + "nitro-sqlite-drizzle-core": ["nitro-sqlite-drizzle-core@workspace:packages/nitro-sqlite-drizzle-core"], + + "nitro-sqlite-kysely": ["nitro-sqlite-kysely@workspace:packages/integrations/nitro-ui/kysely"], + + "nitro-sqlite-mikro-orm": ["nitro-sqlite-mikro-orm@workspace:packages/integrations/nitro-ui/mikro-orm"], + + "nitro-sqlite-typeorm": ["nitro-sqlite-typeorm@workspace:packages/integrations/nitro-ui/typeorm"], + + "nitro-sqlite-vec": ["nitro-sqlite-vec@workspace:packages/integrations/nitro-ui/vec"], "nitrogen": ["nitrogen@1.0.0-alpha.nightly.138.g43e09c161101", "", { "dependencies": { "chalk": "^5.3.0", "nitro-core": "1.0.0-alpha.nightly.138.g43e09c161101", "ts-morph": "^28.0.0", "yargs": "^18.1.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "bin/nitrogen.js" } }, "sha512-cFf+u0MQqy7e1uipRBoipkYVHMxN8KaB2LUs/9G0BHQPMZJu7KjVt7t1moPicBtrMPfZPDW/aClpUylYfNDpkA=="], @@ -2876,27 +3005,25 @@ "react-native-harness": ["react-native-harness@1.6.0", "", { "dependencies": { "@react-native-harness/babel-preset": "1.6.0", "@react-native-harness/cli": "1.6.0", "@react-native-harness/jest": "1.6.0", "@react-native-harness/metro": "1.6.0", "@react-native-harness/runtime": "1.6.0", "tslib": "^2.3.0" }, "bin": { "harness": "bin.js", "react-native-harness": "bin.js" } }, "sha512-cDQb7FPur0PKu5EAHZd6bJh28/0H7NuPilSjrIIjJ8JzijZgkepmczvpZi6HPPaGKS0FCFAFT5hp1O7zcbglYw=="], - "react-native-macos-local": ["react-native-macos@0.81.9", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native-macos/virtualized-lists": "0.81.9", "@react-native/assets-registry": "0.81.6", "@react-native/codegen": "0.81.6", "@react-native/community-cli-plugin": "0.81.6", "@react-native/gradle-plugin": "0.81.6", "@react-native/js-polyfills": "0.81.6", "@react-native/normalize-colors": "0.81.6", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.29.1", "base64-js": "^1.5.1", "commander": "^12.0.0", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.83.1", "metro-source-map": "^0.83.1", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.5", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.26.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.1.4", "react": "^19.1.4", "react-native": "0.81.6" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js", "react-native-macos": "cli.js" } }, "sha512-MG120BR4dFzH6v4IBhd4TZILTPvf4oUJHEM0y4ZedXUcGJqUYPIvBzLjPZddl/J3TMZzPaF0heLO3wXJoxqDLw=="], - "react-native-nitro-modules": ["react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101", "", { "dependencies": { "nitro-core": "1.0.0-alpha.nightly.138.g43e09c161101" }, "peerDependencies": { "react": "*", "react-native": ">=0.88.0" } }, "sha512-wMBTgHxy6WyzIVnccmXGjbQGTJWbix7kTYAP9BJWy6Cp6Dcdy0A+QWujGL/t6W/0smD1rYyLx1u7PQBJp8UjvA=="], "react-native-nitro-sqlite": ["react-native-nitro-sqlite@workspace:packages/react-native-nitro-sqlite"], - "react-native-nitro-sqlite-drizzle": ["react-native-nitro-sqlite-drizzle@workspace:packages/react-native-nitro-sqlite-drizzle"], + "react-native-nitro-sqlite-drizzle": ["react-native-nitro-sqlite-drizzle@workspace:packages/integrations/react-native/drizzle"], - "react-native-nitro-sqlite-example": ["react-native-nitro-sqlite-example@workspace:example"], + "react-native-nitro-sqlite-example": ["react-native-nitro-sqlite-example@workspace:examples/react-native"], - "react-native-nitro-sqlite-expo-example": ["react-native-nitro-sqlite-expo-example@workspace:example/expo"], + "react-native-nitro-sqlite-expo-example": ["react-native-nitro-sqlite-expo-example@workspace:examples/react-native/expo"], - "react-native-nitro-sqlite-kysely": ["react-native-nitro-sqlite-kysely@workspace:packages/react-native-nitro-sqlite-kysely"], + "react-native-nitro-sqlite-kysely": ["react-native-nitro-sqlite-kysely@workspace:packages/integrations/react-native/kysely"], - "react-native-nitro-sqlite-macos-example": ["react-native-nitro-sqlite-macos-example@workspace:example/macos"], + "react-native-nitro-sqlite-macos-example": ["react-native-nitro-sqlite-macos-example@workspace:examples/react-native/macos"], - "react-native-nitro-sqlite-mikro-orm": ["react-native-nitro-sqlite-mikro-orm@workspace:packages/react-native-nitro-sqlite-mikro-orm"], + "react-native-nitro-sqlite-mikro-orm": ["react-native-nitro-sqlite-mikro-orm@workspace:packages/integrations/react-native/mikro-orm"], - "react-native-nitro-sqlite-typeorm": ["react-native-nitro-sqlite-typeorm@workspace:packages/react-native-nitro-sqlite-typeorm"], + "react-native-nitro-sqlite-typeorm": ["react-native-nitro-sqlite-typeorm@workspace:packages/integrations/react-native/typeorm"], - "react-native-nitro-sqlite-vec": ["react-native-nitro-sqlite-vec@workspace:packages/react-native-nitro-sqlite-vec"], + "react-native-nitro-sqlite-vec": ["react-native-nitro-sqlite-vec@workspace:packages/integrations/react-native/vec"], "react-native-quick-base64": ["react-native-quick-base64@3.0.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-EjUP2U7WqKmlMmoY7XGyHomy8bM0q4+yCDCRg4ZezQ6zedYRwc7yVk4V2O/iSftKaLEzhuW98lpyPMdk1iPHXQ=="], @@ -3474,6 +3601,8 @@ "@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@expo/cli/@expo/ws-tunnel": ["@expo/ws-tunnel@2.0.1", "", { "peerDependencies": { "ws": "^8.0.0" } }, "sha512-mljsRffbOHzmSimYQbQu9h9NR3alwCCwEEouRGFL4QRTt8dNvsNtKEPa/5jHmtDLDtsh4xXsWKwzjN9BTpeXHQ=="], + "@expo/cli/@react-native/dev-middleware": ["@react-native/dev-middleware@0.88.1", "", { "dependencies": { "@isaacs/ttlcache": "^1.4.1", "@react-native/debugger-frontend": "0.88.1", "@react-native/debugger-shell": "0.88.1", "connect": "^3.6.5", "debug": "^4.4.0", "invariant": "^2.2.4", "nullthrows": "^1.1.1", "open": "^8.4.2", "serve-static": "^1.16.2", "ws": "^7.5.10" } }, "sha512-0smOWE3NCdEYUwPiEdiwVXjTdvXcwSejviCM0YZB0Dj6HaQ+uu4hpSrvgERDevr5dvtSaqr8N4TdYZCLXiVgFw=="], "@expo/cli/ora": ["ora@3.4.0", "", { "dependencies": { "chalk": "^2.4.2", "cli-cursor": "^2.1.0", "cli-spinners": "^2.0.0", "log-symbols": "^2.2.0", "strip-ansi": "^5.2.0", "wcwidth": "^1.0.1" } }, "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg=="], @@ -3520,8 +3649,6 @@ "@expo/require-utils/@babel/plugin-transform-modules-commonjs": ["@babel/plugin-transform-modules-commonjs@7.29.7", "", { "dependencies": { "@babel/helper-module-transforms": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ=="], - "@expo/ws-tunnel/ws": ["ws@8.21.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g=="], - "@expo/xcpretty/@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], "@expo/xcpretty/js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="], @@ -4272,8 +4399,18 @@ "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], + "nitro-sqlite/nitrogen": ["nitrogen@1.0.0-alpha.nightly.137.gd4793c40b8b8", "", { "dependencies": { "chalk": "^5.3.0", "nitro-core": "1.0.0-alpha.nightly.137.gd4793c40b8b8", "ts-morph": "^28.0.0", "yargs": "^18.1.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "bin/nitrogen.js" } }, "sha512-U+/MugSAIfM55gzXCFyND9vb2c4FCOWROr/TlYEHE3Bt+55lXmxEFsmK/ohdGL3n7jiDrrWcR2gf7uf55C9eHw=="], + + "nitro-sqlite-core/nitro-core": ["nitro-core@1.0.0-alpha.nightly.86.g15e19db42041", "", {}, "sha512-ClH75zDyCx2frd5CL8yhz35m5aIPveWPDdnOX86OWADGU2tq06vkc5rkVbuaNTnCH6FJLutTXPg7HxEFVZfrJQ=="], + + "nitro-sqlite-drizzle/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "nitro-sqlite-vec/nitrogen": ["nitrogen@1.0.0-alpha.nightly.137.gd4793c40b8b8", "", { "dependencies": { "chalk": "^5.3.0", "nitro-core": "1.0.0-alpha.nightly.137.gd4793c40b8b8", "ts-morph": "^28.0.0", "yargs": "^18.1.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "bin/nitrogen.js" } }, "sha512-U+/MugSAIfM55gzXCFyND9vb2c4FCOWROr/TlYEHE3Bt+55lXmxEFsmK/ohdGL3n7jiDrrWcR2gf7uf55C9eHw=="], + "nitrogen/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], + "nitrogen/nitro-core": ["nitro-core@1.0.0-alpha.nightly.138.g43e09c161101", "", {}, "sha512-PTOpc4jUIzfsyWUWJgXT+3of9xqbOBCenS6dkhrEmYPvHsZ+VKMK61RO+ph38UKVZLAd/zLij3uh2ZU0g1AtYQ=="], + "node-abi/semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], "normalize-package-data/hosted-git-info": ["hosted-git-info@4.1.0", "", { "dependencies": { "lru-cache": "^6.0.0" } }, "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA=="], @@ -4332,31 +4469,9 @@ "react-native-harness/@react-native-harness/cli": ["@react-native-harness/cli@1.6.0", "", { "dependencies": { "@react-native-harness/bridge": "1.6.0", "@react-native-harness/cache": "1.6.0", "@react-native-harness/config": "1.6.0", "@react-native-harness/platforms": "1.6.0", "@react-native-harness/tools": "1.6.0", "jest-cli": "^30.2.0", "tslib": "^2.3.0" } }, "sha512-eo5tM6jD/kV5SAOQ48z74S/QhANRgpf0wtcsK7polUUsK5y7gAkX/RcBiRZ4iZzFnFMinosYlaZOd9Ipn+9l/Q=="], - "react-native-macos-local/@react-native/codegen": ["@react-native/codegen@0.81.6", "", { "dependencies": { "@babel/core": "^7.25.2", "@babel/parser": "^7.25.3", "glob": "^7.1.1", "hermes-parser": "0.29.1", "invariant": "^2.2.4", "nullthrows": "^1.1.1", "yargs": "^17.6.2" } }, "sha512-9KoYRep/KDnELLLmIYTtIIEOClVUJ88pxWObb/0sjkacA7uL4SgfbAg7rWLURAQJWI85L1YS67IhdEqNNk1I7w=="], - - "react-native-macos-local/@react-native/gradle-plugin": ["@react-native/gradle-plugin@0.81.6", "", {}, "sha512-atUItC5MZ6yaNaI0sbsoDwUdF+KMNZcMKBIrNhXlUyIj3x1AQ6Cf8CHHv6Qokn8ZFw+uU6GWmQSiOWYUbmi8Ag=="], - - "react-native-macos-local/@react-native/js-polyfills": ["@react-native/js-polyfills@0.81.6", "", {}, "sha512-P5MWH/9vM24XkJ1TasCq42DMLoCUjZVSppTn6VWv/cI65NDjuYEy7bUSaXbYxGTnqiKyPG5Y+ADymqlIkdSAcw=="], - - "react-native-macos-local/@react-native/normalize-colors": ["@react-native/normalize-colors@0.81.6", "", {}, "sha512-/OCgUysHIFhfmZxbJAydVc58l2SGIZbWpbQXBrYEYch8YElBbDFQ8IUtyogB7YJJQ8ewHZFj93rQGaECgkvvcw=="], + "react-native-nitro-modules/nitro-core": ["nitro-core@1.0.0-alpha.nightly.138.g43e09c161101", "", {}, "sha512-PTOpc4jUIzfsyWUWJgXT+3of9xqbOBCenS6dkhrEmYPvHsZ+VKMK61RO+ph38UKVZLAd/zLij3uh2ZU0g1AtYQ=="], - "react-native-macos-local/babel-plugin-syntax-hermes-parser": ["babel-plugin-syntax-hermes-parser@0.29.1", "", { "dependencies": { "hermes-parser": "0.29.1" } }, "sha512-2WFYnoWGdmih1I1J5eIqxATOeycOqRwYxAQBu3cUu/rhwInwHUg7k60AFNbuGjSDL8tje5GDrAnxzRLcu2pYcA=="], - - "react-native-macos-local/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], - - "react-native-macos-local/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], - - "react-native-macos-local/metro-runtime": ["metro-runtime@0.83.8", "", { "dependencies": { "@babel/runtime": "^7.25.0", "flow-enums-runtime": "^0.0.6" } }, "sha512-f7FfeM0pamq8vrvs8aO9KvIUabbUKe0WkHFpLt6Q9yIIIsORqNFwlgJeHGraOFPU7Cxqj5yLXkJu5bT1uwDXvw=="], - - "react-native-macos-local/metro-source-map": ["metro-source-map@0.83.8", "", { "dependencies": { "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", "metro-symbolicate": "0.83.8", "nullthrows": "^1.1.1", "ob1": "0.83.8", "source-map": "^0.5.6", "vlq": "^1.0.0" } }, "sha512-60Uor7bM+KsVewLkLCcZfkPFCbqjPDdoSmeBuT3+ye+ac80BuLWbbR8DpyxWpUqQeZPdaAT5ZqFgDIs8BNEcVA=="], - - "react-native-macos-local/scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="], - - "react-native-macos-local/semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], - - "react-native-macos-local/ws": ["ws@6.2.3", "", { "dependencies": { "async-limiter": "~1.0.0" } }, "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA=="], - - "react-native-macos-local/yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="], + "react-native-nitro-sqlite/better-sqlite3": ["better-sqlite3@13.2.0", "", { "dependencies": { "node-addon-api": "^8.0.0" } }, "sha512-Z8Q/9x/uNyKxA1v4FNodyItRVRw1TeKBrmj32JhxhR0ceNcBY+wMobt/Bv7M7TzwPAXjnZRtNaEsATnUZSKWZQ=="], "react-native-nitro-sqlite-drizzle/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], @@ -4366,8 +4481,6 @@ "react-native-nitro-sqlite-example/@types/node": ["@types/node@22.19.0", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-xpr/lmLPQEj+TUnHmR+Ab91/glhJvsqcjB+yY0Ix9GO70H6Lb4FHH5GeqdOE5btAx7eIMwuHkp4H2MSkLcqWbA=="], - "react-native-nitro-sqlite-macos-example/@babel/plugin-transform-class-static-block": ["@babel/plugin-transform-class-static-block@7.28.3", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.3", "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.12.0" } }, "sha512-LtPXlBbRoc4Njl/oh1CeD/3jC+atytbnf/UqLoqTDcEYGUPj022+rvfkbDYieUrSj3CaV4yHDByPE+T2HwfsJg=="], - "react-native-nitro-sqlite-macos-example/@react-native-community/cli": ["@react-native-community/cli@19.1.2", "", { "dependencies": { "@react-native-community/cli-clean": "19.1.2", "@react-native-community/cli-config": "19.1.2", "@react-native-community/cli-doctor": "19.1.2", "@react-native-community/cli-server-api": "19.1.2", "@react-native-community/cli-tools": "19.1.2", "@react-native-community/cli-types": "19.1.2", "chalk": "^4.1.2", "commander": "^9.4.1", "deepmerge": "^4.3.0", "execa": "^5.0.0", "find-up": "^5.0.0", "fs-extra": "^8.1.0", "graceful-fs": "^4.1.3", "prompts": "^2.4.2", "semver": "^7.5.2" }, "bin": { "rnc-cli": "build/bin.js" } }, "sha512-b28TLqODMgQRx6f4gbHoHYpnKyFbWzJkIk3+Ggpad/at493KfGQ+WvKg1sts/st8mxzmbk0T6lCc/9A3QoFKkQ=="], "react-native-nitro-sqlite-macos-example/@react-native-community/cli-platform-android": ["@react-native-community/cli-platform-android@19.1.2", "", { "dependencies": { "@react-native-community/cli-config-android": "19.1.2", "@react-native-community/cli-tools": "19.1.2", "chalk": "^4.1.2", "execa": "^5.0.0", "logkitty": "^0.7.1" } }, "sha512-eMryTlSSTl3JK/tZTaMaMgHec9qu+eQj+3A15qmBdj2ac3p/hiauwAe4q35rz5XABw1cJCuyn+s469YsdTllaw=="], @@ -4386,6 +4499,8 @@ "react-native-nitro-sqlite-macos-example/react-native": ["react-native@0.81.6", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native/assets-registry": "0.81.6", "@react-native/codegen": "0.81.6", "@react-native/community-cli-plugin": "0.81.6", "@react-native/gradle-plugin": "0.81.6", "@react-native/js-polyfills": "0.81.6", "@react-native/normalize-colors": "0.81.6", "@react-native/virtualized-lists": "0.81.6", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.29.1", "base64-js": "^1.5.1", "commander": "^12.0.0", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.83.1", "metro-source-map": "^0.83.1", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.5", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.26.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.1.4", "react": "^19.1.4" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js" } }, "sha512-X/tI8GqfzVaa+zfbE4+lySNN5UzwBIAVRHVZPKymOny9Acc5GYYcjAcEVfG3AM4h920YALWoSl8favnDmQEWIg=="], + "react-native-nitro-sqlite-macos-example/react-native-macos-local": ["react-native-macos@0.81.9", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native-macos/virtualized-lists": "0.81.9", "@react-native/assets-registry": "0.81.6", "@react-native/codegen": "0.81.6", "@react-native/community-cli-plugin": "0.81.6", "@react-native/gradle-plugin": "0.81.6", "@react-native/js-polyfills": "0.81.6", "@react-native/normalize-colors": "0.81.6", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.29.1", "base64-js": "^1.5.1", "commander": "^12.0.0", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.83.1", "metro-source-map": "^0.83.1", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.5", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.26.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.1.4", "react": "^19.1.4", "react-native": "0.81.6" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js", "react-native-macos": "cli.js" } }, "sha512-MG120BR4dFzH6v4IBhd4TZILTPvf4oUJHEM0y4ZedXUcGJqUYPIvBzLjPZddl/J3TMZzPaF0heLO3wXJoxqDLw=="], + "react-native-nitro-sqlite-macos-example/react-native-nitro-modules": ["react-native-nitro-modules@0.37.2", "", { "dependencies": { "nitro-core": "0.37.2" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Odnrq/p6/q0R01qZlkqeXu9VHHMuGEnZZmyxMvehEu6QiACNHhBCmAHgyBDqOSo9Lb3G0TscFAT+HG0uxsR/GA=="], "react-native-nitro-sqlite-vec/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], @@ -4462,8 +4577,6 @@ "typedoc/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], - "typeorm/better-sqlite3": ["better-sqlite3@12.11.1", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-dq9AtApgg5PGFtBzPFSBl3HZQjHok5gaQCM6zh2Yk0aSmDCs1CbnVI8/HgASQkNKsWFpseIO9beg5xxpYhbIfA=="], - "typescript-eslint/@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.46.3", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.46.3", "@typescript-eslint/type-utils": "8.46.3", "@typescript-eslint/utils": "8.46.3", "@typescript-eslint/visitor-keys": "8.46.3", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.46.3", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-sbaQ27XBUopBkRiuY/P9sWGOWUW4rl8fDoHIUmLpZd8uldsTyB4/Zg6bWTegPoTLnKj9Hqgn3QD6cjPNB32Odw=="], "typescript-eslint/@typescript-eslint/parser": ["@typescript-eslint/parser@8.46.3", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.46.3", "@typescript-eslint/types": "8.46.3", "@typescript-eslint/typescript-estree": "8.46.3", "@typescript-eslint/visitor-keys": "8.46.3", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-6m1I5RmHBGTnUGS113G04DMu3CpSdxCAU/UvtjNWL4Nuf3MW9tQhiJqRlHzChIkhy6kZSAQmc+I1bcGjE3yNKg=="], @@ -5482,6 +5595,10 @@ "mocha/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "nitro-sqlite-vec/nitrogen/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], + + "nitro-sqlite/nitrogen/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], + "normalize-package-data/hosted-git-info/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], "noxcturnal/@babel/code-frame/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], @@ -5664,26 +5781,6 @@ "react-native-harness/@react-native-harness/cli/@react-native-harness/tools": ["@react-native-harness/tools@1.6.0", "", { "dependencies": { "@clack/prompts": "1.0.0-alpha.9", "memfs": "^4.64.0", "nano-spawn": "^1.0.2", "picocolors": "^1.1.1", "tslib": "^2.3.0" }, "peerDependencies": { "react-native": "*" } }, "sha512-f54pvgJYnrc3RgamOGbjiAXiCg/w8537zqwJs404Lqyl6sObofroPiawNv7MQMHjIBT9YBT+Xqm+22/fRi09HQ=="], - "react-native-macos-local/@react-native/codegen/@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], - - "react-native-macos-local/@react-native/codegen/hermes-parser": ["hermes-parser@0.29.1", "", { "dependencies": { "hermes-estree": "0.29.1" } }, "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA=="], - - "react-native-macos-local/babel-plugin-syntax-hermes-parser/hermes-parser": ["hermes-parser@0.29.1", "", { "dependencies": { "hermes-estree": "0.29.1" } }, "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA=="], - - "react-native-macos-local/metro-source-map/@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], - - "react-native-macos-local/metro-source-map/@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], - - "react-native-macos-local/metro-source-map/metro-symbolicate": ["metro-symbolicate@0.83.8", "", { "dependencies": { "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", "metro-source-map": "0.83.8", "nullthrows": "^1.1.1", "source-map": "^0.5.6", "vlq": "^1.0.0" }, "bin": { "metro-symbolicate": "src/index.js" } }, "sha512-ZLrbqOqQ+m+Mpv7zo65XEXkNqVYvgUbY7tIsb9e1zSSmU/4C3D6DjaJvRHqcAdl0mkg8TI/csKooAEa5xcZNwg=="], - - "react-native-macos-local/metro-source-map/ob1": ["ob1@0.83.8", "", { "dependencies": { "flow-enums-runtime": "^0.0.6" } }, "sha512-pk7el+eTOzfSKMAY4QBiiwKzegXn633JQj13y+pW5E5IdS+yV2CfDJ9Hf20K/LKy8nCrP9dAmd7XOk52OJxifA=="], - - "react-native-macos-local/yargs/cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], - - "react-native-macos-local/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], - - "react-native-macos-local/yargs/yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], - "react-native-nitro-sqlite-example/@babel/core/@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], "react-native-nitro-sqlite-example/@babel/core/@babel/generator": ["@babel/generator@7.29.13", "", { "dependencies": { "@babel/parser": "^7.29.13", "@babel/types": "^7.29.11", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-T5FRo+RzVHvGjWOuF1Ljc44b+NXAOazodHkGUHp4I3zCkQ4/sNVJm56h1S278LMR0bY5xBhztGziSbli8zObIw=="], @@ -5918,6 +6015,32 @@ "react-native-nitro-sqlite-macos-example/react-native/yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="], + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/codegen": ["@react-native/codegen@0.81.6", "", { "dependencies": { "@babel/core": "^7.25.2", "@babel/parser": "^7.25.3", "glob": "^7.1.1", "hermes-parser": "0.29.1", "invariant": "^2.2.4", "nullthrows": "^1.1.1", "yargs": "^17.6.2" } }, "sha512-9KoYRep/KDnELLLmIYTtIIEOClVUJ88pxWObb/0sjkacA7uL4SgfbAg7rWLURAQJWI85L1YS67IhdEqNNk1I7w=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/gradle-plugin": ["@react-native/gradle-plugin@0.81.6", "", {}, "sha512-atUItC5MZ6yaNaI0sbsoDwUdF+KMNZcMKBIrNhXlUyIj3x1AQ6Cf8CHHv6Qokn8ZFw+uU6GWmQSiOWYUbmi8Ag=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/js-polyfills": ["@react-native/js-polyfills@0.81.6", "", {}, "sha512-P5MWH/9vM24XkJ1TasCq42DMLoCUjZVSppTn6VWv/cI65NDjuYEy7bUSaXbYxGTnqiKyPG5Y+ADymqlIkdSAcw=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/normalize-colors": ["@react-native/normalize-colors@0.81.6", "", {}, "sha512-/OCgUysHIFhfmZxbJAydVc58l2SGIZbWpbQXBrYEYch8YElBbDFQ8IUtyogB7YJJQ8ewHZFj93rQGaECgkvvcw=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/babel-plugin-syntax-hermes-parser": ["babel-plugin-syntax-hermes-parser@0.29.1", "", { "dependencies": { "hermes-parser": "0.29.1" } }, "sha512-2WFYnoWGdmih1I1J5eIqxATOeycOqRwYxAQBu3cUu/rhwInwHUg7k60AFNbuGjSDL8tje5GDrAnxzRLcu2pYcA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-runtime": ["metro-runtime@0.83.8", "", { "dependencies": { "@babel/runtime": "^7.25.0", "flow-enums-runtime": "^0.0.6" } }, "sha512-f7FfeM0pamq8vrvs8aO9KvIUabbUKe0WkHFpLt6Q9yIIIsORqNFwlgJeHGraOFPU7Cxqj5yLXkJu5bT1uwDXvw=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map": ["metro-source-map@0.83.8", "", { "dependencies": { "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", "metro-symbolicate": "0.83.8", "nullthrows": "^1.1.1", "ob1": "0.83.8", "source-map": "^0.5.6", "vlq": "^1.0.0" } }, "sha512-60Uor7bM+KsVewLkLCcZfkPFCbqjPDdoSmeBuT3+ye+ac80BuLWbbR8DpyxWpUqQeZPdaAT5ZqFgDIs8BNEcVA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/ws": ["ws@6.2.3", "", { "dependencies": { "async-limiter": "~1.0.0" } }, "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="], + "react-native-nitro-sqlite-macos-example/react-native-nitro-modules/nitro-core": ["nitro-core@0.37.2", "", {}, "sha512-dhagikz9VXXzfidRH/vPNJfYWPmTBArDOo9wE/wEqeERU9C8uRWz9YccOyNUOvADccPAZq319yzhDMoJ9excSQ=="], "react-native/@react-native/community-cli-plugin/@react-native/dev-middleware": ["@react-native/dev-middleware@0.88.1", "", { "dependencies": { "@isaacs/ttlcache": "^1.4.1", "@react-native/debugger-frontend": "0.88.1", "@react-native/debugger-shell": "0.88.1", "connect": "^3.6.5", "debug": "^4.4.0", "invariant": "^2.2.4", "nullthrows": "^1.1.1", "open": "^8.4.2", "serve-static": "^1.16.2", "ws": "^7.5.10" } }, "sha512-0smOWE3NCdEYUwPiEdiwVXjTdvXcwSejviCM0YZB0Dj6HaQ+uu4hpSrvgERDevr5dvtSaqr8N4TdYZCLXiVgFw=="], @@ -6810,20 +6933,6 @@ "react-native-harness/@react-native-harness/cli/@react-native-harness/config/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], - "react-native-macos-local/@react-native/codegen/@babel/parser/@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], - - "react-native-macos-local/@react-native/codegen/hermes-parser/hermes-estree": ["hermes-estree@0.29.1", "", {}, "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ=="], - - "react-native-macos-local/babel-plugin-syntax-hermes-parser/hermes-parser/hermes-estree": ["hermes-estree@0.29.1", "", {}, "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ=="], - - "react-native-macos-local/metro-source-map/@babel/traverse/@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], - - "react-native-macos-local/metro-source-map/@babel/traverse/@babel/generator": ["@babel/generator@7.29.1", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="], - - "react-native-macos-local/metro-source-map/@babel/traverse/@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], - - "react-native-macos-local/metro-source-map/@babel/traverse/@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], - "react-native-nitro-sqlite-example/@babel/core/@babel/code-frame/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], "react-native-nitro-sqlite-example/@babel/core/@babel/helper-compilation-targets/@babel/compat-data": ["@babel/compat-data@7.29.7", "", {}, "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg=="], @@ -6968,6 +7077,26 @@ "react-native-nitro-sqlite-macos-example/mocha/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/codegen/@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/codegen/hermes-parser": ["hermes-parser@0.29.1", "", { "dependencies": { "hermes-estree": "0.29.1" } }, "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/babel-plugin-syntax-hermes-parser/hermes-parser": ["hermes-parser@0.29.1", "", { "dependencies": { "hermes-estree": "0.29.1" } }, "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/metro-symbolicate": ["metro-symbolicate@0.83.8", "", { "dependencies": { "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", "metro-source-map": "0.83.8", "nullthrows": "^1.1.1", "source-map": "^0.5.6", "vlq": "^1.0.0" }, "bin": { "metro-symbolicate": "src/index.js" } }, "sha512-ZLrbqOqQ+m+Mpv7zo65XEXkNqVYvgUbY7tIsb9e1zSSmU/4C3D6DjaJvRHqcAdl0mkg8TI/csKooAEa5xcZNwg=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/ob1": ["ob1@0.83.8", "", { "dependencies": { "flow-enums-runtime": "^0.0.6" } }, "sha512-pk7el+eTOzfSKMAY4QBiiwKzegXn633JQj13y+pW5E5IdS+yV2CfDJ9Hf20K/LKy8nCrP9dAmd7XOk52OJxifA=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/yargs/cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/yargs/yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], + "react-native-nitro-sqlite-macos-example/react-native/@react-native/codegen/@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], "react-native-nitro-sqlite-macos-example/react-native/@react-native/codegen/hermes-parser": ["hermes-parser@0.29.1", "", { "dependencies": { "hermes-estree": "0.29.1" } }, "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA=="], @@ -8242,6 +8371,20 @@ "react-native-nitro-sqlite-macos-example/mocha/chokidar/readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/codegen/@babel/parser/@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/@react-native/codegen/hermes-parser/hermes-estree": ["hermes-estree@0.29.1", "", {}, "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/babel-plugin-syntax-hermes-parser/hermes-parser/hermes-estree": ["hermes-estree@0.29.1", "", {}, "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/traverse/@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/traverse/@babel/generator": ["@babel/generator@7.29.1", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/traverse/@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], + + "react-native-nitro-sqlite-macos-example/react-native-macos-local/metro-source-map/@babel/traverse/@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], + "react-native-nitro-sqlite-macos-example/react-native/@react-native/codegen/@babel/parser/@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], "react-native-nitro-sqlite-macos-example/react-native/@react-native/codegen/hermes-parser/hermes-estree": ["hermes-estree@0.29.1", "", {}, "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ=="], diff --git a/docs/README.md b/docs/README.md index 0f7e6b371..8ac7e767f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,9 +20,11 @@ bun docs build Documentation pages are in `content/docs/`. Each `.mdx` page has `title` and `description` frontmatter. The `meta.json` files set section names and navigation order. Add or move a page in both its directory and the corresponding `meta.json`. The landing page and search route live in `src/app/`; shared site data lives in `src/lib/`. +The documentation describes one SQLite library with separate React Native and NitroUI adapters. Start with [Supported platforms](content/docs/supported-platforms.mdx), then use the [React Native guide](content/docs/react-native/index.mdx) or [NitroUI guide](content/docs/nitro-ui/index.mdx). The NitroUI guide uses the example's pinned SDK packages and a local adapter package that requires repository access. It does not assume an adapter release on npm. + ## API reference -The site generates the `/api` reference from the public entry points listed in [typedoc.json](typedoc.json), including the ORM drivers and Kysely dialect. The generated MDX pages in `content/api/` are ignored by Git. Development, type checking, and production builds regenerate them and check public exports, key members, and internal links. +The site generates the `/api` reference from the public entry points listed in [typedoc.json](typedoc.json), with shared configuration in [typedoc.config.mjs](typedoc.config.mjs), including the ORM drivers and Kysely dialect. The generated MDX pages in `content/api/` are ignored by Git. Development, type checking, and production builds regenerate them and check public exports, key members, and internal links. The [native access guide](content/docs/guides/sync-and-async.mdx) explains the raw Nitro interface and results. The [TypeORM guide](content/docs/integrations/orms/typeorm.mdx) describes the connection returned by `typeORMDriver.openDatabase`. Both guides link to generated reference pages for the relevant exported types. diff --git a/docs/api-package-intros.mjs b/docs/api-package-intros.mjs index ec8735bdc..19af2584e 100644 --- a/docs/api-package-intros.mjs +++ b/docs/api-package-intros.mjs @@ -1,7 +1,7 @@ const packageIntros = { - 'react-native-nitro-sqlite': `\`open({ name })\` returns a connection with query, transaction, and cleanup methods. This reference lists the package's exported functions, objects, and types. + 'react-native-nitro-sqlite': `\`open({ name })\` returns a connection with query, transaction, and cleanup methods. This reference is generated from the React Native package. It documents the shared SQLite API, along with React Native's native interfaces and integration helpers. The NitroUI adapter has its own runtime bindings and setup requirements. -Start with [Getting Started](/docs) for installation and a first query. Use [Configuration](/docs/configuration) for shared \`package.json\` settings, [database lifecycle](/docs/guides/database-lifecycle) for opening and closing connections, and [parameters and results](/docs/guides/parameters-and-results) for queries and errors. For the Node-only test export, see [Test SQLite in Node](/docs/guides/node-test-mock). +Start with [Supported platforms](/docs/supported-platforms), then follow the [React Native guide](/docs/react-native) or [NitroUI guide](/docs/nitro-ui). Use [Configuration](/docs/configuration) for React Native's \`package.json\` settings, [database lifecycle](/docs/guides/database-lifecycle) for opening and closing connections, and [parameters and results](/docs/guides/parameters-and-results) for queries and errors. For the Node-only test export, see [Test SQLite in Node](/docs/guides/node-test-mock). `, 'react-native-nitro-sqlite/mock': `Import \`react-native-nitro-sqlite/mock\` to run SQLite tests through \`better-sqlite3\` without loading the React Native module. See [Test SQLite in Node](/docs/guides/node-test-mock) for installation, Jest setup, shared connections, prepared statements, transactions, and cleanup. `, @@ -9,12 +9,21 @@ Start with [Getting Started](/docs) for installation and a first query. Use [Con Follow the [Expo configuration guide](/docs/configuration/expo) for app config examples and rebuild requirements. The types below describe the plugin options. Import them from \`react-native-nitro-sqlite/plugin\` to type an \`app.config.ts\`. `, - 'react-native-nitro-sqlite-vec': `\`createVectorTable()\` creates a vector table, \`knnSearch()\` finds nearby matches, and \`isVecAvailable()\` checks extension availability on an open connection. This optional package adds [sqlite-vec](https://github.com/asg017/sqlite-vec) to Nitro SQLite. + 'react-native-nitro-sqlite-vec': `\`createVectorTable()\` creates a vector table, \`knnSearch()\` finds nearby matches, and \`isVecAvailable()\` checks extension availability on an open connection. This optional React Native package adds [sqlite-vec](https://github.com/asg017/sqlite-vec) to Nitro SQLite. It is not a NitroUI adapter. Follow the [vector search guide](/docs/integrations/vector-search) for installation, platform setup, and a complete example. The functions and types below describe the helper API. `, } +for (const host of ['react-native-nitro-sqlite', 'nitro-sqlite']) { + packageIntros[`${host}-kysely`] = + `Create a Kysely SQLite dialect with \`createNitroSQLiteDialect()\`. Each Kysely instance opens an independent handle on first use and owns it until \`destroy()\`. Follow the [Kysely guide](/docs/integrations/orms/kysely) for installation, transactions, parameters, and migrations.\n` + packageIntros[`${host}-mikro-orm`] = + `Use \`NitroSQLiteDriver\` with explicit MikroORM entities and a database file name. Follow the [MikroORM guide](/docs/integrations/orms/mikro-orm) for installation, host bundler setup, transactions, and SQL dumps.\n` + packageIntros[`${host}-typeorm`] = + `Pass \`typeORMDriver\` to a TypeORM DataSource with \`type: 'react-native'\`. That string selects TypeORM's callback contract in either host. This companion replaces the deprecated driver import from the SQLite package root. Follow the [TypeORM guide](/docs/integrations/orms/typeorm) for installation and host setup.\n` +} + export function addPackageIntro(packageName, contents) { const intro = packageIntros[packageName] if (!intro) return contents diff --git a/docs/content/docs/concepts/databases-and-connections.mdx b/docs/content/docs/concepts/databases-and-connections.mdx index b4b4c8724..ada2f5f97 100644 --- a/docs/content/docs/concepts/databases-and-connections.mdx +++ b/docs/content/docs/concepts/databases-and-connections.mdx @@ -5,6 +5,8 @@ description: SQLite database files, open connections, and persistent data. SQLite is an embedded database engine. It runs inside an application and reads and writes local files without a separate database server. A database contains tables, indexes, and other schema objects. See [SQLite's overview](https://www.sqlite.org/about.html). +Nitro SQLite includes SQLite and the native bindings that connect it to JavaScript. React Native apps use `react-native-nitro-sqlite`; NitroUI apps use `nitro-sqlite`. Both packages use the same connection, query, transaction, and prepared-statement APIs. See [supported platforms](/docs/supported-platforms) for the host and operating system requirements. + ## Connections diff --git a/docs/content/docs/configuration/android.mdx b/docs/content/docs/configuration/android.mdx index 1dbbed379..52a7c6e07 100644 --- a/docs/content/docs/configuration/android.mdx +++ b/docs/content/docs/configuration/android.mdx @@ -6,15 +6,21 @@ description: Database storage, batch atomic writes, and Gradle overrides. -See [Configuration](/docs/configuration) for shared `package.json` settings. +The database directory applies to both React Native and NitroUI. The Gradle options below belong to `react-native-nitro-sqlite`. For NitroUI's native build, see [Configuration](/docs/configuration#nitro-ui-build-settings) and [supported platforms](/docs/supported-platforms). ## Database location By default, Nitro SQLite opens databases in the app's internal `filesDir`, including existing databases after an app upgrade. When SQLite stores temporary tables on disk, it uses the app's cache directory. See [file locations](/docs/guides/database-lifecycle#file-location-and-prepopulated-databases) for the `location` option and prepopulated databases. +## Manual initialization + +React Native autolinking initializes the native library. Existing manual calls to `com.margelo.nitro.rnnitrosqlite.RNNitroSQLiteOnLoad.initializeNative()` remain supported and forward to the same initializer. Repeated calls are safe. + +NitroUI uses the activity initializer declared by `nitro-sqlite`. It records the application context before JavaScript starts. A custom runtime host must call `com.margelo.nitro.nitrosqlite.SQLiteModule.initialize(applicationContext)` before importing the package. Repeated calls are safe; the initializer retains only the application context. + ## Commit I/O -To disable batch atomic writes, set this in your app's `package.json`: +In React Native apps, disable batch atomic writes with this setting in `package.json`: ```json { @@ -28,7 +34,7 @@ To disable batch atomic writes, set this in your app's `package.json`: ## SQLite compile flags -Use `nitroSqliteFlags` in `android/gradle.properties` for additional SQLite features or to override individual build defaults. For example, to enable FTS5: +For React Native, use `nitroSqliteFlags` in `android/gradle.properties` for additional SQLite features or to override individual build defaults. For example, to enable FTS5: ```properties nitroSqliteFlags="-DSQLITE_ENABLE_FTS5=1" @@ -40,7 +46,7 @@ Android flushes data with `fdatasync()`. To use `fsync()`, add `-DHAVE_FDATASYNC ## Vector search -Install `react-native-nitro-sqlite-vec` and add this to `android/gradle.properties`: +For React Native, install `react-native-nitro-sqlite-vec` and add this to `android/gradle.properties`: ```properties nitroSqliteVec=true diff --git a/docs/content/docs/configuration/expo.mdx b/docs/content/docs/configuration/expo.mdx index 0f85b391d..01886b2ea 100644 --- a/docs/content/docs/configuration/expo.mdx +++ b/docs/content/docs/configuration/expo.mdx @@ -48,10 +48,7 @@ npx expo install react-native-nitro-sqlite-vec@nitro-v1 ```json { "expo": { - "plugins": [ - "react-native-nitro-sqlite", - "react-native-nitro-sqlite-vec" - ] + "plugins": ["react-native-nitro-sqlite", "react-native-nitro-sqlite-vec"] } } ``` @@ -128,6 +125,6 @@ EAS Build runs these plugins when it generates native directories. If you commit Manual configuration remains supported. The plugin merges additional flags and preserves unrelated properties and entitlements. When a manual value conflicts with a requested option, remove the conflicting value or make it match. Build environment switches such as `NITRO_SQLITE_VEC=1` and `NITRO_SQLITE_USE_PHONE_VERSION=1` must agree with the plugin settings. See [iOS configuration](/docs/configuration/ios) and [Android configuration](/docs/configuration/android) for manual setup. -The repository's [Expo example](https://github.com/margelo/react-native-nitro-sqlite/tree/main/example/expo) uses both plugins and checks FTS5, an extra compile definition, and sqlite-vec at runtime. +The repository's [Expo example](https://github.com/margelo/react-native-nitro-sqlite/tree/main/examples/react-native/expo) uses both plugins and checks FTS5, an extra compile definition, and sqlite-vec at runtime. After rebuilding with FTS5 enabled, `SELECT sqlite_compileoption_used('ENABLE_FTS5')` should return `1`, and `CREATE VIRTUAL TABLE notes_search USING fts5(body)` should succeed. diff --git a/docs/content/docs/configuration/index.mdx b/docs/content/docs/configuration/index.mdx index 0673e1ec7..f65546c76 100644 --- a/docs/content/docs/configuration/index.mdx +++ b/docs/content/docs/configuration/index.mdx @@ -1,9 +1,13 @@ --- title: Configuration -description: Shared SQLite settings in package.json. +description: SQLite build settings for React Native and NitroUI. --- -Add the options you want to change to your app's `package.json`. These are the defaults for bundled SQLite: +SQLite compile options determine which features the native library provides. JavaScript updates cannot change those options. See [supported platforms](/docs/supported-platforms) for the hosts and operating systems. + +## React Native build settings + +The `react-native-nitro-sqlite` build reads `nitroSQLite` in your app's `package.json`. These are its defaults for bundled SQLite: ```json { @@ -33,4 +37,10 @@ WAL databases default to `synchronous = NORMAL`, which can lose recent commits a When supplying custom flags, omit `SQLITE_ENABLE_RTREE` to disable it. Defining it as `0` still enables the module. -For platform settings and alternative build flags, see [iOS](/docs/configuration/ios), [Android](/docs/configuration/android), or [macOS](/docs/configuration/macos). +For platform settings and alternative React Native build flags, see [iOS](/docs/configuration/ios), [Android](/docs/configuration/android), or [macOS](/docs/configuration/macos). + +## NitroUI build settings + +`nitro-sqlite` compiles bundled SQLite with thread safety and RTree enabled. Its `Package.swift` and Android `nitro-ui.cmake` define those flags directly. The adapter does not read `nitroSQLite` settings, `nitroSqliteFlags`, or the React Native package's environment overrides. It also does not apply the React Native `performanceMode` defaults described above. + +To change its compile options, customize the adapter's native build files, then run your host's native preparation and rebuild. Keep SQLite thread safety enabled. The [iOS storage settings](/docs/configuration/ios#database-location) and [Android database directory](/docs/configuration/android#database-location) apply to both hosts. diff --git a/docs/content/docs/configuration/ios.mdx b/docs/content/docs/configuration/ios.mdx index a2c80684e..fc767aa91 100644 --- a/docs/content/docs/configuration/ios.mdx +++ b/docs/content/docs/configuration/ios.mdx @@ -5,7 +5,7 @@ description: Database storage, app groups, and Swift Package Manager build optio -See [Configuration](/docs/configuration) for shared `package.json` settings. +The database directory and app group settings apply to both React Native and NitroUI. The Swift Package Manager overrides below belong to `react-native-nitro-sqlite`. See [supported platforms](/docs/supported-platforms) for host requirements. ## Set up Swift Package Manager @@ -26,40 +26,48 @@ React Native 0.88 refuses a plain SwiftPM update while CocoaPods is integrated. Databases use Documents by default. To use `Library/Application Support`, add this to your app's `Info.plist`: ```xml -RNNitroSQLite_DatabaseLocation +NitroSQLite_DatabaseLocation ApplicationSupport ``` Existing databases and their sidecar files move when next opened or attached. Switching back to `Documents` does not move them back. See [file locations](/docs/guides/database-lifecycle#file-location-and-prepopulated-databases) for the `location` option. +`RNNitroSQLite_DatabaseLocation` remains supported when `NitroSQLite_DatabaseLocation` is absent. If both keys exist, `NitroSQLite_DatabaseLocation` wins. Renaming the key without changing its value uses the same directory and does not move databases. + +The selected value must be a string. A non-string value throws an error that names the key, including when the legacy key has a valid value. + ## App groups Enable the App Groups capability for your app and extension, then add the group identifier to `Info.plist`: ```xml -RNNitroSQLite_AppGroup +NitroSQLite_AppGroup group.example.shared ``` The group container takes precedence over the database location setting. An invalid or inaccessible container causes initialization to throw. +`RNNitroSQLite_AppGroup` remains supported when `NitroSQLite_AppGroup` is absent. If both keys exist, `NitroSQLite_AppGroup` wins. Both key names resolve the same group identifier to the same container. + +The selected group identifier must be a string. A non-string value throws an error that names the key. + ## Build settings -Swift Package Manager reads the SQLite build settings when it resolves Nitro SQLite's package, and it caches the result. Changed environment variables are picked up automatically, but changes to [`package.json` settings](/docs/configuration) or Expo’s generated `ios/Podfile.properties.json` require a refresh. After changing them, delete `~/Library/Caches/org.swift.swiftpm/manifests` and rebuild. +For React Native, Swift Package Manager reads the SQLite build settings when it resolves Nitro SQLite's package, and it caches the result. Changed environment variables are picked up automatically, but changes to [`package.json` settings](/docs/configuration) or Expo’s generated `ios/Podfile.properties.json` require a refresh. After changing them, delete `~/Library/Caches/org.swift.swiftpm/manifests` and rebuild. ## Bundled or system SQLite -To use system SQLite instead of the bundled library, set `NITRO_SQLITE_USE_PHONE_VERSION=1` in the environment of the command that builds the app, for example `NITRO_SQLITE_USE_PHONE_VERSION=1 npx react-native run-ios`. Builds started from the Xcode app do not read your shell environment. The shared build settings cannot change system SQLite's capabilities. +To use system SQLite in React Native, set `NITRO_SQLITE_USE_PHONE_VERSION=1` in the environment of the command that builds the app, for example `NITRO_SQLITE_USE_PHONE_VERSION=1 npx react-native run-ios`. Builds started from the Xcode app do not read your shell environment. The shared build settings cannot change system SQLite's capabilities. Apple’s SQLite can enable legacy table renaming. If a migration renames a table referenced by a view or trigger, run `PRAGMA legacy_alter_table = OFF` on that connection before `ALTER TABLE ... RENAME TO`. SQLite will update those references as part of the rename. See [SQLite’s table rename behavior](https://www.sqlite.org/lang_altertable.html#alter_table_rename). ## Thread safety and performance mode -When set in the environment of the command that builds the app, `NITRO_SQLITE_THREADSAFE` and `NITRO_SQLITE_PERFORMANCE_MODE` override the corresponding [`package.json` settings](/docs/configuration). Both accept `true`, `false`, `1`, or `0`. +In React Native builds, `NITRO_SQLITE_THREADSAFE` and `NITRO_SQLITE_PERFORMANCE_MODE` override the corresponding [`package.json` settings](/docs/configuration). Set them in the build command's environment. Both accept `true`, `false`, `1`, or `0`. ## Additional compile flags -Use `iosSqliteFlags` in your app's `package.json` for additional SQLite features or to override individual build defaults. For example, to enable FTS5 full-text search: +For React Native, use `iosSqliteFlags` in your app's `package.json` for additional SQLite features or to override individual build defaults. For example, to enable FTS5 full-text search: ```json { @@ -71,11 +79,13 @@ Use `iosSqliteFlags` in your app's `package.json` for additional SQLite features The value accepts only `-DNAME` and `-DNAME=VALUE` definitions, separated by spaces. Custom definitions take precedence over the defaults from your other `package.json` settings. +NitroUI uses its adapter's own `Package.swift` and does not read these React Native build overrides. See [NitroUI build settings](/docs/configuration#nitro-ui-build-settings). + ## Vector search Use bundled SQLite for vector search. Apple's system SQLite does not support the automatic extension registration that sqlite-vec uses. -Install `react-native-nitro-sqlite-vec`, then refresh the Swift packages from your app directory: +In React Native, install `react-native-nitro-sqlite-vec`, then refresh the Swift packages from your app directory: ```sh npx react-native spm diff --git a/docs/content/docs/configuration/macos.mdx b/docs/content/docs/configuration/macos.mdx index 6f53388b6..c20bf055d 100644 --- a/docs/content/docs/configuration/macos.mdx +++ b/docs/content/docs/configuration/macos.mdx @@ -24,4 +24,4 @@ For vector search, install `react-native-nitro-sqlite-vec@10` and run `NITRO_SQL ## Run the example -Use the [example from the 10.4.0 tag](https://github.com/margelo/react-native-nitro-sqlite/tree/v10.4.0/example/macos). It requires macOS 14 or later. Install its workspace and Ruby dependencies, then run the `pods:macos` and `macos` scripts. To run Metro separately, use the `start` script and pass `--no-packager` to `macos`. For a release build, pass `--mode Release --no-packager`. +Use the [example from the 10.4.0 tag](https://github.com/margelo/react-native-nitro-sqlite/tree/v10.4.0/examples/react-native/macos). It requires macOS 14 or later. Install its workspace and Ruby dependencies, then run the `pods:macos` and `macos` scripts. To run Metro separately, use the `start` script and pass `--no-packager` to `macos`. For a release build, pass `--mode Release --no-packager`. diff --git a/docs/content/docs/guides/ai-agents.mdx b/docs/content/docs/guides/ai-agents.mdx index 54933ebcd..c90a9a95e 100644 --- a/docs/content/docs/guides/ai-agents.mdx +++ b/docs/content/docs/guides/ai-agents.mdx @@ -7,6 +7,8 @@ Give your coding agent the [NitroSQLite skill](https://github.com/margelo/react- To install it for your agents, run `npx skills add margelo/react-native-skills --skill react-native-nitro-sqlite`. Check the [API reference](/docs/api) against your installed package version when an example or generated call differs from the package types. +For NitroUI native setup, use the [NitroUI installation guide](/docs/nitro-ui). + When reviewing generated code, check that it: - Opens a connection with `open({ name })` and uses that connection for queries. diff --git a/docs/content/docs/guides/attach-databases.mdx b/docs/content/docs/guides/attach-databases.mdx index 841103ed2..9592ac8b3 100644 --- a/docs/content/docs/guides/attach-databases.mdx +++ b/docs/content/docs/guides/attach-databases.mdx @@ -5,6 +5,8 @@ description: Query another database file through a named SQLite schema. Use `db.attach()` to query another database file through an existing connection. Its alias becomes a SQLite schema name, which distinguishes its tables from those in the main database. Use it when one query needs data from both files. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ## Attach and query a database In NitroSQLite, call `attach()` on an open connection. The alias becomes the SQLite schema name. Use the same platform root and relative `location` convention as `open()`. diff --git a/docs/content/docs/guides/batch-operations.mdx b/docs/content/docs/guides/batch-operations.mdx index cc1bebba6..6c7ab65da 100644 --- a/docs/content/docs/guides/batch-operations.mdx +++ b/docs/content/docs/guides/batch-operations.mdx @@ -5,6 +5,8 @@ description: Execute a fixed list of statements in one native transaction. Use `db.executeBatch()` or `db.executeBatchAsync()` to run a fixed list of statements together. A transaction commits the whole list or rolls it back if a command fails. A batch also avoids a separate JavaScript call for each write. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ## Run a batch Pass a nonempty list of commands. Each batch uses an exclusive transaction. A failure throws or rejects, and the result of a successful batch contains the sum of `rowsAffected`; it does not include SELECT rows. diff --git a/docs/content/docs/guides/database-lifecycle.mdx b/docs/content/docs/guides/database-lifecycle.mdx index 837ee6c4f..75b4a93c9 100644 --- a/docs/content/docs/guides/database-lifecycle.mdx +++ b/docs/content/docs/guides/database-lifecycle.mdx @@ -5,6 +5,8 @@ description: Open, close, delete, and place database files in an app directory. Use `open({ name })` to open an existing database or create a new one. Keep the returned connection for queries, then call `close()` when done. See [databases and connections](/docs/concepts/databases-and-connections) for the difference between the file and its open handles. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ## Open and close a connection Keep the returned connection while you need to query the database. Only one default connection can be open for a database name at a time. Close it before opening another default connection, or use `connection: 'independent'` for a separate connection to the same file. See [multiple connections](/docs/guides/multiple-connections). @@ -33,7 +35,7 @@ temporary.delete() Both methods are synchronous. They fail if an operation on that connection is queued or running. Await outstanding promises first, and [finalize prepared statements](/docs/guides/prepared-statements#connection-ordering-and-cleanup) before closing. `delete()` also fails if the named file does not exist. -On iOS, when a database is being moved from Documents to Application Support, deletion also cleans up copies and SQLite sidecar files from both locations. +On iOS in either host, when a database is being moved from Documents to Application Support, deletion also cleans up copies and SQLite sidecar files from both locations. ## File location and prepopulated databases @@ -47,7 +49,7 @@ Only pass database names and locations you control. The library does not validat To open a prepopulated database, copy the SQLite file into the intended app directory before calling `open()`. Use the same `name` and `location` when you open it. A missing file creates a new, empty database, so verify the copy if your schema must already exist. See [file lifetimes](/docs/concepts/databases-and-connections#file-lifetimes) for WAL companion files. -The platform pages describe the database roots and storage settings for [iOS](/docs/configuration/ios#database-location), [Android](/docs/configuration/android#database-location), and [macOS](/docs/configuration/macos). The generated [`Connection` reference](/api/react-native-nitro-sqlite/interfaces/Connection) lists the lifecycle methods. +The platform pages describe storage settings for [iOS](/docs/configuration/ios#database-location) and [Android](/docs/configuration/android#database-location) in both hosts, and [macOS](/docs/configuration/macos) in React Native. See [supported platforms](/docs/supported-platforms) for the host and operating system combinations. The generated [`Connection` reference](/api/react-native-nitro-sqlite/interfaces/Connection) lists the lifecycle methods. ## Runtime teardown diff --git a/docs/content/docs/guides/encryption.mdx b/docs/content/docs/guides/encryption.mdx index 8583d7a4a..cb68bf040 100644 --- a/docs/content/docs/guides/encryption.mdx +++ b/docs/content/docs/guides/encryption.mdx @@ -5,9 +5,15 @@ description: Build Nitro SQLite with licensed SQLite SEE and open a database wit Pass `encryptionKey` to `open()` to use an encrypted database. This requires a native build with the licensed [SQLite Encryption Extension](https://sqlite.org/see), or SEE. Nitro SQLite does not include SEE; ordinary SQLite files remain readable without a key. You need licensed source matching the bundled SQLite version, a native rebuild, and a way to store and retrieve the key outside your app source. A JavaScript-only update cannot enable encryption in an existing app binary. -## Build with SEE +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). -1. In your installed `react-native-nitro-sqlite` package, replace `cpp/sqlite/sqlite3.c` with your licensed SEE amalgamation and `cpp/sqlite/sqlite3.h` with its matching header. Compare `SQLITE_VERSION` in the headers before replacing them. Reapply the replacement after dependency installation; an install can restore the package's ordinary SQLite files. Follow your SEE license when handling the source. + + +## Replace the SQLite source + +These source changes apply to either host package. + +1. In your installed `react-native-nitro-sqlite` or `nitro-sqlite` package, replace `cpp/sqlite/sqlite3.c` with your licensed SEE amalgamation and `cpp/sqlite/sqlite3.h` with its matching header. Compare `SQLITE_VERSION` in the headers before replacing them. Reapply the replacement after dependency installation; an install can restore the package's ordinary SQLite files. Follow your SEE license when handling the source. 2. Keep `#include "sqlite3-symbol-prefix.h"` at the start of `sqlite3.c`. Keep the following block at the start of `sqlite3.h`, before its `SQLITE3_H` guard, so the SEE functions use Nitro SQLite's private SQLite symbols: ```c @@ -16,36 +22,33 @@ Pass `encryptionKey` to `open()` to use an encrypted database. This requires a n #endif ``` -3. Define `SQLITE_ENABLE_SEE=1` for the `RNNitroSQLite` native target on every platform you ship. On Android, set this in your app's `android/gradle.properties`: +## Enable SEE in React Native - ```properties - nitroSqliteFlags="-DSQLITE_ENABLE_SEE=1" - ``` +Define `SQLITE_ENABLE_SEE=1` for the SQLite native target on every platform you ship. On Android, set this in your app's `android/gradle.properties`: - On iOS, set this in your app's `package.json`: +```properties +nitroSqliteFlags="-DSQLITE_ENABLE_SEE=1" +``` - ```json - { - "nitroSQLite": { - "iosSqliteFlags": "-DSQLITE_ENABLE_SEE=1" - } - } - ``` +On iOS, set this in your app's `package.json`: - On macOS, add the definition to the `RNNitroSQLite` target inside your existing Podfile `post_install` block: +```json +{ + "nitroSQLite": { + "iosSqliteFlags": "-DSQLITE_ENABLE_SEE=1" + } +} +``` - ```ruby - installer.pods_project.targets.each do |target| - next unless target.name == 'RNNitroSQLite' +Use the bundled SQLite build on iOS. The system SQLite library does not include your SEE source. Rebuild the native app after changing the source or flags. See [iOS configuration](/docs/configuration/ios#additional-compile-flags) and [Android configuration](/docs/configuration/android#sqlite-compile-flags) for build settings. For the legacy macOS example, see [macOS compatibility](/docs/configuration/macos). - target.build_configurations.each do |config| - definitions = Array(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || '$(inherited)') - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = definitions + ['SQLITE_ENABLE_SEE=1'] - end - end - ``` +## Enable SEE in NitroUI + +The NitroUI adapter does not read the React Native Gradle properties, `nitroSQLite` options, or environment overrides above. After replacing the SQLite source, add `SQLITE_ENABLE_SEE=1` to the adapter's native build definitions. + +On iOS, add the definition to both the C and C++ settings of the `NitroSQLite` target in `nitro-sqlite/Package.swift`. On Android, add it to the `NitroSQLite` target's compile definitions in `nitro-sqlite/android/nitro-ui.cmake`. Preserve the existing thread safety and RTree flags. Keep these source and build-file changes in a reproducible package patch. - Use the bundled SQLite build on Apple platforms. `NITRO_SQLITE_USE_PHONE_VERSION=1` links the system SQLite library, which does not include your SEE source. Rebuild the native app after changing the source or flags. On iOS, delete `~/Library/Caches/org.swift.swiftpm/manifests` first, so Swift Package Manager reads the new flags. On macOS, install Pods again first. See [iOS configuration](/docs/configuration/ios#additional-compile-flags) and [Android configuration](/docs/configuration/android#sqlite-compile-flags) for the platform build settings. +Run the host's native preparation and rebuild the app. These steps require a licensed SEE source and a customized native build; installing the package alone does not enable encryption. See [NitroUI build settings](/docs/configuration#nitro-ui-build-settings). ## Open an encrypted database diff --git a/docs/content/docs/guides/migrate-from-quick-sqlite.mdx b/docs/content/docs/guides/migrate-from-quick-sqlite.mdx index f6f9fc8c0..b45374312 100644 --- a/docs/content/docs/guides/migrate-from-quick-sqlite.mdx +++ b/docs/content/docs/guides/migrate-from-quick-sqlite.mdx @@ -3,6 +3,8 @@ title: Migrate from Quick SQLite description: Move from react-native-quick-sqlite 8.x to the Nitro SQLite 9.x package. --- +This guide covers React Native apps. NitroUI apps use a different host package; see [supported platforms](/docs/supported-platforms). + `react-native-quick-sqlite` was renamed for version 9. The replacement package is `react-native-nitro-sqlite`, which requires `react-native-nitro-modules`. Update both the native dependency and your imports, then rebuild the app. ## Install the new package diff --git a/docs/content/docs/guides/migrate-to-nitro-v1.mdx b/docs/content/docs/guides/migrate-to-nitro-v1.mdx index e726c7246..fe2592c78 100644 --- a/docs/content/docs/guides/migrate-to-nitro-v1.mdx +++ b/docs/content/docs/guides/migrate-to-nitro-v1.mdx @@ -25,6 +25,8 @@ Update your type imports using the table below. The old names remain available a `NativeQueryResult`, `NativePreparedStatement`, and `NativeSQLite` describe values exposed through `NitroSQLite.native`. The managed API keeps its `QueryResult` and `PreparedStatement` names. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ```ts import { open, SQLiteError } from 'react-native-nitro-sqlite' import type { ConnectionOptions } from 'react-native-nitro-sqlite' @@ -48,6 +50,6 @@ try { `SQLiteError` and `NitroSQLiteError` refer to the same constructor, and both exception-category exports refer to the same object. The error's `name` is `SQLiteError`. -If your native code includes helper headers, replace their `NitroSQLite` filename prefix with `SQLite`, for example `NitroSQLiteOperations.hpp` becomes `SQLiteOperations.hpp`. The package name, `NitroSQLite` entry point, and native module names stay the same. +If your native code includes helper headers, replace their `NitroSQLite` filename prefix with `SQLite`, for example `NitroSQLiteOperations.hpp` becomes `SQLiteOperations.hpp`. For React Native apps, the package name, `NitroSQLite` entry point, and native module names stay the same. -See [Getting Started](/docs) for Nitro V1's platform requirements and Swift Package Manager setup. +See [Getting Started](/docs) for host installation and [supported platforms](/docs/supported-platforms) for platform requirements. diff --git a/docs/content/docs/guides/multiple-connections.mdx b/docs/content/docs/guides/multiple-connections.mdx index d2b4c3e15..ae4dfc0fc 100644 --- a/docs/content/docs/guides/multiple-connections.mdx +++ b/docs/content/docs/guides/multiple-connections.mdx @@ -5,7 +5,9 @@ description: Open independent SQLite handles for reads and writes against one da `open({ name })` creates the default connection for a database name. Opening a second default connection with that name throws until the first closes. Use `connection: 'independent'` to open another native SQLite handle to the same file. Each returned connection has its own operation queue and transactions; closing one leaves the others open. -Independent connections require the shared [`threadSafe` setting](/docs/configuration#thread-safety) to remain enabled. +Independent connections require SQLite thread safety. Keep React Native's [`threadSafe` setting](/docs/configuration#thread-safety) enabled. The [NitroUI build](/docs/configuration#nitro-ui-build-settings) enables thread safety by default. + +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). ## One writer and one reader diff --git a/docs/content/docs/guides/node-test-mock.mdx b/docs/content/docs/guides/node-test-mock.mdx index 0591ad66c..400fee174 100644 --- a/docs/content/docs/guides/node-test-mock.mdx +++ b/docs/content/docs/guides/node-test-mock.mdx @@ -3,10 +3,12 @@ title: Test SQLite in Node description: Test shared SQLite connections, statements, and transactions in Node. --- -Import `react-native-nitro-sqlite/mock` to test SQLite connections in Node without loading the React Native module. Install `better-sqlite3` as a development dependency in your test project. The mock creates databases in a temporary directory and supports queries, atomic batches, prepared statements, and callback transactions. Separate connections share committed data and can keep consistent read snapshots under [WAL](/docs/guides/multiple-connections). +Both host packages export a Node mock. Use `react-native-nitro-sqlite/mock` for React Native or `nitro-sqlite/mock` for NitroUI. Neither entry point initializes the native runtime. See [supported platforms](/docs/supported-platforms) for native host requirements. Install `better-sqlite3` as a development dependency in your test project. The mock creates databases in a temporary directory and supports queries, atomic batches, prepared statements, and callback transactions. Separate connections share committed data and can keep consistent read snapshots under [WAL](/docs/guides/multiple-connections). ## Set up Jest +The examples below use the React Native package. For NitroUI, replace `react-native-nitro-sqlite` with `nitro-sqlite` in the mock mapping, imports, and `/mock` paths. Keep your test runner's TypeScript transform enabled for the NitroUI package's source entry points. + The package ships ES modules. Jest runs tests as CommonJS and skips transforming files in `node_modules` by default, so add `react-native-nitro-sqlite` to the packages your `transformIgnorePatterns` lets Jest transform. If your pattern already lists other packages, add it to that list: ```js @@ -51,7 +53,21 @@ test('stores a note', () => { }) ``` -The mock returns query rows through both `results` and `rows`, supports [rows as arrays](/docs/guides/parameters-and-results#rows-as-arrays) through `executeRaw()` and `executeRawAsync()`, and supports [atomic batches](/docs/guides/batch-operations). Bound `undefined` becomes SQL NULL. A query that fails throws from `execute()` or rejects from `executeAsync()`. +The mock returns query rows through both `results` and `rows`, supports [rows as arrays](/docs/guides/parameters-and-results#rows-as-arrays) through `executeRaw()` and `executeRawAsync()`, and supports [atomic batches](/docs/guides/batch-operations). Column metadata is present for row-producing statements, including an empty `SELECT` or `RETURNING` result. It reports each column's declared type and position, and keeps the first declaration when column names repeat, as the native adapter does. Bound `undefined` becomes SQL NULL. A query that fails throws from `execute()` or rejects from `executeAsync()`. + +You can also import the mock directly instead of mapping the native entry point. For example, in a NitroUI project's Node test: + +```ts +import { open, resetAllDatabases } from 'nitro-sqlite/mock' + +afterEach(resetAllDatabases) + +test('opens a temporary database', () => { + const db = open({ name: 'notes.sqlite' }) + expect(db.execute('SELECT 1 AS value').rows.item(0)?.value).toBe(1) + db.close() +}) +``` ## Share a database between connections @@ -128,6 +144,8 @@ The reset throws if any connection is busy. Await that work and retry. No connec ## API reference and limits +The mock ignores `encryptionKey` and writes plaintext databases. Test SEE encryption and native encryption errors on a device. + The generated [mock API reference](/api/react-native-nitro-sqlite/mock) documents `open()`, `NitroSQLite.open()`, `MockConnection`, and `resetAllDatabases()`. Connection methods use the same parameter and result types as the native API. -The mock does not implement attachments, SQL file imports, or direct `NitroSQLite.native` methods. Its SQL runs synchronously on Node's thread; async methods schedule that work and return promises. It uses the SQLite version bundled with `better-sqlite3`, which can differ from the library's native SQLite build. Use device tests for native integration, thread behavior, lock contention, and performance. +The mock exports `open`, `NitroSQLite.open`, `resetAllDatabases`, and the `MockConnection` type. It does not replace every native package export. It does not implement attachments, SQL file imports, or direct `NitroSQLite.native` methods. Its SQL runs synchronously on Node's thread; async methods schedule that work and return promises. It uses the SQLite version bundled with `better-sqlite3`, which can differ from the library's native SQLite build. Use device tests for native integration, thread behavior, lock contention, and performance. diff --git a/docs/content/docs/guides/parameters-and-results.mdx b/docs/content/docs/guides/parameters-and-results.mdx index c9a3c01cf..62430329b 100644 --- a/docs/content/docs/guides/parameters-and-results.mdx +++ b/docs/content/docs/guides/parameters-and-results.mdx @@ -46,7 +46,19 @@ const { columnNames, rows } = db.executeRaw( // rows: [[1, 'Ada', 7, 'Rex'], [2, 'Grace', null, null]] ``` -The result has `columnNames`, `rows`, `rowsAffected`, and `insertId`. It has no `rows._array` container and no `metadata`. `columnNames` is filled even when the query returns no rows. Transactions and prepared statements have the same two methods. The exact shape is in [`NitroSQLiteRawQueryResult`](/api/react-native-nitro-sqlite/interfaces/NitroSQLiteRawQueryResult). +The result has `columnNames`, `rows`, `rowsAffected`, and `insertId`. It has no `rows._array` container and no `metadata`. `columnNames` is filled even when the query returns no rows. Transactions and prepared statements have the same two methods. The exact shape is in [`NativeRawQueryResult`](/api/react-native-nitro-sqlite/interfaces/NativeRawQueryResult). + +## Read columns by position + +SQLite can return several columns with the same name. Object rows have one property per name. For a join or a driver that needs each value in selection order, use `executeRaw()` or `executeRawAsync()` on the connection. The `columnNames` array keeps repeated names. Each entry in `rows` holds the corresponding values in order. + +```ts +const result = await db.executeRawAsync('SELECT ? AS id, ? AS id', [1, 2]) +// result.columnNames is ['id', 'id'] +// result.rows is [[1, 2]] +``` + +Transactions and prepared statements also support raw results. The [Drizzle driver](/docs/integrations/orms/drizzle) uses them to map joined columns back to their tables. ## Column metadata @@ -65,6 +77,8 @@ Be especially careful with nullable columns and expressions when specifying a ro ## Errors +The example imports `react-native-nitro-sqlite/errors` for React Native. NitroUI apps use `nitro-sqlite/errors`. Both packages export the same error helpers. See [supported platforms](/docs/supported-platforms). + The connection's JavaScript helpers normalize database failures to `SQLiteError`. Async methods reject; sync methods throw. An empty SQL string or one containing only comments also fails with the native category `SqlExecutionError`, because SQLite produces no statement to execute. Each query runs one statement, so SQL that contains another statement after the first fails with the same category instead of running only the first one; trailing whitespace, comments, and semicolons are allowed. Use [batch operations](/docs/guides/batch-operations) to run several statements. Catch the error around the operation you can recover from: ```ts @@ -91,7 +105,7 @@ try { When a native `NitroSQLiteException` reaches a managed helper, `error.type` holds a [`SQLiteExceptionType`](/api/react-native-nitro-sqlite/type-aliases/SQLiteExceptionType) such as `SqlExecutionError`. It is `undefined` for JavaScript errors, including connection queue errors, and unrecognized native categories. These categories are not SQLite's numeric error codes. The native categories are `UnknownError`, `DatabaseCannotBeOpened`, `EncryptionNotEnabled`, `DatabaseCannotBeDecrypted`, `DatabaseNotOpen`, `UnableToAttachToDatabase`, `SqlExecutionError`, `CouldNotLoadFile`, and `NoBatchCommandsProvided`. See [encrypt a database](/docs/guides/encryption#handle-open-failures) for the encryption errors. The current native `DatabaseNotOpen` helper emits `UnableToAttachToDatabase`, and a missing database file emits `SqlExecutionError`. Calls through `NitroSQLite.native` throw raw native errors. -The [`SQLiteExceptionType` constants](/api/react-native-nitro-sqlite/variables/SQLiteExceptionType) expose these categories as runtime strings. The object and the TypeScript union share the same name, so existing type-only imports still work. Both the constants and `SQLiteError` are available from the package root and `react-native-nitro-sqlite/errors`. The `/errors` entry point does not import React Native or initialize Nitro's native module, so shared classifiers and Node tests can use it without a native runtime. `error.name` is `SQLiteError`. Use `error instanceof SQLiteError` to identify a managed failure and `error.type` to distinguish its category. The deprecated `NitroSQLiteError` export refers to the same constructor, so existing `instanceof NitroSQLiteError` checks also work. +The [`SQLiteExceptionType` constants](/api/react-native-nitro-sqlite/variables/SQLiteExceptionType) expose these categories as runtime strings. The object and the TypeScript union share the same name, so existing type-only imports still work. Both the constants and `SQLiteError` are available from each package's root and `/errors` entry point. The `/errors` entry points do not initialize the native module, so shared classifiers and Node tests can use them without a native runtime. `error.name` is `SQLiteError`. Use `error instanceof SQLiteError` to identify a managed failure and `error.type` to distinguish its category. The deprecated `NitroSQLiteError` export refers to the same constructor, so existing `instanceof NitroSQLiteError` checks also work. `DatabaseCannotBeOpened` covers several causes, including invalid paths, an already-open default connection, and filesystem failures. It does not by itself establish that the device is low on storage. diff --git a/docs/content/docs/guides/prepared-statements.mdx b/docs/content/docs/guides/prepared-statements.mdx index 297710a97..4b321cf87 100644 --- a/docs/content/docs/guides/prepared-statements.mdx +++ b/docs/content/docs/guides/prepared-statements.mdx @@ -5,6 +5,8 @@ description: Reuse a compiled SQL statement with different bound values. Call `db.prepare(query)` to reuse SQL with different parameter values. It returns a statement with `execute(params)`, `executeAsync(params)`, `isFinalized`, and `finalize()`, plus `executeRaw(params)` and `executeRawAsync(params)` for [rows as arrays](/docs/guides/parameters-and-results#rows-as-arrays). Preparation is synchronous and throws if the connection has work pending or running. For a query that runs only once, use `db.execute()` or `db.executeAsync()`. See [parameters and prepared statements](/docs/concepts/queries-and-indexes#parameters-and-prepared-statements) for the SQLite concept. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ```ts import { open } from 'react-native-nitro-sqlite' diff --git a/docs/content/docs/guides/standalone-review.mdx b/docs/content/docs/guides/standalone-review.mdx new file mode 100644 index 000000000..64f7e0137 --- /dev/null +++ b/docs/content/docs/guides/standalone-review.mdx @@ -0,0 +1,10 @@ +--- +title: NitroUI +description: Find the NitroUI installation and first-query guides. +--- + +Nitro SQLite runs on NitroUI through `nitro-sqlite`. The adapter uses the shared SQLite implementation and API without React Native. + +Start with [Install on NitroUI](/docs/nitro-ui) for the source checkout and local archive paths. Then [run your first query](/docs/nitro-ui/first-query). + +The [supported platforms page](/docs/supported-platforms) lists the runtime versions and OS coverage. The [shared API reference](/api) describes the database operations. diff --git a/docs/content/docs/guides/sync-and-async.mdx b/docs/content/docs/guides/sync-and-async.mdx index ff860eca1..22f851709 100644 --- a/docs/content/docs/guides/sync-and-async.mdx +++ b/docs/content/docs/guides/sync-and-async.mdx @@ -7,6 +7,8 @@ Use `db.execute()` for a small query that needs an immediate result, and `await `executeRaw`, `executeBatch`, and `loadFile` also have matching `Async` methods. A [prepared statement](/docs/guides/prepared-statements) has `execute()` and `executeAsync()` for repeated SQL. +Examples use `react-native-nitro-sqlite` for React Native. In NitroUI, import from `nitro-sqlite` with the same APIs. See [supported platforms](/docs/supported-platforms). + ```ts import { open } from 'react-native-nitro-sqlite' @@ -71,4 +73,6 @@ try { Native calls bypass the JavaScript queue. If you use them alongside an `open()` connection, coordinate access yourself. A native statement can run inside an active connection transaction without joining its callback's sequence. The raw result is a plain JavaScript object with `rowsAffected`, `insertId`, `results`, and `metadata`; ordinary garbage collection reclaims it. `NitroSQLite.native` itself is a Nitro hybrid object with a `dispose()` member. Do not dispose that shared instance during normal database cleanup; `dispose()` is not a database `close()` call. -Call raw methods through `NitroSQLite.native`. Keep the shared [`threadSafe` setting](/docs/configuration#thread-safety) enabled when work can run across multiple database connections. +Native direct and prepared `execute()` methods return [`NativeQueryResult`](/api/react-native-nitro-sqlite/interfaces/NativeQueryResult). Their `executeAsync()` methods resolve to the same result shape. + +Call raw methods through `NitroSQLite.native`. Keep SQLite thread safety enabled when work can run across multiple database connections. Use React Native's [`threadSafe` setting](/docs/configuration#thread-safety) or retain the [NitroUI adapter's native default](/docs/configuration#nitro-ui-build-settings). diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index 4ea43230e..a2c0560fb 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -1,83 +1,29 @@ --- -title: Getting Started -description: Install Nitro SQLite, rebuild your React Native app, and run your first query. +title: Getting started +description: Choose React Native or NitroUI, install Nitro SQLite, and run your first query. --- -Nitro SQLite gives React Native apps a local SQLite database on iOS and Android in the Nitro V1 prerelease. The stable 10.x line also supports macOS and visionOS. Start by installing its native package and Nitro Modules, then open a database with `open()`. +Nitro SQLite is a Nitro library for local SQLite databases. It runs on React Native and NitroUI through separate packages. Both packages share the database API, SQLite implementation, transactions, prepared statements, and result types. -## 1. Install the packages +SQLite stores your data in a local file. Opening a connection creates the file when needed. Closing the connection releases its resources and keeps the data for the next connection. -Nitro SQLite is built with Nitro V1, which requires React Native 0.88 or newer with the New Architecture. iOS builds require Xcode with Swift 6.4 or newer. Install the Nitro version that Nitro SQLite was built with, because the generated native bindings must match it: +## Choose your platform -```sh -npm install react-native-nitro-sqlite@nitro-v1 react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101 -``` +| Your app | Package | Start here | +| ------------------------------------------ | --------------------------- | ----------------------------------------------------------------------------------------------------------- | +| React Native, including Expo native builds | `react-native-nitro-sqlite` | [Install on React Native](/docs/react-native), then [run your first query](/docs/react-native/first-query). | +| NitroUI | `nitro-sqlite` | [Install on NitroUI](/docs/nitro-ui), then [run your first query](/docs/nitro-ui/first-query). | -## 2. Set up the native project +The packages use different Nitro versions and generated bindings. Choose the package for your app's runtime. See [supported platforms](/docs/supported-platforms) for OS coverage and version requirements. -For iOS, follow the [React Native SwiftPM setup](/docs/configuration/ios#set-up-swift-package-manager). If your app uses Expo prebuild, follow the [Expo setup](/docs/configuration/expo#generate-and-rebuild) to generate the Xcode project and set up SwiftPM before building. +The NitroUI adapter is available through the source checkout or a locally packed archive. Its installation guide covers both paths. -Android needs no additional Nitro SQLite configuration for the default setup. For macOS and visionOS, install Nitro SQLite 10.x with Nitro Modules 0.37.2 and reinstall Pods in your platform's native project. The [macOS setup](/docs/configuration/macos) describes the stable macOS example, and the [10.x CocoaPods options](https://github.com/margelo/react-native-nitro-sqlite/blob/v10.4.0/docs/content/docs/configuration/ios.mdx) cover Apple build settings for both platforms. Use [Configuration](/docs/configuration) for the shared `package.json` options. +## Use the shared docs -## 3. Rebuild the app +Start with [databases and connections](/docs/concepts/databases-and-connections) for SQLite fundamentals. The Concepts section covers tables, queries, transactions, and isolation. -An already installed binary cannot load a native module added only to JavaScript. From a standard React Native CLI project, run the native build for your platform: +After installation, the [guides](/docs/guides/sync-and-async) apply to both packages unless a page states a platform requirement. Use your platform's package name in imports. The [API reference](/api) documents the shared SQLite methods and types. -```sh -npm run ios -# or -npm run android -``` +The [configuration pages](/docs/configuration) explain React Native build options. The NitroUI installation guide describes its separate native build and storage settings. -If your app uses different scripts, run its equivalent native build. See the [React Native build setup](https://reactnative.dev/docs/getting-started-without-a-framework) for platform prerequisites. - -For an Expo project, build a native app for your platform: - -```sh -npx expo run:ios -# or -npx expo run:android -``` - -> [!NOTE] -> Expo Go does not include Nitro SQLite. Use a native build after adding the package. - -For optional features such as FTS5, vector search, or iOS App Groups, use the [Expo config plugin](/docs/configuration/expo). - -## 4. Run your first query - -`open()` returns a connection bound to a database name. SQLite creates the file if it does not exist. This example creates a table, binds a value to `?`, and reads it back: - -```ts -import { open } from 'react-native-nitro-sqlite' - -const db = open({ name: 'app.sqlite' }) - -db.execute(` - CREATE TABLE IF NOT EXISTS notes ( - id INTEGER PRIMARY KEY, - body TEXT NOT NULL - ) -`) - -const body = 'Read the docs' -db.execute('INSERT INTO notes (body) VALUES (?)', [body]) - -const { rows } = db.execute<{ id: number; body: string }>( - 'SELECT id, body FROM notes WHERE body = ?', - [body], -) - -console.log(rows._array) -db.close() -``` - -Bind user supplied values as parameters rather than putting them into the SQL string. The row generic gives `rows._array` and `rows.item(index)` a TypeScript shape; it does not validate database values at runtime. For more result details, see [parameters and results](/docs/guides/parameters-and-results). - -## Keep going - -To work with Drizzle ORM, TypeORM, MikroORM, or Kysely, start with [ORMs and query builders](/docs/integrations/orms). - -Start with [databases and connections](/docs/concepts/databases-and-connections) for SQLite fundamentals. The Concepts section covers data, queries, transactions, and isolation. - -For Nitro SQLite APIs, see [database lifecycle](/docs/guides/database-lifecycle), [sync and async](/docs/guides/sync-and-async), and [parameters and results](/docs/guides/parameters-and-results). The [generated API reference](/api) lists public exports and method signatures. +Choose an optional [ORM or query builder](/docs/integrations/orms) for Drizzle, TypeORM, MikroORM, or Kysely. Each host has its own companion packages and installation steps. diff --git a/docs/content/docs/integrations/orms/drizzle.mdx b/docs/content/docs/integrations/orms/drizzle.mdx index f01845ca9..7adbe3431 100644 --- a/docs/content/docs/integrations/orms/drizzle.mdx +++ b/docs/content/docs/integrations/orms/drizzle.mdx @@ -1,33 +1,92 @@ --- title: Drizzle ORM -description: Use Drizzle ORM with Nitro SQLite through the react-native-nitro-sqlite-drizzle driver. +description: Use Drizzle to query a Nitro SQLite connection in React Native or NitroUI. --- -`react-native-nitro-sqlite-drizzle` runs [Drizzle ORM](https://orm.drizzle.team) queries on a Nitro SQLite connection. Pass an open connection to `drizzle()` and query it with Drizzle's API. Every query is asynchronous. +Drizzle maps TypeScript table definitions to SQL. Its Nitro SQLite driver executes queries asynchronously on an open connection. A join can return two columns named `id`. The driver reads each value by its position, so each table keeps its own ID. -## Install +## Install the driver -Use [the Drizzle quick start](/docs/integrations/orms#drizzle) to install the driver, open a database, and run a query. The driver supports `drizzle-orm` 0.45.4 and later 0.x releases. +Install `drizzle-orm` (0.45.4 or a later 0.x release) alongside the driver and SQLite adapter for your runtime. -## Create a database +| Runtime | Driver | SQLite adapter | +| ---------------------------------- | ----------------------------------- | --------------------------- | +| [React Native](/docs/react-native) | `react-native-nitro-sqlite-drizzle` | `react-native-nitro-sqlite` | +| [NitroUI](/docs/nitro-ui) | `nitro-sqlite-drizzle` | `nitro-sqlite` | -A Drizzle table declaration describes columns to the query builder. SQLite needs the corresponding table in the database file. The quick start creates it with SQL. For versioned schema changes, use the migrations below. +For this pre-release source, install the matching driver and SQLite archives from the checkout. The repository examples use the local packages. -Create `db` once, outside your components. `drizzle(connection, config)` accepts Drizzle's `schema`, `logger`, and `casing` options. `db.$client` is the connection passed to `drizzle()`. Close it after outstanding work finishes. +## Open a database -SQLite stores binary values as BLOBs. When you pass a `Buffer` or another typed-array view through Drizzle, the driver binds its bytes as an `ArrayBuffer`, preserving the view's byte range. +Choose the imports for your runtime. In React Native: -## Migrations +```ts +import { open } from 'react-native-nitro-sqlite' +import { drizzle, migrate } from 'react-native-nitro-sqlite-drizzle' +``` + +In NitroUI: + +```ts +import { open } from 'nitro-sqlite' +import { drizzle, migrate } from 'nitro-sqlite-drizzle' +``` + +The remaining code works in either runtime. Keep the connection outside components so it survives re-renders. -Start the first generated migration on a fresh database. The quick start creates the `notes` table directly, so Drizzle has no migration record for it and would try to create it again. +```ts +import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core' + +const notes = sqliteTable('notes', { + id: integer('id').primaryKey(), + body: text('body').notNull(), +}) + +const connection = open({ name: 'notes.sqlite' }) +const db = drizzle(connection) +``` -Install the development tools for generating and bundling migrations. +## Apply migrations and query the database + +SQLite needs a table before it can store rows. Pass the Drizzle Kit journal and bundled SQL strings to `migrate()` at startup. This example includes one migration inline so it runs with either bundler. + +```ts +await migrate(db, { + journal: { + entries: [ + { idx: 0, when: 1735689600000, tag: '0000_notes', breakpoints: true }, + ], + }, + migrations: { + m0000: 'CREATE TABLE notes (id INTEGER PRIMARY KEY, body TEXT NOT NULL)', + }, +}) -```sh -npm install --save-dev drizzle-kit babel-plugin-inline-import +await db + .insert(notes) + .values({ id: 1, body: 'Hello SQLite' }) + .onConflictDoNothing() +const rows = await db.select().from(notes) ``` -Put the table declarations in `db/schema.ts` so Drizzle Kit can load them in Node without opening a native connection. Drizzle Kit generates SQL migration files from that schema. Set `driver: 'expo'` so it also writes a `migrations.js` file that bundles them for React Native: +The driver records completed migrations in `__drizzle_migrations`. Calls on the same connection wait for earlier migrations. If a migration fails, its transaction rolls back and the caller can retry. In a component, `useMigrations(db, migrations)` returns `{ success, error }`. + +For transactions, await each statement on the handle passed to the callback. Await nested transactions one at a time. Close the underlying connection when the app has finished using the database. + +```ts +await db.transaction(async (tx) => { + await tx.insert(notes).values({ body: 'Another note' }) +}) +connection.close() +``` + +SQLite stores binary values as BLOBs. When you pass a `Buffer` or another typed-array view through Drizzle, the driver binds its bytes as an `ArrayBuffer`, preserving the view's byte range. + +## Migrations + +Schema declarations describe your tables to Drizzle. They do not create SQLite tables. Run migrations before inserting or querying rows in a fresh database. + +Drizzle Kit generates SQL migration files from your schema. Set `driver: 'expo'` so it also writes a `migrations.js` file that bundles them for React Native: ```ts title="drizzle.config.ts" import { defineConfig } from 'drizzle-kit' @@ -84,8 +143,13 @@ To run migrations outside a component, such as in startup code or a test, call ` ```ts import { migrate } from 'react-native-nitro-sqlite-drizzle' +import migrations from './drizzle/migrations' +import { db } from './db' +import { users } from './db/schema' await migrate(db, migrations) +await db.insert(users).values({ id: 1, name: 'Ada' }).onConflictDoNothing() +const rows = await db.select().from(users) ``` Calls using the same connection wait for earlier migration calls before checking which migrations are pending. React Strict Mode can replay `useMigrations` without applying the same migration twice. If a migration fails, its transaction rolls back and a later call can retry it. @@ -100,8 +164,8 @@ Run every query inside a transaction through `tx`: import { eq } from 'drizzle-orm' await db.transaction(async (tx) => { - await tx.insert(notes).values({ title: 'Passport' }) - await tx.update(notes).set({ title: 'Packed' }).where(eq(notes.id, 1)) + await tx.insert(users).values({ id: 2, name: 'Grace' }) + await tx.update(users).set({ name: 'Ada L.' }).where(eq(users.id, 1)) }) ``` @@ -109,32 +173,34 @@ A transaction holds the connection until its callback finishes. A query awaited ### Nested transactions -SQLite savepoints form a stack inside one transaction. Releasing a savepoint keeps its changes inside the outer transaction. Rolling back to a savepoint undoes changes since that savepoint. Savepoints cannot isolate overlapping callbacks. +SQLite savepoints form a stack inside one transaction. Releasing a savepoint keeps its changes inside the outer transaction. Rolling back to a savepoint undoes every change since that savepoint, including changes from later savepoints. Savepoints cannot isolate callbacks that overlap. -Nested `tx.transaction()` calls use savepoints. Await each nested call before starting another on the same handle, using its parent handle for queries, or returning from the parent callback. Use the child handle to nest further: +Nested `tx.transaction()` calls use savepoints. Await each nested call before starting another on the same handle, using its parent handle for queries, or returning from the parent callback. To nest further, use the handle supplied to the nested callback: ```ts await db.transaction(async (tx) => { await tx.transaction(async (child) => { - await child.insert(notes).values({ title: 'Passport' }) + await child.insert(users).values({ id: 3, name: 'Ada' }) await child.transaction(async (grandchild) => { - await grandchild.insert(notes).values({ title: 'Tickets' }) + await grandchild.insert(users).values({ id: 4, name: 'Grace' }) }) }) await tx.transaction(async (child) => { - await child.insert(notes).values({ title: 'Packed' }) + await child.insert(users).values({ id: 5, name: 'Linus' }) }) }) ``` -Overlapping nested calls on the same handle reject before executing SQL or invoking the second callback. This includes siblings started with `Promise.all()` and nested calls made through an ancestor handle. Top-level transactions still wait for earlier transactions on their connection. Separate connections have separate scopes. - -Catch a nested callback's rejection in its parent to continue after a rollback. The driver rolls back and releases the savepoint before rejecting. Savepoint setup or cleanup failures force the outer transaction to roll back, even if caught. When callback and cleanup both fail, the error's `cause` is an `AggregateError` containing both errors. +Only one nested call can be active on each handle. Overlapping calls, including siblings started with `Promise.all()`, reject before executing SQL or invoking the second callback. Calls are not queued. A nested callback that calls `transaction()` through an ancestor handle also rejects instead of waiting on itself. Use sequential `await` calls for sibling work. Top-level `db.transaction()` calls still wait for earlier transactions on their connection, and separate connections have separate transaction scopes. -If a callback returns or throws with an active child, the driver waits for that child to settle, then rejects the parent and rolls back its work. Always await the child yourself. +Catch a nested callback's rejection in its parent to continue after a rollback. The driver rolls back and releases that savepoint before rejecting. A savepoint setup or cleanup failure forces the outer transaction to roll back, even if you catch the error. When callback failure and cleanup failure occur together, the error's `cause` is an `AggregateError` containing both errors. -Queries through a finished child handle reject after either release or rollback, including prepared queries created through that handle. This applies while its parent remains active. Continue through the parent or start and await another child. +If a callback returns or throws with an active nested call, the driver waits for that child to settle, then rejects the parent and rolls back its work. Always await the child yourself. Do not leave transaction promises running after their parent callback finishes, and do not reuse transaction handles after their callbacks finish. `tx.rollback()` rolls back the transaction and rejects it with a `SQLiteError` whose message is `Rollback`. The `behavior` option of `db.transaction()` is ignored: transactions start with `BEGIN`. See [transactions](/docs/guides/transactions) for how Nitro SQLite runs them. +### Transaction handle lifetime + +SQLite savepoints share the outer transaction. A released or rolled-back savepoint no longer defines a child scope. Nitro SQLite rejects queries through a finished Drizzle child handle, including prepared queries created through it, even while the parent transaction remains active. Use the parent handle to continue, or start and await another child transaction. + If a statement implicitly rolls back the entire SQLite transaction, later queries and nested transactions reject before running SQL. Catching a default `ABORT` constraint error keeps the transaction active and allows further queries and nested transactions. See [constraint errors and implicit rollback](/docs/concepts/transactions#constraint-errors-and-implicit-rollback). diff --git a/docs/content/docs/integrations/orms/index.mdx b/docs/content/docs/integrations/orms/index.mdx index a409b117e..0885c6e79 100644 --- a/docs/content/docs/integrations/orms/index.mdx +++ b/docs/content/docs/integrations/orms/index.mdx @@ -7,6 +7,19 @@ description: Install an integration, open a local SQLite database, and write and import { TabsContent } from 'fumadocs-ui/components/tabs' import { OrmExamples, OrmTabs } from '@/components/orm-tabs' +SQLite stores tables and indexes in a file on the device. An ORM maps entities to those tables and tracks changes to objects. A query builder compiles typed SQL and bound parameters. Both use the same SQLite transactions and file locks as direct queries. + +For entity mapping, dialects, and migrations, see [how ORMs work with SQLite](/docs/concepts/orms-and-query-builders). Choose the integration that matches how your app represents its data. Each package below uses the SQLite adapter for the same host. Keep one ORM or query-builder instance for each database and close it after its outstanding work finishes. + +| Integration | React Native | NitroUI | +| --------------------------------------------- | ------------------------------------- | ------------------------ | +| [Drizzle](/docs/integrations/orms/drizzle) | `react-native-nitro-sqlite-drizzle` | `nitro-sqlite-drizzle` | +| [TypeORM](/docs/integrations/orms/typeorm) | `react-native-nitro-sqlite-typeorm` | `nitro-sqlite-typeorm` | +| [MikroORM](/docs/integrations/orms/mikro-orm) | `react-native-nitro-sqlite-mikro-orm` | `nitro-sqlite-mikro-orm` | +| [Kysely](/docs/integrations/orms/kysely) | `react-native-nitro-sqlite-kysely` | `nitro-sqlite-kysely` | + +Drizzle and Kysely use typed queries. TypeORM and MikroORM also provide entity mapping and change tracking. Vector search has a [separate guide](/docs/integrations/vector-search). + Choose **Drizzle ORM**, **TypeORM**, **MikroORM**, or **Kysely**, a typed SQL query builder. All four store data in SQLite on the device. Vector search has a [separate guide](/docs/integrations/vector-search). For the difference between entity mapping and a typed query builder, see [How ORMs work with SQLite](/docs/concepts/orms-and-query-builders). @@ -64,8 +77,29 @@ npm install react-native-nitro-sqlite-kysely 'kysely@^0.29.9' +## Install from a source checkout + +Use a source checkout with its workspace dependencies installed. The NitroUI companion packages are source previews. For this checkout, build local archives of the SQLite adapter and companions for your host. The archive name contains the version in each package manifest. + +From the package directory for your host and integration, build a local archive. For example: + +```sh +cd packages/integrations/nitro-ui/kysely +bun run pack +``` + +For the staged NitroUI package version, this produces `nitro-sqlite-kysely-11.0.0.tgz`. Use the corresponding `packages/integrations/react-native/kysely` directory for React Native. The ORM companions have the same packing entry point. For React Native Vec, run `bun pm pack` in `packages/integrations/react-native/vec` instead. + +Install the archive into your app alongside the SQLite adapter for that host. For NitroUI, follow [adapter installation](/docs/nitro-ui#add-the-adapter-to-an-existing-app). For React Native, follow [React Native setup](/docs/react-native) and use the matching SQLite archive from this checkout. + +A companion archive includes its shared implementation. Your app does not need `shared/orm`, `nitro-sqlite-core`, or `nitro-sqlite-drizzle-core` installed from a registry. If you install a package through a local directory instead of an archive, prepare it from the source checkout first. + +NitroUI apps also need the ORM libraries in the installation tabs above, using their `nitro-sqlite-*` companions instead of the React Native companions. MikroORM requires both its driver and Kysely companion archives. Its NitroUI [browser bundle and Buffer setup](/docs/integrations/orms/mikro-orm#configure-nitroui) uses JavaScript dependencies. React Native keeps its [native Buffer setup](/docs/integrations/orms/mikro-orm#react-native-buffer-options) or can use the shared JavaScript adapter. + ## Usage +The examples below use React Native imports. For NitroUI, replace the `react-native-nitro-sqlite` prefix with `nitro-sqlite`. Complete each guide's host setup first, including TypeORM and MikroORM browser bundles. + Open the database, create a table, and read back the note you insert. For an app that keeps its database open, initialize it once and close it after outstanding queries finish. @@ -89,8 +123,11 @@ try { connection.execute( 'CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, title TEXT NOT NULL)', ) - const { id } = await db.insert(notes).values({ title: 'Packing list' }) - .returning({ id: notes.id }).get() + const { id } = await db + .insert(notes) + .values({ title: 'Packing list' }) + .returning({ id: notes.id }) + .get() const saved = await db.select().from(notes).where(eq(notes.id, id)).get() console.log(saved?.title) } finally { @@ -197,14 +234,22 @@ const db = new Kysely({ }) try { - await db.schema.createTable('notes').ifNotExists() + await db.schema + .createTable('notes') + .ifNotExists() .addColumn('id', 'integer', (column) => column.primaryKey()) .addColumn('title', 'text', (column) => column.notNull()) .execute() - const { id } = await db.insertInto('notes').values({ title: 'Packing list' }) - .returning('id').executeTakeFirstOrThrow() - const saved = await db.selectFrom('notes').select('title') - .where('id', '=', id).executeTakeFirstOrThrow() + const { id } = await db + .insertInto('notes') + .values({ title: 'Packing list' }) + .returning('id') + .executeTakeFirstOrThrow() + const saved = await db + .selectFrom('notes') + .select('title') + .where('id', '=', id) + .executeTakeFirstOrThrow() console.log(saved.title) } finally { await db.destroy() diff --git a/docs/content/docs/integrations/orms/kysely.mdx b/docs/content/docs/integrations/orms/kysely.mdx index ed55b0e23..7eeb5d1ab 100644 --- a/docs/content/docs/integrations/orms/kysely.mdx +++ b/docs/content/docs/integrations/orms/kysely.mdx @@ -7,11 +7,48 @@ SQLite stores tables and indexes in a file on the device. [Kysely](https://kysel ## Install -The [Kysely quick start](/docs/integrations/orms#kysely) lists the packages and shows how to configure the dialect. It requires Nitro SQLite 10.4 or later and Kysely 0.29.9 or a compatible 0.29.x release. +The [companion installation guide](/docs/integrations/orms#kysely) lists the packages for each host. These pre-release packages use Nitro SQLite 11 and Kysely 0.29.9. Both React Native and NitroUI expose the same dialect API. ## Create a table and query it -The TypeScript database interface in the quick start describes the schema to Kysely. Use `db.schema` to create the corresponding database tables. For a file that already contains user data, apply versioned changes when the app opens it. +Choose the dialect import for your host. React Native uses `react-native-nitro-sqlite-kysely`; NitroUI uses `nitro-sqlite-kysely`. + +```ts +import { Kysely, type Generated } from 'kysely' +import { createNitroSQLiteDialect } from 'nitro-sqlite-kysely' + +interface Database { + notes: { id: Generated; title: string } +} + +const db = new Kysely({ + dialect: createNitroSQLiteDialect({ name: 'notes.sqlite' }), +}) + +try { + await db.schema + .createTable('notes') + .ifNotExists() + .addColumn('id', 'integer', (column) => column.primaryKey()) + .addColumn('title', 'text', (column) => column.notNull()) + .execute() + const { id } = await db + .insertInto('notes') + .values({ title: 'Packing list' }) + .returning('id') + .executeTakeFirstOrThrow() + const saved = await db + .selectFrom('notes') + .selectAll() + .where('id', '=', id) + .executeTakeFirstOrThrow() + console.log(saved.title) +} finally { + await db.destroy() +} +``` + +The TypeScript database interface above describes the schema to Kysely. Use `db.schema` to create the corresponding database tables. For a file that already contains user data, apply versioned changes when the app opens it. ## Connection lifetime @@ -24,8 +61,11 @@ SQLite commits or rolls back the statements in a transaction together. Run every ```ts await db.transaction().execute(async (trx) => { await trx.insertInto('notes').values({ title: 'Passport' }).execute() - await trx.updateTable('notes').set({ title: 'Packed' }) - .where('title', '=', 'Packing list').execute() + await trx + .updateTable('notes') + .set({ title: 'Packed' }) + .where('title', '=', 'Packing list') + .execute() }) ``` @@ -39,9 +79,15 @@ SQLite reserves `PRAGMA user_version` for the application to store its schema ve import { sql } from 'kysely' await db.transaction().execute(async (trx) => { - const { rows } = await sql<{ user_version: number }>`PRAGMA user_version`.execute(trx) + const { rows } = await sql<{ + user_version: number + }>`PRAGMA user_version`.execute(trx) if (rows[0]?.user_version === 0) { - await trx.schema.createIndex('notes_title').on('notes').column('title').execute() + await trx.schema + .createIndex('notes_title') + .on('notes') + .column('title') + .execute() await sql`PRAGMA user_version = 1`.execute(trx) } }) diff --git a/docs/content/docs/integrations/orms/mikro-orm.mdx b/docs/content/docs/integrations/orms/mikro-orm.mdx index 0f9b6d396..a596c819e 100644 --- a/docs/content/docs/integrations/orms/mikro-orm.mdx +++ b/docs/content/docs/integrations/orms/mikro-orm.mdx @@ -3,6 +3,8 @@ title: MikroORM description: Store and query MikroORM entities in a local Nitro SQLite database. --- +import { sourceUrl } from '@/lib/site' + SQLite stores tables in a file on the device. [MikroORM](https://mikro-orm.io) maps entities to those tables, tracks changes to the entities you load, and writes pending changes when you call `flush()`. The Nitro SQLite driver executes those queries asynchronously on a dedicated native connection. ## Install the driver @@ -13,15 +15,61 @@ Use `@mikro-orm/sql` for the shared SQLite platform. The `@mikro-orm/sqlite` pac `@mikro-orm/sql` exposes a single entry point that also includes other SQL dialects. Account for those modules when assessing your app's bundle size. -This setup uses the MIT-licensed `@craftzdog/react-native-buffer` package's root entry point. It supports the `base64url` encoding that MikroORM cursors require. The `buffer@6.0.3` package does not. Quick Crypto is not required for this setup. +Both hosts use `buffer@6.0.3` with the repository's shared Buffer adapter. The adapter adds the `base64url` spelling used by MikroORM cursors. Copy it into your app and initialize the global before importing ORM code. This setup uses JavaScript dependencies and does not add a native Buffer or Base64 module. + +## Configure NitroUI + +The NitroUI example prepares MikroORM as a browser bundle before the SDK bundles the app. Follow the same preparation for another NitroUI app. Install `esbuild@0.28.1` as a development dependency, plus `buffer@6.0.3` and `reflect-metadata` as app dependencies. + +1. Copy `prepare-mikro-orm.mjs` and `mikro-environment.mjs` from the source checkout into your app's `scripts` directory. Run the preparation script before starting or bundling the app: + + ```sh + node scripts/prepare-mikro-orm.mjs + ``` + + The script creates `.nitro/vendor/mikro-orm.js` and its type declarations. It uses browser conditions for filesystem stubs and keeps SQLite, Nitro Core, and Kysely as app dependencies. Keep `@mikro-orm/sql` and `nitro-sqlite-mikro-orm` in the same browser bundle. Import the ORM and driver from that bundle so they share the same classes. + +2. Keep the environment shim used by that preparation script. MikroORM expects `process.env` to be an object and checks environment variable names with `in`. The script redirects MikroORM's environment reads to `mikroOrmEnvironment`, which turns a string into `{ NODE_ENV: value }` and preserves an existing environment object. It does not replace the SDK global. + +3. Initialize `Buffer` with `base64url` support before importing ORM code. The repository's `buffer.ts` adapts `buffer@6.0.3` for MikroORM cursor encoding. Copy that module into your app, then load it and `reflect-metadata` from your entry initialization: + + ```ts + import 'reflect-metadata' + import { Buffer } from './buffer' + + Object.assign(globalThis, { Buffer }) + ``` + + Import this initialization before your app's database modules. The example uses `polyfills.ts` for this ordering. A plain `buffer@6.0.3` global without the adapter does not support MikroORM's `base64url` cursor encoding. + +4. In a module such as `src/database.ts`, import every MikroORM entry point from the prepared bundle: + + ```ts + import { + defineEntity, + MikroORM, + NitroSQLiteDriver, + p, + } from '../.nitro/vendor/mikro-orm.js' + ``` + + The example's `scripts/prepare-shared.mjs` redirects its shared tests to this bundle. An app that imports the bundle directly does not need that test-source rewriting step. Pass explicit entity classes or schemas; device builds do not support filesystem entity discovery. + +The Metro and Babel configuration below applies to React Native. + +## React Native Buffer options + +The existing React Native setup uses the MIT-licensed `@craftzdog/react-native-buffer` package's root entry point. It supports the `base64url` encoding that MikroORM cursors require. The `buffer@6.0.3` package does not. Quick Crypto is not required for this setup. Quick Base64 is a native dependency. Install pods for a bare iOS app, or create a new development build for an Expo app. Expo Go cannot load this native module. The package's Node.js fallback uses `base64-js`, which Metro also resolves when bundling. Install it explicitly because version 6.1.2 lists it only as a development dependency. This fallback is not a native-free React Native entry point. +The JavaScript setup below is an alternative. With the native setup, alias `buffer` and `node:buffer` to `@craftzdog/react-native-buffer` in your existing Metro resolver and initialize the global from that package instead. Keep the rest of the resolver and Babel setup. + ## Configure Metro and Babel The driver ships two build-time helpers. The Metro resolver selects MikroORM's browser stubs for filesystem access. The Babel plugin handles MikroORM's computed imports and leaves Unicode property escapes for Hermes. -Nitro SQLite requires React Native 0.75 or later. These snippets explicitly enable [Metro package exports](https://metrobundler.dev/docs/package-exports/), which React Native enables by default only from 0.79. Keep exports enabled so the resolver can select MikroORM's browser stubs. +This adapter requires React Native 0.88 or later. These snippets explicitly enable [Metro package exports](https://metrobundler.dev/docs/package-exports/), which React Native enables by default only from 0.79. Keep exports enabled so the resolver can select MikroORM's browser stubs. In a bare React Native app, start with your existing Metro configuration, including its resolver customizations. For a new app, use `getDefaultConfig(__dirname)` as below. Capture the existing resolver before wrapping it. @@ -38,9 +86,6 @@ config.resolver = { ...config.resolver, unstable_enablePackageExports: true, resolveRequest(context, moduleName, platform) { - if (moduleName === 'buffer' || moduleName === 'node:buffer') { - moduleName = '@craftzdog/react-native-buffer' - } return resolveMikroORM( { ...context, @@ -77,9 +122,6 @@ config.resolver = { ...config.resolver, unstable_enablePackageExports: true, resolveRequest(context, moduleName, platform) { - if (moduleName === 'buffer' || moduleName === 'node:buffer') { - moduleName = '@craftzdog/react-native-buffer' - } return resolveMikroORM( { ...context, @@ -101,7 +143,7 @@ config.resolver = { module.exports = config ``` -Both snippets preserve other resolver options and pass requests through your existing resolver. The Buffer aliases make dependencies that import `buffer` or `node:buffer` use the same implementation as the global below. MikroORM 7.2.13 itself reads the global `Buffer`. +Both snippets preserve other resolver options and pass requests through your existing resolver. MikroORM 7.2.13 reads the global `Buffer`, initialized below. Add `babelPlugin` to the plugins in `babel.config.js`. This example shows a bare React Native app. Keep `babel-preset-expo` in an Expo app. @@ -116,10 +158,10 @@ module.exports = { Keep your app's existing presets and plugins. Restart Metro with a clear cache after changing either file. -Set up the JavaScript `Buffer` implementation before importing your ORM code. For example, add this to an initialization module and import it first from the app entry point. +Copy the shared Buffer adapter linked above to `src/buffer.ts`. Set up its JavaScript `Buffer` before importing your ORM code. Add this to an initialization module and import it first from the app entry point. The repository's React Native initialization uses the same adapter. ```js -import { Buffer } from '@craftzdog/react-native-buffer' +import { Buffer } from './buffer' globalThis.Buffer = Buffer ``` @@ -128,7 +170,42 @@ Assign the global even if an earlier polyfill installed `Buffer`. Keeping a Buff ## Store and read an entity -The [MikroORM quick start](/docs/integrations/orms#mikro-orm) defines a `Note` entity and stores and reads it using separate entity manager forks. Use a fork for each independent unit of work. For a long-lived database, create the ORM once and close it after its queries and transactions finish. +This example belongs in `src/database.ts` of the NitroUI app prepared above. In React Native, import `defineEntity`, `MikroORM`, and `p` from `@mikro-orm/sql`, and `NitroSQLiteDriver` from `react-native-nitro-sqlite-mikro-orm` after completing the Metro setup. + +```ts +import { + defineEntity, + MikroORM, + NitroSQLiteDriver, + p, +} from '../.nitro/vendor/mikro-orm.js' + +const Note = defineEntity({ + name: 'Note', + properties: { id: p.integer().primary(), title: p.string() }, +}) + +const orm = new MikroORM({ + driver: NitroSQLiteDriver, + dbName: 'notes.sqlite', + entities: [Note], +}) + +try { + await orm.schema.update() + const writer = orm.em.fork() + const note = writer.create(Note, { title: 'Packing list' }) + await writer.flush() + const saved = await orm.em.fork().findOneOrFail(Note, note.id) + console.log(saved.title) +} finally { + await orm.close() +} +``` + +Use versioned migrations for production schema changes. `schema.update()` is shown here for a new example database. + +The example above defines a `Note` entity and stores and reads it using separate entity manager forks. Use a fork for each independent unit of work. For a long-lived database, create the ORM once and close it after its queries and transactions finish. A file name in `dbName` selects the database in the app's SQLite directory. Pass Nitro SQLite's `location`, `readOnly`, or `encryptionKey` in `driverOptions`. An `encryptionKey` requires a licensed [SQLite SEE build](/docs/guides/encryption). diff --git a/docs/content/docs/integrations/orms/typeorm.mdx b/docs/content/docs/integrations/orms/typeorm.mdx index 342389462..3580b56fb 100644 --- a/docs/content/docs/integrations/orms/typeorm.mdx +++ b/docs/content/docs/integrations/orms/typeorm.mdx @@ -1,32 +1,22 @@ --- title: TypeORM -description: Use Nitro SQLite as the database driver for TypeORM's React Native DataSource. +description: Use Nitro SQLite as TypeORM's database driver in either host. --- -Pass `typeORMDriver` to a [TypeORM](https://typeorm.io) `DataSource` with `type: 'react-native'` to use Nitro SQLite. TypeORM maps your entities to tables and runs their queries through the driver. Use [`open()`](/api/react-native-nitro-sqlite/functions/open) directly when you do not need TypeORM. +TypeORM maps entities to SQLite tables and runs their queries through a callback database driver. Install the separate companion for your host and pass its `typeORMDriver` to a `DataSource` with `type: 'react-native'`. That string selects TypeORM's callback contract in either host. -## Install the separate adapter +| Host | Companion | SQLite adapter | +| ------------ | ----------------------------------- | --------------------------- | +| React Native | `react-native-nitro-sqlite-typeorm` | `react-native-nitro-sqlite` | +| NitroUI | `nitro-sqlite-typeorm` | `nitro-sqlite` | -The standalone `react-native-nitro-sqlite-typeorm` package uses Nitro SQLite 10.4.0 or later and TypeORM 1.1.2 or a compatible 1.x version as peer dependencies. If npm lists only the `0.0.0-stage` placeholder, use the [core 10.4.0 setup](/docs/integrations/orms#typeorm). Once an adapter release is available, install all three packages in your app: - -```sh -npm install react-native-nitro-sqlite-typeorm react-native-nitro-sqlite 'typeorm@^1.1.2' -``` - -Import the driver and its connection type from the adapter. Keep imports for direct SQLite operations, such as `open()`, in `react-native-nitro-sqlite`. - -```ts -import { - typeORMDriver, - type TypeOrmNitroSQLiteConnection, -} from 'react-native-nitro-sqlite-typeorm' -``` - -The standalone adapter shares core's callback implementation. Installing core alone no longer installs TypeORM. +Follow the [companion installation guide](/docs/integrations/orms#typeorm) and use TypeORM 1.1.2. Both SQLite package roots retain their TypeORM driver and connection type exports for compatibility, but those exports are deprecated. Import the driver and connection types from the companion for new code. ## Configure module resolution -Install the packages listed in [the TypeORM quick start](/docs/integrations/orms#typeorm). The example uses TypeORM 1.1.2. Its browser build uses static class blocks. Configure the Babel transform and these resolution changes before you initialize the data source. +### React Native + +Install `typeorm`, `react-native-nitro-sqlite`, `babel-plugin-module-resolver`, and `@babel/plugin-transform-class-static-block` in the app. The repository's working example uses TypeORM 1.1.2. Its browser build uses static class blocks, so the Babel transform is needed in addition to two resolution changes: 1. Expose `./package.json` in TypeORM's `exports` map. The repository keeps this as a persistent package patch: @@ -36,7 +26,7 @@ Install the packages listed in [the TypeORM quick start](/docs/integrations/orms ".": { ``` -2. In `babel.config.js`, point the `react-native-sqlite-storage` alias to the package you import `typeORMDriver` from. The example below uses the standalone adapter. For the core 10.4.0 setup, use `react-native-nitro-sqlite` as the alias target. +2. Alias the SQLite storage package name that TypeORM imports to Nitro SQLite in `babel.config.js`: ```js module.exports = { @@ -57,25 +47,63 @@ Install the packages listed in [the TypeORM quick start](/docs/integrations/orms Merge this plugin into your existing Babel configuration rather than replacing the rest of its plugins. +### NitroUI + +Use `nitro-sqlite-typeorm` with `nitro-sqlite` and TypeORM's browser build. The standalone example uses TypeORM 1.1.2 and prepares a browser bundle in `examples/nitro-ui/scripts/prepare-typeorm.mjs`. Its shared-source preparation redirects TypeORM imports to that bundle. This preserves TypeORM's browser mappings before the NitroUI bundler consumes it. + +The example also loads `reflect-metadata`, browser timers, and `Buffer` before the app. Follow `examples/nitro-ui/src/polyfills.ts` for that initialization. Its native startup and browser-bundle preparation are part of the example, not extra exports of the SQLite package. The React Native Babel configuration above does not apply to this host. + ## Create a DataSource -The [TypeORM quick start](/docs/integrations/orms#typeorm) uses `EntitySchema` and `synchronize: true` to create the table in a new example database. For an app with existing data, register bundled migration classes in `migrations`, leave `synchronize` off, and call `await dataSource.runMigrations()` after initialization. +The example below uses the React Native package. For NitroUI, import `typeORMDriver` from `nitro-sqlite-typeorm` and resolve the TypeORM import to your prepared browser bundle. The DataSource options and entity definitions are the same. -`database` becomes the connection's `name`. `location` is a directory relative to the [platform database root](/docs/guides/database-lifecycle#file-location-and-prepopulated-databases). Reuse the initialized data source while the app needs the database and call `await dataSource.destroy()` when its queries finish. +```ts +import { DataSource, EntitySchema } from 'typeorm' +import { typeORMDriver } from 'react-native-nitro-sqlite-typeorm' + +type Note = { id: number; title: string } + +const NoteEntity = new EntitySchema({ + name: 'Note', + columns: { + id: { type: Number, primary: true, generated: true }, + title: { type: String }, + }, +}) + +const dataSource = new DataSource({ + type: 'react-native', + database: 'notes.sqlite', + location: '.', + driver: typeORMDriver, + entities: [NoteEntity], + synchronize: true, +}) + +await dataSource.initialize() +const notes = dataSource.getRepository(NoteEntity) +await notes.save({ title: 'First note' }) +const saved = await notes.find() +await dataSource.destroy() +``` + +This small example uses `synchronize: true` to create the table. Choose your application's schema management before shipping. `database` becomes the connection's `name`; `location` is a directory relative to the [platform database root](/docs/guides/database-lifecycle#file-location-and-prepopulated-databases). ## Driver export -[`typeORMDriver`](/api/react-native-nitro-sqlite-typeorm/variables/typeORMDriver) has one public method, `openDatabase(options, ok, fail)`. The connection passed to `ok` and returned on success has the exported [`TypeOrmNitroSQLiteConnection`](/api/react-native-nitro-sqlite-typeorm/type-aliases/TypeOrmNitroSQLiteConnection) type. The `TypeORMDriver` alias below is used only on this page. +Both TypeORM companions export the `TypeOrmConnection` type. Use the companion for your host in the type import below. + +`typeORMDriver` has one public method, `openDatabase(options, ok, fail)`. The connection passed to `ok` and returned on success has the exported [`TypeOrmConnection`](/api/react-native-nitro-sqlite-typeorm/type-aliases/TypeOrmConnection) type. The `TypeORMDriver` alias below is used only on this page. ```ts -import type { TypeOrmNitroSQLiteConnection } from 'react-native-nitro-sqlite-typeorm' +import type { TypeOrmConnection } from 'react-native-nitro-sqlite-typeorm' type TypeORMDriver = { openDatabase( options: { name: string; location?: string; encryptionKey?: string }, - ok: (connection: TypeOrmNitroSQLiteConnection) => void, + ok: (connection: TypeOrmConnection) => void, fail: (message: string) => void, - ): TypeOrmNitroSQLiteConnection | null + ): TypeOrmConnection | null } ``` @@ -85,7 +113,7 @@ The failure callbacks for `openDatabase` and `executeSql` are typed to receive a ## Encrypt a TypeORM database -After building Nitro SQLite with licensed SEE, pass the key through the DataSource's `encryptionKey` option. TypeORM forwards it to `typeORMDriver.openDatabase`: +After building Nitro SQLite with licensed SEE, pass the key through the DataSource's `encryptionKey` option. TypeORM 1.1.2 forwards it to `typeORMDriver.openDatabase`: ```ts const dataSource = new DataSource({ diff --git a/docs/content/docs/integrations/vector-search.mdx b/docs/content/docs/integrations/vector-search.mdx index ed00ef93c..729e792c5 100644 --- a/docs/content/docs/integrations/vector-search.mdx +++ b/docs/content/docs/integrations/vector-search.mdx @@ -1,16 +1,42 @@ --- title: Vector search with sqlite-vec -description: Add vector search with the optional sqlite-vec package and its typed helpers. +description: Enable sqlite-vec for vector search in React Native or NitroUI. --- -Use `createVectorTable()` and `knnSearch()` from `react-native-nitro-sqlite-vec` to store vectors and find nearby matches. Vectors are numeric arrays, often called embeddings. The optional package adds sqlite-vec's `vec0` virtual tables to SQLite for those queries. +Vectors are numeric arrays, often called embeddings. The sqlite-vec extension adds `vec0` virtual tables to SQLite so you can store vectors and find nearby matches. Its SQL works in either host once the native extension is registered. See [supported platforms](/docs/supported-platforms). -## Enable vector search +Install the companion for your runtime. Both expose the same functions for creating vector tables and finding neighbors. -Install `react-native-nitro-sqlite-vec` alongside `react-native-nitro-sqlite`. Enable it for each platform you ship using the [iOS](/docs/configuration/ios#vector-search), [macOS](/docs/configuration/macos#apple-build-options), or [Android](/docs/configuration/android#vector-search) configuration page, then rebuild the native app. Expo projects add `react-native-nitro-sqlite-vec` to their app config's plugins instead; see [Expo configuration](/docs/configuration/expo#enable-vector-search). Check availability with `isVecAvailable(db)` before running vector queries. A JavaScript update alone cannot enable the extension. + + +## Enable vector search in React Native + +Install `react-native-nitro-sqlite-vec` alongside `react-native-nitro-sqlite`. Enable it for each platform you ship using the [iOS](/docs/configuration/ios#vector-search) or [Android](/docs/configuration/android#vector-search) configuration page, then rebuild the native app. Check availability with `isVecAvailable(db)` before running vector queries. A JavaScript update alone cannot enable the extension. + +Expo projects can enable Vec during prebuild with the [Vec config plugin](/docs/configuration/expo#enable-vector-search). For macOS, use the [10.x setup](/docs/configuration/macos#apple-build-options). + +## NitroUI + +Install the local `nitro-sqlite-vec` archive alongside the matching `nitro-sqlite` archive. The repository example uses a local file dependency for each package. Prepare and rebuild the native app after adding Vec, just as when [installing the SQLite adapter](/docs/nitro-ui). Vec links to the SQLite engine in the adapter. + +Call `registerVectorExtensions()` once at startup, before opening your first connection. Registration applies to connections opened afterward and lasts for the rest of the process. + +```ts +import { open } from 'nitro-sqlite' +import { registerVectorExtensions, vecVersion } from 'nitro-sqlite-vec' + +registerVectorExtensions() +const db = open({ name: 'vectors.sqlite' }) +console.log(vecVersion(db)) +db.close() +``` + + ## Create and search a vector table +The example below uses React Native imports. On NitroUI, import the same helpers from `nitro-sqlite-vec` and `open` from `nitro-sqlite` after registering the extension. + ```ts import { open } from 'react-native-nitro-sqlite' import { diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json index b4c1bb7b0..8b0929244 100644 --- a/docs/content/docs/meta.json +++ b/docs/content/docs/meta.json @@ -1,3 +1,12 @@ { - "pages": ["index", "concepts", "guides", "integrations", "configuration"] + "pages": [ + "index", + "supported-platforms", + "react-native", + "nitro-ui", + "concepts", + "guides", + "integrations", + "configuration" + ] } diff --git a/docs/content/docs/nitro-ui/first-query.mdx b/docs/content/docs/nitro-ui/first-query.mdx new file mode 100644 index 000000000..3cd8e38a4 --- /dev/null +++ b/docs/content/docs/nitro-ui/first-query.mdx @@ -0,0 +1,54 @@ +--- +title: Your first query +description: Create a SQLite table, save a note, and read it in a NitroUI app. +--- + +First, [install the NitroUI adapter and build the native app](/docs/nitro-ui). Run the following code once from app startup or an event handler. Keep database writes out of React render functions. + +SQLite stores rows in tables. A primary key identifies each row. The `?` placeholder binds a value separately from the SQL text. + +## Save and read a note + +```ts +import { open } from 'nitro-sqlite' + +const database = open({ name: 'notes.sqlite' }) + +try { + database.execute(` + CREATE TABLE IF NOT EXISTS notes ( + id INTEGER PRIMARY KEY, + body TEXT NOT NULL + ) + `) + database.execute( + 'INSERT INTO notes (id, body) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET body = excluded.body', + [1, 'My first note'], + ) + const { rows } = database.execute<{ id: number; body: string }>( + 'SELECT id, body FROM notes WHERE id = ?', + [1], + ) + console.log(rows._array) +} finally { + database.close() +} +``` + +The console prints: + +```json +[{ "id": 1, "body": "My first note" }] +``` + +`open()` creates the database file if needed. Repeating the example updates the row with ID `1`. `close()` releases the connection and keeps the database file. + +The row generic describes the TypeScript result. It does not validate values read from SQLite. Bind user supplied values as parameters, as the insert and select do here. + +## Continue with the shared API + +The shared guides use `react-native-nitro-sqlite` in their snippets. In a NitroUI app, import the same exports from `nitro-sqlite`. Use `nitro-sqlite/errors` for errors and `nitro-sqlite/mock` for the [Node test mock](/docs/guides/node-test-mock). + +Use [parameters and results](/docs/guides/parameters-and-results) for value conversion, [database lifecycle](/docs/guides/database-lifecycle) for file locations, and [sync and async](/docs/guides/sync-and-async) for work that should not block JavaScript. + +The [SQLite concepts](/docs/concepts/databases-and-connections) and [API reference](/api) apply to both adapters. Build and extension setup remains specific to your adapter. diff --git a/docs/content/docs/nitro-ui/index.mdx b/docs/content/docs/nitro-ui/index.mdx new file mode 100644 index 000000000..8068cc052 --- /dev/null +++ b/docs/content/docs/nitro-ui/index.mdx @@ -0,0 +1,87 @@ +--- +title: Install on NitroUI +description: Use the SQLite adapter in a NitroUI app on iOS and Android. +--- + +`nitro-sqlite` runs Nitro SQLite in NitroUI without React Native. The adapter opens SQLite files in the app's storage directory and exposes the [shared SQLite API](/api). + +This 11.0.0 pre-release source is not an npm release. Install the adapter from a source checkout or a locally packed archive using one of the paths below. + +## Requirements + +The adapter uses Nitro Core and Nitrogen `1.0.0-alpha.nightly.137.gd4793c40b8b8`. The example pins NitroUI SDK `0.2.0` and React `19.3.0`. Keep those versions together. React Native's Nitro bindings use a different version. + +For iOS, use Xcode with Swift 6.4 or newer. The adapter's Swift package declares iOS 16 or newer. Android uses the NitroUI host's native build requirements. See [supported platforms](/docs/supported-platforms) for the OS coverage. + +## Run the repository example + +Use a source checkout of this repository. The app at `examples/nitro-ui` has its own `package.json`, lockfile, and dependencies. It installs the SQLite adapter and its Vec and ORM companions from the local checkout. + +From the repository root, enter the example and install its dependencies with the Bun version pinned by the example's `packageManager` field: + +```sh +cd examples/nitro-ui +bun install --frozen-lockfile +``` + +Installation prepares the local adapter and the native app. The environment check verifies that the app uses one React instance, one Nitro Core instance, and the adapter's SQLite source and generated bindings. + +Start the JavaScript development server: + +```sh +bun run start +``` + +In a second terminal in `examples/nitro-ui`, build and launch the app for your device: + +```sh +bun run ios --device +# or +bun run android --device +``` + +The app opens the **NitroUI SQLite Example** home screen. Choose **SQL Console** to run queries against sample data, or **Unit Tests** to run the shared tests on the device. + +## Add the adapter to an existing app + +Use an existing NitroUI app with the compatible versions above. Build a local adapter archive from the source checkout. First install the repository's workspace dependencies, then run these commands from the repository root: + +```sh +cd packages/nitro-sqlite +bun run pack +``` + +The package's preparation step includes the TypeScript API, native implementation, bundled SQLite, and generated bindings in `nitro-sqlite-11.0.0.tgz`. It does not require the shared workspace package at runtime. + +From your NitroUI app directory, install that archive. Replace the path with the location of your checkout: + +```sh +bun add /path/to/checkout/packages/nitro-sqlite/nitro-sqlite-11.0.0.tgz +``` + +Prepare and rebuild the native app with the compatible NitroUI CLI: + +```sh +bunx nitro-ui prepare +bunx nitro-ui start +``` + +In a second terminal, launch your platform: + +```sh +bunx nitro-ui ios --device +# or +bunx nitro-ui android --device +``` + +Use your app's scripts instead when they perform these steps. A JavaScript reload alone cannot add the native adapter to an existing binary. + +## Storage and configuration + +iOS uses Documents by default. The [iOS storage settings](/docs/configuration/ios#database-location) also apply to this adapter, including `NitroSQLite_DatabaseLocation` and `NitroSQLite_AppGroup`. Android stores persistent databases in the app's files directory and temporary SQLite files in its cache directory. + +In the repository example, edit `native-settings.json` to change the iOS location or app group. Run `bun run prepare:native` from `examples/nitro-ui`, then rebuild. The [database lifecycle guide](/docs/guides/database-lifecycle) explains relative locations and file migration. + +The React Native `nitroSQLite` build settings do not configure this adapter. The NitroUI adapter bundles SQLite with thread safety and RTree enabled. Use the optional [Vec package](/docs/integrations/vector-search#nitro-ui) for vector search or the [Drizzle driver](/docs/integrations/orms/drizzle) to query with Drizzle ORM. + +Continue with [your first NitroUI query](/docs/nitro-ui/first-query). diff --git a/docs/content/docs/nitro-ui/meta.json b/docs/content/docs/nitro-ui/meta.json new file mode 100644 index 000000000..648e369d1 --- /dev/null +++ b/docs/content/docs/nitro-ui/meta.json @@ -0,0 +1,4 @@ +{ + "title": "NitroUI", + "pages": ["index", "first-query"] +} diff --git a/docs/content/docs/react-native/first-query.mdx b/docs/content/docs/react-native/first-query.mdx new file mode 100644 index 000000000..fcaa54444 --- /dev/null +++ b/docs/content/docs/react-native/first-query.mdx @@ -0,0 +1,52 @@ +--- +title: Your first query +description: Create a SQLite table, save a note, and read it in a React Native app. +--- + +First, [install Nitro SQLite and build the native app](/docs/react-native). Run the following code once from app startup or an event handler. Keep database writes out of React render functions. + +SQLite stores rows in tables. A primary key identifies each row. The `?` placeholder binds a value separately from the SQL text. + +## Save and read a note + +```ts +import { open } from 'react-native-nitro-sqlite' + +const database = open({ name: 'notes.sqlite' }) + +try { + database.execute(` + CREATE TABLE IF NOT EXISTS notes ( + id INTEGER PRIMARY KEY, + body TEXT NOT NULL + ) + `) + database.execute( + 'INSERT INTO notes (id, body) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET body = excluded.body', + [1, 'My first note'], + ) + const { rows } = database.execute<{ id: number; body: string }>( + 'SELECT id, body FROM notes WHERE id = ?', + [1], + ) + console.log(rows._array) +} finally { + database.close() +} +``` + +The console prints: + +```json +[{ "id": 1, "body": "My first note" }] +``` + +`open()` creates the database file if needed. Repeating the example updates the row with ID `1`. `close()` releases the connection and keeps the database file. + +The row generic describes the TypeScript result. It does not validate values read from SQLite. Bind user supplied values as parameters, as the insert and select do here. + +## Keep using the same API + +Use [parameters and results](/docs/guides/parameters-and-results) for value conversion, [database lifecycle](/docs/guides/database-lifecycle) for file locations, and [sync and async](/docs/guides/sync-and-async) for work that should not block JavaScript. + +The [SQLite concepts](/docs/concepts/databases-and-connections) explain the database model. The [API reference](/api) lists the shared connection methods and types. diff --git a/docs/content/docs/react-native/index.mdx b/docs/content/docs/react-native/index.mdx new file mode 100644 index 000000000..7783a71da --- /dev/null +++ b/docs/content/docs/react-native/index.mdx @@ -0,0 +1,63 @@ +--- +title: Install on React Native +description: Install Nitro SQLite in a React Native or Expo native app on iOS and Android. +--- + +This guide adds `react-native-nitro-sqlite` to a React Native app. The native module opens SQLite files inside the app's storage directory. After installation, [run your first query](/docs/react-native/first-query). + +Published React Native releases remain available, including 10.x and the `nitro-v1` prereleases. The instructions below install this source checkout from local archives. Its React Native package versions remain provisional. Use the documentation for your installed release when staying on an existing version. + +## Requirements + +Use React Native 0.88 or newer with the New Architecture. Nitro V1 iOS builds require Xcode with Swift 6.4 or newer. Your app's platform requirements can exceed Nitro SQLite's iOS 16 minimum. + +The instructions below cover iOS and Android. For the legacy macOS example and the visionOS declaration, see [supported platforms](/docs/supported-platforms). + +## 1. Install the packages + +To try the Nitro V1 source in this checkout, first build the SQLite archive from a source checkout with workspace dependencies installed: + +```sh +cd packages/react-native-nitro-sqlite +bun run pack +``` + +The packing step prints the archive filename with its recorded package version. Replace `VERSION` below with that version. Install it in your app with the Nitro Modules version used by its generated bindings: + +```sh +npm install /path/to/react-native-nitro-sqlite-VERSION.tgz react-native-nitro-modules@1.0.0-alpha.nightly.138.g43e09c161101 +``` + +Existing apps that use an earlier Nitro SQLite release can follow the [Nitro V1 migration guide](/docs/guides/migrate-to-nitro-v1). + +## 2. Set up the native project + +On iOS, set an explicit deployment target for each app build configuration. Follow the [Swift Package Manager setup](/docs/configuration/ios#set-up-swift-package-manager), including the steps for apps that also use CocoaPods. + +Android needs no additional Nitro SQLite configuration for the default setup. The [configuration pages](/docs/configuration) cover build options and platform storage settings. + +## 3. Build the native app + +An existing binary cannot load a native module added only to JavaScript. In a standard React Native CLI project, build the app for your platform: + +```sh +npm run ios +# or +npm run android +``` + +If the app uses different scripts, run its equivalent native build. + +### Expo native builds + +Use an Expo SDK whose native app meets the React Native and Nitro requirements above. Expo Go cannot load this native module. Follow the [Expo configuration guide](/docs/configuration/expo#generate-and-rebuild) to generate the native project and configure Swift Package Manager on iOS. Build the development app for your platform: + +```sh +npx expo run:ios +# or +npx expo run:android +``` + +## 4. Run a query + +Continue with [your first React Native query](/docs/react-native/first-query). It creates a table, saves a note, and reads the note back. diff --git a/docs/content/docs/react-native/meta.json b/docs/content/docs/react-native/meta.json new file mode 100644 index 000000000..19eb622a6 --- /dev/null +++ b/docs/content/docs/react-native/meta.json @@ -0,0 +1,4 @@ +{ + "title": "React Native", + "pages": ["index", "first-query"] +} diff --git a/docs/content/docs/supported-platforms.mdx b/docs/content/docs/supported-platforms.mdx new file mode 100644 index 000000000..427c8d7ee --- /dev/null +++ b/docs/content/docs/supported-platforms.mdx @@ -0,0 +1,46 @@ +--- +title: Supported platforms +description: React Native and NitroUI packages, version requirements, and OS coverage. +--- + +Nitro SQLite is a Nitro library for React Native and NitroUI. Choose the package for your app. Both packages use the same SQLite engine and TypeScript API. + +| Runtime | Package | Installation | Usage | +| ------------ | --------------------------- | --------------------------------------------- | --------------------------------------------------- | +| React Native | `react-native-nitro-sqlite` | [Install on React Native](/docs/react-native) | [Run a first query](/docs/react-native/first-query) | +| NitroUI | `nitro-sqlite` | [Install on NitroUI](/docs/nitro-ui) | [Run a first query](/docs/nitro-ui/first-query) | + +## Operating systems + +| OS | React Native | NitroUI | +| -------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| iOS | Supported. The SQLite package requires iOS 16 or newer. | Supported. The SQLite package requires iOS 16 or newer. | +| Android | Supported. Use the Android minimum required by React Native and your app. | Supported. Use the Android minimum required by NitroUI and your app. | +| macOS | Use Nitro SQLite 10.x with Nitro Modules 0.37.2. [macOS compatibility](/docs/configuration/macos) | No documented build or example. | +| visionOS | Use Nitro SQLite 10.x with Nitro Modules 0.37.2. | No documented build or example. | + +The library includes no native adapter for Windows or the web in this release. The [Node test mock](/docs/guides/node-test-mock) uses `better-sqlite3` for tests. + +## Runtime requirements + +React Native requires version 0.88 or newer with the New Architecture. Its SQLite adapter uses Nitro Modules, Nitro Core, and Nitrogen `1.0.0-alpha.nightly.138.g43e09c161101`. + +The NitroUI example uses SDK `0.2.0`. Its adapter uses Nitro Core and Nitrogen `1.0.0-alpha.nightly.137.gd4793c40b8b8`. Each package ships the bindings for its own runtime. + +## Shared API and platform-specific configuration + +Both adapters expose `open()`, managed connections, sync and async queries, batches, transactions, prepared statements, and errors. The TypeORM driver now has a separate companion package; its SQLite-root export remains available with a deprecation notice. See the [shared API reference](/api) and [SQLite concepts](/docs/concepts/databases-and-connections). + +## Optional integrations + +| Integration | React Native | NitroUI | +| ------------------------------------------------- | ------------------------------------- | ------------------------ | +| [Drizzle ORM](/docs/integrations/orms/drizzle) | `react-native-nitro-sqlite-drizzle` | `nitro-sqlite-drizzle` | +| [Vector search](/docs/integrations/vector-search) | `react-native-nitro-sqlite-vec` | `nitro-sqlite-vec` | +| [TypeORM](/docs/integrations/orms/typeorm) | `react-native-nitro-sqlite-typeorm` | `nitro-sqlite-typeorm` | +| [MikroORM](/docs/integrations/orms/mikro-orm) | `react-native-nitro-sqlite-mikro-orm` | `nitro-sqlite-mikro-orm` | +| [Kysely](/docs/integrations/orms/kysely) | `react-native-nitro-sqlite-kysely` | `nitro-sqlite-kysely` | + +Each companion works with the SQLite adapter for the same runtime. React Native uses [native build settings](/docs/configuration) to enable vector search. NitroUI apps install the Vec companion and register the extension before opening a database. + +The [ORM setup guide](/docs/integrations/orms) explains how to build and install these local companion archives. No public companion release is assumed. diff --git a/docs/next.config.mjs b/docs/next.config.mjs index bfbca99fd..896cad506 100644 --- a/docs/next.config.mjs +++ b/docs/next.config.mjs @@ -1,21 +1,28 @@ import { createMDX } from 'fumadocs-mdx/next' +import { gitRevision, repositoryUrl } from './site-repository.mjs' const withMDX = createMDX() /** @type {import('next').NextConfig} */ const config = { reactStrictMode: true, + env: { + NEXT_PUBLIC_DOCS_REPOSITORY_URL: repositoryUrl, + NEXT_PUBLIC_DOCS_GIT_REVISION: gitRevision, + }, turbopack: { root: process.cwd() }, async redirects() { return [ - ...['/docs/integrations', '/markdown/docs/integrations'].flatMap((base) => [ - { source: base, destination: `${base}/orms`, permanent: true }, - { - source: `${base}/:library(drizzle|typeorm|mikro-orm|kysely)`, - destination: `${base}/orms/:library`, - permanent: true, - }, - ]), + ...['/docs/integrations', '/markdown/docs/integrations'].flatMap( + (base) => [ + { source: base, destination: `${base}/orms`, permanent: true }, + { + source: `${base}/:library(drizzle|typeorm|mikro-orm|kysely)`, + destination: `${base}/orms/:library`, + permanent: true, + }, + ], + ), { source: '/docs/configuration/common', destination: '/docs/configuration', diff --git a/docs/package.json b/docs/package.json index cc79a9edb..22c07adbb 100644 --- a/docs/package.json +++ b/docs/package.json @@ -7,7 +7,7 @@ "node": ">=22.13.0" }, "scripts": { - "generate:api": "typedoc && node scripts/check-api.mjs", + "generate:api": "bun run --cwd .. prepare && bun run --cwd ../packages/nitro-sqlite specs && bun run --cwd ../packages/integrations/nitro-ui/vec specs && typedoc --options typedoc.config.mjs && node scripts/check-api.mjs", "dev": "bun run generate:api && fumadocs-mdx && next dev --webpack", "build": "bun run generate:api && fumadocs-mdx && next build --webpack", "start": "next start", diff --git a/docs/public/llms.txt b/docs/public/llms.txt index fdb263cf4..29e94f8cb 100644 --- a/docs/public/llms.txt +++ b/docs/public/llms.txt @@ -1,11 +1,19 @@ -# NitroSQLite +# Nitro SQLite -> SQLite for React Native on iOS and Android, built with Nitro Modules. +> Nitro SQLite is a Nitro library for React Native and NitroUI. Both packages expose the same TypeScript API for working with SQLite. ## Documentation -- [Getting started](https://sqlite.margelo.com/docs): Installation, native setup, and a first query. -- [API reference](https://sqlite.margelo.com/docs/api): Public methods and types. +- [Supported platforms](/docs/supported-platforms) lists runtime versions and operating systems. +- [React Native](/docs/react-native) covers installing react-native-nitro-sqlite and running a first query. +- [NitroUI](/docs/nitro-ui) covers installing nitro-sqlite from the checkout and running a first query. +- [Shared API reference](/api) documents methods and types. +- [AI coding agents](/docs/guides/ai-agents) explains what to check in generated SQLite code. +- [NitroSQLite skill](https://github.com/margelo/react-native-skills/blob/main/skills/react-native-nitro-sqlite/SKILL.md) covers React Native usage and migration. + +- [ORMs and query builders](/docs/integrations/orms) lists local companion installation for both hosts. +- [Kysely](/docs/integrations/orms/kysely) covers typed queries, transaction leases, and migrations. +- [MikroORM](/docs/integrations/orms/mikro-orm) covers entities, bundler setup, and SQL dumps. +- [TypeORM](/docs/integrations/orms/typeorm) covers the separate companion and deprecated SQLite-root import. +- [Expo configuration](/docs/configuration/expo) covers config plugins and native builds. - [Migrate from react-native-quick-sqlite](https://sqlite.margelo.com/docs/guides/migrate-from-quick-sqlite): `react-native-quick-sqlite` is deprecated and NitroSQLite is its successor. Covers the package swap, connection API changes, and keeping existing database files. -- [AI coding agents](https://sqlite.margelo.com/docs/guides/ai-agents): Skill link and checks for generated code. -- [NitroSQLite skill](https://github.com/margelo/react-native-skills/blob/main/skills/react-native-nitro-sqlite/SKILL.md): Task-specific guidance and references. diff --git a/docs/releases/README.md b/docs/releases/README.md index f3a7e8447..08f67ec76 100644 --- a/docs/releases/README.md +++ b/docs/releases/README.md @@ -6,11 +6,13 @@ To choose the version yourself, release a maintenance branch, or release without Open the **Release** workflow in GitHub Actions, select **Run workflow**, and choose the branch containing the changes to release. The same flow supports main and any maintenance or release branch that contains the release automation. -Set **version** to `patch`, `minor`, `major`, `prerelease`, or an exact version such as `11.0.0` or `11.0.0-beta.0`. The workflow resolves the version from the selected branch and existing tags. Both packages, the workspace, and the example keep the same version. Existing patch tags from the same version line prevent accidental reuse across sibling branches. +Set **version** to `patch`, `minor`, `major`, `prerelease`, or an exact version such as `11.0.0` or `11.0.0-beta.0`. The workflow resolves the version from the selected branch and existing tags. The six React Native packages, the workspace, and the React Native example keep the same version. Existing patch tags from the same version line prevent accidental reuse across sibling branches. The workflow creates or updates a Release Please PR against that branch, regenerates the workspace and CocoaPods lockfiles, and commits the generated files through GitHub's signed commit API. It waits for the usual PR checks and merges when GitHub permits the merge. Required reviews and branch protection still apply. No manually prepared version commit or separate publishing trigger is needed. -After merging, Release Please creates a draft release and its tag at the merge commit. The workflow validates and builds both packages, checks both npm trusted publishers, and publishes with provenance. It attaches the Android example APK before publishing the GitHub announcement. +After merging, Release Please creates a draft release and its tag at the merge commit. The workflow validates and builds the six React Native packages, checks their npm trusted publishers, and publishes with provenance. It attaches the Android example APK before publishing the GitHub announcement. + +The NitroUI package family is excluded from this workflow. Its publication requires separate maintainer approval and is disabled by default. Local archive builds do not publish packages or create release tags. ## Announcements and changelog @@ -32,7 +34,7 @@ Start a channel by releasing its branch with an exact version, such as `11.0.0-n Configure a `RELEASE_PLEASE_TOKEN` repository secret with a fine-grained personal access token that can write repository contents, pull requests, and issues. Include workflows write access for release branches whose workflows differ from the default branch. The token must be allowed to create and merge release PRs subject to the repository's normal rules. A token separate from the workflow's built-in token makes automated commits trigger the usual CI checks. -During migration, the existing `RELEASE_IT_GITHUB_TOKEN` secret is accepted as a fallback with the same permissions. No npm publishing token is needed. Both npm packages retain their trusted publisher for `margelo/react-native-nitro-sqlite`, workflow `release.yml`, with no environment. +During migration, the existing `RELEASE_IT_GITHUB_TOKEN` secret is accepted as a fallback with the same permissions. No npm publishing token is needed. All six React Native packages require a trusted publisher for `margelo/react-native-nitro-sqlite`, workflow `release.yml`, with no environment. ## Recovering a failed release diff --git a/docs/releases/v11.0.0.md b/docs/releases/v11.0.0.md new file mode 100644 index 000000000..d700b337b --- /dev/null +++ b/docs/releases/v11.0.0.md @@ -0,0 +1,13 @@ +Nitro SQLite 11.0.0 moves its native bindings to Nitro V1. React Native apps need React Native 0.88 or newer with the New Architecture. iOS builds require iOS 16.0 or later, Swift Package Manager, and Xcode with Swift 6.4 or newer. + +NitroUI apps use `nitro-sqlite` on iOS and Android. Each runtime has its own optional Vec, Drizzle, Kysely, MikroORM, and TypeORM packages. See [supported platforms](../content/docs/supported-platforms.mdx) for package names and setup. + +## Upgrade your React Native app + +This document describes the planned Nitro V1 release. This checkout keeps React Native release metadata at its provisional public versions. Build and install the adapter's local archive using the [React Native installation guide](../content/docs/react-native/index.mdx). + +For vector search or an ORM, build the matching companion archives using the [integration guide](../content/docs/integrations/orms/index.mdx). Published React Native 10.x releases and `nitro-v1` prereleases remain separate installation options. + +Set a literal iOS deployment target in every app build configuration before updating Swift Package Manager. Follow the [React Native SwiftPM setup](https://sqlite.margelo.com/docs/configuration/ios#set-up-swift-package-manager) or the [Expo prebuild setup](https://sqlite.margelo.com/docs/configuration/expo#generate-and-rebuild), then rebuild your native app. + +TypeScript exports such as `NitroSQLiteConnection` and `NitroSQLiteError` have shorter names, `Connection` and `SQLiteError`. The old names remain available as deprecated aliases. See the [Nitro V1 migration guide](../content/docs/guides/migrate-to-nitro-v1.mdx) for the replacement names and native header changes. diff --git a/docs/scripts/check-api.mjs b/docs/scripts/check-api.mjs index fca4b8930..97a1c684f 100644 --- a/docs/scripts/check-api.mjs +++ b/docs/scripts/check-api.mjs @@ -1,5 +1,12 @@ import assert from 'node:assert/strict' import { existsSync, readFileSync, readdirSync } from 'node:fs' +import { + gitRevision, + repositoryUrl, + resolveSourcePath, +} from '../site-repository.mjs' + +const sourcePrefix = `${repositoryUrl}/blob/${gitRevision}/` const api = JSON.parse( readFileSync( @@ -19,13 +26,44 @@ const deprecatedExports = [ 'NitroSQLiteNative', 'NitroSQLiteError', 'NitroSQLiteExceptionType', - 'TypeOrmNitroSQLiteConnection', ] +const drizzleExports = [ + 'drizzle', + 'migrate', + 'useMigrations', + 'NitroSQLiteDatabase', + 'MigrationConfig', + 'MigrationState', +] + +const ormExports = Object.fromEntries( + ['react-native-nitro-sqlite', 'nitro-sqlite'].flatMap((host) => [ + [ + `${host}-kysely`, + [ + 'createNitroSQLiteDialect', + 'openNitroSQLiteExecutor', + 'NitroSQLiteDialectOptions', + ], + ], + [`${host}-mikro-orm`, ['NitroSQLiteDriver', 'NitroSQLiteDriverOptions']], + [ + `${host}-typeorm`, + ['typeORMDriver', 'TypeOrmConnection', 'TypeOrmNitroSQLiteConnection'], + ], + ]), +) + const requiredExports = { - 'react-native-nitro-sqlite-typeorm': [ - 'typeORMDriver', - 'TypeOrmNitroSQLiteConnection', + ...ormExports, + 'nitro-sqlite-drizzle': drizzleExports, + 'nitro-sqlite-vec': [ + 'registerVectorExtensions', + 'createVectorTable', + 'knnSearch', + 'isVecAvailable', + 'vecVersion', ], 'react-native-nitro-sqlite/plugin': [ 'default', @@ -46,6 +84,7 @@ const requiredExports = { 'NativeSQLite', 'NativePreparedStatement', 'NativeQueryResult', + 'NativeQueryResultBinding', 'NativeQueryRows', 'NativeRawQueryResult', 'NitroSQLiteRawQueryResult', @@ -53,6 +92,7 @@ const requiredExports = { 'QueryResultRows', 'QueryColumnMetadata', 'TypeOrmConnection', + 'TypeOrmNitroSQLiteConnection', 'typeORMDriver', ...deprecatedExports, ], @@ -96,6 +136,8 @@ const requiredExports = { ], } +requiredExports['nitro-sqlite'] = requiredExports['react-native-nitro-sqlite'] + for (const [packageName, exports] of Object.entries(requiredExports)) { const packageReflection = api.children?.find( (child) => child.name === packageName, @@ -131,13 +173,22 @@ const requiredMembers = { 'transaction', 'execute', 'executeAsync', + 'executeRaw', + 'executeRawAsync', 'executeBatch', 'executeBatchAsync', 'loadFile', 'loadFileAsync', ], ConnectionOptions: ['encryptionKey'], - Transaction: ['commit', 'rollback', 'execute', 'executeAsync'], + Transaction: [ + 'commit', + 'rollback', + 'execute', + 'executeAsync', + 'executeRaw', + 'executeRawAsync', + ], SQLiteError: ['type', 'fromError'], NativeSQLite: [ 'open', @@ -148,6 +199,8 @@ const requiredMembers = { 'detach', 'execute', 'executeAsync', + 'executeRaw', + 'executeRawAsync', 'executeBatch', 'executeBatchAsync', 'loadFile', @@ -227,7 +280,7 @@ for (const page of pages) { ) assert.match( content, - /\*\*Source files:\*\* \[(?:TypeScript|JavaScript|C\+\+|C|Kotlin|Swift)\]\(https:\/\/github\.com\/margelo\/react-native-nitro-sqlite\/blob\/[^)]+\)/, + /\*\*Source files:\*\* \[(?:TypeScript|JavaScript|C\+\+|C|Kotlin|Swift)\]\(https:\/\/github\.com\/[^/]+\/[^/]+\/blob\/[^)]+\)/, `Missing language-labeled source link: ${page}`, ) assert.match( @@ -237,14 +290,30 @@ for (const page of pages) { ) } + for (const [sourceLine] of content.matchAll( + /^(?:\*\*Source files:\*\*|Defined in:).+$/gm, + )) { + for (const [, href] of sourceLine.matchAll(/\]\(([^)]+)\)/g)) { + assert.ok( + href.startsWith(sourcePrefix), + `Source link uses another repository or revision in ${page}: ${href}`, + ) + } + } + const route = page.endsWith('index.mdx') ? `/api/${page.slice(0, -'/index.mdx'.length)}`.replace(/\/$/, '') : `/api/${page.slice(0, -4)}` for (const [, href] of content.matchAll(/\]\(([^)\s]+)\)/g)) { - const sourcePath = href.match( - /^https:\/\/github\.com\/margelo\/react-native-nitro-sqlite\/blob\/[^/]+\/(packages\/[^#]+)#L\d+$/, - )?.[1] - if (sourcePath?.startsWith('packages/react-native-nitro-sqlite-typeorm/')) { + if (href.startsWith(sourcePrefix)) { + const sourcePath = decodeURIComponent( + href.slice(sourcePrefix.length).split('#')[0], + ) + assert.equal( + resolveSourcePath(sourcePath), + sourcePath, + `API source link points to materialized output: ${sourcePath}`, + ) assert.ok( existsSync(new URL(`../../${sourcePath}`, import.meta.url)), `Missing source file in ${page}: ${href}`, @@ -287,6 +356,27 @@ for (const page of pages) { } } +for (const host of ['react-native-nitro-sqlite', 'nitro-sqlite']) { + const nativeResultLink = `[\`NativeQueryResultBinding\`](/api/${host}/type-aliases/NativeQueryResultBinding)` + for (const name of ['NativeSQLite', 'NativePreparedStatement']) { + const page = `${host}/hybrid-objects/${name}.mdx` + const content = readFileSync(new URL(page, output), 'utf8') + for (const method of ['execute', 'executeAsync']) { + const returnType = + method === 'executeAsync' + ? `\`Promise\`<${nativeResultLink}>` + : nativeResultLink + const signature = content + .split('\n') + .find((line) => line.startsWith(`**${method}**`)) + assert.ok( + signature?.endsWith(`: ${returnType}`), + `Missing linked return signature: ${host}.${name}.${method}`, + ) + } + } +} + const corePackageHome = readFileSync( new URL('react-native-nitro-sqlite/index.mdx', output), 'utf8', @@ -334,6 +424,18 @@ for (const name of deprecatedExports) { `Missing rendered replacement link: ${name}`, ) } +for (const name of [ + 'TypeOrmConnection', + 'TypeOrmNitroSQLiteConnection', + 'typeORMDriver', +]) { + const legacy = corePackage.children.find((child) => child.name === name) + assert.ok( + legacy?.comment?.blockTags?.some((tag) => tag.tag === '@deprecated'), + `Missing TypeORM core deprecation: ${name}`, + ) +} + assert.ok( corePackageHome.indexOf('## Hybrid Objects') < corePackageHome.indexOf('## Classes'), diff --git a/docs/site-repository.mjs b/docs/site-repository.mjs new file mode 100644 index 000000000..4a9e1e542 --- /dev/null +++ b/docs/site-repository.mjs @@ -0,0 +1,63 @@ +import { execFileSync } from 'node:child_process' +import { existsSync } from 'node:fs' +import { fileURLToPath } from 'node:url' + +export const repositoryDirectory = fileURLToPath(new URL('..', import.meta.url)) +const { VERCEL_GIT_REPO_OWNER, VERCEL_GIT_REPO_SLUG } = process.env +const repositorySlug = + VERCEL_GIT_REPO_OWNER && VERCEL_GIT_REPO_SLUG + ? `${VERCEL_GIT_REPO_OWNER}/${VERCEL_GIT_REPO_SLUG}` + : getCheckoutSlug() +export const repositoryUrl = `https://github.com/${repositorySlug}` + +function getCheckoutSlug() { + const remote = execFileSync('git', ['remote', 'get-url', 'origin'], { + cwd: repositoryDirectory, + encoding: 'utf8', + }).trim() + const slug = remote.match( + /(?:^|[@/])github\.com[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?\/?$/i, + )?.[1] + if (!slug) + throw new Error( + 'Set a GitHub origin or supply the Vercel repository owner and name to build source links.', + ) + return slug +} + +export const gitRevision = + process.env.VERCEL_GIT_COMMIT_SHA ?? + execFileSync('git', ['rev-parse', 'HEAD'], { + cwd: repositoryDirectory, + encoding: 'utf8', + }).trim() + +export function getRepositorySourceUrl(path, line) { + return `${repositoryUrl}/blob/${gitRevision}/${resolveSourcePath(path)}${line ? `#L${line}` : ''}` +} + +export function resolveSourcePath(path) { + const ormSource = path.match( + /^packages\/integrations\/(?:react-native|nitro-ui)\/(kysely|mikro-orm)\/src\/(.+)$/, + ) + if (ormSource) return `shared/orm/${ormSource[1]}/${ormSource[2]}` + const driverSource = path.match( + /^packages\/integrations\/(?:react-native|nitro-ui)\/drizzle\/(src\/.+)$/, + ) + if (driverSource) + return `packages/nitro-sqlite-drizzle-core/${driverSource[1]}` + if (path === 'packages/integrations/nitro-ui/vec/src/helpers.ts') { + return 'packages/integrations/react-native/vec/src/index.ts' + } + const adapterSource = path.match( + /^packages\/(react-native-nitro-sqlite|nitro-sqlite)\/((?:src|cpp)\/.+)$/, + ) + if (!adapterSource) return path + + const [, packageName, sourcePath] = adapterSource + const platformPath = `packages/${packageName}/platform/${sourcePath}` + if (existsSync(new URL(`../${platformPath}`, import.meta.url))) + return platformPath + + return `packages/nitro-sqlite-core/${sourcePath}` +} diff --git a/docs/src/app/(content)/api/[[...slug]]/page.tsx b/docs/src/app/(content)/api/[[...slug]]/page.tsx index 26a252f39..1b5f39091 100644 --- a/docs/src/app/(content)/api/[[...slug]]/page.tsx +++ b/docs/src/app/(content)/api/[[...slug]]/page.tsx @@ -27,7 +27,7 @@ export default async function Page({ params }: Props) { const toc = page.data.toc?.filter((item) => item.depth <= 3) const rawMarkdown = await page.data.getText('raw') const sourceLink = rawMarkdown.match( - /\*\*Source files:\*\* \[[^\]]+\]\((https:\/\/github\.com\/margelo\/react-native-nitro-sqlite\/blob\/[^)]+)\)/, + /\*\*Source files:\*\* \[[^\]]+\]\((https:\/\/github\.com\/[^/]+\/[^/]+\/blob\/[^)]+)\)/, )?.[1] const actions = ( }} > {isOverview && {page.data.title}} - {isOverview && {page.data.description}} + {isOverview && ( + + {page.data.description} + + )} {isOverview && actions} }} > {page.data.title} - {page.data.description} + + {page.data.description} + - + ) diff --git a/docs/src/app/(home)/DatabaseIllustration.tsx b/docs/src/app/(home)/DatabaseIllustration.tsx index 50b9fd2c7..9b2292b16 100644 --- a/docs/src/app/(home)/DatabaseIllustration.tsx +++ b/docs/src/app/(home)/DatabaseIllustration.tsx @@ -26,19 +26,37 @@ export function DatabaseIllustration() { const onPointerMove = (event: PointerEvent) => { if (mobile.matches || reducedMotion.matches) return - const x = Math.max(-1, Math.min(1, event.clientX / window.innerWidth * 2 - 1)) - const y = Math.max(-1, Math.min(1, event.clientY / window.innerHeight * 2 - 1)) + const x = Math.max( + -1, + Math.min(1, (event.clientX / window.innerWidth) * 2 - 1), + ) + const y = Math.max( + -1, + Math.min(1, (event.clientY / window.innerHeight) * 2 - 1), + ) setPosition(x, y, (y + 1) / 2) } - const onPointerLeave = () => { if (!mobile.matches) setPosition(0, 0, 0.35) } + const onPointerLeave = () => { + if (!mobile.matches) setPosition(0, 0, 0.35) + } const onScroll = () => { if (!mobile.matches || reducedMotion.matches) return cancelAnimationFrame(frame) frame = requestAnimationFrame(() => { const bounds = scene.getBoundingClientRect() - const progress = Math.max(0, Math.min(1, (window.innerHeight - bounds.top) / (window.innerHeight + bounds.height))) + const progress = Math.max( + 0, + Math.min( + 1, + (window.innerHeight - bounds.top) / + (window.innerHeight + bounds.height), + ), + ) scene.style.setProperty('--scene-x', '0') - scene.style.setProperty('--scene-y', ((progress - 0.5) * 1.3).toFixed(3)) + scene.style.setProperty( + '--scene-y', + ((progress - 0.5) * 1.3).toFixed(3), + ) scene.style.setProperty('--scene-progress', progress.toFixed(3)) }) } @@ -59,43 +77,84 @@ export function DatabaseIllustration() { }, []) return ( -
-