react-native-nitro-sqlite-kysely 10.5.0 → 11.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Marc Rousavy & Christoph Pader
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  Use Kysely's typed SQL builder with a local Nitro SQLite database on React Native. Install `react-native-nitro-sqlite-kysely`, `kysely@^0.29.9`, and the [Nitro SQLite native dependencies](https://sqlite.margelo.com/docs).
4
4
 
5
+ Install the 11.0.0 alpha from the `alpha` tag. Save exact versions: npm otherwise saves `^11.0.0-alpha.0`, which also matches the older `11.0.0-nitro-v1.x` builds.
6
+
7
+ ```sh
8
+ npm install --save-exact react-native-nitro-sqlite@alpha react-native-nitro-sqlite-kysely@alpha
9
+ npm install 'kysely@^0.29.9'
10
+ ```
11
+
12
+ See the [companion installation guide](../../../../docs/content/docs/integrations/orms/index.mdx) for peer dependencies.
13
+
5
14
  ```ts
6
15
  import { Kysely } from 'kysely'
7
16
  import { createNitroSQLiteDialect } from 'react-native-nitro-sqlite-kysely'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-sqlite-kysely",
3
- "version": "10.5.0",
3
+ "version": "11.0.0-alpha.1",
4
4
  "description": "Kysely SQLite dialect for React Native using Nitro SQLite.",
5
5
  "source": "./src/index.ts",
6
6
  "react-native": "./src/index.ts",
@@ -8,16 +8,24 @@
8
8
  "types": "./src/index.ts",
9
9
  "files": [
10
10
  "src",
11
- "README.md"
11
+ "scripts",
12
+ "README.md",
13
+ "LICENSE",
14
+ "tsconfig.json"
12
15
  ],
13
16
  "scripts": {
14
- "typecheck": "tsc --build",
15
- "lint": "eslint \"src/**/*.ts\" --fix",
16
- "prepublishOnly": "bun typecheck"
17
+ "materialize": "node scripts/materialize.mjs",
18
+ "typecheck": "node scripts/materialize.mjs && tsc --build",
19
+ "prepack": "bun run typecheck",
20
+ "prepublishOnly": "bun run typecheck",
21
+ "test": "node scripts/materialize.mjs && node --experimental-strip-types --test tests/*.test.ts",
22
+ "pack": "bun pm pack",
23
+ "lint": "eslint \"src/**/*.ts\" --fix"
17
24
  },
18
25
  "repository": {
19
26
  "type": "git",
20
- "url": "git+https://github.com/margelo/react-native-nitro-sqlite.git"
27
+ "url": "git+https://github.com/margelo/nitro-sqlite.git",
28
+ "directory": "packages/integrations/react-native/kysely"
21
29
  },
22
30
  "author": "Christoph Pader",
23
31
  "license": "MIT",
@@ -30,10 +38,20 @@
30
38
  },
31
39
  "peerDependencies": {
32
40
  "kysely": "^0.29.9",
33
- "react-native-nitro-sqlite": ">=10.4.0"
41
+ "react-native-nitro-sqlite": ">=11.0.0-0"
34
42
  },
35
43
  "devDependencies": {
36
44
  "kysely": "0.29.9",
37
- "react-native-nitro-sqlite": "10.5.0"
45
+ "react-native-nitro-sqlite": "11.0.0-alpha.1",
46
+ "better-sqlite3": "^12.11.1",
47
+ "@types/node": "^25.0.0",
48
+ "typescript": "^6.0.3"
49
+ },
50
+ "exports": {
51
+ ".": {
52
+ "types": "./src/index.ts",
53
+ "default": "./src/index.ts"
54
+ },
55
+ "./package.json": "./package.json"
38
56
  }
39
57
  }
@@ -0,0 +1,19 @@
1
+ import { existsSync } from 'node:fs'
2
+ import { dirname, join, resolve } from 'node:path'
3
+ import { fileURLToPath, pathToFileURL } from 'node:url'
4
+
5
+ const packageDirectory = resolve(dirname(fileURLToPath(import.meta.url)), '..')
6
+ const sharedHelper = resolve(
7
+ packageDirectory,
8
+ '../../../../shared/orm/materialize-sources.mjs',
9
+ )
10
+ if (existsSync(sharedHelper)) {
11
+ const { materializeOrmSources } = await import(
12
+ pathToFileURL(sharedHelper).href
13
+ )
14
+ materializeOrmSources(packageDirectory)
15
+ } else if (!existsSync(join(packageDirectory, 'src/index.ts'))) {
16
+ throw new Error(
17
+ 'ORM source is missing. Prepare the package from the workspace before packing it.',
18
+ )
19
+ }
package/src/index.ts CHANGED
@@ -6,18 +6,15 @@ import {
6
6
  } from 'kysely-generic-sqlite'
7
7
  import {
8
8
  open,
9
- type NitroSQLiteConnectionOptions,
9
+ type ConnectionOptions,
10
10
  type SQLiteValue,
11
11
  } from 'react-native-nitro-sqlite'
12
12
 
13
13
  /** SQLite file, location, access mode and optional SEE key for one dedicated native handle. */
14
- export type NitroSQLiteDialectOptions = Omit<
15
- NitroSQLiteConnectionOptions,
16
- 'connection'
17
- >
14
+ export type NitroSQLiteDialectOptions = Omit<ConnectionOptions, 'connection'>
18
15
 
19
16
  /**
20
- * Create a Kysely SQLite dialect for React Native. The first query opens an
17
+ * Create a Kysely SQLite dialect for React Native and NitroUI. The first query opens an
21
18
  * independent Nitro SQLite handle. Kysely serializes queries and holds the
22
19
  * handle for the duration of a transaction or connection callback.
23
20
  * Queries reject on open, bind or SQLite errors. Streaming is unsupported.
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../../../config/tsconfig.json",
3
+ "include": ["src"],
4
+ "references": [{ "path": "../../../react-native-nitro-sqlite" }],
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": ".tsbuild",
8
+ "emitDeclarationOnly": true,
9
+ "noEmit": false,
10
+ "tsBuildInfoFile": ".tsbuild/tsconfig.tsbuildinfo",
11
+ "paths": {
12
+ "react-native-nitro-sqlite": ["../../../react-native-nitro-sqlite/src/index.ts"]
13
+ }
14
+ }
15
+ }