Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
555d9e5
Add initial iOS core registration
stevensJourney Sep 4, 2025
b09aa1b
update capacitor
stevensJourney Sep 4, 2025
607d494
update code
stevensJourney Sep 5, 2025
b6afc44
load core extension with Android. woop woop
stevensJourney Sep 20, 2025
55dcd05
Support single read and single write connection. Implement table upda…
stevensJourney Sep 20, 2025
0fdc512
Package README. Update example app. Implement PowerSyncDatabase for C…
stevensJourney Sep 22, 2025
d59cd41
dynamically find capacitor/android for build
stevensJourney Sep 22, 2025
20b083d
added changeset
stevensJourney Sep 22, 2025
685c99b
Merge remote-tracking branch 'origin/main' into capacitor-sdk
stevensJourney Sep 22, 2025
b894538
fix build
stevensJourney Sep 22, 2025
0acfd2d
document execute limitation
stevensJourney Sep 22, 2025
872ce0b
add open factory example
stevensJourney Sep 22, 2025
1841e91
fix build command
stevensJourney Sep 22, 2025
91260c8
allow package to be published
stevensJourney Sep 22, 2025
570b978
use release builds for tests
stevensJourney Sep 22, 2025
37e317b
provide core extension error code logging
stevensJourney Sep 22, 2025
f354b1a
Add tests for package exports
stevensJourney Sep 22, 2025
45cc79f
Merge remote-tracking branch 'origin/main' into capacitor-sdk
stevensJourney Sep 22, 2025
b161d93
add WAL support
stevensJourney Sep 22, 2025
cddefdb
update npm files
stevensJourney Sep 25, 2025
4b52a14
cater for version zero
stevensJourney Sep 25, 2025
48e0f89
Add debugMode
stevensJourney Sep 29, 2025
6756660
fix executeRaw and execute limitations
stevensJourney Sep 30, 2025
600f0d5
Merge remote-tracking branch 'origin/main' into capacitor-sdk
stevensJourney Oct 30, 2025
2bea72c
Update Capacitor community SQLite. Restore Android Execute method fun…
stevensJourney Oct 30, 2025
3133398
Use dynamic extension loading for Android.
stevensJourney Oct 30, 2025
e6b1f44
Revert demo test
stevensJourney Oct 30, 2025
7afe2a8
Fix typos
stevensJourney Oct 30, 2025
f2283c9
That's no typo
stevensJourney Oct 30, 2025
871385e
rename file
stevensJourney Oct 30, 2025
b663c92
Update demo
stevensJourney Oct 30, 2025
fd25e44
skip Android build test for now
stevensJourney Oct 31, 2025
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
Prev Previous commit
Next Next commit
update code
  • Loading branch information
