@livestore/livestore 0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b → 0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SqliteDbWrapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqliteDbWrapper.test.d.ts","sourceRoot":"","sources":["../src/SqliteDbWrapper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { Effect } from '@livestore/utils/effect';
2
+ import { Vitest } from '@livestore/utils-dev/node-vitest';
3
+ import { expect } from 'vitest';
4
+ import { makeTodoMvc } from './utils/tests/fixture.js';
5
+ Vitest.describe('SqliteDbWrapper', () => {
6
+ Vitest.describe('getTablesUsed', () => {
7
+ const getTablesUsed = (query) => Effect.gen(function* () {
8
+ const store = yield* makeTodoMvc({});
9
+ return store.sqliteDbWrapper.getTablesUsed(query);
10
+ });
11
+ Vitest.scopedLive('should return the correct tables used', (_test) => Effect.gen(function* () {
12
+ const tablesUsed = yield* getTablesUsed('select * from todos');
13
+ expect(tablesUsed).toEqual(new Set(['todos']));
14
+ }));
15
+ Vitest.scopedLive('should handle DELETE FROM statement without WHERE clause', (_test) => Effect.gen(function* () {
16
+ const tablesUsed = yield* getTablesUsed('DELETE FROM todos');
17
+ expect(tablesUsed).toEqual(new Set(['todos']));
18
+ }));
19
+ Vitest.scopedLive('should handle INSERT with ON CONFLICT clause', (_test) => Effect.gen(function* () {
20
+ const tablesUsed = yield* getTablesUsed('INSERT INTO todos (id, text, completed) VALUES (?, ?, ?) ON CONFLICT(id) DO UPDATE SET text = ?');
21
+ expect(tablesUsed).toEqual(new Set(['todos']));
22
+ }));
23
+ });
24
+ });
25
+ //# sourceMappingURL=SqliteDbWrapper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sq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AC,CAAC,CAAA;QAChD,CAAC,CAAC,CACH,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,8CAA8C,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,aAAa,CACrC,iGAAiG,CAClG,CAAA;YACD,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAChD,CAAC,CAAC,CACH,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/livestore",
3
- "version": "0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b",
3
+ "version": "0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@opentelemetry/api": "1.9.0",
40
- "@livestore/utils": "0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b",
41
- "@livestore/common": "0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b"
40
+ "@livestore/common": "0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d",
41
+ "@livestore/utils": "0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@opentelemetry/sdk-trace-base": "^2.0.0",
@@ -46,8 +46,8 @@
46
46
  "typescript": "^5.8.3",
47
47
  "vite": "^6.3.4",
48
48
  "vitest": "^3.1.2",
49
- "@livestore/adapter-web": "0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b",
50
- "@livestore/utils-dev": "0.0.0-snapshot-77d0fdc63f389a3feccb2673e2e9429068437a9b"
49
+ "@livestore/adapter-web": "0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d",
50
+ "@livestore/utils-dev": "0.0.0-snapshot-b7822254660009af2b4f89db574826d288a7777d"
51
51
  },
52
52
  "files": [
53
53
  "package.json",
@@ -0,0 +1,38 @@
1
+ import { Effect } from '@livestore/utils/effect'
2
+ import { Vitest } from '@livestore/utils-dev/node-vitest'
3
+ import { expect } from 'vitest'
4
+
5
+ import { makeTodoMvc } from './utils/tests/fixture.js'
6
+
7
+ Vitest.describe('SqliteDbWrapper', () => {
8
+ Vitest.describe('getTablesUsed', () => {
9
+ const getTablesUsed = (query: string) =>
10
+ Effect.gen(function* () {
11
+ const store = yield* makeTodoMvc({})
12
+ return store.sqliteDbWrapper.getTablesUsed(query)
13
+ })
14
+
15
+ Vitest.scopedLive('should return the correct tables used', (_test) =>
16
+ Effect.gen(function* () {
17
+ const tablesUsed = yield* getTablesUsed('select * from todos')
18
+ expect(tablesUsed).toEqual(new Set(['todos']))
19
+ }),
20
+ )
21
+
22
+ Vitest.scopedLive('should handle DELETE FROM statement without WHERE clause', (_test) =>
23
+ Effect.gen(function* () {
24
+ const tablesUsed = yield* getTablesUsed('DELETE FROM todos')
25
+ expect(tablesUsed).toEqual(new Set(['todos']))
26
+ }),
27
+ )
28
+
29
+ Vitest.scopedLive('should handle INSERT with ON CONFLICT clause', (_test) =>
30
+ Effect.gen(function* () {
31
+ const tablesUsed = yield* getTablesUsed(
32
+ 'INSERT INTO todos (id, text, completed) VALUES (?, ?, ?) ON CONFLICT(id) DO UPDATE SET text = ?',
33
+ )
34
+ expect(tablesUsed).toEqual(new Set(['todos']))
35
+ }),
36
+ )
37
+ })
38
+ })