diff --git a/.changeset/config.json b/.changeset/config.json index c62f93ed..a979177f 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -7,9 +7,13 @@ "access": "restricted", "baseBranch": "main", "updateInternalDependencies": "patch", - "ignore": [], + "ignore": ["!@powersync/*"], "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { "onlyUpdatePeerDependentsWhenOutOfRange": true, "updateInternalDependents": "out-of-range" + }, + "privatePackages": { + "tag": true, + "version": true } } diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3d63c8d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.idea + +**/node_modules +**/dist diff --git a/.github/workflows/diagnostics-image-build.yaml b/.github/workflows/diagnostics-image-build.yaml new file mode 100644 index 00000000..a5d08bfa --- /dev/null +++ b/.github/workflows/diagnostics-image-build.yaml @@ -0,0 +1,25 @@ +name: Diagnostics Image Build + +on: + push: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + build-docker-image: + name: Build diagnostics-app Docker Image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Image + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + cache-from: type=registry,ref=${{vars.DIAGNOSTICS_DOCKER_REGISTRY}}:latest + context: . + file: ./tools/diagnostics-app/Dockerfile diff --git a/.github/workflows/diagnostics-image-release.yaml b/.github/workflows/diagnostics-image-release.yaml new file mode 100644 index 00000000..fc6ccba4 --- /dev/null +++ b/.github/workflows/diagnostics-image-release.yaml @@ -0,0 +1,56 @@ +# Publishes the Diagnostics App Docker image to DockerHub +# This is triggered whenever the `diagnostics-app` package is versioned and tagged +name: Diagnostics Image Release + +on: + workflow_dispatch: + push: + tags: + - '@powersync/diagnostics-app*' + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release-docker-image: + name: Build and Release diagnostics-app Docker Image + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # This uses the service's package.json version for the Docker Image tag + - name: Get Image Version from package.json + id: get_version + run: echo "IMAGE_VERSION=$(node -p "require('./tools/diagnostics-app/package.json').version")" >> $GITHUB_OUTPUT + + - name: Build Image and Push + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + cache-from: type=registry,ref=${{vars.DIAGNOSTICS_DOCKER_REGISTRY}}:latest + context: . + tags: ${{vars.DIAGNOSTICS_DOCKER_REGISTRY}}:latest,${{vars.DIAGNOSTICS_DOCKER_REGISTRY}}:${{steps.get_version.outputs.IMAGE_VERSION}} + push: true + file: ./tools/diagnostics-app/Dockerfile + + # Updates the README section on the DockerHub page + - name: Update repo description + # Note that this 3rd party extention is recommended in the DockerHub docs: + # https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/ + uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: ${{vars.DIAGNOSTICS_DOCKER_REGISTRY}} + # This is the contents of what will be shown on DockerHub + readme-filepath: ./tools/diagnostics-app/README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32a00b8a..813d1d01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,9 @@ jobs: - uses: pnpm/action-setup@v2 name: Install pnpm with: - version: 9 + # Pnpm 9.4 introduces this https://github.com/pnpm/pnpm/pull/7633 + # which causes workspace:^1.2.0 to be converted to 1.2.0^1.2.0 + version: 9.3 run_install: false - name: Get pnpm store directory shell: bash diff --git a/demos/angular-supabase-todolist/CHANGELOG.md b/demos/angular-supabase-todolist/CHANGELOG.md index f26d1a16..d8da1573 100644 --- a/demos/angular-supabase-todolist/CHANGELOG.md +++ b/demos/angular-supabase-todolist/CHANGELOG.md @@ -1,5 +1,11 @@ # PowerSync Angular Demo +## 0.0.25 + +### Patch Changes + +- @powersync/web@1.2.4 + ## 0.0.24 ### Patch Changes diff --git a/demos/angular-supabase-todolist/package.json b/demos/angular-supabase-todolist/package.json index a2556716..f5dda124 100644 --- a/demos/angular-supabase-todolist/package.json +++ b/demos/angular-supabase-todolist/package.json @@ -1,6 +1,6 @@ { "name": "angular-supabase-todolist", - "version": "0.0.24", + "version": "0.0.25", "scripts": { "ng": "ng", "serve": "ng serve", diff --git a/demos/django-react-native-todolist/CHANGELOG.md b/demos/django-react-native-todolist/CHANGELOG.md index 116e2eee..791aeb60 100644 --- a/demos/django-react-native-todolist/CHANGELOG.md +++ b/demos/django-react-native-todolist/CHANGELOG.md @@ -1,5 +1,14 @@ # django-react-native-todolist +## 1.2.2 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + - @powersync/react@1.3.7 + - @powersync/react-native@1.8.3 + ## 1.2.1 ### Patch Changes diff --git a/demos/django-react-native-todolist/package.json b/demos/django-react-native-todolist/package.json index c06f04af..c149cee9 100644 --- a/demos/django-react-native-todolist/package.json +++ b/demos/django-react-native-todolist/package.json @@ -1,6 +1,6 @@ { "name": "django-react-native-todolist", - "version": "1.2.1", + "version": "1.2.2", "main": "./index.js", "scripts": { "android": "expo run:android", diff --git a/demos/example-capacitor/CHANGELOG.md b/demos/example-capacitor/CHANGELOG.md index 50003685..55766187 100644 --- a/demos/example-capacitor/CHANGELOG.md +++ b/demos/example-capacitor/CHANGELOG.md @@ -1,5 +1,12 @@ # example-capacitor +## 0.0.11 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.0.10 ### Patch Changes diff --git a/demos/example-capacitor/package.json b/demos/example-capacitor/package.json index 2276d98f..553afaec 100644 --- a/demos/example-capacitor/package.json +++ b/demos/example-capacitor/package.json @@ -1,6 +1,6 @@ { "name": "example-capacitor", - "version": "0.0.10", + "version": "0.0.11", "description": "Example of using Capacitor with PowerSync", "main": "index.js", "private": true, diff --git a/demos/example-electron/CHANGELOG.md b/demos/example-electron/CHANGELOG.md index be3d6740..3545a864 100644 --- a/demos/example-electron/CHANGELOG.md +++ b/demos/example-electron/CHANGELOG.md @@ -1,5 +1,12 @@ # example-electron +## 1.0.16 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 1.0.15 ### Patch Changes diff --git a/demos/example-electron/package.json b/demos/example-electron/package.json index a6fdea97..851e989e 100644 --- a/demos/example-electron/package.json +++ b/demos/example-electron/package.json @@ -1,7 +1,7 @@ { "name": "example-electron", "productName": "example-electron", - "version": "1.0.15", + "version": "1.0.16", "description": "Example of using Electron with PowerSync", "main": ".vite/build/main.js", "type": "module", diff --git a/demos/example-nextjs/CHANGELOG.md b/demos/example-nextjs/CHANGELOG.md index 05bae7ca..111a399e 100644 --- a/demos/example-nextjs/CHANGELOG.md +++ b/demos/example-nextjs/CHANGELOG.md @@ -1,5 +1,12 @@ # example-nextjs +## 0.1.15 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.1.14 ### Patch Changes diff --git a/demos/example-nextjs/package.json b/demos/example-nextjs/package.json index 40131e97..878035b4 100644 --- a/demos/example-nextjs/package.json +++ b/demos/example-nextjs/package.json @@ -1,6 +1,6 @@ { "name": "example-nextjs", - "version": "0.1.14", + "version": "0.1.15", "private": true, "scripts": { "build": "next build", diff --git a/demos/example-nextjs/src/app/favicon.ico b/demos/example-nextjs/src/app/favicon.ico index 96be8f92..918ca54e 100644 Binary files a/demos/example-nextjs/src/app/favicon.ico and b/demos/example-nextjs/src/app/favicon.ico differ diff --git a/demos/example-vite/CHANGELOG.md b/demos/example-vite/CHANGELOG.md index e598c359..1084192e 100644 --- a/demos/example-vite/CHANGELOG.md +++ b/demos/example-vite/CHANGELOG.md @@ -1,5 +1,11 @@ # example-vite +## 0.0.33 + +### Patch Changes + +- @powersync/web@1.2.4 + ## 0.0.32 ### Patch Changes diff --git a/demos/example-vite/package.json b/demos/example-vite/package.json index a1fa3d38..48757fe8 100644 --- a/demos/example-vite/package.json +++ b/demos/example-vite/package.json @@ -1,7 +1,7 @@ { "name": "example-vite", "private": true, - "version": "0.0.32", + "version": "0.0.33", "type": "module", "scripts": { "dev": "vite", diff --git a/demos/react-multi-client/CHANGELOG.md b/demos/react-multi-client/CHANGELOG.md index 55f5d26f..1e4c2f65 100644 --- a/demos/react-multi-client/CHANGELOG.md +++ b/demos/react-multi-client/CHANGELOG.md @@ -1,5 +1,12 @@ # react-multi-client +## 0.0.7 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.0.6 ### Patch Changes diff --git a/demos/react-multi-client/package.json b/demos/react-multi-client/package.json index afb40c5f..6b478caa 100644 --- a/demos/react-multi-client/package.json +++ b/demos/react-multi-client/package.json @@ -1,6 +1,6 @@ { "name": "react-multi-client", - "version": "0.0.6", + "version": "0.0.7", "private": true, "scripts": { "dev": "vite", diff --git a/demos/react-native-supabase-group-chat/CHANGELOG.md b/demos/react-native-supabase-group-chat/CHANGELOG.md index da88a088..1cdeb8fc 100644 --- a/demos/react-native-supabase-group-chat/CHANGELOG.md +++ b/demos/react-native-supabase-group-chat/CHANGELOG.md @@ -1,5 +1,14 @@ # react-native-supabase-group-chat +## 1.1.13 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + - @powersync/react@1.3.7 + - @powersync/react-native@1.8.3 + ## 1.1.12 ### Patch Changes diff --git a/demos/react-native-supabase-group-chat/package.json b/demos/react-native-supabase-group-chat/package.json index 91328a25..8b627f32 100644 --- a/demos/react-native-supabase-group-chat/package.json +++ b/demos/react-native-supabase-group-chat/package.json @@ -1,6 +1,6 @@ { "name": "react-native-supabase-group-chat", - "version": "1.1.12", + "version": "1.1.13", "main": "expo-router/entry", "scripts": { "clear": "find ./ -type d -and \\( -name node_modules -or -name build -or -name dist \\) -exec rm -rf '{}' +", diff --git a/demos/react-native-supabase-todolist/CHANGELOG.md b/demos/react-native-supabase-todolist/CHANGELOG.md index dcfdf9b6..d794a734 100644 --- a/demos/react-native-supabase-todolist/CHANGELOG.md +++ b/demos/react-native-supabase-todolist/CHANGELOG.md @@ -1,5 +1,15 @@ # react-native-supabase-todolist +## 1.3.8 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + - @powersync/attachments@2.0.12 + - @powersync/react@1.3.7 + - @powersync/react-native@1.8.3 + ## 1.3.7 ### Patch Changes diff --git a/demos/react-native-supabase-todolist/package.json b/demos/react-native-supabase-todolist/package.json index 952b6974..8d4f96e2 100644 --- a/demos/react-native-supabase-todolist/package.json +++ b/demos/react-native-supabase-todolist/package.json @@ -1,6 +1,6 @@ { "name": "react-native-supabase-todolist", - "version": "1.3.7", + "version": "1.3.8", "main": "./index.js", "scripts": { "android": "expo run:android", diff --git a/demos/react-supabase-todolist/CHANGELOG.md b/demos/react-supabase-todolist/CHANGELOG.md index e800100f..ff00bb8c 100644 --- a/demos/react-supabase-todolist/CHANGELOG.md +++ b/demos/react-supabase-todolist/CHANGELOG.md @@ -1,5 +1,12 @@ # react-supabase-todolist +## 0.3.16 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.3.15 ### Patch Changes diff --git a/demos/react-supabase-todolist/package.json b/demos/react-supabase-todolist/package.json index eb121045..ed05ab60 100644 --- a/demos/react-supabase-todolist/package.json +++ b/demos/react-supabase-todolist/package.json @@ -1,6 +1,6 @@ { "name": "react-supabase-todolist", - "version": "0.3.15", + "version": "0.3.16", "private": true, "scripts": { "dev": "vite", diff --git a/demos/vue-supabase-todolist/CHANGELOG.md b/demos/vue-supabase-todolist/CHANGELOG.md index 88c05e3e..00033936 100644 --- a/demos/vue-supabase-todolist/CHANGELOG.md +++ b/demos/vue-supabase-todolist/CHANGELOG.md @@ -1,5 +1,12 @@ # vue-supabase-todolist +## 0.0.22 + +### Patch Changes + +- @powersync/vue@0.1.9 +- @powersync/web@1.2.4 + ## 0.0.21 ### Patch Changes diff --git a/demos/vue-supabase-todolist/package.json b/demos/vue-supabase-todolist/package.json index 2166d918..db3895a7 100644 --- a/demos/vue-supabase-todolist/package.json +++ b/demos/vue-supabase-todolist/package.json @@ -1,7 +1,7 @@ { "name": "vue-supabase-todolist", "private": true, - "version": "0.0.21", + "version": "0.0.22", "type": "module", "scripts": { "dev": "vue-tsc --noEmit --watch & vite dev", diff --git a/demos/yjs-react-supabase-text-collab/CHANGELOG.md b/demos/yjs-react-supabase-text-collab/CHANGELOG.md index de1fd5df..908563a2 100644 --- a/demos/yjs-react-supabase-text-collab/CHANGELOG.md +++ b/demos/yjs-react-supabase-text-collab/CHANGELOG.md @@ -1,5 +1,12 @@ # yjs-react-supabase-text-collab +## 0.1.16 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.1.15 ### Patch Changes diff --git a/demos/yjs-react-supabase-text-collab/package.json b/demos/yjs-react-supabase-text-collab/package.json index e7925efb..a5cf4210 100644 --- a/demos/yjs-react-supabase-text-collab/package.json +++ b/demos/yjs-react-supabase-text-collab/package.json @@ -1,6 +1,6 @@ { "name": "yjs-react-supabase-text-collab", - "version": "0.1.15", + "version": "0.1.16", "private": true, "scripts": { "dev": "vite", diff --git a/packages/attachments/CHANGELOG.md b/packages/attachments/CHANGELOG.md index 18bfcde1..3280e553 100644 --- a/packages/attachments/CHANGELOG.md +++ b/packages/attachments/CHANGELOG.md @@ -1,5 +1,20 @@ # @powersync/attachments +## 2.0.13 + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [05f3dbd] + - @powersync/common@1.14.0 + +## 2.0.12 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + ## 2.0.11 ### Patch Changes diff --git a/packages/attachments/package.json b/packages/attachments/package.json index b711bdad..6436d747 100644 --- a/packages/attachments/package.json +++ b/packages/attachments/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/attachments", - "version": "2.0.11", + "version": "2.0.13", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" @@ -27,6 +27,6 @@ "watch": "tsc -b -w" }, "peerDependencies": { - "@powersync/common": "workspace:^" + "@powersync/common": "workspace:^1.14.0" } } diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 57cc23d2..e2b5c1e5 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,17 @@ # @powersync/common +## 1.14.0 + +### Minor Changes + +- 05f3dbd: Add debugMode flag to log queries on the performance timeline + +## 1.13.1 + +### Patch Changes + +- 44c568b: Fix issue where WebSockets might not close under some error conditions. + ## 1.13.0 ### Minor Changes diff --git a/packages/common/package.json b/packages/common/package.json index c12c0826..d1b3310b 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/common", - "version": "1.13.0", + "version": "1.14.0", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" diff --git a/packages/common/src/client/SQLOpenFactory.ts b/packages/common/src/client/SQLOpenFactory.ts index 3736c4b8..a8115fc6 100644 --- a/packages/common/src/client/SQLOpenFactory.ts +++ b/packages/common/src/client/SQLOpenFactory.ts @@ -9,6 +9,17 @@ export interface SQLOpenOptions { * Directory where the database file is located. */ dbLocation?: string; + + /** + * Enable debugMode to log queries to the performance timeline. + * + * Defaults to false. + * + * To enable in development builds, use: + * + * debugMode: process.env.NODE_ENV !== 'production' + */ + debugMode?: boolean; } export interface SQLOpenFactory { diff --git a/packages/common/src/client/sync/stream/AbstractRemote.ts b/packages/common/src/client/sync/stream/AbstractRemote.ts index 497d8525..fd9ba98e 100644 --- a/packages/common/src/client/sync/stream/AbstractRemote.ts +++ b/packages/common/src/client/sync/stream/AbstractRemote.ts @@ -253,9 +253,18 @@ export abstract class AbstractRemote { socketIsClosed = true; rsocket.close(); }; + // Helps to prevent double close scenarios + rsocket.onClose(() => (socketIsClosed = true)); // We initially request this amount and expect these to arrive eventually let pendingEventsCount = SYNC_QUEUE_REQUEST_N; + const disposeClosedListener = stream.registerListener({ + closed: () => { + closeSocket(); + disposeClosedListener(); + } + }); + const socket = await new Promise((resolve, reject) => { let connectionEstablished = false; @@ -275,9 +284,8 @@ export abstract class AbstractRemote { if (e.message !== 'Closed. ') { this.logger.error(e); } - // RSocket will close this automatically - // Attempting to close multiple times causes a console warning - socketIsClosed = true; + // RSocket will close the RSocket stream automatically + // Close the downstream stream as well - this will close the RSocket connection and WebSocket stream.close(); // Handles cases where the connection failed e.g. auth error or connection error if (!connectionEstablished) { @@ -318,8 +326,7 @@ export abstract class AbstractRemote { } }, closed: () => { - closeSocket(); - l?.(); + l(); } }); diff --git a/packages/kysely-driver/CHANGELOG.md b/packages/kysely-driver/CHANGELOG.md index f9cf12f9..b7b5f04d 100644 --- a/packages/kysely-driver/CHANGELOG.md +++ b/packages/kysely-driver/CHANGELOG.md @@ -1,5 +1,20 @@ # @powersync/kysely-driver +## 0.2.9 + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [05f3dbd] + - @powersync/common@1.14.0 + +## 0.2.8 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + ## 0.2.7 ### Patch Changes diff --git a/packages/kysely-driver/package.json b/packages/kysely-driver/package.json index 0416cb74..3aed8ffb 100644 --- a/packages/kysely-driver/package.json +++ b/packages/kysely-driver/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/kysely-driver", - "version": "0.2.7", + "version": "0.2.9", "description": "Kysely driver for PowerSync", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -25,7 +25,7 @@ "test": "pnpm build && vitest" }, "peerDependencies": { - "@powersync/common": "workspace:^" + "@powersync/common": "workspace:^1.14.0" }, "dependencies": { "kysely": "^0.27.2" diff --git a/packages/react-native/CHANGELOG.md b/packages/react-native/CHANGELOG.md index bda2b6d0..c0043894 100644 --- a/packages/react-native/CHANGELOG.md +++ b/packages/react-native/CHANGELOG.md @@ -1,5 +1,23 @@ # @powersync/react-native +## 1.8.4 + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [843cfec] +- Updated dependencies [05f3dbd] + - @powersync/react@1.3.8 + - @powersync/common@1.14.0 + +## 1.8.3 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + - @powersync/react@1.3.7 + ## 1.8.2 ### Patch Changes diff --git a/packages/react-native/package.json b/packages/react-native/package.json index ec606582..b7298adc 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/react-native", - "version": "1.8.2", + "version": "1.8.4", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" @@ -29,7 +29,7 @@ "homepage": "https://docs.powersync.com/", "peerDependencies": { "@journeyapps/react-native-quick-sqlite": "^1.1.8", - "@powersync/common": "workspace:^", + "@powersync/common": "workspace:^1.14.0", "react": "*", "react-native": "*" }, diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 1aabe2c5..a5428852 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,20 @@ # @powersync/react +## 1.3.8 + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [05f3dbd] + - @powersync/common@1.14.0 + +## 1.3.7 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + ## 1.3.6 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index cad0194f..993d0905 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/react", - "version": "1.3.6", + "version": "1.3.8", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" @@ -29,7 +29,7 @@ "homepage": "https://docs.powersync.com", "peerDependencies": { "react": "*", - "@powersync/common": "workspace:^" + "@powersync/common": "workspace:^1.14.0" }, "devDependencies": { "@testing-library/react": "^15.0.2", diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index 01b3f5ad..04bd6c8e 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -1,5 +1,20 @@ # @powersync/vue +## 0.1.10 + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [05f3dbd] + - @powersync/common@1.14.0 + +## 0.1.9 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + ## 0.1.8 ### Patch Changes diff --git a/packages/vue/package.json b/packages/vue/package.json index c841d708..3f0d06ed 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/vue", - "version": "0.1.8", + "version": "0.1.10", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" @@ -29,7 +29,7 @@ "homepage": "https://docs.powersync.com", "peerDependencies": { "vue": "*", - "@powersync/common": "workspace:^" + "@powersync/common": "workspace:^1.14.0" }, "devDependencies": { "flush-promises": "^1.0.2", diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index f2257c9f..5346c38d 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -1,5 +1,24 @@ # @powersync/web +## 1.3.0 + +### Minor Changes + +- 05f3dbd: Add debugMode flag to log queries on the performance timeline + +### Patch Changes + +- 843cfec: revert peer dep change +- Updated dependencies [05f3dbd] + - @powersync/common@1.14.0 + +## 1.2.4 + +### Patch Changes + +- Updated dependencies [44c568b] + - @powersync/common@1.13.1 + ## 1.2.3 ### Patch Changes diff --git a/packages/web/package.json b/packages/web/package.json index 4a06bef3..7b973aaa 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@powersync/web", - "version": "1.2.3", + "version": "1.3.0", "description": "A Web SDK for JourneyApps PowerSync", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -35,7 +35,7 @@ "license": "Apache-2.0", "peerDependencies": { "@journeyapps/wa-sqlite": "~0.2.0", - "@powersync/common": "workspace:^" + "@powersync/common": "workspace:^1.14.0" }, "dependencies": { "@powersync/common": "workspace:*", diff --git a/packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts b/packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts index 7449ad29..395cfeed 100644 --- a/packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +++ b/packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts @@ -39,12 +39,28 @@ export class WASQLiteDBAdapter extends BaseObserver implement private logger: ILogger; private dbGetHelpers: DBGetUtils | null; private methods: DBFunctionsInterface | null; + private debugMode: boolean; constructor(protected options: WASQLiteDBAdapterOptions) { super(); this.logger = Logger.get('WASQLite'); this.dbGetHelpers = null; this.methods = null; + this.debugMode = options.debugMode ?? false; + if (this.debugMode) { + const originalExecute = this._execute.bind(this); + this._execute = async (sql, bindings) => { + const start = performance.now(); + try { + const r = await originalExecute(sql, bindings); + performance.measure(`[SQL] ${sql}`, { start }); + return r; + } catch (e: any) { + performance.measure(`[SQL] [ERROR: ${e.message}] ${sql}`, { start }); + throw e; + } + }; + } this.initialized = this.init(); this.dbGetHelpers = this.generateDBHelpers({ execute: (query, params) => this.acquireLock(() => this._execute(query, params)) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 779bd9e7..d6edfdbb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1262,7 +1262,7 @@ importers: packages/attachments: dependencies: '@powersync/common': - specifier: workspace:^ + specifier: workspace:^1.14.0 version: link:../common packages/common: @@ -1341,7 +1341,7 @@ importers: packages/kysely-driver: dependencies: '@powersync/common': - specifier: workspace:^ + specifier: workspace:^1.14.0 version: link:../common kysely: specifier: ^0.27.2 @@ -1387,7 +1387,7 @@ importers: packages/react: dependencies: '@powersync/common': - specifier: workspace:^ + specifier: workspace:^1.14.0 version: link:../common devDependencies: '@testing-library/react': @@ -1479,7 +1479,7 @@ importers: packages/vue: dependencies: '@powersync/common': - specifier: workspace:^ + specifier: workspace:^1.14.0 version: link:../common devDependencies: flush-promises: @@ -7016,8 +7016,8 @@ packages: dependencies: '@babel/runtime': 7.24.8 '@expo/code-signing-certificates': 0.0.5 - '@expo/config': 9.0.1 - '@expo/config-plugins': 8.0.4 + '@expo/config': 9.0.3 + '@expo/config-plugins': 8.0.8 '@expo/devcert': 1.1.2 '@expo/env': 0.3.0 '@expo/image-utils': 0.5.1 @@ -7202,7 +7202,7 @@ packages: resolution: {integrity: sha512-0tjaXBstTbXmD4z+UMFBkh2SZFwilizSQhW6DlaTMnPG5ezuw93zSFEWAuEC3YzkpVtNQTmYzxAYjxwh6seOGg==} dependencies: '@babel/code-frame': 7.10.4 - '@expo/config-plugins': 8.0.4 + '@expo/config-plugins': 8.0.8 '@expo/config-types': 51.0.2 '@expo/json-file': 8.3.3 getenv: 1.0.0 @@ -7370,7 +7370,7 @@ packages: '@babel/generator': 7.24.10 '@babel/parser': 7.24.8 '@babel/types': 7.24.9 - '@expo/config': 9.0.1 + '@expo/config': 9.0.3 '@expo/env': 0.3.0 '@expo/json-file': 8.3.3 '@expo/spawn-async': 1.7.2 @@ -7554,8 +7554,8 @@ packages: peerDependencies: expo-modules-autolinking: '>=0.8.1' dependencies: - '@expo/config': 9.0.1 - '@expo/config-plugins': 8.0.4 + '@expo/config': 9.0.3 + '@expo/config-plugins': 8.0.8 '@expo/config-types': 51.0.2 '@expo/image-utils': 0.5.1 '@expo/json-file': 8.3.3 @@ -19538,7 +19538,7 @@ packages: /filelist@1.0.4: resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} dependencies: - minimatch: 5.1.2 + minimatch: 5.1.6 dev: true /filename-reserved-regex@2.0.0: diff --git a/tools/diagnostics-app/CHANGELOG.md b/tools/diagnostics-app/CHANGELOG.md index e3875794..b2a83f8d 100644 --- a/tools/diagnostics-app/CHANGELOG.md +++ b/tools/diagnostics-app/CHANGELOG.md @@ -1,5 +1,25 @@ # diagnostics-app +## 0.3.0 + +### Minor Changes + +- 79eaa25: Add docker image + +### Patch Changes + +- Updated dependencies [843cfec] +- Updated dependencies [05f3dbd] + - @powersync/react@1.3.8 + - @powersync/web@1.3.0 + +## 0.2.2 + +### Patch Changes + +- @powersync/react@1.3.7 +- @powersync/web@1.2.4 + ## 0.2.1 ### Patch Changes diff --git a/tools/diagnostics-app/Dockerfile b/tools/diagnostics-app/Dockerfile new file mode 100644 index 00000000..089dca94 --- /dev/null +++ b/tools/diagnostics-app/Dockerfile @@ -0,0 +1,16 @@ +FROM node:22.5 AS builder +WORKDIR /app + +RUN npm i -g pnpm@9 + +COPY . /app + +RUN pnpm i --frozen-lockfile --filter ./packages/react --filter ./packages/common --filter ./packages/web --filter ./tools/diagnostics-app +RUN pnpm run --filter ./packages/react --filter ./packages/common --filter ./packages/web build +RUN pnpm run --filter ./tools/diagnostics-app build + +# === PROD === + +FROM nginx +COPY ./tools/diagnostics-app/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/tools/diagnostics-app/dist /usr/share/nginx/html diff --git a/tools/diagnostics-app/README.md b/tools/diagnostics-app/README.md index 325f9fd3..07202f28 100644 --- a/tools/diagnostics-app/README.md +++ b/tools/diagnostics-app/README.md @@ -7,7 +7,9 @@ This diagnostics app presents data from the perspective of a specific user (no s - Get started quickly - play around with a SQLite database without creating an app. - Serve as a baseline to compare your own apps against if you run into issues. -The app is currently available as a local standalone web app, and is largely based on the [web SDK](/packages/web/). +The app is currently available at [https://diagnostics-app.powersync.com/](https://diagnostics-app.powersync.com/) + +It can also be run as a local standalone web app, and is largely based on the [web SDK](/packages/web/). ## Running the app @@ -24,8 +26,12 @@ Then in this directory run: pnpm dev ``` +The app is now available on [http://localhost:5173/](http://localhost:5173/). + Generate a [development token](https://docs.powersync.com/usage/installation/authentication-setup/development-tokens) and sign in. For development tokens, the PowerSync endpoint should be populated automatically. For some others like Supabase tokens, it needs to be entered manually. +If you run powersync inside docker (such as via the [self-host-demo](https://github.com/powersync-ja/self-host-demo)) the returned powersync_url is internal to the docker network and will be unreachable outside of it. Since we run the diagnostics app outside of docker, you can then connect to the endpoint as exposed by docker-proxy, e.g. `http://localhost:8080`. + **Note**: Please see the known usability issues listed below. ## Functionality diff --git a/tools/diagnostics-app/nginx.conf b/tools/diagnostics-app/nginx.conf new file mode 100644 index 00000000..79b774af --- /dev/null +++ b/tools/diagnostics-app/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 80; + server_name frontend; + location / { + root /usr/share/nginx/html; + try_files $uri /index.html; + } +} diff --git a/tools/diagnostics-app/package.json b/tools/diagnostics-app/package.json index 1a9aa252..7514b854 100644 --- a/tools/diagnostics-app/package.json +++ b/tools/diagnostics-app/package.json @@ -1,6 +1,6 @@ { - "name": "diagnostics-app", - "version": "0.2.1", + "name": "@powersync/diagnostics-app", + "version": "0.3.0", "private": true, "scripts": { "dev": "vite", diff --git a/tools/diagnostics-app/src/library/powersync/ConnectionManager.ts b/tools/diagnostics-app/src/library/powersync/ConnectionManager.ts index caf930cf..f04d2ffe 100644 --- a/tools/diagnostics-app/src/library/powersync/ConnectionManager.ts +++ b/tools/diagnostics-app/src/library/powersync/ConnectionManager.ts @@ -19,7 +19,8 @@ export const schemaManager = new DynamicSchemaManager(); export const db = new PowerSyncDatabase({ database: { - dbFilename: 'example.db' + dbFilename: 'example.db', + debugMode: true }, schema: schemaManager.buildSchema() });