stevensJourney committed Sep 5, 2025
commit 607d4945d0307be53c9f2866450c125431ea3871
1 change: 1 addition & 0 deletions demos/example-capacitor/android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ android {

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-community-sqlite')
implementation project(':capacitor-splash-screen')
implementation project(':powersync-capacitor')

Expand Down
3 changes: 3 additions & 0 deletions demos/example-capacitor/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../../../node_modules/@capacitor/android/capacitor')

include ':capacitor-community-sqlite'
project(':capacitor-community-sqlite').projectDir = new File('../../../node_modules/@capacitor-community/sqlite/android')

include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../../../node_modules/@capacitor/splash-screen/android')

Expand Down
1 change: 1 addition & 0 deletions demos/example-capacitor/ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../../../node_modules/@capacitor/ios'
pod 'CapacitorCommunitySqlite', :path => '../../../../node_modules/@capacitor-community/sqlite'
pod 'CapacitorSplashScreen', :path => '../../../../node_modules/@capacitor/splash-screen'
pod 'PowersyncCapacitor', :path => '../../../../packages/capacitor'
end
Expand Down
13 changes: 12 additions & 1 deletion demos/example-capacitor/ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
PODS:
- Capacitor (7.4.3):
- CapacitorCordova
- CapacitorCommunitySqlite (7.0.1):
- Capacitor
- SQLCipher
- ZIPFoundation
- CapacitorCordova (7.4.3)
- CapacitorSplashScreen (7.0.2):
- Capacitor
Expand All @@ -14,9 +18,11 @@ PODS:
- SQLCipher/common (4.10.0)
- SQLCipher/standard (4.10.0):
- SQLCipher/common
- ZIPFoundation (0.9.19)

DEPENDENCIES:
- "Capacitor (from `../../../../node_modules/@capacitor/ios`)"
- "CapacitorCommunitySqlite (from `../../../../node_modules/@capacitor-community/sqlite`)"
- "CapacitorCordova (from `../../../../node_modules/@capacitor/ios`)"
- "CapacitorSplashScreen (from `../../../../node_modules/@capacitor/splash-screen`)"
- PowersyncCapacitor (from `../../../../packages/capacitor`)
Expand All @@ -25,10 +31,13 @@ SPEC REPOS:
trunk:
- powersync-sqlite-core
- SQLCipher
- ZIPFoundation

EXTERNAL SOURCES:
Capacitor:
:path: "../../../../node_modules/@capacitor/ios"
CapacitorCommunitySqlite:
:path: "../../../../node_modules/@capacitor-community/sqlite"
CapacitorCordova:
:path: "../../../../node_modules/@capacitor/ios"
CapacitorSplashScreen:
Expand All @@ -38,12 +47,14 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Capacitor: b4741ca7affb32c1b70debd03df92cbf522d8a80
CapacitorCommunitySqlite: 3f60098baa077322ce32a678614a5fa0029ab519
CapacitorCordova: 435121e81a2df4d0034f0fb11fcefab5104cfdb5
CapacitorSplashScreen: 8d6c8cb0542a8e81585c593815db8785ed8ce454
powersync-sqlite-core: 6f32860379009d2a37cadc9e9427a431bdbd83c8
PowersyncCapacitor: 91411eaf8f7a773df9da4b76b19f576275b5a40a
SQLCipher: eb79c64049cb002b4e9fcb30edb7979bf4706dfc
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: e802d16d4c452b75fb43b31bf198bbe0b7916693
PODFILE CHECKSUM: 1c728e00549cebade63eaffb81de205fd020c4ea

COCOAPODS: 1.16.2
3 changes: 2 additions & 1 deletion demos/example-capacitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
"preview": "vite preview"
},
"dependencies": {
"@capacitor-community/sqlite": "^7.0.1",
"@capacitor/android": "^7.4.3",
"@capacitor/core": "latest",
"@capacitor/ios": "^7.4.3",
"@capacitor/splash-screen": "latest",
"@journeyapps/wa-sqlite": "^1.3.1",
"@powersync/capacitor": "workspace:*",
"@powersync/react": "workspace:*",
"@powersync/web": "workspace:*",
"@powersync/capacitor": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { PowerSyncContext } from '@powersync/react';
import { PowerSyncDatabase, createBaseLogger, LogLevel } from '@powersync/web';
import { Capacitor } from '@capacitor/core';
import { CircularProgress } from '@mui/material';
import { CapacitorSQLiteAdapter } from '@powersync/capacitor';
import { PowerSyncContext } from '@powersync/react';
import { createBaseLogger, LogLevel, PowerSyncDatabase } from '@powersync/web';
import React, { Suspense } from 'react';
import { AppSchema } from '../../library/powersync/AppSchema.js';
import { BackendConnector } from '../../library/powersync/BackendConnector.js';
import { Capacitor } from '@capacitor/core';

const logger = createBaseLogger();
logger.useDefaults();
Expand All @@ -16,7 +17,10 @@ const isIOs = platform === 'ios';
const useWebWorker = !isIOs;

const powerSync = new PowerSyncDatabase({
database: { dbFilename: 'powersync2.db' },
// We should probably rather have a separate Capacitor PowerSync client
database: new CapacitorSQLiteAdapter({
dbFilename: 'test.sqlite'
}),
schema: AppSchema,
flags: {
enableMultiTabs: false,
Expand Down
21 changes: 13 additions & 8 deletions packages/capacitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,30 @@ npx cap sync

<docgen-index>

* [`echo(...)`](#echo)
* [`registerCore()`](#registercore)
* [Type Aliases](#type-aliases)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### echo(...)
### registerCore()

```typescript
echo(options: { value: string; }) => Promise<{ value: string; }>
registerCore() => Promise<RegistrationResponse>
```

| Param | Type |
| ------------- | ------------------------------- |
| **`options`** | <code>{ value: string; }</code> |

**Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
**Returns:** <code>Promise&lt;<a href="#registrationresponse">RegistrationResponse</a>&gt;</code>

--------------------


### Type Aliases


#### RegistrationResponse

<code>{ responseCode: number; }</code>

</docgen-api>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef CMyPackage_h
#define CMyPackage_h

#include <stdio.h>

int register_powersync();

#endif /* CMyPackage_h */
10 changes: 2 additions & 8 deletions packages/capacitor/ios/Sources/PowerSyncPlugin/PowerSync.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import Foundation

@objc public class PowerSync: NSObject {
@objc public func registerCore() throws -> String {
let result = register_powersync()
if result != 0 {
throw NSError(domain: "PowerSyncError", code: Int(result), userInfo: [
NSLocalizedDescriptionKey: "PowerSync registration failed with code \(result)"
])
}
return "Success"
@objc public func registerCore() -> Int32 {
return register_powersync()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ public class PowerSyncPlugin: CAPPlugin, CAPBridgedPlugin {
]
private let implementation = PowerSync()

@objc func registerCore(_ call: CAPPluginCall) throws -> String {
let result = register_powersync()
if result != 0 {
throw NSError(domain: "PowerSyncError", code: Int(result), userInfo: [
NSLocalizedDescriptionKey: "PowerSync registration failed with code \(result)"
])
}
return "Success"
@objc func registerCore(_ call: CAPPluginCall) {
call.resolve([
"responseCode": implementation.registerCore()
])
}
}
15 changes: 8 additions & 7 deletions packages/capacitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,36 @@
"prepublishOnly": "pnpm build"
},
"devDependencies": {
"@capacitor-community/sqlite": "^7.0.1",
"@capacitor/android": "^7.0.0",
"@capacitor/core": "^7.0.0",
"@capacitor/docgen": "^0.3.0",
"@capacitor/ios": "^7.0.0",
"@ionic/eslint-config": "^0.4.0",
"@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^2.0.0",
"@powersync/common": "workspace:*",
"eslint": "^8.57.0",
"prettier": "^3.4.2",
"prettier-plugin-java": "^2.6.6",
"rimraf": "^6.0.1",
"rollup": "^4.30.1",
"swiftlint": "^2.0.0",
"typescript": "~4.1.5"
"swiftlint": "^2.0.0"
},
"peerDependencies": {
"@capacitor/core": ">=7.0.0"
"@capacitor/core": ">=7.0.0",
"@powersync/common": "workspace:*"
},
"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"capacitor": {
"ios": {
"src": "ios"
},
"android": {
"src": "android"
}
},
"dependencies": {
"async-lock": "^1.4.0"
}
}
Loading