Skip to content

Commit 243f8e9

Browse files
committed
Update wa-sqlite version
1 parent 89f6b7c commit 243f8e9

File tree

5 files changed

+67
-28
lines changed

5 files changed

+67
-28
lines changed

demos/react-supabase-todolist/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
"dependencies": {
1212
"@journeyapps/powersync-react": "workspace:*",
1313
"@journeyapps/powersync-sdk-web": "workspace:*",
14-
"@journeyapps/wa-sqlite": "~0.1.1",
14+
"@journeyapps/wa-sqlite": "~0.2.0",
1515
"@mui/material": "^5.15.12",
1616
"@mui/x-data-grid": "^6.19.6",
17+
"@mui/icons-material": "^5.15.12",
1718
"@supabase/supabase-js": "^2.39.7",
1819
"js-logger": "^1.6.1",
1920
"lodash": "^4.17.21",

demos/react-supabase-todolist/src/app/utils/fts_helpers.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import { db } from '@/components/providers/SystemProvider';
22

3+
/**
4+
* adding * to the end of the search term will match any word that starts with the search term
5+
* e.g. searching bl will match blue, black, etc.
6+
* consult FTS5 Full-text Query Syntax documentation for more options
7+
* @param searchTerm
8+
* @returns a modified search term with options.
9+
*/
310
function createSearchTermWithOptions(searchTerm: string): string {
4-
// adding * to the end of the search term will match any word that starts with the search term
5-
// e.g. searching bl will match blue, black, etc.
6-
// consult FTS5 Full-text Query Syntax documentation for more options
711
const searchTermWithOptions: string = `${searchTerm}*`;
812
return searchTermWithOptions;
913
}
1014

11-
/// Search the FTS table for the given searchTerm
15+
/**
16+
* Search the FTS table for the given searchTerm
17+
* @param searchTerm
18+
* @param tableName
19+
* @returns results from the FTS table
20+
*/
1221
export async function searchTable(searchTerm: string, tableName: string): Promise<any[]> {
1322
const searchTermWithOptions = createSearchTermWithOptions(searchTerm);
1423
return await db.getAll(`SELECT * FROM fts_${tableName} WHERE fts_${tableName} MATCH ? ORDER BY rank`, [

demos/react-supabase-todolist/src/app/utils/fts_setup.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ import { Table } from '@journeyapps/powersync-sdk-web';
33
import { db } from '@/components/providers/SystemProvider';
44
import { ExtractType, generateJsonExtracts } from './helpers';
55

6-
/// Create a Full Text Search table for the given table and columns
7-
/// with an option to use a different tokenizer otherwise it defaults
8-
/// to unicode61. It also creates the triggers that keep the FTS table
9-
/// and the PowerSync table in sync.
6+
/**
7+
* Create a Full Text Search table for the given table and columns
8+
* with an option to use a different tokenizer otherwise it defaults
9+
* to unicode61. It also creates the triggers that keep the FTS table
10+
* and the PowerSync table in sync.
11+
* @param tableName
12+
* @param columns
13+
* @param tokenizationMethod
14+
*/
1015
async function createFtsTable(tableName: string, columns: string[], tokenizationMethod = 'unicode61'): Promise<void> {
1116
const internalName = (AppSchema.tables as Table[]).find((table) => table.name === tableName)?.internalName;
1217
const stringColumns = columns.join(', ');
@@ -49,9 +54,11 @@ async function createFtsTable(tableName: string, columns: string[], tokenization
4954
});
5055
}
5156

52-
/// This is where you can add more methods to generate FTS tables
53-
/// that correspond to the tables in your schema and populate them
54-
/// with the data you would like to search on
57+
/**
58+
* This is where you can add more methods to generate FTS tables in this demo
59+
* that correspond to the tables in your schema and populate them
60+
* with the data you would like to search on
61+
*/
5562
export async function configureFts(): Promise<void> {
5663
await createFtsTable('lists', ['name'], 'porter unicode61');
5764
await createFtsTable('todos', ['description', 'list_id']);

packages/powersync-sdk-web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"author": "JOURNEYAPPS",
3434
"license": "Apache-2.0",
3535
"devDependencies": {
36-
"@journeyapps/wa-sqlite": "~0.1.1",
36+
"@journeyapps/wa-sqlite": "~0.2.0",
3737
"@types/lodash": "^4.14.200",
3838
"@types/uuid": "^9.0.6",
3939
"@vitest/browser": "^1.3.1",
@@ -45,7 +45,7 @@
4545
"webdriverio": "^8.32.3"
4646
},
4747
"peerDependencies": {
48-
"@journeyapps/wa-sqlite": "~0.1.1"
48+
"@journeyapps/wa-sqlite": "~0.2.0"
4949
},
5050
"dependencies": {
5151
"@journeyapps/powersync-sdk-common": "workspace:*",

pnpm-lock.yaml

Lines changed: 36 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)