diff --git a/demos/angular-supabase-todolist/package.json b/demos/angular-supabase-todolist/package.json index 7a9c16a3..2f202e3b 100644 --- a/demos/angular-supabase-todolist/package.json +++ b/demos/angular-supabase-todolist/package.json @@ -20,7 +20,7 @@ "@angular/platform-browser-dynamic": "^17.0.4", "@angular/router": "^17.0.4", "@angular/service-worker": "^17.0.4", - "@journeyapps/powersync-sdk-web": "^0.0.3", + "@journeyapps/powersync-sdk-web": "workspace:*", "@journeyapps/wa-sqlite": "^0.0.2", "@supabase/supabase-js": "^2.38.5", "rxjs": "~7.8.1", diff --git a/demos/nextjs-supabase-todolist/src/library/powersync/AppSchema.ts b/demos/nextjs-supabase-todolist/src/library/powersync/AppSchema.ts index cd5941d9..20d9ea4f 100644 --- a/demos/nextjs-supabase-todolist/src/library/powersync/AppSchema.ts +++ b/demos/nextjs-supabase-todolist/src/library/powersync/AppSchema.ts @@ -3,15 +3,18 @@ import { column, Schema, TableV2 } from '@journeyapps/powersync-sdk-web'; export const LISTS_TABLE = 'lists'; export const TODOS_TABLE = 'todos'; -const todos = new TableV2({ - list_id: column.text, - created_at: column.text, - completed_at: column.text, - description: column.text, - created_by: column.text, - completed_by: column.text, - completed: column.integer -}); +const todos = new TableV2( + { + list_id: column.text, + created_at: column.text, + completed_at: column.text, + description: column.text, + created_by: column.text, + completed_by: column.text, + completed: column.integer + }, + { indexes: { list: ['list_id'] } } +); const lists = new TableV2({ created_at: column.text, diff --git a/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/AppSchema.ts b/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/AppSchema.ts index 7c7db76f..25532399 100644 --- a/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/AppSchema.ts +++ b/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/AppSchema.ts @@ -1,20 +1,28 @@ -import { Column, ColumnType, Index, IndexedColumn, Schema, Table } from '@journeyapps/powersync-sdk-web'; +import { column, Schema, TableV2 } from '@journeyapps/powersync-sdk-web'; -export const AppSchema = new Schema([ - new Table({ - name: 'documents', - columns: [ - new Column({ name: 'title', type: ColumnType.TEXT }), - new Column({ name: 'created_at', type: ColumnType.TEXT }) - ] - }), - new Table({ - name: 'document_updates', - columns: [ - new Column({ name: 'created_at', type: ColumnType.TEXT }), - new Column({ name: 'document_id', type: ColumnType.TEXT }), - new Column({ name: 'update_b64', type: ColumnType.TEXT }) - ], - indexes: [new Index({ name: 'by_document', columns: [new IndexedColumn({ name: 'document_id' })] })] - }) -]); +const documents = new TableV2( + { + title: column.text, + created_at: column.text + }, + { indexes: { list: ['list_id'] } } +); + +const document_updates = new TableV2( + { + document_id: column.text, + created_at: column.text, + update_b64: column.text + }, + { indexes: { by_document: ['document_id'] } } +); + +export const AppSchema = new Schema({ + documents, + document_updates +}); + +export type Database = (typeof AppSchema)['types']; +export type Documents = Database['documents']; + +export type DocumentUpdates = Database['document_updates']; diff --git a/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/SupabaseConnector.ts b/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/SupabaseConnector.ts index e2b5efaa..83637019 100644 --- a/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/SupabaseConnector.ts +++ b/demos/yjs-nextjs-supabase-text-collab/src/library/powersync/SupabaseConnector.ts @@ -9,7 +9,6 @@ import { import { SupabaseClient, createClient, - PostgrestError, FunctionsHttpError, FunctionsRelayError, FunctionsFetchError diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0978e859..151ee32b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,8 +51,8 @@ importers: specifier: ^17.0.4 version: 17.1.3(@angular/common@17.1.3)(@angular/core@17.1.3) '@journeyapps/powersync-sdk-web': - specifier: ^0.0.3 - version: 0.0.3(@journeyapps/wa-sqlite@0.0.2) + specifier: workspace:* + version: link:../../packages/powersync-sdk-web '@journeyapps/wa-sqlite': specifier: ^0.0.2 version: 0.0.2 @@ -7507,32 +7507,6 @@ packages: '@types/yargs': 17.0.32 chalk: 4.1.2 - /@journeyapps/powersync-sdk-common@0.1.4: - resolution: {integrity: sha512-VFf/ej7sy1NxL0yFkMwPIIjCI9TJ6EWj0thx5WPEanhLeCqgA5OdTmSmp39Tc6EYxF1VZdLWqUMvhT+r0WMFuQ==} - dependencies: - async-mutex: 0.4.1 - can-ndjson-stream: 1.0.2 - event-iterator: 2.0.0 - js-logger: 1.6.1 - lodash: 4.17.21 - object-hash: 3.0.0 - uuid: 3.4.0 - dev: false - - /@journeyapps/powersync-sdk-web@0.0.3(@journeyapps/wa-sqlite@0.0.2): - resolution: {integrity: sha512-NV1oJYC3We7M/hvySPAfAstQ4ZMEMDn7I95CJh/2Pv98ij5JaROz8n/31qnBBgK4PRCtZXNx7P2sBMGvYOe4Qw==} - peerDependencies: - '@journeyapps/wa-sqlite': ~0.0.2 - dependencies: - '@journeyapps/powersync-sdk-common': 0.1.4 - '@journeyapps/wa-sqlite': 0.0.2 - async-mutex: 0.4.1 - comlink: 4.4.1 - js-logger: 1.6.1 - lodash: 4.17.21 - uuid: 9.0.1 - dev: false - /@journeyapps/react-native-quick-sqlite@1.1.1(react-native@0.72.4)(react@18.2.0): resolution: {integrity: sha512-5I8zUZoFRgtnagjQygqnSyWG0L39ycFvum+ytsMmFW8LY1GpEZ+a3I6fWggwM82/Cc9YOheCVRIz47g0uBBZug==} peerDependencies: @@ -22686,6 +22660,7 @@ packages: /object-hash@3.0.0: resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} engines: {node: '>= 6'} + dev: true /object-inspect@1.13.1: resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}