@storecraft/database-turso 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  <div style="text-align:center">
4
4
  <img src='https://storecraft.app/storecraft-color.svg'
5
- width='90%'' />
5
+ width='90%' />
6
6
  </div><hr/><br/>
7
7
 
8
8
  Official `Turso` / `libSql` driver for `StoreCraft` on any platforms.
9
9
 
10
10
  ```bash
11
- npm i @storecraft/database-cloudflare-d1
11
+ npm i @storecraft/database-turso
12
12
  ```
13
13
 
14
14
  ## Setup
@@ -23,14 +23,11 @@ npm i @storecraft/database-cloudflare-d1
23
23
  ```js
24
24
  import 'dotenv/config';
25
25
  import http from "node:http";
26
- import { join } from "node:path";
27
- import { homedir } from "node:os";
28
-
29
26
  import { App } from '@storecraft/core'
30
- import { NodePlatform } from '@storecraft/platforms/node';
27
+ import { NodePlatform } from '@storecraft/core/platform/node';
28
+ import { NodeLocalStorage } from '@storecraft/core/storage/node'
31
29
  import { Turso } from '@storecraft/database-turso'
32
30
  import { migrateToLatest } from '@storecraft/database-turso/migrate.js'
33
- import { NodeLocalStorage } from '@storecraft/storage-local/node'
34
31
 
35
32
  const app = new App(
36
33
  {
@@ -51,7 +48,7 @@ const app = new App(
51
48
  }
52
49
  )
53
50
  )
54
- .withStorage(new NodeLocalStorage(join(homedir(), 'tomer')))
51
+ .withStorage(new NodeLocalStorage('storage'))
55
52
 
56
53
  await app.init();
57
54
  await migrateToLatest(app.db, false);
package/index.js CHANGED
@@ -1,4 +1,23 @@
1
- export * from './driver.js';
1
+ import { SQL } from '@storecraft/database-sql-base';
2
+ import { LibsqlDialect } from './kysely.turso.dialect.js';
2
3
 
4
+ /**
5
+ * @extends {SQL}
6
+ */
7
+ export class Turso extends SQL {
3
8
 
9
+ /**
10
+ *
11
+ * @param {import('./types.public.d.ts').Config} [config] config
12
+ */
13
+ constructor(config) {
14
+ super(
15
+ {
16
+ dialect_type: 'SQLITE',
17
+ dialect: new LibsqlDialect(config),
18
+ }
19
+ );
4
20
 
21
+ }
22
+
23
+ }
@@ -1,11 +1,6 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
4
- "noEmit": true,
5
- "allowJs": true,
6
3
  "checkJs": true,
7
- "target": "ESNext",
8
- "resolveJsonModule": true,
9
4
  "moduleResolution": "NodeNext",
10
5
  "module": "NodeNext",
11
6
  "composite": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/database-turso",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "`Storecraft` database driver for `Turso` (cloud sqlite)",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",
@@ -21,7 +21,8 @@
21
21
  "types": "./types.public.d.ts",
22
22
  "scripts": {
23
23
  "database-turso:test": "node ./tests/runner.test.js",
24
- "database-turso:publish": "npm publish --access public"
24
+ "test": "npm run database-turso:test",
25
+ "prepublishOnly": "npm version patch --force"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "kysely": "*"
@@ -32,7 +33,6 @@
32
33
  "@storecraft/database-sql-base": "^1.0.0"
33
34
  },
34
35
  "devDependencies": {
35
- "@storecraft/test-runner": "^1.0.0",
36
36
  "@types/node": "^20.11.0",
37
37
  "dotenv": "^16.3.1",
38
38
  "uvu": "^0.5.6"
@@ -1,6 +1,6 @@
1
1
  import { App } from '@storecraft/core';
2
- import { NodePlatform } from '@storecraft/platforms/node';
3
- import { api_index } from '@storecraft/test-runner'
2
+ import { NodePlatform } from '@storecraft/core/platform/node';
3
+ import { api } from '@storecraft/core/test-runner'
4
4
  import { Turso } from '../index.js';
5
5
  import { migrateToLatest } from '../migrate.js';
6
6
 
@@ -24,7 +24,7 @@ export const create_app = async () => {
24
24
  }
25
25
  }
26
26
  )
27
- )
27
+ );
28
28
 
29
29
  return app.init();
30
30
  }
@@ -34,12 +34,12 @@ async function test() {
34
34
 
35
35
  await migrateToLatest(app.db, false);
36
36
 
37
- Object.entries(api_index).slice(0, -1).forEach(
37
+ Object.entries(api).slice(0, -1).forEach(
38
38
  ([name, runner]) => {
39
39
  runner.create(app).run();
40
40
  }
41
41
  );
42
- const last_test = Object.values(api_index).at(-1).create(app);
42
+ const last_test = Object.values(api).at(-1).create(app);
43
43
  last_test.after(async ()=>{app.db.disconnect()});
44
44
  last_test.run();
45
45
  }
package/tests/sandbox.js CHANGED
@@ -2,7 +2,7 @@ import 'dotenv/config';
2
2
  import { App } from '@storecraft/core';
3
3
  import { Turso } from '@storecraft/database-turso';
4
4
  import { migrateToLatest } from '@storecraft/database-turso/migrate.js';
5
- import { NodePlatform } from '@storecraft/platforms/node';
5
+ import { NodePlatform } from '@storecraft/core/platform/node';
6
6
 
7
7
  export const test = async () => {
8
8
  const app = new App(
package/driver.js DELETED
@@ -1,33 +0,0 @@
1
- import { App } from '@storecraft/core';
2
- import { SQL } from '@storecraft/database-sql-base';
3
- import { LibsqlDialect } from './kysely.turso.dialect.js';
4
-
5
- /**
6
- * @param {any} b
7
- * @param {string} msg
8
- */
9
- const assert = (b, msg) => {
10
- if(!Boolean(b)) throw new Error(msg);
11
- }
12
-
13
-
14
- /**
15
- * @extends {SQL}
16
- */
17
- export class Turso extends SQL {
18
-
19
- /**
20
- *
21
- * @param {import('./types.public.d.ts').Config} [config] config
22
- */
23
- constructor(config) {
24
- super(
25
- {
26
- dialect_type: 'SQLITE',
27
- dialect: new LibsqlDialect(config),
28
- }
29
- );
30
-
31
- }
32
-
33
- }