diff --git a/.prettierignore b/.prettierignore index b992e6cb..7b20ab4c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,4 +11,6 @@ **/android/** **/assets/** **/bin/** -**/ios/** \ No newline at end of file +**/ios/** + +**/devlink/** diff --git a/README.md b/README.md index 92c2a8b2..cbe85ad1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

-*[PowerSync](https://www.powersync.com) is a Postgres-SQLite sync layer, which helps developers to create local-first real-time reactive apps that work seamlessly both online and offline.* +_[PowerSync](https://www.powersync.com) is a Postgres-SQLite sync layer, which helps developers to create local-first real-time reactive apps that work seamlessly both online and offline._ # PowerSync JavaScript SDKs @@ -17,7 +17,7 @@ - [packages/web](./packages/web/README.md) - JS Web SDK implementation (extension of `packages/common`) - + - [packages/react](./packages/react/README.md) - React integration for PowerSync. diff --git a/demos/angular-supabase-todolist/angular.json b/demos/angular-supabase-todolist/angular.json index 90cdfc47..fbc3798a 100644 --- a/demos/angular-supabase-todolist/angular.json +++ b/demos/angular-supabase-todolist/angular.json @@ -20,10 +20,7 @@ "customWebpackConfig": { "path": "./extra-webpack.config.js" }, - "allowedCommonJsDependencies": [ - "js-logger", - "ws" - ], + "allowedCommonJsDependencies": ["js-logger", "ws"], "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", diff --git a/demos/django-react-native-todolist/app/signin.tsx b/demos/django-react-native-todolist/app/signin.tsx index 0ff933cf..85bdfab1 100644 --- a/demos/django-react-native-todolist/app/signin.tsx +++ b/demos/django-react-native-todolist/app/signin.tsx @@ -24,14 +24,14 @@ export default function Signin() { setCredentials({ ...credentials, username: value.toLowerCase().trim() })} /> setCredentials({ ...credentials, password: value })} /> {error ? {error} : null} diff --git a/demos/django-react-native-todolist/library/widgets/ListItemWidget.tsx b/demos/django-react-native-todolist/library/widgets/ListItemWidget.tsx index f6b4a523..0a3df45b 100644 --- a/demos/django-react-native-todolist/library/widgets/ListItemWidget.tsx +++ b/demos/django-react-native-todolist/library/widgets/ListItemWidget.tsx @@ -42,7 +42,8 @@ export const ListItemWidget: React.FC<{ pathname: 'views/todos/edit/[id]', params: { id: record.id } }); - }}> + }} + > ); diff --git a/demos/example-capacitor/README.md b/demos/example-capacitor/README.md index c205088d..2dad2b18 100644 --- a/demos/example-capacitor/README.md +++ b/demos/example-capacitor/README.md @@ -13,12 +13,12 @@ To see it in action: To run the iOS version of the app run: - 1. `pnpm sync` - 2. `pnpm ios` +1. `pnpm sync` +2. `pnpm ios` ## Android To run the Android version of the app run: - 1. `pnpm sync` - 2. `pnpm android` (to see console run `chrome://inspect/#devices` in browser) +1. `pnpm sync` +2. `pnpm android` (to see console run `chrome://inspect/#devices` in browser) diff --git a/demos/example-capacitor/src/index.css b/demos/example-capacitor/src/index.css index 8856f90b..8ed16598 100644 --- a/demos/example-capacitor/src/index.css +++ b/demos/example-capacitor/src/index.css @@ -1,6 +1,5 @@ body { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, - Arial, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; margin: auto; max-width: 38rem; padding: 2rem; diff --git a/demos/example-capacitor/src/manifest.json b/demos/example-capacitor/src/manifest.json index 2ed57013..8eb4e11a 100644 --- a/demos/example-capacitor/src/manifest.json +++ b/demos/example-capacitor/src/manifest.json @@ -3,11 +3,13 @@ "short_name": "App", "start_url": "index.html", "display": "standalone", - "icons": [{ - "src": "assets/imgs/logo.png", - "sizes": "512x512", - "type": "image/png" - }], + "icons": [ + { + "src": "assets/imgs/logo.png", + "sizes": "512x512", + "type": "image/png" + } + ], "background_color": "#31d53d", "theme_color": "#31d53d" } diff --git a/demos/example-electron/README.md b/demos/example-electron/README.md index 20826c00..626f4bcc 100644 --- a/demos/example-electron/README.md +++ b/demos/example-electron/README.md @@ -8,4 +8,4 @@ To see it in action: 2. Copy `.env.local.template` to `.env.local`, and complete the environment variables. You can generate a [temporary development token](https://docs.powersync.com/usage/installation/authentication-setup/development-tokens), or leave blank to test with local-only data. 3. `cd` into this directory and run `pnpm start`. -The Electron app should open automatically. \ No newline at end of file +The Electron app should open automatically. diff --git a/demos/example-electron/src/app/page.tsx b/demos/example-electron/src/app/page.tsx index d50ac8f2..40016dff 100644 --- a/demos/example-electron/src/app/page.tsx +++ b/demos/example-electron/src/app/page.tsx @@ -12,7 +12,8 @@ const EntryPage = () => { return (

- Syncing down from the backend. This will load indefinitely if you have not set up the connection correctly. Check the console for issues. + Syncing down from the backend. This will load indefinitely if you have not set up the connection correctly. + Check the console for issues.

diff --git a/demos/example-electron/src/index.css b/demos/example-electron/src/index.css index 8856f90b..8ed16598 100644 --- a/demos/example-electron/src/index.css +++ b/demos/example-electron/src/index.css @@ -1,6 +1,5 @@ body { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, - Arial, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; margin: auto; max-width: 38rem; padding: 2rem; diff --git a/demos/example-nextjs/src/app/page.tsx b/demos/example-nextjs/src/app/page.tsx index ea55b923..77ce2603 100644 --- a/demos/example-nextjs/src/app/page.tsx +++ b/demos/example-nextjs/src/app/page.tsx @@ -13,7 +13,8 @@ const EntryPage = () => { return (

- Syncing down from the backend. This will load indefinitely if you have not set up the connection correctly. Check the console for issues. + Syncing down from the backend. This will load indefinitely if you have not set up the connection correctly. + Check the console for issues.

@@ -52,7 +53,6 @@ const EntryPage = () => { ); }; - namespace S { export const CenteredGrid = styled(Grid)` display: flex; diff --git a/demos/react-multi-client/.prettierrc b/demos/react-multi-client/.prettierrc index b33c4f12..9e6b72ea 100644 --- a/demos/react-multi-client/.prettierrc +++ b/demos/react-multi-client/.prettierrc @@ -4,4 +4,4 @@ "singleQuote": true, "bracketSameLine": true, "trailingComma": "none" -} \ No newline at end of file +} diff --git a/demos/react-native-supabase-group-chat/src/app/(app)/(chats)/g/[group]/settings.tsx b/demos/react-native-supabase-group-chat/src/app/(app)/(chats)/g/[group]/settings.tsx index 6ab1db29..4d3e2325 100644 --- a/demos/react-native-supabase-group-chat/src/app/(app)/(chats)/g/[group]/settings.tsx +++ b/demos/react-native-supabase-group-chat/src/app/(app)/(chats)/g/[group]/settings.tsx @@ -145,7 +145,8 @@ export default function GroupSettings() { backgroundColor="$red10" color="white" onPress={handleDelete} - margin="$3"> + margin="$3" + > Delete group diff --git a/demos/react-native-supabase-group-chat/src/app/(app)/contacts/index.tsx b/demos/react-native-supabase-group-chat/src/app/(app)/contacts/index.tsx index 6d476a3c..9cdee5ff 100644 --- a/demos/react-native-supabase-group-chat/src/app/(app)/contacts/index.tsx +++ b/demos/react-native-supabase-group-chat/src/app/(app)/contacts/index.tsx @@ -112,7 +112,7 @@ export default function ContactsIndex() { icon={} backgroundColor="$brand1" borderRadius="$3" - // circular + // circular /> diff --git a/demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx b/demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx index 085cd1bb..1ba79283 100644 --- a/demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx +++ b/demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx @@ -33,7 +33,7 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => { const l = connector.registerListener({ initialized: () => {}, sessionStarted: () => { - powerSync.connect(connector, {connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET}); + powerSync.connect(connector, { connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET }); } }); diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index e56c7856..ec62e157 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -38,31 +38,31 @@ #returns + p + p + table, #returns + div, #returns + div + table, -[id^="returns-"], -[id^="returns-"] + p, -[id^="returns-"] + p + p, -[id^="returns-"] + p + p, -[id^="returns-"] + p + p + table, -[id^="returns-"] + div, -[id^="returns-"] + div + table, +[id^='returns-'], +[id^='returns-'] + p, +[id^='returns-'] + p + p, +[id^='returns-'] + p + p, +[id^='returns-'] + p + p + table, +[id^='returns-'] + div, +[id^='returns-'] + div + table, #type-parameters, #type-parameters + table, -[id^="type-parameters-"], -[id^="type-parameters-"] + table, +[id^='type-parameters-'], +[id^='type-parameters-'] + table, #inherited-from, #inherited-from + p, -[id^="inherited-from-"], -[id^="inherited-from-"] + p { +[id^='inherited-from-'], +[id^='inherited-from-'] + p { display: none; } /* Expand parameter and enumeration tables to full width */ #parameters + table, -[id^="parameters-"] + table, +[id^='parameters-'] + table, #properties + table, -[id^="properties-"] + table, +[id^='properties-'] + table, #enumeration-members + table, -[id^="enumeration-members-"] + table { +[id^='enumeration-members-'] + table { width: 100%; table-layout: fixed; display: table; diff --git a/packages/common/src/client/sync/bucket/SqliteBucketStorage.ts b/packages/common/src/client/sync/bucket/SqliteBucketStorage.ts index 6a4feff5..96f25600 100644 --- a/packages/common/src/client/sync/bucket/SqliteBucketStorage.ts +++ b/packages/common/src/client/sync/bucket/SqliteBucketStorage.ts @@ -103,9 +103,7 @@ export class SqliteBucketStorage extends BaseObserver imp */ private async deleteBucket(bucket: string) { await this.writeTransaction(async (tx) => { - await tx.execute( - 'INSERT INTO powersync_operations(op, data) VALUES(?, ?)', - ['delete_bucket', bucket]); + await tx.execute('INSERT INTO powersync_operations(op, data) VALUES(?, ?)', ['delete_bucket', bucket]); }); this.logger.debug('done deleting bucket'); diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index d6b93809..e2af05ae 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -15,7 +15,7 @@ export * from './client/sync/bucket/OplogEntry'; export * from './client/sync/stream/AbstractRemote'; export * from './client/sync/stream/AbstractStreamingSyncImplementation'; export * from './client/sync/stream/streaming-sync-types'; -export { MAX_OP_ID } from './client/constants' +export { MAX_OP_ID } from './client/constants'; export * from './db/crud/SyncStatus'; export * from './db/crud/UploadQueueStatus'; diff --git a/packages/kysely-driver/README.md b/packages/kysely-driver/README.md index 846eb69d..82cc7ea5 100644 --- a/packages/kysely-driver/README.md +++ b/packages/kysely-driver/README.md @@ -21,7 +21,7 @@ export const powerSyncDb = new PowerSyncDatabase({ database: { dbFilename: 'test.sqlite' }, - schema: appSchema, + schema: appSchema }); export const db = wrapPowerSyncWithKysely(powerSyncDb); diff --git a/packages/react-native/vendor/crypto.js b/packages/react-native/vendor/crypto.js index 454e9ad0..5adf198a 100644 --- a/packages/react-native/vendor/crypto.js +++ b/packages/react-native/vendor/crypto.js @@ -3,83 +3,100 @@ // Modifications: // - Instead of applying to all global references of crypto, provide a ponyfill export. -const base64Decode = require('fast-base64-decode') -const { NativeModules } = require('react-native') +const base64Decode = require('fast-base64-decode'); +const { NativeModules } = require('react-native'); class TypeMismatchError extends Error {} class QuotaExceededError extends Error {} -let warned = false -function insecureRandomValues (array) { +let warned = false; +function insecureRandomValues(array) { if (!warned) { - console.warn('Using an insecure random number generator, this should only happen when running in a debugger without support for crypto.getRandomValues') - warned = true + console.warn( + 'Using an insecure random number generator, this should only happen when running in a debugger without support for crypto.getRandomValues' + ); + warned = true; } for (let i = 0, r; i < array.length; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000 - array[i] = (r >>> ((i & 0x03) << 3)) & 0xff + if ((i & 0x03) === 0) r = Math.random() * 0x100000000; + array[i] = (r >>> ((i & 0x03) << 3)) & 0xff; } - return array + return array; } /** * @param {number} byteLength * @returns {string} */ -function getRandomBase64 (byteLength) { +function getRandomBase64(byteLength) { if (NativeModules.RNGetRandomValues) { - return NativeModules.RNGetRandomValues.getRandomBase64(byteLength) + return NativeModules.RNGetRandomValues.getRandomBase64(byteLength); } else if (NativeModules.ExpoRandom) { // Expo SDK 41-44 - return NativeModules.ExpoRandom.getRandomBase64String(byteLength) + return NativeModules.ExpoRandom.getRandomBase64String(byteLength); } else if (global.ExpoModules) { // Expo SDK 45+ return global.ExpoModules.ExpoRandom.getRandomBase64String(byteLength); } else { - throw new Error('Native module not found') + throw new Error('Native module not found'); } } /** * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Uint8ClampedArray} array */ -function getRandomValues (array) { - if (!(array instanceof Int8Array || array instanceof Uint8Array || array instanceof Int16Array || array instanceof Uint16Array || array instanceof Int32Array || array instanceof Uint32Array || array instanceof Uint8ClampedArray)) { - throw new TypeMismatchError('Expected an integer array') +function getRandomValues(array) { + if ( + !( + array instanceof Int8Array || + array instanceof Uint8Array || + array instanceof Int16Array || + array instanceof Uint16Array || + array instanceof Int32Array || + array instanceof Uint32Array || + array instanceof Uint8ClampedArray + ) + ) { + throw new TypeMismatchError('Expected an integer array'); } if (array.byteLength > 65536) { - throw new QuotaExceededError('Can only request a maximum of 65536 bytes') + throw new QuotaExceededError('Can only request a maximum of 65536 bytes'); } // Expo SDK 48+ - if (global.expo && global.expo.modules && global.expo.modules.ExpoCrypto && global.expo.modules.ExpoCrypto.getRandomValues) { + if ( + global.expo && + global.expo.modules && + global.expo.modules.ExpoCrypto && + global.expo.modules.ExpoCrypto.getRandomValues + ) { // ExpoCrypto.getRandomValues doesn't return the array - global.expo.modules.ExpoCrypto.getRandomValues(array) - return array + global.expo.modules.ExpoCrypto.getRandomValues(array); + return array; } // Calling getRandomBase64 in remote debugging mode leads to the error // "Calling synchronous methods on native modules is not supported in Chrome". // So in that specific case we fall back to just using Math.random(). if (isRemoteDebuggingInChrome()) { - return insecureRandomValues(array) + return insecureRandomValues(array); } - base64Decode(getRandomBase64(array.byteLength), new Uint8Array(array.buffer, array.byteOffset, array.byteLength)) + base64Decode(getRandomBase64(array.byteLength), new Uint8Array(array.buffer, array.byteOffset, array.byteLength)); - return array + return array; } -function isRemoteDebuggingInChrome () { +function isRemoteDebuggingInChrome() { // Remote debugging in Chrome is not supported in bridgeless if ('RN$Bridgeless' in global && RN$Bridgeless === true) { - return false + return false; } - return __DEV__ && typeof global.nativeCallSyncHook === 'undefined' + return __DEV__ && typeof global.nativeCallSyncHook === 'undefined'; } export default { getRandomValues }; diff --git a/packages/vue/tests/tsconfig.json b/packages/vue/tests/tsconfig.json index ad939a2d..0287fcc7 100644 --- a/packages/vue/tests/tsconfig.json +++ b/packages/vue/tests/tsconfig.json @@ -6,10 +6,7 @@ "rootDir": "../", "composite": true, "outDir": "./lib", - "lib": [ - "esnext", - "DOM" - ], + "lib": ["esnext", "DOM"], "module": "esnext", "sourceMap": true, "moduleResolution": "node", @@ -21,7 +18,5 @@ "skipLibCheck": true, "target": "esnext" }, - "include": [ - "../src/**/*" - ] + "include": ["../src/**/*"] } diff --git a/tools/diagnostics-app/README.md b/tools/diagnostics-app/README.md index 73aef496..2a7d9216 100644 --- a/tools/diagnostics-app/README.md +++ b/tools/diagnostics-app/README.md @@ -32,7 +32,7 @@ The app is now available on [http://localhost:5173/](http://localhost:5173/). Signing in as a user requires a PowerSync Token (JWT) and Endpoint. -**PowerSync Token**: +**PowerSync Token**: Generate a [development token](https://docs.powersync.com/usage/installation/authentication-setup/development-tokens) for the user. diff --git a/tools/diagnostics-app/src/app/views/layout.tsx b/tools/diagnostics-app/src/app/views/layout.tsx index 76485b68..a352770e 100644 --- a/tools/diagnostics-app/src/app/views/layout.tsx +++ b/tools/diagnostics-app/src/app/views/layout.tsx @@ -118,7 +118,8 @@ export default function ViewsLayout({ children }: { children: React.ReactNode }) await item.beforeNavigate?.(); navigate(item.path); setMobileOpen(false); - }}> + }} + > {item.icon()} @@ -135,7 +136,8 @@ export default function ViewsLayout({ children }: { children: React.ReactNode }) sx={{ width: { md: `calc(100% - ${drawerWidth}px)` }, ml: { md: `${drawerWidth}px` } - }}> + }} + > + onClick={handleDrawerToggle} + > @@ -173,7 +176,8 @@ export default function ViewsLayout({ children }: { children: React.ReactNode }) sx={{ display: { xs: 'block', md: 'none' }, '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth } - }}> + }} + > {drawer} + open + > {drawer} diff --git a/tools/diagnostics-app/src/app/views/sql-console.tsx b/tools/diagnostics-app/src/app/views/sql-console.tsx index fd0ba4ed..c84953bf 100644 --- a/tools/diagnostics-app/src/app/views/sql-console.tsx +++ b/tools/diagnostics-app/src/app/views/sql-console.tsx @@ -56,7 +56,8 @@ export default function SQLConsolePage() { if (queryInput) { setQuery(queryInput); } - }}> + }} + > Execute diff --git a/tools/diagnostics-app/src/app/views/sync-diagnostics.tsx b/tools/diagnostics-app/src/app/views/sync-diagnostics.tsx index b628ae8d..891f0ff4 100644 --- a/tools/diagnostics-app/src/app/views/sync-diagnostics.tsx +++ b/tools/diagnostics-app/src/app/views/sync-diagnostics.tsx @@ -267,7 +267,8 @@ export default function SyncDiagnosticsPage() { variant="contained" onClick={() => { clearData(); - }}> + }} + > Clear & Redownload diff --git a/tools/diagnostics-app/src/components/widgets/LoginDetailsWidget.tsx b/tools/diagnostics-app/src/components/widgets/LoginDetailsWidget.tsx index fc8f24ed..7e30beb8 100644 --- a/tools/diagnostics-app/src/components/widgets/LoginDetailsWidget.tsx +++ b/tools/diagnostics-app/src/components/widgets/LoginDetailsWidget.tsx @@ -51,7 +51,8 @@ export const LoginDetailsWidget: React.FC = (props) => setSubmitting(false); setFieldError('endpoint', ex.message); } - }}> + }} + > {({ values, errors, handleChange, handleBlur, isSubmitting, handleSubmit }) => (