diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44ad266d..6e98d3f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,8 @@ jobs: if: steps.select.outputs.cpp_tests == 'true' run: bash scripts/test-cpp.sh - name: Test SQLite thread-safety pod configuration - if: steps.select.outputs.ios == 'true' + # Paused because Nitro V1 doesn't generate the CocoaPods files that the podspec loads. + if: false && steps.select.outputs.ios == 'true' run: ruby scripts/test-podspec-threadsafe.rb - name: Check documentation if: steps.select.outputs.docs == 'true' @@ -149,7 +150,9 @@ jobs: lockfiles: name: Native lockfiles needs: checks + # Paused because Nitro V1 doesn't support CocoaPods. Remove `false &&` to resume it. if: >- + false && github.event_name != 'push' && !github.event.pull_request.draft && (needs.checks.outputs.ios_pods == 'true' || needs.checks.outputs.macos_pods == 'true') uses: ./.github/workflows/update-lockfiles.yml @@ -173,7 +176,10 @@ jobs: ios: name: iOS needs: [checks, lockfiles] + # Paused because Nitro V1 builds iOS with Swift Package Manager, which this workflow doesn't set up yet. + # Remove `false &&` to resume it. if: >- + false && !cancelled() && needs.checks.result == 'success' && (needs.lockfiles.result == 'success' || needs.lockfiles.result == 'skipped') && github.event_name != 'push' && !github.event.pull_request.draft && @@ -185,7 +191,9 @@ jobs: macos: name: macOS needs: [checks, lockfiles] + # Paused until Nitro V1 supports React Native macOS. Remove `false &&` to resume it. if: >- + false && !cancelled() && needs.checks.result == 'success' && (needs.lockfiles.result == 'success' || needs.lockfiles.result == 'skipped') && github.event_name != 'push' && !github.event.pull_request.draft && diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 193d3b4f..049ea598 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,14 +94,18 @@ jobs: bun run sync:lockfile bun run check:lockfile bun install --frozen-lockfile + # The CocoaPods steps are paused because Nitro V1 doesn't support CocoaPods. - uses: ruby/setup-ruby@v1 + if: false with: ruby-version: 3.3.0 bundler-cache: true working-directory: example - name: Select Xcode + if: false run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer" - name: Update iOS and macOS lockfiles + if: false run: | bun example pods bun example pods:macos diff --git a/bun.lock b/bun.lock index 14a30440..80f234f3 100644 --- a/bun.lock +++ b/bun.lock @@ -7,7 +7,7 @@ "patch-package": "^8.0.0", "react": "19.3.1", "react-native": "0.88.0", - "react-native-nitro-modules": "0.37.1", + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041", }, "devDependencies": { "@babel/core": "^7.28.5", @@ -33,7 +33,7 @@ "eslint-plugin-prettier": "^5.5.4", "jest": "^30.2.0", "jsonc-parser": "^3.3.1", - "nitrogen": "0.37.1", + "nitrogen": "1.0.0-alpha.nightly.86.g15e19db42041", "prettier": "^3.6.2", "release-please": "17.6.0", "typeorm": "1.1.1", @@ -81,7 +81,7 @@ "expo-status-bar": "^1.12.1", "react": "19.3.1", "react-native": "0.88.0", - "react-native-nitro-modules": "*", + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041", "react-native-nitro-sqlite": "10.2.0", "react-native-nitro-sqlite-vec": "10.2.0", "react-native-safe-area-context": "^5.10.1", @@ -165,20 +165,21 @@ "@types/better-sqlite3": "^9.6.0", "better-sqlite3": "^12.11.1", "jest": "^30.2.0", - "nitrogen": "0.37.1", + "nitrogen": "1.0.0-alpha.nightly.86.g15e19db42041", "react": "19.3.1", "react-native": "0.88.0", "react-native-builder-bob": "^0.31.0", - "react-native-nitro-modules": "0.37.1", + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041", }, "peerDependencies": { "better-sqlite3": "^12.11.1", "react": ">=17.0.0", - "react-native": ">=0.75.0", - "react-native-nitro-modules": ">=0.35.0", + "react-native": ">=0.88.0", + "react-native-nitro-modules": "*", }, "optionalPeers": [ "better-sqlite3", + "react-native-nitro-modules", ], }, "packages/react-native-nitro-sqlite-vec": { @@ -1548,7 +1549,7 @@ "emittery": ["emittery@0.13.1", "", {}, "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ=="], - "emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="], @@ -1756,7 +1757,7 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="], + "get-east-asian-width": ["get-east-asian-width@1.7.0", "", {}, "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q=="], "get-func-name": ["get-func-name@2.0.2", "", {}, "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ=="], @@ -2386,7 +2387,9 @@ "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=="], - "nitrogen": ["nitrogen@0.37.1", "", { "dependencies": { "chalk": "^5.3.0", "react-native-nitro-modules": "^0.37.1", "ts-morph": "^28.0.0", "yargs": "^18.0.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "lib/index.js" } }, "sha512-RMK1n8xV7B38JorfLCFexgPEDp7/4CnM/AR0R3UfikufXo8qB8TecgtY+sW0xjOjZJYwW5bJJI/kyZjusYk4JA=="], + "nitro-core": ["nitro-core@1.0.0-alpha.nightly.86.g15e19db42041", "", {}, "sha512-ClH75zDyCx2frd5CL8yhz35m5aIPveWPDdnOX86OWADGU2tq06vkc5rkVbuaNTnCH6FJLutTXPg7HxEFVZfrJQ=="], + + "nitrogen": ["nitrogen@1.0.0-alpha.nightly.86.g15e19db42041", "", { "dependencies": { "chalk": "^5.3.0", "nitro-core": "1.0.0-alpha.nightly.86.g15e19db42041", "ts-morph": "^28.0.0", "yargs": "^18.1.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "bin/nitrogen.js" } }, "sha512-hIABkFyOSLqQ4Awxf/dBxL8X5Jfr/JZ2CVSXX9QBGukCrt03FC+tgbMsywjhOmEd0TLuhFWdJUZSG3yMmCFpqw=="], "nocache": ["nocache@3.0.4", "", {}, "sha512-WDD0bdg9mbq6F4mRxEYcPWwfA1vxd0mrvKOyxI7Xj/atfRHVeutzuWByG//jfm4uPzp0y4Kj051EORCBSQMycw=="], @@ -2578,7 +2581,7 @@ "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@0.37.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-KpW6EQVQ/bfegpCGxN9Be+ndvsfj56t4IESEvCASu9gWpJa/NDfHpIeIwCOvZQ3eXmLEj6YD4wCLqcC1FJPr2w=="], + "react-native-nitro-modules": ["react-native-nitro-modules@1.0.0-alpha.nightly.86.g15e19db42041", "", { "dependencies": { "nitro-core": "1.0.0-alpha.nightly.86.g15e19db42041" }, "peerDependencies": { "react": "*", "react-native": ">=0.88.0" } }, "sha512-R4QpOJUDaNGV2BgKGfTJ3qFB/VneeEgbC3mPkCMAUyyAcrVLeO7p78yBp0T5yrdiAckASLkaC/0Gc0tICFfyew=="], "react-native-nitro-sqlite": ["react-native-nitro-sqlite@workspace:packages/react-native-nitro-sqlite"], @@ -2796,7 +2799,7 @@ "string-natural-compare": ["string-natural-compare@3.0.1", "", {}, "sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw=="], - "string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + "string-width": ["string-width@8.3.0", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ=="], "string-width-cjs": ["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=="], @@ -3048,7 +3051,7 @@ "yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], - "yargs": ["yargs@18.0.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^7.2.0", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg=="], + "yargs": ["yargs@18.2.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^8.2.1", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w=="], "yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="], @@ -3318,6 +3321,8 @@ "chromium-edge-launcher/@types/node": ["@types/node@22.19.0", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-xpr/lmLPQEj+TUnHmR+Ab91/glhJvsqcjB+yY0Ix9GO70H6Lb4FHH5GeqdOE5btAx7eIMwuHkp4H2MSkLcqWbA=="], + "cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + "cliui/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="], "code-suggester/@types/yargs": ["@types/yargs@16.0.11", "", { "dependencies": { "@types/yargs-parser": "*" } }, "sha512-sbtvk8wDN+JvEdabmZExoW/HNr1cB7D/j4LT08rMiuikfA7m/JNJg7ATQcgzs34zHnoScDkY0ZRSl29Fkmk36g=="], @@ -3738,6 +3743,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-nitro-modules": ["react-native-nitro-modules@0.37.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-KpW6EQVQ/bfegpCGxN9Be+ndvsfj56t4IESEvCASu9gWpJa/NDfHpIeIwCOvZQ3eXmLEj6YD4wCLqcC1FJPr2w=="], + "react-native-nitro-sqlite-vec/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], "read-pkg/normalize-package-data": ["normalize-package-data@2.5.0", "", { "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA=="], @@ -3806,8 +3813,6 @@ "string-width/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="], - "string-width-cjs/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "tar-stream/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], "terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], @@ -3820,6 +3825,8 @@ "typedoc/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "typeorm/yargs": ["yargs@18.0.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^7.2.0", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg=="], + "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=="], @@ -3850,6 +3857,8 @@ "wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + "wrap-ansi/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + "wrap-ansi/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="], "wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -4054,6 +4063,10 @@ "chromium-edge-launcher/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "cliui/string-width/emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + + "cliui/string-width/get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="], + "cliui/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], "code-suggester/yargs/cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="], @@ -4488,6 +4501,10 @@ "typedoc/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "typeorm/yargs/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + + "typeorm/yargs/yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="], + "typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.46.3", "", { "dependencies": { "@typescript-eslint/types": "8.46.3", "@typescript-eslint/visitor-keys": "8.46.3" } }, "sha512-FCi7Y1zgrmxp3DfWfr+3m9ansUUFoy8dkEdeQSgA9gbm8DaHYvZCdkFRQrtKiedFf3Ha6VmoqoAaP68+i+22kg=="], "typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.46.3", "", { "dependencies": { "@typescript-eslint/types": "8.46.3", "@typescript-eslint/typescript-estree": "8.46.3", "@typescript-eslint/utils": "8.46.3", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-ZPCADbr+qfz3aiTTYNNkCbUt+cjNwI/5McyANNrFBpVxPt7GqpEYz5ZfdwuFyGUnJ9FdDXbGODUu6iRCI6XRXw=="], @@ -4508,7 +4525,9 @@ "unist-util-remove-position/unist-util-visit/unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="], - "wrap-ansi-cjs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], + "wrap-ansi/string-width/emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + + "wrap-ansi/string-width/get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="], "wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], @@ -4540,16 +4559,10 @@ "@react-native-harness/jest/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "@react-native-harness/jest/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "@react-native-harness/platform-apple/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "@react-native-harness/platform-apple/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "@react-native/codegen/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "@react-native/codegen/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "@typescript-eslint/eslint-plugin/@typescript-eslint/utils/@typescript-eslint/typescript-estree/@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.70.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.70.0", "@typescript-eslint/types": "^8.70.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-hFHbTNqhU9G+2eKFXCBVb1tjFT/LceiJ4+HfLO4pTpDI0KHi6iajpcFFkaSQ9gXmCh7n82A0PthaayEdN6mspQ=="], "@typescript-eslint/eslint-plugin/@typescript-eslint/utils/@typescript-eslint/typescript-estree/@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.70.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-adnkeeNq9Sq1sUf4+FRVc0KdgYghzsgFpZSQVZVvY0LCuUuN0FnQgyGzCJeC4fW1cdXseBAjU2EOqUIjbNcZUw=="], @@ -4582,8 +4595,6 @@ "code-suggester/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "code-suggester/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "errorhandler/accepts/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], "expect/jest-message-util/@jest/types/@types/node": ["@types/node@22.19.0", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-xpr/lmLPQEj+TUnHmR+Ab91/glhJvsqcjB+yY0Ix9GO70H6Lb4FHH5GeqdOE5btAx7eIMwuHkp4H2MSkLcqWbA=="], @@ -4600,8 +4611,6 @@ "jest-cli/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "jest-cli/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "jest-config/babel-jest/babel-preset-jest/babel-plugin-jest-hoist": ["babel-plugin-jest-hoist@30.2.0", "", { "dependencies": { "@types/babel__core": "^7.20.5" } }, "sha512-ftzhzSGMUnOzcCXd6WHdBGMyuwy15Wnn0iyyWGKgBDLxf9/s5ABuraCSpBX2uG0jUg4rqJnxsLc5+oYBqoxVaA=="], "jest-config/glob/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], @@ -4640,8 +4649,6 @@ "logkitty/yargs/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], - "logkitty/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "logkitty/yargs/yargs-parser/camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="], "metro-config/metro/flow-parser/flow-estree": ["flow-estree@0.331.0", "", {}, "sha512-FVLYkSL/ITb/QXBEQvNWPjPooRGswuUtGOwrH+puSlMDneNkxy640+FZsk/TfKL+b7Wbw/Fg9FTUv2bMQDpj2w=="], @@ -4660,8 +4667,6 @@ "metro/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "metro/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "mocha/glob/path-scurry/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], "mocha/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], @@ -4710,8 +4715,6 @@ "react-native-builder-bob/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native-builder-bob/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "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=="], @@ -4726,8 +4729,6 @@ "react-native-macos-local/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native-macos-local/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "react-native-nitro-sqlite-macos-example/@react-native-community/cli-platform-android/@react-native-community/cli-tools/semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], "react-native-nitro-sqlite-macos-example/@react-native-community/cli/@react-native-community/cli-doctor/yaml": ["yaml@2.8.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw=="], @@ -4816,18 +4817,20 @@ "react-native/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "read-pkg-up/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], "release-please/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "release-please/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "slice-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], "typedoc/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], + "typeorm/yargs/string-width/emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + + "typeorm/yargs/string-width/get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="], + + "typeorm/yargs/string-width/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="], + "typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@8.46.3", "", {}, "sha512-G7Ok9WN/ggW7e/tOf8TQYMaxgID3Iujn231hfi0Pc7ZheztIJVpO44ekY00b7akqc6nZcvregk0Jpah3kep6hA=="], "typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils/@typescript-eslint/types": ["@typescript-eslint/types@8.46.3", "", {}, "sha512-G7Ok9WN/ggW7e/tOf8TQYMaxgID3Iujn231hfi0Pc7ZheztIJVpO44ekY00b7akqc6nZcvregk0Jpah3kep6hA=="], @@ -4888,8 +4891,6 @@ "metro-config/metro/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "metro-config/metro/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "metro/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "pkg-dir/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], @@ -4956,8 +4957,6 @@ "react-native-nitro-sqlite-macos-example/mocha/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native-nitro-sqlite-macos-example/mocha/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "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=="], @@ -4972,8 +4971,6 @@ "react-native-nitro-sqlite-macos-example/react-native/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native-nitro-sqlite-macos-example/react-native/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "react-native/@react-native/community-cli-plugin/metro/flow-parser/flow-estree": ["flow-estree@0.331.0", "", {}, "sha512-FVLYkSL/ITb/QXBEQvNWPjPooRGswuUtGOwrH+puSlMDneNkxy640+FZsk/TfKL+b7Wbw/Fg9FTUv2bMQDpj2w=="], "react-native/@react-native/community-cli-plugin/metro/metro-transform-worker/metro-minify-terser": ["metro-minify-terser@0.87.1", "", { "dependencies": { "flow-enums-runtime": "^0.0.6", "terser": "^5.15.0" } }, "sha512-YK4k1oO1wV48hfE+Nbw2rJCnAgeabzrgT/xH5ha5n9gbK4p3HYFC898cERUiyTl9vRh58CNTiXRc88f7y6PfKg=="], @@ -4984,6 +4981,8 @@ "release-please/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + "typeorm/yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], + "@jest/expect/expect/jest-matcher-utils/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.34.41", "", {}, "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g=="], "@typescript-eslint/eslint-plugin/@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], @@ -5024,8 +5023,6 @@ "react-native-nitro-sqlite-macos-example/@react-native/babel-preset/@react-native/babel-plugin-codegen/@react-native/codegen/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "react-native-nitro-sqlite-macos-example/@react-native/babel-preset/@react-native/babel-plugin-codegen/@react-native/codegen/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "react-native-nitro-sqlite-macos-example/@react-native/babel-preset/@react-native/babel-plugin-codegen/@react-native/codegen/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], } } diff --git a/docs/scripts/check-api.mjs b/docs/scripts/check-api.mjs index 96fc4c3e..c1ad4a4f 100644 --- a/docs/scripts/check-api.mjs +++ b/docs/scripts/check-api.mjs @@ -68,12 +68,6 @@ const requiredMembers = { 'executeAsync', 'executeBatch', 'executeBatchAsync', - 'close', - 'drop', - 'attach', - 'detach', - 'loadFile', - 'loadFileAsync', ], NitroSQLiteConnection: [ 'close', diff --git a/docs/typedoc-fumadocs.mjs b/docs/typedoc-fumadocs.mjs index cc7ee698..6fa13dd9 100644 --- a/docs/typedoc-fumadocs.mjs +++ b/docs/typedoc-fumadocs.mjs @@ -117,8 +117,11 @@ class NitroMemberRouter extends MemberRouter { } function isHybridObject(reflection) { + // Nitro V1 exports the HybridObject base class through a NativeHybridObject constant. return reflection.extendedTypes?.some( - (type) => type.type === 'reference' && type.name === 'HybridObject', + (type) => + type.type === 'reference' && + ['HybridObject', 'NativeHybridObject'].includes(type.name), ) } diff --git a/patches/react-native-nitro-modules+0.37.1.patch b/example/macos/patches/react-native-nitro-modules+0.37.1.patch similarity index 100% rename from patches/react-native-nitro-modules+0.37.1.patch rename to example/macos/patches/react-native-nitro-modules+0.37.1.patch diff --git a/example/package.json b/example/package.json index 5037dd20..d6c7466b 100644 --- a/example/package.json +++ b/example/package.json @@ -32,7 +32,7 @@ "expo-status-bar": "^1.12.1", "react": "19.3.1", "react-native": "0.88.0", - "react-native-nitro-modules": "*", + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041", "react-native-nitro-sqlite": "10.2.0", "react-native-nitro-sqlite-vec": "10.2.0", "react-native-safe-area-context": "^5.10.1", diff --git a/example/tests/unit/specs/operations/execute.spec.ts b/example/tests/unit/specs/operations/execute.spec.ts index d5dcedf0..d5814c21 100644 --- a/example/tests/unit/specs/operations/execute.spec.ts +++ b/example/tests/unit/specs/operations/execute.spec.ts @@ -4,7 +4,7 @@ import { createArrayBufferTestDb, testDb } from '@tests/db' import { open } from 'react-native-nitro-sqlite' import { buildJSQueryResult } from '@nitro-sqlite/operations/execute' import type { ColumnType } from 'react-native-nitro-sqlite' -import type { NitroSQLiteQueryResult } from '@nitro-sqlite/specs/NitroSQLiteQueryResult.nitro' +import type { NitroSQLiteQueryResult } from '@nitro-sqlite/specs/NitroSQLiteQueryResult' const QUERY_RESULT_SIZES = [60, 1_000, 10_000] // Asynchronous reads hand rows to JavaScript in batches of 256; cover the batch edges. diff --git a/package.json b/package.json index d1450b00..b69402a7 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "patch-package": "^8.0.0", "react": "19.3.1", "react-native": "0.88.0", - "react-native-nitro-modules": "0.37.1" + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041" }, "devDependencies": { "@babel/core": "^7.28.5", @@ -67,7 +67,7 @@ "eslint-plugin-prettier": "^5.5.4", "jest": "^30.2.0", "jsonc-parser": "^3.3.1", - "nitrogen": "0.37.1", + "nitrogen": "1.0.0-alpha.nightly.86.g15e19db42041", "prettier": "^3.6.2", "typeorm": "1.1.1", "typescript": "^6.0.3", diff --git a/packages/react-native-nitro-sqlite/android/RNNitroSQLiteAdapter.cpp b/packages/react-native-nitro-sqlite/android/RNNitroSQLiteAdapter.cpp index aadc5d01..ec89e9b6 100644 --- a/packages/react-native-nitro-sqlite/android/RNNitroSQLiteAdapter.cpp +++ b/packages/react-native-nitro-sqlite/android/RNNitroSQLiteAdapter.cpp @@ -1,5 +1,5 @@ #include "HybridNitroSQLite.hpp" -#include "RNNitroSQLiteOnLoad.hpp" +#include #include #include #include @@ -10,7 +10,7 @@ using namespace margelo::nitro::rnnitrosqlite; JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { - return margelo::nitro::rnnitrosqlite::initialize(vm); + return facebook::jni::initialize(vm, [] { margelo::nitro::rnnitrosqlite::registerAllNatives(); }); } extern "C" JNIEXPORT void JNICALL Java_com_margelo_rnnitrosqlite_DocPathSetter_setDocPathInJNI(JNIEnv* env, jclass clazz, jstring doc_path, diff --git a/packages/react-native-nitro-sqlite/android/src/main/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad.kt b/packages/react-native-nitro-sqlite/android/src/main/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad.kt index 13bbae3a..58b3336a 100644 --- a/packages/react-native-nitro-sqlite/android/src/main/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad.kt +++ b/packages/react-native-nitro-sqlite/android/src/main/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad.kt @@ -8,11 +8,13 @@ import com.margelo.rnnitrosqlite.DocPathSetter @Keep @DoNotStrip class HybridNitroSQLiteOnLoad : HybridNitroSQLiteOnLoadSpec() { - @Keep - @DoNotStrip - override fun init() { - NitroModules.applicationContext?.let { context -> - DocPathSetter.setDocPath(context) + companion object : HybridNitroSQLiteOnLoadSpec.Companion { + @Keep + @DoNotStrip + override fun init() { + NitroModules.applicationContext?.let { context -> + DocPathSetter.setDocPath(context) + } } } } diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteExecuteBatch.hpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteExecuteBatch.hpp index b96deae7..25da2358 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteExecuteBatch.hpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteExecuteBatch.hpp @@ -3,8 +3,8 @@ */ #pragma once -#include "BatchQueryCommand.hpp" #include "NitroSQLiteTypes.hpp" +#include #include namespace margelo::nitro::rnnitrosqlite { diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.cpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.cpp index 6a547e53..a831fc54 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.cpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.cpp @@ -105,9 +105,12 @@ void bindStatement(sqlite3_stmt* statement, const SQLiteQueryParams& values) { } else if (std::holds_alternative(*optionalValue)) { const auto& stringValue = std::get(*optionalValue); bindStatus = sqlite3_bind_text(statement, sqliteIndex, stringValue.c_str(), stringValue.length(), SQLITE_TRANSIENT); - } else if (std::holds_alternative>(*optionalValue)) { - const auto& arrayBufferValue = std::get>(*optionalValue); - bindStatus = sqlite3_bind_blob(statement, sqliteIndex, arrayBufferValue->data(), arrayBufferValue->size(), SQLITE_TRANSIENT); + } else if (std::holds_alternative(*optionalValue)) { + const auto& arrayBufferValue = std::get(*optionalValue); + // Empty buffers may have no data pointer, which sqlite3_bind_blob would bind as NULL. + bindStatus = arrayBufferValue.size() == 0 + ? sqlite3_bind_zeroblob(statement, sqliteIndex, 0) + : sqlite3_bind_blob(statement, sqliteIndex, arrayBufferValue.data(), arrayBufferValue.size(), SQLITE_TRANSIENT); } if (bindStatus != SQLITE_OK) { @@ -306,13 +309,9 @@ namespace { metadata->insert({columnName, std::move(columnMeta)}); } - NitroSQLiteQueryResult result; - result.rowsAffected = sqlite3_changes(db); - result.insertId = static_cast(sqlite3_last_insert_rowid(db)); - result.results = SQLiteQueryResults(std::move(columnNames), std::move(rows)); - result.metadata = std::move(metadata); - result.rowBatchCount = static_cast(rowBatchCount); - return result; + return NitroSQLiteQueryResult(sqlite3_changes(db), static_cast(sqlite3_last_insert_rowid(db)), + SQLiteQueryResults(std::move(columnNames), std::move(rows)), std::move(metadata), + static_cast(rowBatchCount)); } } // namespace diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.hpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.hpp index 20b150c2..ddf6b1f1 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.hpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteOperations.hpp @@ -1,8 +1,8 @@ #pragma once #include "NitroSQLiteDatabaseConnections.hpp" -#include "NitroSQLiteQueryResult.hpp" #include "sqlite/sqlite3.h" +#include #include #include #include diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementGroup.hpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementGroup.hpp index 5e6fc58d..5dd4612e 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementGroup.hpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementGroup.hpp @@ -1,7 +1,7 @@ #pragma once +#include "sqlite/sqlite3.h" #include -#include #include #include #include diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementTail.hpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementTail.hpp index 1a793b79..7ff43cc9 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementTail.hpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteStatementTail.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "sqlite/sqlite3.h" namespace margelo::nitro::rnnitrosqlite { diff --git a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteTypes.hpp b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteTypes.hpp index 375a6ac8..8b81b2af 100644 --- a/packages/react-native-nitro-sqlite/cpp/NitroSQLiteTypes.hpp +++ b/packages/react-native-nitro-sqlite/cpp/NitroSQLiteTypes.hpp @@ -1,8 +1,9 @@ #pragma once -#include "ColumnType.hpp" -#include "NitroSQLiteQueryColumnMetadata.hpp" #include +#include +#include +#include #include #include #include @@ -11,7 +12,7 @@ namespace margelo::nitro::rnnitrosqlite { -using SQLiteValue = std::optional, std::string, double>>; +using SQLiteValue = std::optional>; using SQLiteQueryParams = std::vector; using SQLiteQueryTableMetadata = std::unordered_map; diff --git a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.cpp b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.cpp index df6f21d9..67975e57 100644 --- a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.cpp +++ b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.cpp @@ -30,8 +30,8 @@ static std::optional copyArrayBufferParamsForBackground(const copiedParams.reserve(params->size()); for (const auto& value : *params) { - if (value && std::holds_alternative>(*value)) { - const auto& buffer = std::get>(*value); + if (value && std::holds_alternative(*value)) { + const auto& buffer = std::get(*value); const auto copiedBuffer = ArrayBuffer::copy(buffer); copiedParams.push_back(copiedBuffer); } else { @@ -61,31 +61,31 @@ static std::vector copyArrayBufferParamsForBackground(const std::vec } template -static std::shared_ptr> enqueueConnectionOperation(const SQLiteConnectionPtr& connection, Operation&& operation) { - auto promise = Promise::create(); +static Promise enqueueConnectionOperation(const SQLiteConnectionPtr& connection, Operation&& operation) { + auto promise = Promise::pending(); try { connection->enqueueAsync([promise, operation = std::forward(operation)]() mutable { std::optional result; try { result.emplace(operation()); } catch (...) { - promise->reject(std::current_exception()); + promise.reject(std::current_exception()); return; } // Resolving may dispatch to JavaScript and throw after the native promise // has settled. Do not try to reject that same promise again. try { - promise->resolve(std::move(*result)); + promise.resolve(std::move(*result)); } catch (...) { - if (promise->isPending()) { - promise->reject(std::current_exception()); + if (promise.isPending()) { + promise.reject(std::current_exception()); return; } throw; } }); } catch (...) { - promise->reject(std::current_exception()); + promise.reject(std::current_exception()); } return promise; } @@ -133,7 +133,7 @@ const std::string getMigratedDocPath(DatabaseConnections& connections, const std return selectedPath; } -void HybridNitroSQLite::open(const std::string& dbName, const std::optional& location, std::optional readOnly, +void HybridNitroSQLite::open(const std::string& dbName, const std::optional& location, const std::optional& readOnly, const std::optional& encryptionKey) { validateDatabaseName(dbName); std::lock_guard lock(_connections.lifecycleMutex); @@ -145,7 +145,7 @@ void HybridNitroSQLite::open(const std::string& dbName, const std::optional& location, - std::optional readOnly, const std::optional& encryptionKey) { + const std::optional& readOnly, const std::optional& encryptionKey) { validateDatabaseName(dbName); if (sqlite3_threadsafe() == 0) { throw NitroSQLiteException(NitroSQLiteExceptionType::DatabaseCannotBeOpened, @@ -212,9 +212,9 @@ NitroSQLiteQueryResult HybridNitroSQLite::execute(const std::string& dbName, con return sqliteExecute(_connections.get(dbName), query, params); }; -std::shared_ptr> HybridNitroSQLite::executeAsync(const std::string& dbName, const std::string& query, - const std::optional& params, - const std::optional& onRows) { +Promise HybridNitroSQLite::executeAsync(const std::string& dbName, const std::string& query, + const std::optional& params, + const std::optional>& onRows) { const auto copiedParams = copyArrayBufferParamsForBackground(params); SQLiteConnectionPtr connection; try { @@ -223,10 +223,15 @@ std::shared_ptr> HybridNitroSQLite::executeAsync return Promise::rejected(std::current_exception()); } - return enqueueConnectionOperation( - connection, [connection, query, copiedParams, onRows = onRows.value_or(nullptr)]() -> NitroSQLiteQueryResult { - return sqliteExecute(connection, query, copiedParams, onRows); - }); + SQLiteRowBatchHandler rowBatchHandler = nullptr; + if (onRows) { + rowBatchHandler = [onRows = *onRows](SQLiteQueryResults rows) { onRows(std::move(rows)); }; + } + + return enqueueConnectionOperation(connection, + [connection, query, copiedParams, rowBatchHandler]() -> NitroSQLiteQueryResult { + return sqliteExecute(connection, query, copiedParams, rowBatchHandler); + }); }; std::shared_ptr HybridNitroSQLite::prepare(const std::string& dbName, const std::string& query) { @@ -240,8 +245,8 @@ BatchQueryResult HybridNitroSQLite::executeBatch(const std::string& dbName, cons return BatchQueryResult(result.rowsAffected); }; -std::shared_ptr> HybridNitroSQLite::executeBatchAsync(const std::string& dbName, - const std::vector& batchParams) { +Promise HybridNitroSQLite::executeBatchAsync(const std::string& dbName, + const std::vector& batchParams) { // Convert BatchQueryCommand objects on the JS thread and copy any JS-backed // ArrayBuffers into native buffers before going off-thread. const auto commands = batchParamsToCommands(batchParams); @@ -264,7 +269,7 @@ FileLoadResult HybridNitroSQLite::loadFile(const std::string& dbName, const std: return FileLoadResult(result.commands, result.rowsAffected); }; -std::shared_ptr> HybridNitroSQLite::loadFileAsync(const std::string& dbName, const std::string& location) { +Promise HybridNitroSQLite::loadFileAsync(const std::string& dbName, const std::string& location) { SQLiteConnectionPtr connection; try { connection = _connections.get(dbName); diff --git a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.hpp b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.hpp index aca8e47d..d2919cbb 100644 --- a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.hpp +++ b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.hpp @@ -2,8 +2,8 @@ #include "../NitroSQLiteDatabaseConnections.hpp" #include "../NitroSQLiteTypes.hpp" -#include "HybridNitroSQLitePreparedStatementSpec.hpp" -#include "HybridNitroSQLiteSpec.hpp" +#include +#include namespace margelo::nitro::rnnitrosqlite { @@ -14,7 +14,7 @@ namespace margelo::nitro::rnnitrosqlite { */ class HybridNitroSQLite : public HybridNitroSQLiteSpec { public: - HybridNitroSQLite() : HybridObject(TAG) {} + HybridNitroSQLite() = default; public: static std::string docPath; @@ -29,11 +29,11 @@ class HybridNitroSQLite : public HybridNitroSQLiteSpec { public: // Methods /** Open the default connection, requiring an existing file in read-only mode. */ - void open(const std::string& dbName, const std::optional& location, std::optional readOnly, + void open(const std::string& dbName, const std::optional& location, const std::optional& readOnly, const std::optional& encryptionKey) override; /** Open a separate native handle and return an opaque ID for later calls. */ - std::string openConnection(const std::string& dbName, const std::optional& location, std::optional readOnly, + std::string openConnection(const std::string& dbName, const std::optional& location, const std::optional& readOnly, const std::optional& encryptionKey) override; /** Close the named native database handle. */ @@ -69,9 +69,9 @@ class HybridNitroSQLite : public HybridNitroSQLiteSpec { /** Execute one SQL statement on a background thread. * @return A promise of the native query result. */ - std::shared_ptr> executeAsync(const std::string& dbName, const std::string& query, - const std::optional& params, - const std::optional& onRows) override; + Promise executeAsync(const std::string& dbName, const std::string& query, + const std::optional& params, + const std::optional>& onRows) override; /** Prepare one SQL statement for repeated execution on an open connection. */ std::shared_ptr prepare(const std::string& dbName, const std::string& query) override; @@ -84,8 +84,7 @@ class HybridNitroSQLite : public HybridNitroSQLiteSpec { /** Run a nonempty batch in one exclusive transaction on a background thread. * @return A promise of the total affected row count. */ - std::shared_ptr> executeBatchAsync(const std::string& dbName, - const std::vector& commands) override; + Promise executeBatchAsync(const std::string& dbName, const std::vector& commands) override; /** Import a SQL file in one exclusive transaction on the calling thread. * Each nonempty line is interpreted as one statement. @@ -97,7 +96,7 @@ class HybridNitroSQLite : public HybridNitroSQLiteSpec { * @param location Path to the SQL file. * @return A promise of the command and affected row counts. */ - std::shared_ptr> loadFileAsync(const std::string& dbName, const std::string& location) override; + Promise loadFileAsync(const std::string& dbName, const std::string& location) override; }; inline std::string HybridNitroSQLite::docPath = ""; diff --git a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.cpp b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.cpp index 11caae01..f1beefca 100644 --- a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.cpp +++ b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.cpp @@ -14,8 +14,8 @@ namespace { copiedParams.reserve(params->size()); for (const auto& value : *params) { - if (value && std::holds_alternative>(*value)) { - copiedParams.push_back(ArrayBuffer::copy(std::get>(*value))); + if (value && std::holds_alternative(*value)) { + copiedParams.push_back(ArrayBuffer::copy(std::get(*value))); } else { copiedParams.push_back(value); } @@ -27,14 +27,13 @@ namespace { } // namespace HybridNitroSQLitePreparedStatement::HybridNitroSQLitePreparedStatement(std::shared_ptr statement) - : HybridObject(TAG), _statement(std::move(statement)) {} + : _statement(std::move(statement)) {} NitroSQLiteQueryResult HybridNitroSQLitePreparedStatement::execute(const std::optional& params) { return _statement->execute(params); } -std::shared_ptr> -HybridNitroSQLitePreparedStatement::executeAsync(const std::optional& params) { +Promise HybridNitroSQLitePreparedStatement::executeAsync(const std::optional& params) { const auto copiedParams = copyArrayBufferParamsForBackground(params); const auto statement = _statement; diff --git a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.hpp b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.hpp index 966acfab..e375574a 100644 --- a/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.hpp +++ b/packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.hpp @@ -2,7 +2,7 @@ #include "../NitroSQLiteOperations.hpp" #include "../NitroSQLiteTypes.hpp" -#include "HybridNitroSQLitePreparedStatementSpec.hpp" +#include #include namespace margelo::nitro::rnnitrosqlite { @@ -16,7 +16,7 @@ class HybridNitroSQLitePreparedStatement : public HybridNitroSQLitePreparedState /** Execute with new bindings on the calling thread. */ NitroSQLiteQueryResult execute(const std::optional& params) override; /** Execute with new bindings on a background thread. */ - std::shared_ptr> executeAsync(const std::optional& params) override; + Promise executeAsync(const std::optional& params) override; /** Release the native statement. */ void finalize() override; /** Check whether the native statement has been released. */ diff --git a/packages/react-native-nitro-sqlite/nitro.json b/packages/react-native-nitro-sqlite/nitro.json index 25621890..af9419d9 100644 --- a/packages/react-native-nitro-sqlite/nitro.json +++ b/packages/react-native-nitro-sqlite/nitro.json @@ -1,4 +1,6 @@ { + "$schema": "https://nitro.margelo.com/nitro.schema.json", + "environment": "react-native", "cxxNamespace": ["rnnitrosqlite"], "ios": { "iosModuleName": "RNNitroSQLite" @@ -7,13 +9,5 @@ "androidNamespace": ["rnnitrosqlite"], "androidCxxLibName": "RNNitroSQLite" }, - "autolinking": { - "NitroSQLite": { - "cpp": "HybridNitroSQLite" - }, - "NitroSQLiteOnLoad": { - "kotlin": "HybridNitroSQLiteOnLoad" - } - }, "ignorePaths": ["node_modules", "example", "lib"] } diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake index 3b5d4635..baddd8d9 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake @@ -1,83 +1,48 @@ # # RNNitroSQLite+autolinking.cmake # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -# https://github.com/mrousavy/nitro +# https://github.com/margelo/nitro # Copyright © Marc Rousavy @ Margelo # -# This is a CMake file that adds all files generated by Nitrogen -# to the current CMake project. -# -# To use it, add this to your CMakeLists.txt: -# ```cmake -# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/RNNitroSQLite+autolinking.cmake) -# ``` - -# Define a flag to check if we are building properly -add_definitions(-DBUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT) - -# Enable Raw Props parsing in react-native (for Nitro Views) -add_definitions(-DRN_SERIALIZABLE_STATE) - -# Add all headers that were generated by Nitrogen -include_directories( - "../nitrogen/generated/shared/c++" - "../nitrogen/generated/android/c++" - "../nitrogen/generated/android/" +target_compile_features(RNNitroSQLite PUBLIC cxx_std_20) +target_include_directories(RNNitroSQLite PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/include" + "${CMAKE_CURRENT_LIST_DIR}/c++/include" + "${CMAKE_CURRENT_LIST_DIR}/include" ) - -# Add all .cpp sources that were generated by Nitrogen -target_sources( - # CMake project name (Android C++ library name) - RNNitroSQLite PRIVATE - # Autolinking Setup - ../nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp - # Shared Nitrogen C++ sources - ../nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp - ../nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp - ../nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp - # Android-specific Nitrogen C++ sources - ../nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp +target_sources(RNNitroSQLite PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/RNNitroSQLiteOnLoad.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../android/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../android/c++/HybridNitroSQLiteSpecClass.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../android/c++/JHybridNitroSQLiteOnLoadSpec.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/BatchQueryCommand.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/BatchQueryResult.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/FileLoadResult.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/HybridNitroSQLiteSpec.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/NitroSQLiteQueryColumnMetadata.cpp" + "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/NitroSQLiteQueryResult.cpp" ) -# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake -# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake -target_compile_definitions( - RNNitroSQLite PRIVATE - -DFOLLY_NO_CONFIG=1 - -DFOLLY_HAVE_CLOCK_GETTIME=1 - -DFOLLY_USE_LIBCPP=1 - -DFOLLY_CFG_NO_COROUTINES=1 - -DFOLLY_MOBILE=1 - -DFOLLY_HAVE_RECVMMSG=1 - -DFOLLY_HAVE_PTHREAD=1 - # Once we target android-23 above, we can comment - # the following line. NDK uses GNU style stderror_r() after API 23. - -DFOLLY_HAVE_XSI_STRERROR_R=1 +find_package(fbjni REQUIRED CONFIG) +find_package(react-native-nitro-modules REQUIRED CONFIG) +find_package(ReactAndroid REQUIRED CONFIG) +target_link_libraries(RNNitroSQLite + fbjni::fbjni + react-native-nitro-modules::NitroModules + ReactAndroid::jsi + ReactAndroid::reactnative ) - -# Add all libraries required by the generated specs -find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++ -find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule) -find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library - -# Link all libraries together -target_link_libraries( - RNNitroSQLite - fbjni::fbjni # <-- Facebook C++ JNI helpers - ReactAndroid::jsi # <-- RN: JSI - react-native-nitro-modules::NitroModules # <-- NitroModules Core :) +# Match React Native's ReactAndroid/cmake-utils/folly-flags.cmake. +target_compile_definitions(RNNitroSQLite PRIVATE + RN_SERIALIZABLE_STATE + FOLLY_NO_CONFIG=1 + FOLLY_HAVE_CLOCK_GETTIME=1 + FOLLY_USE_LIBCPP=1 + FOLLY_CFG_NO_COROUTINES=1 + FOLLY_MOBILE=1 + FOLLY_HAVE_RECVMMSG=1 + FOLLY_HAVE_PTHREAD=1 + FOLLY_HAVE_XSI_STRERROR_R=1 ) - -# Link react-native (different prefab between RN 0.75 and RN 0.76) -if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) - target_link_libraries( - RNNitroSQLite - ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab - ) -else() - target_link_libraries( - RNNitroSQLite - ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core - ) -endif() diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle index c2fe553e..c2f47656 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle @@ -1,27 +1,10 @@ /// /// RNNitroSQLite+autolinking.gradle /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// -/// This is a Gradle file that adds all files generated by Nitrogen -/// to the current Gradle project. -/// -/// To use it, add this to your build.gradle: -/// ```gradle -/// apply from: '../nitrogen/generated/android/RNNitroSQLite+autolinking.gradle' -/// ``` - -logger.warn("[NitroModules] 🔥 RNNitroSQLite is boosted by nitro!") - -android { - sourceSets { - main { - java.srcDirs += [ - // Nitrogen files - "${project.projectDir}/../nitrogen/generated/android/kotlin" - ] - } - } -} +// Resolve beside this script so custom Nitrogen output directories work too. +def nitrogenDirectory = buildscript.sourceFile.parentFile +android.sourceSets.main.java.srcDirs += [new File(nitrogenDirectory, 'kotlin')] diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp index 2bd21a46..16211d28 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp @@ -1,64 +1,22 @@ /// /// RNNitroSQLiteOnLoad.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// -#ifndef BUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT -#error RNNitroSQLiteOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this? -#endif - -#include "RNNitroSQLiteOnLoad.hpp" - -#include -#include -#include - -#include "JHybridNitroSQLiteOnLoadSpec.hpp" -#include "HybridNitroSQLite.hpp" -#include +#include +#include +#include +#include +#include namespace margelo::nitro::rnnitrosqlite { + void registerAllNatives() { + margelo::nitro::rnnitrosqlite::JHybridNitroSQLiteOnLoadSpec::CxxPart::registerNatives(); -int initialize(JavaVM* vm) { - return facebook::jni::initialize(vm, []() { - ::margelo::nitro::rnnitrosqlite::registerAllNatives(); - }); -} - -struct JHybridNitroSQLiteOnLoadSpecImpl: public jni::JavaClass { - static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad;"; - static std::shared_ptr create() { - static const auto constructorFn = javaClassStatic()->getConstructor(); - jni::local_ref javaPart = javaClassStatic()->newObject(constructorFn); - return javaPart->getJHybridNitroSQLiteOnLoadSpec(); + HybridClassRegistry::registerHybridClass("rnnitrosqlite.NitroSQLite", HybridNitroSQLiteSpec::Class::get()); + HybridClassRegistry::registerHybridClass("rnnitrosqlite.NitroSQLiteOnLoad", JHybridNitroSQLiteOnLoadSpec::Class::get()); + HybridClassRegistry::registerHybridClass("rnnitrosqlite.NitroSQLitePreparedStatement", HybridNitroSQLitePreparedStatementSpec::Class::get()); } -}; - -void registerAllNatives() { - using namespace margelo::nitro; - using namespace margelo::nitro::rnnitrosqlite; - - // Register native JNI methods - margelo::nitro::rnnitrosqlite::JHybridNitroSQLiteOnLoadSpec::CxxPart::registerNatives(); - - // Register Nitro Hybrid Objects - HybridObjectRegistry::registerHybridObjectConstructor( - "NitroSQLite", - []() -> std::shared_ptr { - static_assert(std::is_default_constructible_v, - "The HybridObject \"HybridNitroSQLite\" is not default-constructible! " - "Create a public constructor that takes zero arguments to be able to autolink this HybridObject."); - return std::make_shared(); - } - ); - HybridObjectRegistry::registerHybridObjectConstructor( - "NitroSQLiteOnLoad", - []() -> std::shared_ptr { - return JHybridNitroSQLiteOnLoadSpecImpl::create(); - } - ); } - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp deleted file mode 100644 index d611c9d4..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/// -/// RNNitroSQLiteOnLoad.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#include -#include -#include - -namespace margelo::nitro::rnnitrosqlite { - - [[deprecated("Use registerNatives() instead.")]] - int initialize(JavaVM* vm); - - /** - * Register the native (C++) part of RNNitroSQLite, and autolinks all Hybrid Objects. - * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`), - * inside a `facebook::jni::initialize(vm, ...)` call. - * Example: - * ```cpp (cpp-adapter.cpp) - * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { - * return facebook::jni::initialize(vm, []() { - * // register all RNNitroSQLite HybridObjects - * margelo::nitro::rnnitrosqlite::registerNatives(); - * // any other custom registrations go here. - * }); - * } - * ``` - */ - void registerAllNatives(); - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp new file mode 100644 index 00000000..3794b18e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp @@ -0,0 +1,33 @@ +/// +/// HybridNitroSQLitePreparedStatementSpecClass.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace margelo::nitro::rnnitrosqlite { + + + + const std::shared_ptr& HybridNitroSQLitePreparedStatementSpec::Class::get() { + static const auto hybridClass = HybridClass::create([](HybridClass& clazz) { + clazz.registerHybridProperty("isFinalized", &HybridNitroSQLitePreparedStatementSpec::getIsFinalized); + clazz.registerHybridMethod("execute", &HybridNitroSQLitePreparedStatementSpec::execute); + clazz.registerHybridMethod("executeAsync", &HybridNitroSQLitePreparedStatementSpec::executeAsync); + clazz.registerHybridMethod("finalize", &HybridNitroSQLitePreparedStatementSpec::finalize); + }); + return hybridClass; + } + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLiteSpecClass.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLiteSpecClass.cpp new file mode 100644 index 00000000..a6abbd7e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLiteSpecClass.cpp @@ -0,0 +1,63 @@ +/// +/// HybridNitroSQLiteSpecClass.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "NitroSQLiteQueryResults.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include "hybridObjects/HybridNitroSQLite.hpp" +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + namespace { + struct HybridNitroSQLiteSpecBindings final { + static std::shared_ptr constructor() { + static_assert(std::is_constructible_v<::margelo::nitro::rnnitrosqlite::HybridNitroSQLite>, + "NitroSQLite: ::margelo::nitro::rnnitrosqlite::HybridNitroSQLite must implement the declared public constructor."); + return std::make_shared<::margelo::nitro::rnnitrosqlite::HybridNitroSQLite>(); + } + }; + } + + const std::shared_ptr& HybridNitroSQLiteSpec::Class::get() { + static const auto hybridClass = HybridClass::create([](HybridClass& clazz) { + clazz.registerHybridMethod("open", &HybridNitroSQLiteSpec::open); + clazz.registerHybridMethod("openConnection", &HybridNitroSQLiteSpec::openConnection); + clazz.registerHybridMethod("isConnectionOpen", &HybridNitroSQLiteSpec::isConnectionOpen); + clazz.registerHybridMethod("close", &HybridNitroSQLiteSpec::close); + clazz.registerHybridMethod("drop", &HybridNitroSQLiteSpec::drop); + clazz.registerHybridMethod("attach", &HybridNitroSQLiteSpec::attach); + clazz.registerHybridMethod("detach", &HybridNitroSQLiteSpec::detach); + clazz.registerHybridMethod("execute", &HybridNitroSQLiteSpec::execute); + clazz.registerHybridMethod("executeAsync", &HybridNitroSQLiteSpec::executeAsync); + clazz.registerHybridMethod("prepare", &HybridNitroSQLiteSpec::prepare); + clazz.registerHybridMethod("executeBatch", &HybridNitroSQLiteSpec::executeBatch); + clazz.registerHybridMethod("executeBatchAsync", &HybridNitroSQLiteSpec::executeBatchAsync); + clazz.registerHybridMethod("loadFile", &HybridNitroSQLiteSpec::loadFile); + clazz.registerHybridMethod("loadFileAsync", &HybridNitroSQLiteSpec::loadFileAsync); + clazz.registerHybridConstructor(&HybridNitroSQLiteSpecBindings::constructor); + }); + return hybridClass; + } + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp index 0e3960c4..b5c7f98e 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp @@ -1,19 +1,29 @@ /// /// JHybridNitroSQLiteOnLoadSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// -#include "JHybridNitroSQLiteOnLoadSpec.hpp" - +#include +namespace margelo::nitro::rnnitrosqlite { + JHybridNitroSQLiteOnLoadSpec::~JHybridNitroSQLiteOnLoadSpec() = default; + void JHybridNitroSQLiteOnLoadSpec::init() { + static const auto __method = JHybridNitroSQLiteOnLoadSpec::JavaPart::javaClassStatic()->getStaticMethod("init_cxx"); + __method(JHybridNitroSQLiteOnLoadSpec::JavaPart::javaClassStatic()); + } -namespace margelo::nitro::rnnitrosqlite { + const std::shared_ptr& JHybridNitroSQLiteOnLoadSpec::Class::get() { + static const auto hybridClass = HybridClass::create([](HybridClass& clazz) { + clazz.registerStaticHybridMethod("init", &JHybridNitroSQLiteOnLoadSpec::init); + }); + return hybridClass; + } - std::shared_ptr JHybridNitroSQLiteOnLoadSpec::JavaPart::getJHybridNitroSQLiteOnLoadSpec() { + std::shared_ptr JHybridNitroSQLiteOnLoadSpecJavaPart::getJHybridNitroSQLiteOnLoadSpec() { auto hybridObject = JHybridObject::JavaPart::getJHybridObject(); auto castHybridObject = std::dynamic_pointer_cast(hybridObject); if (castHybridObject == nullptr) [[unlikely]] { @@ -26,7 +36,13 @@ namespace margelo::nitro::rnnitrosqlite { return makeCxxInstance(jThis); } - std::shared_ptr JHybridNitroSQLiteOnLoadSpec::CxxPart::createHybridObject(const jni::local_ref& javaPart) { + jni::alias_ref JHybridNitroSQLiteOnLoadSpec::CxxPart::getClass() { + static const auto __field = CxxPart::javaClassStatic()->getStaticField("implementationClass_cxx"); + static const auto __class = jni::make_global(CxxPart::javaClassStatic()->getStaticFieldValue(__field)); + return __class; + } + + std::shared_ptr JHybridNitroSQLiteOnLoadSpec::CxxPart::createHybridObject(jni::alias_ref javaPart) { auto castJavaPart = jni::dynamic_ref_cast(javaPart); if (castJavaPart == nullptr) [[unlikely]] { throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridNitroSQLiteOnLoadSpec::JavaPart!"); @@ -41,12 +57,9 @@ namespace margelo::nitro::rnnitrosqlite { } // Properties - + // Methods - void JHybridNitroSQLiteOnLoadSpec::init() { - static const auto method = _javaPart->javaClassStatic()->getMethod("init"); - method(_javaPart); - } + } // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp deleted file mode 100644 index f806e60d..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/// -/// HybridNitroSQLiteOnLoadSpec.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#include -#include -#include "HybridNitroSQLiteOnLoadSpec.hpp" - - - - -namespace margelo::nitro::rnnitrosqlite { - - using namespace facebook; - - class JHybridNitroSQLiteOnLoadSpec: public virtual HybridNitroSQLiteOnLoadSpec, public virtual JHybridObject { - public: - struct JavaPart: public jni::JavaClass { - static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec;"; - std::shared_ptr getJHybridNitroSQLiteOnLoadSpec(); - }; - struct CxxPart: public jni::HybridClass { - static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec$CxxPart;"; - static jni::local_ref initHybrid(jni::alias_ref jThis); - static void registerNatives(); - using HybridBase::HybridBase; - protected: - std::shared_ptr createHybridObject(const jni::local_ref& javaPart) override; - }; - - public: - explicit JHybridNitroSQLiteOnLoadSpec(const jni::local_ref& javaPart): - HybridObject(HybridNitroSQLiteOnLoadSpec::TAG), - JHybridObject(javaPart), - _javaPart(jni::make_global(javaPart)) {} - ~JHybridNitroSQLiteOnLoadSpec() override { - // Hermes GC can destroy JS objects on a non-JNI Thread. - jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); }); - } - - public: - inline const jni::global_ref& getJavaPart() const noexcept { - return _javaPart; - } - - public: - // Properties - - - public: - // Methods - void init() override; - - private: - jni::global_ref _javaPart; - }; - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpec.hpp new file mode 100644 index 00000000..274882c4 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpec.hpp @@ -0,0 +1,80 @@ +/// +/// JHybridNitroSQLiteOnLoadSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + namespace jni = facebook::jni; + + class JHybridNitroSQLiteOnLoadSpec final : public JHybridObject { + public: + struct Class { + using Base = JHybridObject::Class; + static constexpr const char* name = "NitroSQLiteOnLoad"; + static const std::shared_ptr& get(); + }; + + public: + using JavaPart = JHybridNitroSQLiteOnLoadSpecJavaPart; + struct CxxPart : public jni::HybridClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec$CxxPart;"; + static jni::local_ref initHybrid(jni::alias_ref jThis); + static void registerNatives(); + static jni::alias_ref getClass(); + using HybridBase::HybridBase; + protected: + std::shared_ptr createHybridObject(jni::alias_ref javaPart) override; + }; + + public: + explicit JHybridNitroSQLiteOnLoadSpec(jni::alias_ref javaPart): + JHybridObject(javaPart), + _javaPart(jni::static_ref_cast(JHybridObject::getJavaPart())) { + #ifdef NITRO_DEBUG + if (!jni::isSameObject(_javaPart->getClass(), CxxPart::getClass())) [[unlikely]] { + throw std::runtime_error("NitroSQLiteOnLoad requires its configured implementation when inheritance and multiple implementations are disabled."); + } + #endif + } + // Defined in the owning library so RTTI has one identity across modules. + ~JHybridNitroSQLiteOnLoadSpec() override; + + public: + inline jni::alias_ref getJavaPart() const noexcept { + return _javaPart; + } + + public: + // Properties + + + public: + // Methods + + + public: + // Constructor and static members + static void init(); + + protected: + const std::shared_ptr& getHybridClass() override { + return Class::get(); + } + + private: + jni::alias_ref _javaPart; + }; + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpecJavaPart.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpecJavaPart.hpp new file mode 100644 index 00000000..4bb05911 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/include/RNNitroSQLite/private/JHybridNitroSQLiteOnLoadSpecJavaPart.hpp @@ -0,0 +1,26 @@ +/// +/// JHybridNitroSQLiteOnLoadSpecJavaPart.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + namespace jni = facebook::jni; + + class JHybridNitroSQLiteOnLoadSpec; + + struct JHybridNitroSQLiteOnLoadSpecJavaPart : public jni::JavaClass { + using HybridType = JHybridNitroSQLiteOnLoadSpec; + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec;"; + std::shared_ptr getJHybridNitroSQLiteOnLoadSpec(); + }; + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/include/RNNitroSQLite/private/RNNitroSQLiteOnLoad.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/android/include/RNNitroSQLite/private/RNNitroSQLiteOnLoad.hpp new file mode 100644 index 00000000..d0a2aeb9 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/include/RNNitroSQLite/private/RNNitroSQLiteOnLoad.hpp @@ -0,0 +1,13 @@ +/// +/// RNNitroSQLiteOnLoad.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +namespace margelo::nitro::rnnitrosqlite { + // Call inside facebook::jni::initialize() from JNI_OnLoad. + void registerAllNatives(); +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt b/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt index 397b4277..d1dd507c 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt @@ -1,7 +1,7 @@ /// /// HybridNitroSQLiteOnLoadSpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -11,6 +11,7 @@ import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip import dalvik.annotation.optimization.FastNative +import com.margelo.nitro.rnnitrosqlite.HybridNitroSQLiteOnLoad import com.margelo.nitro.core.HybridObject /** @@ -26,12 +27,10 @@ import com.margelo.nitro.core.HybridObject ) abstract class HybridNitroSQLiteOnLoadSpec: HybridObject() { // Properties - + // Methods - @DoNotStrip - @Keep - abstract fun init(): Unit + // Default implementation of `HybridObject.toString()` override fun toString(): String { @@ -45,12 +44,38 @@ abstract class HybridNitroSQLiteOnLoadSpec: HybridObject() { // C++ JHybridNitroSQLiteOnLoadSpec::CxxPart::initHybrid(...) @FastNative external override fun initHybrid(): HybridData + + companion object { + @DoNotStrip + @Keep + @JvmField + val implementationClass_cxx: Class = HybridNitroSQLiteOnLoad::class.java + } } override fun createCxxPart(): CxxPart { return CxxPart(this) } - companion object { + interface Companion { + // Static Properties + + + // Static Methods + fun init(): Unit + } + + protected companion object Bridge { protected const val TAG = "HybridNitroSQLiteOnLoadSpec" + + private val implementationCompanion: Companion + get() = HybridNitroSQLiteOnLoad + + // Static methods + @JvmStatic + @DoNotStrip + @Keep + private fun init_cxx(): Unit { + HybridNitroSQLiteOnLoad.init() + } } } diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt b/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt index 4553bb35..9d59aa31 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt @@ -1,35 +1,22 @@ /// /// RNNitroSQLiteOnLoad.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// package com.margelo.nitro.rnnitrosqlite -import android.util.Log - internal class RNNitroSQLiteOnLoad { companion object { - private const val TAG = "RNNitroSQLiteOnLoad" private var didLoad = false - /** - * Initializes the native part of "RNNitroSQLite". - * This method is idempotent and can be called more than once. - */ + @JvmStatic + @Synchronized fun initializeNative() { if (didLoad) return - try { - Log.i(TAG, "Loading RNNitroSQLite C++ library...") - System.loadLibrary("RNNitroSQLite") - Log.i(TAG, "Successfully loaded RNNitroSQLite C++ library!") - didLoad = true - } catch (e: Error) { - Log.e(TAG, "Failed to load RNNitroSQLite C++ library! Is it properly installed and linked? " + - "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e) - throw e - } + System.loadLibrary("RNNitroSQLite") + didLoad = true } } } diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/hybrid-classes.json b/packages/react-native-nitro-sqlite/nitrogen/generated/hybrid-classes.json new file mode 100644 index 00000000..54e482a7 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/hybrid-classes.json @@ -0,0 +1,45 @@ +{ + "version": 1, + "classes": { + "NitroSQLite": { + "android": { + "implementation": { + "className": "HybridNitroSQLite", + "include": "\"hybridObjects/HybridNitroSQLite.hpp\"" + }, + "language": "c++" + }, + "ios": { + "implementation": { + "className": "HybridNitroSQLite", + "include": "\"hybridObjects/HybridNitroSQLite.hpp\"" + }, + "language": "c++" + } + }, + "NitroSQLiteOnLoad": { + "android": { + "implementation": { + "className": "HybridNitroSQLiteOnLoad" + }, + "language": "kotlin" + } + }, + "NitroSQLitePreparedStatement": { + "android": { + "implementation": { + "className": "HybridNitroSQLitePreparedStatement", + "include": "\"hybridObjects/HybridNitroSQLitePreparedStatement.hpp\"" + }, + "language": "c++" + }, + "ios": { + "implementation": { + "className": "HybridNitroSQLitePreparedStatement", + "include": "\"hybridObjects/HybridNitroSQLitePreparedStatement.hpp\"" + }, + "language": "c++" + } + } + } +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb deleted file mode 100644 index 55c51c67..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +++ /dev/null @@ -1,62 +0,0 @@ -# -# RNNitroSQLite+autolinking.rb -# This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -# https://github.com/mrousavy/nitro -# Copyright © Marc Rousavy @ Margelo -# - -# This is a Ruby script that adds all files generated by Nitrogen -# to the given podspec. -# -# To use it, add this to your .podspec: -# ```ruby -# Pod::Spec.new do |spec| -# # ... -# -# # Add all files generated by Nitrogen -# load 'nitrogen/generated/ios/RNNitroSQLite+autolinking.rb' -# add_nitrogen_files(spec) -# end -# ``` - -def add_nitrogen_files(spec) - Pod::UI.puts "[NitroModules] 🔥 RNNitroSQLite is boosted by nitro!" - - spec.dependency "NitroModules" - - current_source_files = Array(spec.attributes_hash['source_files']) - spec.source_files = current_source_files + [ - # Generated cross-platform specs - "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}", - # Generated bridges for the cross-platform specs - "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}", - ] - - current_public_header_files = Array(spec.attributes_hash['public_header_files']) - spec.public_header_files = current_public_header_files + [ - # Generated specs - "nitrogen/generated/shared/**/*.{h,hpp}", - # Swift to C++ bridging helpers - "nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp" - ] - - current_private_header_files = Array(spec.attributes_hash['private_header_files']) - spec.private_header_files = current_private_header_files + [ - # iOS specific specs - "nitrogen/generated/ios/c++/**/*.{h,hpp}", - # Views are framework-specific and should be private - "nitrogen/generated/shared/**/views/**/*" - ] - - current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {} - spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({ - # Use C++ 20 - "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", - # Enables C++ <-> Swift interop (by default it's only ObjC) - "SWIFT_OBJC_INTEROP_MODE" => "objcxx", - # Enables stricter modular headers - "DEFINES_MODULE" => "YES", - # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here) - "SWIFT_INSTALL_OBJC_HEADER" => "NO", - }) -end diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp index 468cff59..5187869a 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp @@ -1,17 +1,12 @@ /// /// RNNitroSQLite-Swift-Cxx-Bridge.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// +#include -#include "RNNitroSQLite-Swift-Cxx-Bridge.hpp" -// Include C++ implementation defined types +namespace margelo::nitro::rnnitrosqlite::swift_bridge { - -namespace margelo::nitro::rnnitrosqlite::bridge::swift { - - - -} // namespace margelo::nitro::rnnitrosqlite::bridge::swift +} // namespace margelo::nitro::rnnitrosqlite::swift_bridge diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp deleted file mode 100644 index ce0b30b0..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/// -/// RNNitroSQLite-Swift-Cxx-Bridge.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -// Forward declarations of C++ defined types - - -// Forward declarations of Swift defined types - - -// Include C++ defined types - - -/** - * Contains specialized versions of C++ templated types so they can be accessed from Swift, - * as well as helper functions to interact with those C++ types from Swift. - */ -namespace margelo::nitro::rnnitrosqlite::bridge::swift { - - - -} // namespace margelo::nitro::rnnitrosqlite::bridge::swift diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.cpp new file mode 100644 index 00000000..0a3c9c21 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.cpp @@ -0,0 +1,9 @@ +/// +/// RNNitroSQLiteAppleCxx.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +// Swift packages require at least one source file per C++ target. +#include diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/include/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.h b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/include/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.h new file mode 100644 index 00000000..60a188cc --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAppleCxx/include/RNNitroSQLiteAppleCxx/RNNitroSQLiteAppleCxx.h @@ -0,0 +1,14 @@ +/// +/// RNNitroSQLiteAppleCxx.h +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + + + +namespace margelo::nitro::rnnitrosqlite::swift_bridge { + +} // namespace margelo::nitro::rnnitrosqlite::swift_bridge diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.cpp new file mode 100644 index 00000000..29650d9d --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.cpp @@ -0,0 +1,22 @@ +/// +/// RNNitroSQLiteAutolinking.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include + +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + void registerHybridClasses() { + using namespace margelo::nitro; + using namespace margelo::nitro::rnnitrosqlite; + + HybridClassRegistry::registerHybridClass("rnnitrosqlite.NitroSQLite", HybridNitroSQLiteSpec::Class::get()); + HybridClassRegistry::registerHybridClass("rnnitrosqlite.NitroSQLitePreparedStatement", HybridNitroSQLitePreparedStatementSpec::Class::get()); + } +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm index 54ea94b4..8c74f69f 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm @@ -1,35 +1,24 @@ /// /// RNNitroSQLiteAutolinking.mm /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// #import -#import - -#import - -#include "HybridNitroSQLite.hpp" +#include +/** + * Registers all HybridObject classes of RNNitroSQLite + * when the app loads, so JS can look them up by name. + */ @interface RNNitroSQLiteAutolinking : NSObject @end @implementation RNNitroSQLiteAutolinking -+ (void) load { - using namespace margelo::nitro; - using namespace margelo::nitro::rnnitrosqlite; - - HybridObjectRegistry::registerHybridObjectConstructor( - "NitroSQLite", - []() -> std::shared_ptr { - static_assert(std::is_default_constructible_v, - "The HybridObject \"HybridNitroSQLite\" is not default-constructible! " - "Create a public constructor that takes zero arguments to be able to autolink this HybridObject."); - return std::make_shared(); - } - ); ++ (void)load { + margelo::nitro::rnnitrosqlite::registerHybridClasses(); } @end diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift deleted file mode 100644 index 1267df4f..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +++ /dev/null @@ -1,16 +0,0 @@ -/// -/// RNNitroSQLiteAutolinking.swift -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -import NitroModules - -// TODO: Use empty enums once Swift supports exporting them as namespaces -// See: https://github.com/swiftlang/swift/pull/83616 -public final class RNNitroSQLiteAutolinking { - public typealias bridge = margelo.nitro.rnnitrosqlite.bridge.swift - - -} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp new file mode 100644 index 00000000..3794b18e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp @@ -0,0 +1,33 @@ +/// +/// HybridNitroSQLitePreparedStatementSpecClass.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace margelo::nitro::rnnitrosqlite { + + + + const std::shared_ptr& HybridNitroSQLitePreparedStatementSpec::Class::get() { + static const auto hybridClass = HybridClass::create([](HybridClass& clazz) { + clazz.registerHybridProperty("isFinalized", &HybridNitroSQLitePreparedStatementSpec::getIsFinalized); + clazz.registerHybridMethod("execute", &HybridNitroSQLitePreparedStatementSpec::execute); + clazz.registerHybridMethod("executeAsync", &HybridNitroSQLitePreparedStatementSpec::executeAsync); + clazz.registerHybridMethod("finalize", &HybridNitroSQLitePreparedStatementSpec::finalize); + }); + return hybridClass; + } + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLiteSpecClass.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLiteSpecClass.cpp new file mode 100644 index 00000000..a6abbd7e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/HybridNitroSQLiteSpecClass.cpp @@ -0,0 +1,63 @@ +/// +/// HybridNitroSQLiteSpecClass.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "NitroSQLiteQueryResults.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include "hybridObjects/HybridNitroSQLite.hpp" +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + namespace { + struct HybridNitroSQLiteSpecBindings final { + static std::shared_ptr constructor() { + static_assert(std::is_constructible_v<::margelo::nitro::rnnitrosqlite::HybridNitroSQLite>, + "NitroSQLite: ::margelo::nitro::rnnitrosqlite::HybridNitroSQLite must implement the declared public constructor."); + return std::make_shared<::margelo::nitro::rnnitrosqlite::HybridNitroSQLite>(); + } + }; + } + + const std::shared_ptr& HybridNitroSQLiteSpec::Class::get() { + static const auto hybridClass = HybridClass::create([](HybridClass& clazz) { + clazz.registerHybridMethod("open", &HybridNitroSQLiteSpec::open); + clazz.registerHybridMethod("openConnection", &HybridNitroSQLiteSpec::openConnection); + clazz.registerHybridMethod("isConnectionOpen", &HybridNitroSQLiteSpec::isConnectionOpen); + clazz.registerHybridMethod("close", &HybridNitroSQLiteSpec::close); + clazz.registerHybridMethod("drop", &HybridNitroSQLiteSpec::drop); + clazz.registerHybridMethod("attach", &HybridNitroSQLiteSpec::attach); + clazz.registerHybridMethod("detach", &HybridNitroSQLiteSpec::detach); + clazz.registerHybridMethod("execute", &HybridNitroSQLiteSpec::execute); + clazz.registerHybridMethod("executeAsync", &HybridNitroSQLiteSpec::executeAsync); + clazz.registerHybridMethod("prepare", &HybridNitroSQLiteSpec::prepare); + clazz.registerHybridMethod("executeBatch", &HybridNitroSQLiteSpec::executeBatch); + clazz.registerHybridMethod("executeBatchAsync", &HybridNitroSQLiteSpec::executeBatchAsync); + clazz.registerHybridMethod("loadFile", &HybridNitroSQLiteSpec::loadFile); + clazz.registerHybridMethod("loadFileAsync", &HybridNitroSQLiteSpec::loadFileAsync); + clazz.registerHybridConstructor(&HybridNitroSQLiteSpecBindings::constructor); + }); + return hybridClass; + } + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/RNNitroSQLiteAutolinking.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/RNNitroSQLiteAutolinking.hpp new file mode 100644 index 00000000..6555f71b --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/RNNitroSQLiteAutolinking.hpp @@ -0,0 +1,13 @@ +/// +/// RNNitroSQLiteAutolinking.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +namespace margelo::nitro::rnnitrosqlite { + // Register all generated HybridObject classes + void registerHybridClasses(); +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/private/RNNitroSQLite-Swift-Cxx-Umbrella.hpp similarity index 64% rename from packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp rename to packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/private/RNNitroSQLite-Swift-Cxx-Umbrella.hpp index 2445983d..cc1f0327 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/RNNitroSQLite/private/RNNitroSQLite-Swift-Cxx-Umbrella.hpp @@ -1,31 +1,20 @@ /// /// RNNitroSQLite-Swift-Cxx-Umbrella.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// #pragma once -// Forward declarations of C++ defined types - - -// Include C++ defined types - +// Private C++ implementation includes. Never import this umbrella from Swift. +// Include Swift defined types. They define swift::Optional and swift::Array, +// which the C++ helpers below only forward-declare for Swift's importer. +#include // C++ helpers for Swift -#include "RNNitroSQLite-Swift-Cxx-Bridge.hpp" - -// Common C++ types used in Swift -#include -#include -#include -#include - -// Forward declarations of Swift defined types - +#include -// Include Swift defined types #if __has_include("RNNitroSQLite-Swift.h") // This header is generated by Xcode/Swift on every app build. // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "RNNitroSQLite". diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/module.modulemap b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/module.modulemap new file mode 100644 index 00000000..1dc13020 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/c++/include/module.modulemap @@ -0,0 +1,12 @@ +/// +/// module.modulemap +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +// Headers used by Swift belong to the AppleCxx module. +// This implementation target must not claim them through an umbrella directory. +module RNNitroSQLiteSwiftBridge { + requires cplusplus +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/ios/swift/RNNitroSQLiteModule.swift b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/swift/RNNitroSQLiteModule.swift new file mode 100644 index 00000000..30ebff88 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/ios/swift/RNNitroSQLiteModule.swift @@ -0,0 +1,2 @@ +// Generated by nitrogen. Keeps the SwiftPM module available to its C++ bridge. +internal import NitroModules diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.cpp new file mode 100644 index 00000000..e6656182 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.cpp @@ -0,0 +1,48 @@ +/// +/// BatchQueryCommand.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro { + + margelo::nitro::rnnitrosqlite::BatchQueryCommand JSIConverter::fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rnnitrosqlite::BatchQueryCommand( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query"))), + JSIConverter>>, std::vector>>>>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params"))) + ); + } + + jsi::Value JSIConverter::toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryCommand& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "query"), JSIConverter::toJSI(runtime, arg.query)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "params"), JSIConverter>>, std::vector>>>>>>::toJSI(runtime, arg.params)); + return obj; + } + + bool JSIConverter::canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query")))) return false; + if (!JSIConverter>>, std::vector>>>>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params")))) return false; + return true; + } + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.hpp deleted file mode 100644 index d7ba6585..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/// -/// BatchQueryCommand.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - - - -#include -#include -#include -#include -#include -#include - -namespace margelo::nitro::rnnitrosqlite { - - /** - * A struct which can be represented as a JavaScript object (BatchQueryCommand). - */ - struct BatchQueryCommand final { - public: - std::string query SWIFT_PRIVATE; - std::optional, std::string, double>>>, std::vector, std::string, double>>>>>> params SWIFT_PRIVATE; - - public: - BatchQueryCommand() = default; - explicit BatchQueryCommand(std::string query, std::optional, std::string, double>>>, std::vector, std::string, double>>>>>> params): query(query), params(params) {} - - public: - friend bool operator==(const BatchQueryCommand& lhs, const BatchQueryCommand& rhs) = default; - }; - -} // namespace margelo::nitro::rnnitrosqlite - -namespace margelo::nitro { - - // C++ BatchQueryCommand <> JS BatchQueryCommand (object) - template <> - struct JSIConverter final { - static inline margelo::nitro::rnnitrosqlite::BatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - jsi::Object obj = arg.asObject(runtime); - return margelo::nitro::rnnitrosqlite::BatchQueryCommand( - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query"))), - JSIConverter, std::string, double>>>, std::vector, std::string, double>>>>>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params"))) - ); - } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryCommand& arg) { - jsi::Object obj(runtime); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "query"), JSIConverter::toJSI(runtime, arg.query)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "params"), JSIConverter, std::string, double>>>, std::vector, std::string, double>>>>>>>::toJSI(runtime, arg.params)); - return obj; - } - static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - if (!nitro::isPlainObject(runtime, obj)) { - return false; - } - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query")))) return false; - if (!JSIConverter, std::string, double>>>, std::vector, std::string, double>>>>>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params")))) return false; - return true; - } - }; - -} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.cpp new file mode 100644 index 00000000..864e8b9b --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.cpp @@ -0,0 +1,40 @@ +/// +/// BatchQueryResult.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include + +namespace margelo::nitro { + + margelo::nitro::rnnitrosqlite::BatchQueryResult JSIConverter::fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rnnitrosqlite::BatchQueryResult( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))) + ); + } + + jsi::Value JSIConverter::toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryResult& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter>::toJSI(runtime, arg.rowsAffected)); + return obj; + } + + bool JSIConverter::canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; + return true; + } + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.hpp deleted file mode 100644 index b1ab6b51..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/BatchQueryResult.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/// -/// BatchQueryResult.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - - - -#include - -namespace margelo::nitro::rnnitrosqlite { - - /** - * A struct which can be represented as a JavaScript object (BatchQueryResult). - */ - struct BatchQueryResult final { - public: - std::optional rowsAffected SWIFT_PRIVATE; - - public: - BatchQueryResult() = default; - explicit BatchQueryResult(std::optional rowsAffected): rowsAffected(rowsAffected) {} - - public: - friend bool operator==(const BatchQueryResult& lhs, const BatchQueryResult& rhs) = default; - }; - -} // namespace margelo::nitro::rnnitrosqlite - -namespace margelo::nitro { - - // C++ BatchQueryResult <> JS BatchQueryResult (object) - template <> - struct JSIConverter final { - static inline margelo::nitro::rnnitrosqlite::BatchQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - jsi::Object obj = arg.asObject(runtime); - return margelo::nitro::rnnitrosqlite::BatchQueryResult( - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))) - ); - } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryResult& arg) { - jsi::Object obj(runtime); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter>::toJSI(runtime, arg.rowsAffected)); - return obj; - } - static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - if (!nitro::isPlainObject(runtime, obj)) { - return false; - } - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; - return true; - } - }; - -} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.cpp new file mode 100644 index 00000000..f72ddbfc --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.cpp @@ -0,0 +1,43 @@ +/// +/// FileLoadResult.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include + +namespace margelo::nitro { + + margelo::nitro::rnnitrosqlite::FileLoadResult JSIConverter::fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rnnitrosqlite::FileLoadResult( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "commands"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))) + ); + } + + jsi::Value JSIConverter::toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::FileLoadResult& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "commands"), JSIConverter>::toJSI(runtime, arg.commands)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter>::toJSI(runtime, arg.rowsAffected)); + return obj; + } + + bool JSIConverter::canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "commands")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; + return true; + } + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.hpp deleted file mode 100644 index 198d791a..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/FileLoadResult.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/// -/// FileLoadResult.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - - - -#include - -namespace margelo::nitro::rnnitrosqlite { - - /** - * A struct which can be represented as a JavaScript object (FileLoadResult). - */ - struct FileLoadResult final { - public: - std::optional commands SWIFT_PRIVATE; - std::optional rowsAffected SWIFT_PRIVATE; - - public: - FileLoadResult() = default; - explicit FileLoadResult(std::optional commands, std::optional rowsAffected): commands(commands), rowsAffected(rowsAffected) {} - - public: - friend bool operator==(const FileLoadResult& lhs, const FileLoadResult& rhs) = default; - }; - -} // namespace margelo::nitro::rnnitrosqlite - -namespace margelo::nitro { - - // C++ FileLoadResult <> JS FileLoadResult (object) - template <> - struct JSIConverter final { - static inline margelo::nitro::rnnitrosqlite::FileLoadResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - jsi::Object obj = arg.asObject(runtime); - return margelo::nitro::rnnitrosqlite::FileLoadResult( - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "commands"))), - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))) - ); - } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::FileLoadResult& arg) { - jsi::Object obj(runtime); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "commands"), JSIConverter>::toJSI(runtime, arg.commands)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter>::toJSI(runtime, arg.rowsAffected)); - return obj; - } - static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - if (!nitro::isPlainObject(runtime, obj)) { - return false; - } - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "commands")))) return false; - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; - return true; - } - }; - -} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp deleted file mode 100644 index 6af0d043..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/// -/// HybridNitroSQLiteOnLoadSpec.cpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#include "HybridNitroSQLiteOnLoadSpec.hpp" - -namespace margelo::nitro::rnnitrosqlite { - - void HybridNitroSQLiteOnLoadSpec::loadHybridMethods() { - // load base methods/properties - HybridObject::loadHybridMethods(); - // load custom methods/properties - registerHybrids(this, [](Prototype& prototype) { - prototype.registerHybridMethod("init", &HybridNitroSQLiteOnLoadSpec::init); - }); - } - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp deleted file mode 100644 index 0cc65cb9..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/// -/// HybridNitroSQLiteOnLoadSpec.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - - - - - -namespace margelo::nitro::rnnitrosqlite { - - using namespace margelo::nitro; - - /** - * An abstract base class for `NitroSQLiteOnLoad` - * Inherit this class to create instances of `HybridNitroSQLiteOnLoadSpec` in C++. - * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. - * @example - * ```cpp - * class HybridNitroSQLiteOnLoad: public HybridNitroSQLiteOnLoadSpec { - * public: - * HybridNitroSQLiteOnLoad(...): HybridObject(TAG) { ... } - * // ... - * }; - * ``` - */ - class HybridNitroSQLiteOnLoadSpec: public virtual HybridObject { - public: - // Constructor - explicit HybridNitroSQLiteOnLoadSpec(): HybridObject(TAG) { } - - // Destructor - ~HybridNitroSQLiteOnLoadSpec() override = default; - - public: - // Properties - - - public: - // Methods - virtual void init() = 0; - - protected: - // Hybrid Setup - void loadHybridMethods() override; - - protected: - // Tag for logging - static constexpr auto TAG = "NitroSQLiteOnLoad"; - }; - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp index 906479d3..ec8c805e 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.cpp @@ -1,24 +1,14 @@ /// /// HybridNitroSQLitePreparedStatementSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// -#include "HybridNitroSQLitePreparedStatementSpec.hpp" +#include namespace margelo::nitro::rnnitrosqlite { - void HybridNitroSQLitePreparedStatementSpec::loadHybridMethods() { - // load base methods/properties - HybridObject::loadHybridMethods(); - // load custom methods/properties - registerHybrids(this, [](Prototype& prototype) { - prototype.registerHybridGetter("isFinalized", &HybridNitroSQLitePreparedStatementSpec::getIsFinalized); - prototype.registerHybridMethod("execute", &HybridNitroSQLitePreparedStatementSpec::execute); - prototype.registerHybridMethod("executeAsync", &HybridNitroSQLitePreparedStatementSpec::executeAsync); - prototype.registerHybridMethod("finalize", &HybridNitroSQLitePreparedStatementSpec::finalize); - }); - } + HybridNitroSQLitePreparedStatementSpec::~HybridNitroSQLitePreparedStatementSpec() = default; } // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.hpp deleted file mode 100644 index 5ede22ad..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLitePreparedStatementSpec.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/// -/// HybridNitroSQLitePreparedStatementSpec.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - -// Forward declaration of `NitroSQLiteQueryResult` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct NitroSQLiteQueryResult; } - -#include "NitroSQLiteQueryResult.hpp" -#include -#include -#include -#include -#include -#include -#include - -namespace margelo::nitro::rnnitrosqlite { - - using namespace margelo::nitro; - - /** - * An abstract base class for `NitroSQLitePreparedStatement` - * Inherit this class to create instances of `HybridNitroSQLitePreparedStatementSpec` in C++. - * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. - * @example - * ```cpp - * class HybridNitroSQLitePreparedStatement: public HybridNitroSQLitePreparedStatementSpec { - * public: - * HybridNitroSQLitePreparedStatement(...): HybridObject(TAG) { ... } - * // ... - * }; - * ``` - */ - class HybridNitroSQLitePreparedStatementSpec: public virtual HybridObject { - public: - // Constructor - explicit HybridNitroSQLitePreparedStatementSpec(): HybridObject(TAG) { } - - // Destructor - ~HybridNitroSQLitePreparedStatementSpec() override = default; - - public: - // Properties - virtual bool getIsFinalized() = 0; - - public: - // Methods - virtual NitroSQLiteQueryResult execute(const std::optional, std::string, double>>>>& params) = 0; - virtual std::shared_ptr> executeAsync(const std::optional, std::string, double>>>>& params) = 0; - virtual void finalize() = 0; - - protected: - // Hybrid Setup - void loadHybridMethods() override; - - protected: - // Tag for logging - static constexpr auto TAG = "NitroSQLitePreparedStatement"; - }; - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp index 1297822c..7532f49f 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp @@ -1,34 +1,14 @@ /// /// HybridNitroSQLiteSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// -#include "HybridNitroSQLiteSpec.hpp" +#include namespace margelo::nitro::rnnitrosqlite { - void HybridNitroSQLiteSpec::loadHybridMethods() { - // load base methods/properties - HybridObject::loadHybridMethods(); - // load custom methods/properties - registerHybrids(this, [](Prototype& prototype) { - prototype.registerHybridMethod("open", &HybridNitroSQLiteSpec::open); - prototype.registerHybridMethod("openConnection", &HybridNitroSQLiteSpec::openConnection); - prototype.registerHybridMethod("isConnectionOpen", &HybridNitroSQLiteSpec::isConnectionOpen); - prototype.registerHybridMethod("close", &HybridNitroSQLiteSpec::close); - prototype.registerHybridMethod("drop", &HybridNitroSQLiteSpec::drop); - prototype.registerHybridMethod("attach", &HybridNitroSQLiteSpec::attach); - prototype.registerHybridMethod("detach", &HybridNitroSQLiteSpec::detach); - prototype.registerHybridMethod("execute", &HybridNitroSQLiteSpec::execute); - prototype.registerHybridMethod("executeAsync", &HybridNitroSQLiteSpec::executeAsync); - prototype.registerHybridMethod("prepare", &HybridNitroSQLiteSpec::prepare); - prototype.registerHybridMethod("executeBatch", &HybridNitroSQLiteSpec::executeBatch); - prototype.registerHybridMethod("executeBatchAsync", &HybridNitroSQLiteSpec::executeBatchAsync); - prototype.registerHybridMethod("loadFile", &HybridNitroSQLiteSpec::loadFile); - prototype.registerHybridMethod("loadFileAsync", &HybridNitroSQLiteSpec::loadFileAsync); - }); - } + HybridNitroSQLiteSpec::~HybridNitroSQLiteSpec() = default; } // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp deleted file mode 100644 index 87856cee..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +++ /dev/null @@ -1,98 +0,0 @@ -/// -/// HybridNitroSQLiteSpec.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - -// Forward declaration of `NitroSQLiteQueryResult` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct NitroSQLiteQueryResult; } -// Forward declaration of `HybridNitroSQLitePreparedStatementSpec` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { class HybridNitroSQLitePreparedStatementSpec; } -// Forward declaration of `BatchQueryResult` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct BatchQueryResult; } -// Forward declaration of `BatchQueryCommand` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct BatchQueryCommand; } -// Forward declaration of `FileLoadResult` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct FileLoadResult; } - -#include -#include -#include "NitroSQLiteQueryResult.hpp" -#include -#include -#include -#include -#include -#include "NitroSQLiteQueryResults.hpp" -#include -#include -#include "HybridNitroSQLitePreparedStatementSpec.hpp" -#include "BatchQueryResult.hpp" -#include "BatchQueryCommand.hpp" -#include "FileLoadResult.hpp" - -namespace margelo::nitro::rnnitrosqlite { - - using namespace margelo::nitro; - - /** - * An abstract base class for `NitroSQLite` - * Inherit this class to create instances of `HybridNitroSQLiteSpec` in C++. - * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. - * @example - * ```cpp - * class HybridNitroSQLite: public HybridNitroSQLiteSpec { - * public: - * HybridNitroSQLite(...): HybridObject(TAG) { ... } - * // ... - * }; - * ``` - */ - class HybridNitroSQLiteSpec: public virtual HybridObject { - public: - // Constructor - explicit HybridNitroSQLiteSpec(): HybridObject(TAG) { } - - // Destructor - ~HybridNitroSQLiteSpec() override = default; - - public: - // Properties - - - public: - // Methods - virtual void open(const std::string& dbName, const std::optional& location, std::optional readOnly, const std::optional& encryptionKey) = 0; - virtual std::string openConnection(const std::string& dbName, const std::optional& location, std::optional readOnly, const std::optional& encryptionKey) = 0; - virtual bool isConnectionOpen(const std::string& connectionId) = 0; - virtual void close(const std::string& dbName) = 0; - virtual void drop(const std::string& dbName, const std::optional& location, const std::optional& connectionId) = 0; - virtual void attach(const std::string& mainDbName, const std::string& dbNameToAttach, const std::string& alias, const std::optional& location) = 0; - virtual void detach(const std::string& mainDbName, const std::string& alias) = 0; - virtual NitroSQLiteQueryResult execute(const std::string& dbName, const std::string& query, const std::optional, std::string, double>>>>& params) = 0; - virtual std::shared_ptr> executeAsync(const std::string& dbName, const std::string& query, const std::optional, std::string, double>>>>& params, const std::optional>& onRows) = 0; - virtual std::shared_ptr prepare(const std::string& dbName, const std::string& query) = 0; - virtual BatchQueryResult executeBatch(const std::string& dbName, const std::vector& commands) = 0; - virtual std::shared_ptr> executeBatchAsync(const std::string& dbName, const std::vector& commands) = 0; - virtual FileLoadResult loadFile(const std::string& dbName, const std::string& location) = 0; - virtual std::shared_ptr> loadFileAsync(const std::string& dbName, const std::string& location) = 0; - - protected: - // Hybrid Setup - void loadHybridMethods() override; - - protected: - // Tag for logging - static constexpr auto TAG = "NitroSQLite"; - }; - -} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.cpp new file mode 100644 index 00000000..073cde76 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.cpp @@ -0,0 +1,47 @@ +/// +/// NitroSQLiteQueryColumnMetadata.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include + +namespace margelo::nitro { + + margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata JSIConverter::fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "index"))) + ); + } + + jsi::Value JSIConverter::toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter::toJSI(runtime, arg.name)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter::toJSI(runtime, arg.type)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "index"), JSIConverter::toJSI(runtime, arg.index)); + return obj; + } + + bool JSIConverter::canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "index")))) return false; + return true; + } + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp deleted file mode 100644 index 20337f74..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/// -/// NitroSQLiteQueryColumnMetadata.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - -// Forward declaration of `ColumnType` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { enum class ColumnType; } - -#include -#include "ColumnType.hpp" - -namespace margelo::nitro::rnnitrosqlite { - - /** - * A struct which can be represented as a JavaScript object (NitroSQLiteQueryColumnMetadata). - */ - struct NitroSQLiteQueryColumnMetadata final { - public: - std::string name SWIFT_PRIVATE; - ColumnType type SWIFT_PRIVATE; - double index SWIFT_PRIVATE; - - public: - NitroSQLiteQueryColumnMetadata() = default; - explicit NitroSQLiteQueryColumnMetadata(std::string name, ColumnType type, double index): name(name), type(type), index(index) {} - - public: - friend bool operator==(const NitroSQLiteQueryColumnMetadata& lhs, const NitroSQLiteQueryColumnMetadata& rhs) = default; - }; - -} // namespace margelo::nitro::rnnitrosqlite - -namespace margelo::nitro { - - // C++ NitroSQLiteQueryColumnMetadata <> JS NitroSQLiteQueryColumnMetadata (object) - template <> - struct JSIConverter final { - static inline margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - jsi::Object obj = arg.asObject(runtime); - return margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata( - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))), - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))), - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "index"))) - ); - } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata& arg) { - jsi::Object obj(runtime); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter::toJSI(runtime, arg.name)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter::toJSI(runtime, arg.type)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "index"), JSIConverter::toJSI(runtime, arg.index)); - return obj; - } - static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - if (!nitro::isPlainObject(runtime, obj)) { - return false; - } - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false; - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false; - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "index")))) return false; - return true; - } - }; - -} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.cpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.cpp new file mode 100644 index 00000000..71eadeaa --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.cpp @@ -0,0 +1,56 @@ +/// +/// NitroSQLiteQueryResult.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include +#include +#include "NitroSQLiteQueryResults.hpp" +#include +#include +#include + +namespace margelo::nitro { + + margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult JSIConverter::fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insertId"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "results"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount"))) + ); + } + + jsi::Value JSIConverter::toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter::toJSI(runtime, arg.rowsAffected)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "insertId"), JSIConverter>::toJSI(runtime, arg.insertId)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "results"), JSIConverter::toJSI(runtime, arg.results)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter>>::toJSI(runtime, arg.metadata)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount"), JSIConverter>::toJSI(runtime, arg.rowBatchCount)); + return obj; + } + + bool JSIConverter::canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insertId")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "results")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount")))) return false; + return true; + } + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.hpp deleted file mode 100644 index ae50d9cc..00000000 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/NitroSQLiteQueryResult.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/// -/// NitroSQLiteQueryResult.hpp -/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro -/// Copyright © Marc Rousavy @ Margelo -/// - -#pragma once - -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - -// Forward declaration of `NitroSQLiteQueryColumnMetadata` to properly resolve imports. -namespace margelo::nitro::rnnitrosqlite { struct NitroSQLiteQueryColumnMetadata; } - -#include -#include "NitroSQLiteQueryResults.hpp" -#include -#include "NitroSQLiteQueryColumnMetadata.hpp" -#include - -namespace margelo::nitro::rnnitrosqlite { - - /** - * A struct which can be represented as a JavaScript object (NitroSQLiteQueryResult). - */ - struct NitroSQLiteQueryResult final { - public: - double rowsAffected SWIFT_PRIVATE; - std::optional insertId SWIFT_PRIVATE; - margelo::nitro::rnnitrosqlite::SQLiteQueryResults results SWIFT_PRIVATE; - std::optional> metadata SWIFT_PRIVATE; - std::optional rowBatchCount SWIFT_PRIVATE; - - public: - NitroSQLiteQueryResult() = default; - explicit NitroSQLiteQueryResult(double rowsAffected, std::optional insertId, margelo::nitro::rnnitrosqlite::SQLiteQueryResults results, std::optional> metadata, std::optional rowBatchCount): rowsAffected(rowsAffected), insertId(insertId), results(results), metadata(metadata), rowBatchCount(rowBatchCount) {} - - public: - // NitroSQLiteQueryResult is not equatable because these properties are not equatable: results - }; - -} // namespace margelo::nitro::rnnitrosqlite - -namespace margelo::nitro { - - // C++ NitroSQLiteQueryResult <> JS NitroSQLiteQueryResult (object) - template <> - struct JSIConverter final { - static inline margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - jsi::Object obj = arg.asObject(runtime); - return margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult( - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"))), - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insertId"))), - JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "results"))), - JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))), - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount"))) - ); - } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult& arg) { - jsi::Object obj(runtime); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter::toJSI(runtime, arg.rowsAffected)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "insertId"), JSIConverter>::toJSI(runtime, arg.insertId)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "results"), JSIConverter::toJSI(runtime, arg.results)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter>>::toJSI(runtime, arg.metadata)); - obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount"), JSIConverter>::toJSI(runtime, arg.rowBatchCount)); - return obj; - } - static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - if (!nitro::isPlainObject(runtime, obj)) { - return false; - } - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false; - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insertId")))) return false; - if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "results")))) return false; - if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false; - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowBatchCount")))) return false; - return true; - } - }; - -} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryCommand.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryCommand.hpp new file mode 100644 index 00000000..285e996c --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryCommand.hpp @@ -0,0 +1,49 @@ +/// +/// BatchQueryCommand.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + /** + * A struct which can be represented as a JavaScript object (BatchQueryCommand). + */ + struct BatchQueryCommand final { + public: + std::string query SWIFT_PRIVATE; + std::optional>>, std::vector>>>>> params SWIFT_PRIVATE; + + public: + explicit BatchQueryCommand(std::string query, std::optional>>, std::vector>>>>> params): query(std::move(query)), params(std::move(params)) {} + + public: + friend bool operator==(const BatchQueryCommand& lhs, const BatchQueryCommand& rhs) = default; + }; + +} // namespace margelo::nitro::rnnitrosqlite + +namespace margelo::nitro { + + // C++ BatchQueryCommand <> JS BatchQueryCommand (object) + template <> + struct JSIConverter final { + static margelo::nitro::rnnitrosqlite::BatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg); + static jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryCommand& arg); + static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value); + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryResult.hpp new file mode 100644 index 00000000..3ebf2a42 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/BatchQueryResult.hpp @@ -0,0 +1,43 @@ +/// +/// BatchQueryResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + /** + * A struct which can be represented as a JavaScript object (BatchQueryResult). + */ + struct BatchQueryResult final { + public: + std::optional rowsAffected SWIFT_PRIVATE; + + public: + explicit BatchQueryResult(std::optional rowsAffected): rowsAffected(std::move(rowsAffected)) {} + + public: + friend bool operator==(const BatchQueryResult& lhs, const BatchQueryResult& rhs) = default; + }; + +} // namespace margelo::nitro::rnnitrosqlite + +namespace margelo::nitro { + + // C++ BatchQueryResult <> JS BatchQueryResult (object) + template <> + struct JSIConverter final { + static margelo::nitro::rnnitrosqlite::BatchQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg); + static jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryResult& arg); + static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value); + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/ColumnType.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/ColumnType.hpp similarity index 56% rename from packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/ColumnType.hpp rename to packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/ColumnType.hpp index eae0d101..a3471126 100644 --- a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/ColumnType.hpp +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/ColumnType.hpp @@ -1,22 +1,15 @@ /// /// ColumnType.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// #pragma once -#if __has_include() #include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif -#if __has_include() #include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif +#include namespace margelo::nitro::rnnitrosqlite { @@ -40,8 +33,17 @@ namespace margelo::nitro { template <> struct JSIConverter final { static inline margelo::nitro::rnnitrosqlite::ColumnType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { - int enumValue = JSIConverter::fromJSI(runtime, arg); - return static_cast(enumValue); + int integer = doubleToInt(arg.asNumber()); + switch (integer) { + case 0: return margelo::nitro::rnnitrosqlite::ColumnType::BOOLEAN; + case 1: return margelo::nitro::rnnitrosqlite::ColumnType::NUMBER; + case 2: return margelo::nitro::rnnitrosqlite::ColumnType::INT64; + case 3: return margelo::nitro::rnnitrosqlite::ColumnType::TEXT; + case 4: return margelo::nitro::rnnitrosqlite::ColumnType::ARRAY_BUFFER; + case 5: return margelo::nitro::rnnitrosqlite::ColumnType::NULL_VALUE; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert " + arg.toString(runtime).utf8(runtime) + " to enum ColumnType - invalid value!"); + } } static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rnnitrosqlite::ColumnType arg) { int enumValue = static_cast(arg); @@ -51,15 +53,19 @@ namespace margelo::nitro { if (!value.isNumber()) { return false; } - double number = value.getNumber(); - int integer = static_cast(number); - if (number != integer) { - // The integer is not the same value as the double - we truncated floating points. - // Enums are all integers, so the input floating point number is obviously invalid. + auto integer = tryDoubleToInt(value.getNumber()); + if (!integer.has_value()) { return false; } - // Check if we are within the bounds of the enum. - return integer >= 0 && integer <= 5; + switch (*integer) { + case 0: return true; + case 1: return true; + case 2: return true; + case 3: return true; + case 4: return true; + case 5: return true; + default: return false; + } } }; diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/FileLoadResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/FileLoadResult.hpp new file mode 100644 index 00000000..c32e990b --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/FileLoadResult.hpp @@ -0,0 +1,44 @@ +/// +/// FileLoadResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + /** + * A struct which can be represented as a JavaScript object (FileLoadResult). + */ + struct FileLoadResult final { + public: + std::optional commands SWIFT_PRIVATE; + std::optional rowsAffected SWIFT_PRIVATE; + + public: + explicit FileLoadResult(std::optional commands, std::optional rowsAffected): commands(std::move(commands)), rowsAffected(std::move(rowsAffected)) {} + + public: + friend bool operator==(const FileLoadResult& lhs, const FileLoadResult& rhs) = default; + }; + +} // namespace margelo::nitro::rnnitrosqlite + +namespace margelo::nitro { + + // C++ FileLoadResult <> JS FileLoadResult (object) + template <> + struct JSIConverter final { + static margelo::nitro::rnnitrosqlite::FileLoadResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg); + static jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::FileLoadResult& arg); + static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value); + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLitePreparedStatementSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLitePreparedStatementSpec.hpp new file mode 100644 index 00000000..531a064f --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLitePreparedStatementSpec.hpp @@ -0,0 +1,69 @@ +/// +/// HybridNitroSQLitePreparedStatementSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + using namespace margelo::nitro; + + /** + * An abstract base class for `NitroSQLitePreparedStatement` + * Inherit this class to create instances of `HybridNitroSQLitePreparedStatementSpec` in C++. + * @example + * ```cpp + * class HybridNitroSQLitePreparedStatement : public HybridNitroSQLitePreparedStatementSpec { + * public: + * HybridNitroSQLitePreparedStatement(...) { ... } + * // ... + * }; + * ``` + */ + class HybridNitroSQLitePreparedStatementSpec : public virtual HybridObject { + public: + struct Class { + using Base = HybridObject::Class; + static constexpr const char* name = "NitroSQLitePreparedStatement"; + static const std::shared_ptr& get(); + }; + + public: + // Constructor + HybridNitroSQLitePreparedStatementSpec() = default; + + // Destructor + ~HybridNitroSQLitePreparedStatementSpec() override; + + public: + // Properties + virtual bool getIsFinalized() = 0; + + public: + // Methods + virtual NitroSQLiteQueryResult execute(const std::optional>>>& params) = 0; + virtual Promise executeAsync(const std::optional>>>& params) = 0; + virtual void finalize() = 0; + + protected: + // Hybrid Setup + const std::shared_ptr& getHybridClass() override { + return Class::get(); + } + }; + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLiteSpec.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLiteSpec.hpp new file mode 100644 index 00000000..ccf6142e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/HybridNitroSQLiteSpec.hpp @@ -0,0 +1,89 @@ +/// +/// HybridNitroSQLiteSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "NitroSQLiteQueryResults.hpp" +#include +#include +#include +// Forward declaration of `HybridNitroSQLitePreparedStatementSpec` to properly resolve imports. +namespace margelo::nitro::rnnitrosqlite { class HybridNitroSQLitePreparedStatementSpec; } +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + using namespace margelo::nitro; + + /** + * An abstract base class for `NitroSQLite` + * Inherit this class to create instances of `HybridNitroSQLiteSpec` in C++. + * @example + * ```cpp + * class HybridNitroSQLite : public HybridNitroSQLiteSpec { + * public: + * HybridNitroSQLite(...) { ... } + * // ... + * }; + * ``` + */ + class HybridNitroSQLiteSpec : public virtual HybridObject { + public: + struct Class { + using Base = HybridObject::Class; + static constexpr const char* name = "NitroSQLite"; + static const std::shared_ptr& get(); + }; + + public: + // Constructor + HybridNitroSQLiteSpec() = default; + + // Destructor + ~HybridNitroSQLiteSpec() override; + + public: + // Properties + + + public: + // Methods + virtual void open(const std::string& dbName, const std::optional& location, const std::optional& readOnly, const std::optional& encryptionKey) = 0; + virtual std::string openConnection(const std::string& dbName, const std::optional& location, const std::optional& readOnly, const std::optional& encryptionKey) = 0; + virtual bool isConnectionOpen(const std::string& connectionId) = 0; + virtual void close(const std::string& dbName) = 0; + virtual void drop(const std::string& dbName, const std::optional& location, const std::optional& connectionId) = 0; + virtual void attach(const std::string& mainDbName, const std::string& dbNameToAttach, const std::string& alias, const std::optional& location) = 0; + virtual void detach(const std::string& mainDbName, const std::string& alias) = 0; + virtual NitroSQLiteQueryResult execute(const std::string& dbName, const std::string& query, const std::optional>>>& params) = 0; + virtual Promise executeAsync(const std::string& dbName, const std::string& query, const std::optional>>>& params, const std::optional>& onRows) = 0; + virtual std::shared_ptr prepare(const std::string& dbName, const std::string& query) = 0; + virtual BatchQueryResult executeBatch(const std::string& dbName, const std::vector& commands) = 0; + virtual Promise executeBatchAsync(const std::string& dbName, const std::vector& commands) = 0; + virtual FileLoadResult loadFile(const std::string& dbName, const std::string& location) = 0; + virtual Promise loadFileAsync(const std::string& dbName, const std::string& location) = 0; + + protected: + // Hybrid Setup + const std::shared_ptr& getHybridClass() override { + return Class::get(); + } + }; + +} // namespace margelo::nitro::rnnitrosqlite diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryColumnMetadata.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryColumnMetadata.hpp new file mode 100644 index 00000000..ee839e00 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryColumnMetadata.hpp @@ -0,0 +1,46 @@ +/// +/// NitroSQLiteQueryColumnMetadata.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + /** + * A struct which can be represented as a JavaScript object (NitroSQLiteQueryColumnMetadata). + */ + struct NitroSQLiteQueryColumnMetadata final { + public: + std::string name SWIFT_PRIVATE; + ColumnType type SWIFT_PRIVATE; + double index SWIFT_PRIVATE; + + public: + explicit NitroSQLiteQueryColumnMetadata(std::string name, ColumnType type, double index): name(std::move(name)), type(type), index(index) {} + + public: + friend bool operator==(const NitroSQLiteQueryColumnMetadata& lhs, const NitroSQLiteQueryColumnMetadata& rhs) = default; + }; + +} // namespace margelo::nitro::rnnitrosqlite + +namespace margelo::nitro { + + // C++ NitroSQLiteQueryColumnMetadata <> JS NitroSQLiteQueryColumnMetadata (object) + template <> + struct JSIConverter final { + static margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg); + static jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryColumnMetadata& arg); + static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value); + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryResult.hpp b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryResult.hpp new file mode 100644 index 00000000..bbef148e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/c++/include/RNNitroSQLite/NitroSQLiteQueryResult.hpp @@ -0,0 +1,51 @@ +/// +/// NitroSQLiteQueryResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include +#include "NitroSQLiteQueryResults.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::rnnitrosqlite { + + /** + * A struct which can be represented as a JavaScript object (NitroSQLiteQueryResult). + */ + struct NitroSQLiteQueryResult final { + public: + double rowsAffected SWIFT_PRIVATE; + std::optional insertId SWIFT_PRIVATE; + margelo::nitro::rnnitrosqlite::SQLiteQueryResults results SWIFT_PRIVATE; + std::optional> metadata SWIFT_PRIVATE; + std::optional rowBatchCount SWIFT_PRIVATE; + + public: + explicit NitroSQLiteQueryResult(double rowsAffected, std::optional insertId, margelo::nitro::rnnitrosqlite::SQLiteQueryResults results, std::optional> metadata, std::optional rowBatchCount): rowsAffected(rowsAffected), insertId(std::move(insertId)), results(results), metadata(std::move(metadata)), rowBatchCount(std::move(rowBatchCount)) {} + + public: + // NitroSQLiteQueryResult is not equatable because these properties are not equatable: results + }; + +} // namespace margelo::nitro::rnnitrosqlite + +namespace margelo::nitro { + + // C++ NitroSQLiteQueryResult <> JS NitroSQLiteQueryResult (object) + template <> + struct JSIConverter final { + static margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg); + static jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::NitroSQLiteQueryResult& arg); + static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value); + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.cjs b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.cjs new file mode 100644 index 00000000..9cb2ec83 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.cjs @@ -0,0 +1,19 @@ +/// +/// NitroSQLite.cjs +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +const { NitroModules } = require('react-native-nitro-modules') + +let hybridClass + +module.exports = { + get NitroSQLite() { + if (hybridClass === undefined) { + hybridClass = NitroModules.getHybridClass('rnnitrosqlite.NitroSQLite') + } + return hybridClass + }, +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.d.cts b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.d.cts new file mode 100644 index 00000000..905cd9f4 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLite.d.cts @@ -0,0 +1,9 @@ +/// +/// NitroSQLite.d.cts +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +// The spec's `export declare class NitroSQLite` types this runtime export. +export {} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.cjs b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.cjs new file mode 100644 index 00000000..9e230f3e --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.cjs @@ -0,0 +1,19 @@ +/// +/// NitroSQLiteOnLoad.cjs +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +const { NitroModules } = require('react-native-nitro-modules') + +let hybridClass + +module.exports = { + get NitroSQLiteOnLoad() { + if (hybridClass === undefined) { + hybridClass = NitroModules.getHybridClass('rnnitrosqlite.NitroSQLiteOnLoad') + } + return hybridClass + }, +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.d.cts b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.d.cts new file mode 100644 index 00000000..d91be463 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLiteOnLoad.d.cts @@ -0,0 +1,9 @@ +/// +/// NitroSQLiteOnLoad.d.cts +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +// The spec's `export declare class NitroSQLiteOnLoad` types this runtime export. +export {} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.cjs b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.cjs new file mode 100644 index 00000000..379dd0df --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.cjs @@ -0,0 +1,19 @@ +/// +/// NitroSQLitePreparedStatement.cjs +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +const { NitroModules } = require('react-native-nitro-modules') + +let hybridClass + +module.exports = { + get NitroSQLitePreparedStatement() { + if (hybridClass === undefined) { + hybridClass = NitroModules.getHybridClass('rnnitrosqlite.NitroSQLitePreparedStatement') + } + return hybridClass + }, +} diff --git a/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.d.cts b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.d.cts new file mode 100644 index 00000000..6ab1ac74 --- /dev/null +++ b/packages/react-native-nitro-sqlite/nitrogen/generated/shared/javascript/NitroSQLitePreparedStatement.d.cts @@ -0,0 +1,9 @@ +/// +/// NitroSQLitePreparedStatement.d.cts +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/margelo/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +// The spec's `export declare class NitroSQLitePreparedStatement` types this runtime export. +export {} diff --git a/packages/react-native-nitro-sqlite/package.json b/packages/react-native-nitro-sqlite/package.json index 9c2881f9..ea0fb92a 100644 --- a/packages/react-native-nitro-sqlite/package.json +++ b/packages/react-native-nitro-sqlite/package.json @@ -41,6 +41,9 @@ } } }, + "imports": { + "#nitro/*": "./nitrogen/generated/shared/javascript/*.cjs" + }, "files": [ "THIRD_PARTY_NOTICES.md", "src", @@ -96,21 +99,24 @@ "@types/better-sqlite3": "^9.6.0", "better-sqlite3": "^12.11.1", "jest": "^30.2.0", - "nitrogen": "0.37.1", + "nitrogen": "1.0.0-alpha.nightly.86.g15e19db42041", "react": "19.3.1", "react-native": "0.88.0", "react-native-builder-bob": "^0.31.0", - "react-native-nitro-modules": "0.37.1" + "react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041" }, "peerDependencies": { "better-sqlite3": "^12.11.1", "react": ">=17.0.0", - "react-native": ">=0.75.0", - "react-native-nitro-modules": ">=0.35.0" + "react-native": ">=0.88.0", + "react-native-nitro-modules": "*" }, "peerDependenciesMeta": { "better-sqlite3": { "optional": true + }, + "react-native-nitro-modules": { + "optional": true } }, "resolutions": { diff --git a/packages/react-native-nitro-sqlite/src/OnLoad.android.ts b/packages/react-native-nitro-sqlite/src/OnLoad.android.ts index c89a4fd4..b4ebe523 100644 --- a/packages/react-native-nitro-sqlite/src/OnLoad.android.ts +++ b/packages/react-native-nitro-sqlite/src/OnLoad.android.ts @@ -1,6 +1,3 @@ -import { NitroModules } from 'react-native-nitro-modules' -import { NitroSQLiteOnLoad as NitroSQLiteOnLoadSpec } from './specs/NitroSQLiteOnLoad.nitro' +import { NitroSQLiteOnLoad } from './specs/NitroSQLiteOnLoad.nitro' -const NitroSQLiteOnLoad = - NitroModules.createHybridObject('NitroSQLiteOnLoad') export const init = () => NitroSQLiteOnLoad.init() diff --git a/packages/react-native-nitro-sqlite/src/__tests__/entrypoints.test.ts b/packages/react-native-nitro-sqlite/src/__tests__/entrypoints.test.ts index 1cfe6048..9991477f 100644 --- a/packages/react-native-nitro-sqlite/src/__tests__/entrypoints.test.ts +++ b/packages/react-native-nitro-sqlite/src/__tests__/entrypoints.test.ts @@ -1,7 +1,11 @@ jest.mock('react-native-nitro-modules', () => ({ NitroModules: { - createHybridObject: jest.fn((name: string) => - name === 'NitroSQLiteOnLoad' ? { init: jest.fn() } : { open: jest.fn() }, + getHybridClass: jest.fn((name: string) => + name === 'rnnitrosqlite.NitroSQLiteOnLoad' + ? { init: jest.fn() } + : class { + open = jest.fn() + }, ), }, })) @@ -28,7 +32,9 @@ describe('entrypoints', () => { }) it('creates the native object and exposes its native and managed methods', () => { - expect(NitroModules.createHybridObject).toHaveBeenCalledWith('NitroSQLite') + expect(NitroModules.getHybridClass).toHaveBeenCalledWith( + 'rnnitrosqlite.NitroSQLite', + ) expect(NitroSQLite.native).toBe(HybridNitroSQLite) expect(NitroSQLite.open).toBe(open) expect(NitroSQLite.open).not.toBe(HybridNitroSQLite.open) @@ -38,12 +44,13 @@ describe('entrypoints', () => { it('initializes the Android native loader', () => { androidInit() - expect(NitroModules.createHybridObject).toHaveBeenCalledWith( - 'NitroSQLiteOnLoad', + expect(NitroModules.getHybridClass).toHaveBeenCalledWith( + 'rnnitrosqlite.NitroSQLiteOnLoad', ) const onLoad = jest - .mocked(NitroModules.createHybridObject) - .mock.results.find((result) => 'init' in result.value)?.value + .mocked(NitroModules.getHybridClass) + .mock.results.map((result) => result.value as { init?: jest.Mock }) + .find((value) => 'init' in value) expect(onLoad?.init).toHaveBeenCalledTimes(1) }) }) diff --git a/packages/react-native-nitro-sqlite/src/__tests__/prepare.test.ts b/packages/react-native-nitro-sqlite/src/__tests__/prepare.test.ts index 270d0e1d..5949e06b 100644 --- a/packages/react-native-nitro-sqlite/src/__tests__/prepare.test.ts +++ b/packages/react-native-nitro-sqlite/src/__tests__/prepare.test.ts @@ -26,7 +26,6 @@ afterEach(() => { function mockStatement(): NitroSQLitePreparedStatement { let finalized = false return { - name: 'PreparedStatement', toString: () => 'PreparedStatement', equals: () => false, dispose: jest.fn(), diff --git a/packages/react-native-nitro-sqlite/src/__tests__/testUtils.ts b/packages/react-native-nitro-sqlite/src/__tests__/testUtils.ts index ae4d24f2..a5c13490 100644 --- a/packages/react-native-nitro-sqlite/src/__tests__/testUtils.ts +++ b/packages/react-native-nitro-sqlite/src/__tests__/testUtils.ts @@ -1,4 +1,4 @@ -import type { NitroSQLiteQueryResult } from '../specs/NitroSQLiteQueryResult.nitro' +import type { NitroSQLiteQueryResult } from '../specs/NitroSQLiteQueryResult' import type { SQLiteValue } from '../types' export function nativeResult( diff --git a/packages/react-native-nitro-sqlite/src/index.ts b/packages/react-native-nitro-sqlite/src/index.ts index 1ab6af75..4f791b05 100644 --- a/packages/react-native-nitro-sqlite/src/index.ts +++ b/packages/react-native-nitro-sqlite/src/index.ts @@ -34,7 +34,7 @@ export type { NitroSQLiteQueryResult, NitroSQLiteQueryRows, NitroSQLiteQueryColumnMetadata, -} from './specs/NitroSQLiteQueryResult.nitro' +} from './specs/NitroSQLiteQueryResult' export type { TypeOrmNitroSQLiteConnection } from './typeORM' export type * from './types' export { typeORMDriver } from './typeORM' diff --git a/packages/react-native-nitro-sqlite/src/nitro.ts b/packages/react-native-nitro-sqlite/src/nitro.ts index c1c552e2..1cd966f9 100644 --- a/packages/react-native-nitro-sqlite/src/nitro.ts +++ b/packages/react-native-nitro-sqlite/src/nitro.ts @@ -1,5 +1,3 @@ -import { NitroModules } from 'react-native-nitro-modules' -import type { NitroSQLite as NitroSQLiteSpec } from './specs/NitroSQLite.nitro' +import { NitroSQLite } from './specs/NitroSQLite.nitro' -export const HybridNitroSQLite = - NitroModules.createHybridObject('NitroSQLite') +export const HybridNitroSQLite = new NitroSQLite() diff --git a/packages/react-native-nitro-sqlite/src/operations/execute.ts b/packages/react-native-nitro-sqlite/src/operations/execute.ts index 5ed5511c..0cb628ae 100644 --- a/packages/react-native-nitro-sqlite/src/operations/execute.ts +++ b/packages/react-native-nitro-sqlite/src/operations/execute.ts @@ -1,7 +1,7 @@ import { HybridNitroSQLite } from '../nitro' import type { QueryResult, QueryResultRow, SQLiteQueryParams } from '../types' import NitroSQLiteError from '../NitroSQLiteError' -import type { NitroSQLiteQueryResult } from '../specs/NitroSQLiteQueryResult.nitro' +import type { NitroSQLiteQueryResult } from '../specs/NitroSQLiteQueryResult' import { isDatabaseOpen, queueStatementAsync, diff --git a/packages/react-native-nitro-sqlite/src/specs/NitroSQLite.nitro.ts b/packages/react-native-nitro-sqlite/src/specs/NitroSQLite.nitro.ts index dcd40766..71db521d 100644 --- a/packages/react-native-nitro-sqlite/src/specs/NitroSQLite.nitro.ts +++ b/packages/react-native-nitro-sqlite/src/specs/NitroSQLite.nitro.ts @@ -1,4 +1,4 @@ -import type { HybridObject } from 'react-native-nitro-modules' +import { Android, iOS, type HybridObject } from 'react-native-nitro-modules' import type { BatchQueryCommand, BatchQueryResult, @@ -8,18 +8,33 @@ import type { import type { NitroSQLiteQueryResult, NitroSQLiteQueryRows, -} from './NitroSQLiteQueryResult.nitro' +} from './NitroSQLiteQueryResult' import type { NitroSQLitePreparedStatement } from './NitroSQLitePreparedStatement.nitro' +export * from '#nitro/NitroSQLite' + /** Native database operations exposed through `NitroSQLite.native`. * These calls bypass the managed connection queue. Coordinate them with any * transaction or pending operation on the same database yourself. */ -export interface NitroSQLite - extends HybridObject<{ - ios: 'c++' - android: 'c++' - }> { +@iOS({ + language: 'c++', + implementation: { + className: 'HybridNitroSQLite', + include: '"hybridObjects/HybridNitroSQLite.hpp"', + }, +}) +@Android({ + language: 'c++', + implementation: { + className: 'HybridNitroSQLite', + include: '"hybridObjects/HybridNitroSQLite.hpp"', + }, +}) +export declare class NitroSQLite extends HybridObject { + /** Create a root with its own default and independent connections. */ + constructor() + /** Open a name-based default connection, creating the database unless `readOnly` is true. * @param dbName Database file name and default connection key. * @param location Directory relative to the platform database directory. diff --git a/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteOnLoad.nitro.ts b/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteOnLoad.nitro.ts index 135ae9e1..3cb3123d 100644 --- a/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteOnLoad.nitro.ts +++ b/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteOnLoad.nitro.ts @@ -1,5 +1,13 @@ -import type { HybridObject } from 'react-native-nitro-modules' +import { Android, type HybridObject } from 'react-native-nitro-modules' -export interface NitroSQLiteOnLoad extends HybridObject<{ android: 'kotlin' }> { - init(): void +export * from '#nitro/NitroSQLiteOnLoad' + +/** Android startup hook that configures the native database directories. */ +@Android({ + language: 'kotlin', + implementation: { className: 'HybridNitroSQLiteOnLoad' }, +}) +export declare class NitroSQLiteOnLoad extends HybridObject { + /** Pass the app's files and cache directories from the application context to SQLite. */ + static init(): void } diff --git a/packages/react-native-nitro-sqlite/src/specs/NitroSQLitePreparedStatement.nitro.ts b/packages/react-native-nitro-sqlite/src/specs/NitroSQLitePreparedStatement.nitro.ts index de545bd9..980f653c 100644 --- a/packages/react-native-nitro-sqlite/src/specs/NitroSQLitePreparedStatement.nitro.ts +++ b/packages/react-native-nitro-sqlite/src/specs/NitroSQLitePreparedStatement.nitro.ts @@ -1,13 +1,25 @@ -import type { HybridObject } from 'react-native-nitro-modules' +import { Android, iOS, type HybridObject } from 'react-native-nitro-modules' import type { SQLiteQueryParams } from '../types' -import type { NitroSQLiteQueryResult } from './NitroSQLiteQueryResult.nitro' +import type { NitroSQLiteQueryResult } from './NitroSQLiteQueryResult' + +export * from '#nitro/NitroSQLitePreparedStatement' /** Native prepared statement returned by `NitroSQLite.native.prepare()`. */ -export interface NitroSQLitePreparedStatement - extends HybridObject<{ - ios: 'c++' - android: 'c++' - }> { +@iOS({ + language: 'c++', + implementation: { + className: 'HybridNitroSQLitePreparedStatement', + include: '"hybridObjects/HybridNitroSQLitePreparedStatement.hpp"', + }, +}) +@Android({ + language: 'c++', + implementation: { + className: 'HybridNitroSQLitePreparedStatement', + include: '"hybridObjects/HybridNitroSQLitePreparedStatement.hpp"', + }, +}) +export declare class NitroSQLitePreparedStatement extends HybridObject { /** Whether the native statement has been finalized. */ readonly isFinalized: boolean diff --git a/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteQueryResult.nitro.ts b/packages/react-native-nitro-sqlite/src/specs/NitroSQLiteQueryResult.ts similarity index 100% rename from packages/react-native-nitro-sqlite/src/specs/NitroSQLiteQueryResult.nitro.ts rename to packages/react-native-nitro-sqlite/src/specs/NitroSQLiteQueryResult.ts diff --git a/packages/react-native-nitro-sqlite/src/types.ts b/packages/react-native-nitro-sqlite/src/types.ts index 7ce24aab..0d1cc891 100644 --- a/packages/react-native-nitro-sqlite/src/types.ts +++ b/packages/react-native-nitro-sqlite/src/types.ts @@ -1,4 +1,4 @@ -import type { NitroSQLiteQueryResult } from './specs/NitroSQLiteQueryResult.nitro' +import type { NitroSQLiteQueryResult } from './specs/NitroSQLiteQueryResult' /** Options for `open()` and `NitroSQLite.open()`. */ export interface NitroSQLiteConnectionOptions {