Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client-sdks/reference/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class TodoList {

### Fetching a Single Item

The [get](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/get.html) method executes a read-only (SELECT) query and returns a single result. It throws an exception if no result is found. Use [getOptional](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/getOptional.html) to return a single optional result (returns `null` if no result is found).
The [get](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/get.html) method executes a read-only (SELECT) query and returns a single result. It throws an exception if no result is found. Use [getOptional](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/getOptional.html) to return a single optional result (returns `null` if no result is found).

The following is an example of selecting a list item by ID:
```dart lib/widgets/lists_widget.dart
Expand All @@ -302,7 +302,7 @@ Future<TodoList> find(id) async {

### Querying Items (PowerSync.getAll)

The [getAll](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/getAll.html) method returns a set of rows from a table.
The [getAll](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/getAll.html) method returns a set of rows from a table.

```dart lib/widgets/lists_widget.dart
import 'package:powersync/sqlite3.dart';
Expand All @@ -317,13 +317,13 @@ Future<List<String>> getLists() async {

### Watching Queries (PowerSync.watch)

The [watch](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/watch.html) method executes a read query whenever a change to a dependent table is made.
The [watch](https://pub.dev/documentation/powersync/latest/powersync/PowerSyncDatabase/watch.html) method executes a read query whenever a change to a dependent table is made.

<FlutterWatch />

### Mutations (PowerSync.execute)

The [execute](https://pub.dev/documentation/powersync/latest/powersync/PowerSyncDatabase/execute.html) method can be used for executing single SQLite write statements.
The [execute](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/execute.html) method can be used for executing single SQLite write statements.

```dart lib/widgets/todos_widget.dart {12-15}
import 'package:flutter/material.dart';
Expand Down
2 changes: 1 addition & 1 deletion client-sdks/reference/javascript-web.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ logger.setLevel(LogLevel.DEBUG);
Enable verbose output in the developer tools for detailed logs.
</Tip>

Additionally, the [WASQLiteDBAdapter](https://powersync-ja.github.io/powersync-js/web-sdk/classes/WASQLiteDBAdapter) opens SQLite connections inside a shared web worker. This worker can be inspected in Chrome by accessing:
Additionally, the [WASQLiteOpenFactory](https://powersync-ja.github.io/powersync-js/web-sdk/classes/WASQLiteOpenFactory.html) opens SQLite connections inside a shared web worker. This worker can be inspected in Chrome by accessing:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simolus3 is this new class and link correct?


```
chrome://inspect/#workers
Expand Down
4 changes: 2 additions & 2 deletions client-sdks/reference/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ import com.powersync.PowerSyncDatabase
class MyConnector : PowerSyncBackendConnector() {
override suspend fun fetchCredentials(): PowerSyncCredentials {
// implement fetchCredentials to obtain the necessary credentials to connect to your backend
// See an example implementation in https://github.com/powersync-ja/powersync-kotlin/blob/main/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt
// See an example implementation in https://github.com/powersync-ja/powersync-kotlin/blob/main/integrations/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt

return {
endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
Expand All @@ -194,7 +194,7 @@ class MyConnector : PowerSyncBackendConnector() {
}
```

**Note**: If you are using Supabase, you can use [SupabaseConnector.kt](https://github.com/powersync-ja/powersync-kotlin/blob/main/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt) as a starting point.
**Note**: If you are using Supabase, you can use [SupabaseConnector.kt](https://github.com/powersync-ja/powersync-kotlin/blob/main/integrations/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt) as a starting point.

## Using PowerSync: CRUD functions

Expand Down
12 changes: 6 additions & 6 deletions client-sdks/usage-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call
<Tab title="Dart/Flutter">
Read and write transactions present a context where multiple changes can be made then finally committed to the DB or rolled back. This ensures that either all the changes get persisted, or no change is made to the DB (in the case of a rollback or exception).

The [writeTransaction(callback)](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/writeTransaction.html) method combines all writes into a single transaction, only committing to persistent storage once.
The [writeTransaction(callback)](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/writeTransaction.html) method combines all writes into a single transaction, only committing to persistent storage once.

```dart
deleteList(SqliteDatabase db, String id) async {
Expand All @@ -30,7 +30,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call
}
```

Also see [readTransaction(callback)](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/readTransaction.html)
Also see [readTransaction(callback)](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/readTransaction.html)
</Tab>

<Tab title="React Native & Expo">
Expand Down Expand Up @@ -233,7 +233,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call

<Tabs>
<Tab title="Dart/Flutter">
Use [watch](https://pub.dev/documentation/powersync/latest/sqlite_async/SqliteQueries/watch.html) to watch for changes to the dependent tables of any SQL query.
Use [watch](https://pub.dev/documentation/powersync/latest/powersync/PowerSyncDatabase/watch.html) to watch for changes to the dependent tables of any SQL query.

<FlutterWatch />
</Tab>
Expand Down Expand Up @@ -342,7 +342,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call

<Tabs>
<Tab title="Dart/Flutter">
Use [execute](https://pub.dev/documentation/powersync/latest/powersync/PowerSyncDatabase/execute.html) to run INSERT, UPDATE or DELETE queries.
Use [execute](https://pub.dev/documentation/sqlite_async/latest/sqlite_async/SqliteConnection/execute.html) to run INSERT, UPDATE or DELETE queries.

```dart
FloatingActionButton(
Expand Down Expand Up @@ -559,7 +559,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call
</Tab>

<Tab title="Kotlin">
Override `uploadData` to send local updates to your backend service. If you are using Supabase, see [SupabaseConnector.kt](https://github.com/powersync-ja/powersync-kotlin/blob/main/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt) for a complete implementation.
Override `uploadData` to send local updates to your backend service. If you are using Supabase, see [SupabaseConnector.kt](https://github.com/powersync-ja/powersync-kotlin/blob/main/integrations/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt) for a complete implementation.

```kotlin
/**
Expand Down Expand Up @@ -1380,7 +1380,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call
```

Also see:
- [SyncDownloadProgress API](https://powersync-ja.github.io/powersync-kotlin/core/com.powersync.sync/-sync-download-progress/index.html)
- [SyncDownloadProgress API](https://powersync-ja.github.io/powersync-kotlin/common/com.powersync.sync/-sync-download-progress/index.html)
- [Demo component](https://github.com/powersync-ja/powersync-kotlin/blob/main/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/components/GuardBySync.kt)
</Tab>

Expand Down
2 changes: 1 addition & 1 deletion configuration/source-db/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Post-images can be configured for PowerSync instances as follows:
</Card>
<Card
title="Self-Hosted PowerSync:"
href="https://github.com/powersync-ja/self-host-demo/blob/main/demos/nodejs-mongodb/config/powersync.yaml#L11"
href="https://github.com/powersync-ja/self-host-demo/blob/main/demos/nodejs-mongodb/powersync/service.yaml#L11"
cta="See an example"
>
Configure `post_images` in the `service.yaml` file.
Expand Down
2 changes: 1 addition & 1 deletion handling-writes/custom-write-checkpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Custom Write Checkpoints are available for customers on our [Team and Enterprise

To ensure [consistency](/architecture/consistency), PowerSync relies on Write Checkpoints. These checkpoints ensure that clients have uploaded their own local changes/mutations to the server before applying downloaded data from the server to the local database.

The essential requirement is that the client must get a Write Checkpoint after uploading its last write/mutation. Then, when downloading data from the server, the client checks whether the Write Checkpoint is part of the largest [sync checkpoint](https://github.com/powersync-ja/powersync-service/blob/main/docs/sync-protocol.md) received from the server (i.e. from the PowerSync Service). If it is, the client applies the server-side state to the local database.
The essential requirement is that the client must get a Write Checkpoint after uploading its last write/mutation. Then, when downloading data from the server, the client checks whether the Write Checkpoint is part of the largest [sync checkpoint](https://github.com/powersync-ja/powersync-service/blob/main/docs/specs/sync-protocol.md) received from the server (i.e. from the PowerSync Service). If it is, the client applies the server-side state to the local database.

The default Write Checkpoints implementation relies on uploads being acknowledged _synchronously_, i.e. the change persists in the source database (to which PowerSync is connected) before the [`uploadData` call](/configuration/app-backend/client-side-integration) completes.

Expand Down
2 changes: 1 addition & 1 deletion integrations/serverpod.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
kid: !env PS_JWK_KID
```

<Tip>More information on available options is available under [Service Configuration](/configuration/powersync-service/self-hosted-instances)</Tip>

Check warning on line 258 in integrations/serverpod.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

integrations/serverpod.mdx#L258

Did you really mean 'infor'?

## Authentication

Expand All @@ -268,7 +268,7 @@
3. In the `sync_rules` section, you reference properties of the created JWTs to control data visible to the connecting clients.

In this guide, we will use a single virtual user for everything. For real projects, follow
[Serverpod documentation on authentication](https://docs.serverpod.dev/tutorials/guides/authentication).
[Serverpod documentation on authentication](https://docs.serverpod.dev/concepts/authentication/setup).

PowerSync needs two endpoints, one to request a JWT and one to upload local writes from clients to the backend source database.
In `notes_server/lib/src/powersync_endpoint.dart`, create those endpoints:
Expand Down Expand Up @@ -383,7 +383,7 @@
```

With your Serverpod backend and PowerSync running, you can start connecting your clients.
Go to the `_flutter` project generated by Serverpod and run `dart pub add powersync path path_provider`.

Check warning on line 386 in integrations/serverpod.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

integrations/serverpod.mdx#L386

'path' is repeated!
Next, replace `main.dart` with this demo:

```dart
Expand Down Expand Up @@ -543,7 +543,7 @@
} else if (snapshot.hasError) {
return Text(snapshot.error.toString());
} else {
return const CircularProgressIndicator();

Check warning on line 546 in integrations/serverpod.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

integrations/serverpod.mdx#L546

Did you really mean 'ato'?
}
},
),
Expand Down
2 changes: 0 additions & 2 deletions intro/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ This is a list of additional projects we've spotted from community members 🙌

- [Account Optional Apps with PowerSync](https://www.maxmntl.com/blog/optional-account-powersync/)
- Tutorial for starting your new user app experience fully local (without sync,) and then to switch them to a synced experience
- [Building an Offline-First Chat App Using PowerSync and Supabase](https://bndkt.com/blog/2023/building-an-offline-first-chat-app-using-powersync-and-supabase)
- Postgres (Supabase) + React Native + Expo + Tamagui
- [Building an Offline-First Mobile App with PowerSync](https://blog.stackademic.com/building-an-offline-first-mobile-app-with-powersync-40674d8b7ea1)
- Postgres + Flutter + Nest.js + Prisma ORM + Firebase Auth
- [Implementing Local-First Architecture: A Guide to MongoDB Cluster and PowerSync Integration](https://blog.stackademic.com/implementing-local-first-architecture-a-guide-to-mongodb-cluster-and-powersync-integration-6b21fa8059a1)
Expand Down
2 changes: 1 addition & 1 deletion maintenance-ops/compacting-buckets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ Soon, we will use [incremental reprocessing](https://github.com/orgs/powersync-j

## Technical Details

See the [documentation](https://github.com/powersync-ja/powersync-service/blob/main/docs/compacting-operations.md) in the `powersync-service` repo for more technical details on compacting.
See the [documentation](https://github.com/powersync-ja/powersync-service/blob/main/docs/storage/compacting-operations.md) in the `powersync-service` repo for more technical details on compacting.
2 changes: 1 addition & 1 deletion maintenance-ops/production-readiness-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We recommend adding a view/screen in your application that offers diagnostic inf
Each of the PowerSync Client SDKs have the `SyncStatus` class that can be used to access the fields mentioned above.

- [Flutter](https://pub.dev/documentation/powersync/latest/powersync/SyncStatus-class.html)
- [Kotlin](https://powersync-ja.github.io/powersync-kotlin/core/com.powersync.sync/-sync-status/index.html?query=data%20class%20SyncStatus%20:%20SyncStatusData)
- [Kotlin](https://powersync-ja.github.io/powersync-kotlin/common/com.powersync.sync/-sync-status/index.html)
- [Swift](https://powersync-ja.github.io/powersync-swift/documentation/powersync/syncstatusdata)
- [Web](https://powersync-ja.github.io/powersync-js/web-sdk/classes/SyncStatus)
- [React Native](https://powersync-ja.github.io/powersync-js/react-native-sdk/classes/SyncStatus)
Expand Down
2 changes: 1 addition & 1 deletion sync/advanced/prioritized-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,5 @@ Example implementations of prioritized sync are also available in the following
- Flutter: [Supabase To-Do List](https://github.com/powersync-ja/powersync.dart/tree/main/demos/supabase-todolist)
- Kotlin:
- [Supabase To-Do List (KMP)](https://github.com/powersync-ja/powersync-kotlin/blob/main/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/App.kt#L46)
- [Supabase To-Do List (Android)](https://github.com/powersync-ja/powersync-kotlin/blob/main/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/screens/HomeScreen.kt#L69)
- [Supabase To-Do List (Android)](https://github.com/powersync-ja/powersync-kotlin/blob/main/demos/android-supabase-todolist/src/main/java/com/powersync/androidexample/screens/HomeScreen.kt#L69)
- Swift: [Supabase To-Do List](https://github.com/powersync-ja/powersync-swift/tree/main/Demos/PowerSyncExample)