Skip to content

Commit

Permalink
update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney committed Jul 25, 2024
2 parents 3692611 + ee69e16 commit d1ec14c
Show file tree
Hide file tree
Showing 27 changed files with 1,143 additions and 58 deletions.
6 changes: 5 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.idea

**/node_modules
**/dist
25 changes: 25 additions & 0 deletions .github/workflows/diagnostics-image-build.yaml
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions .github/workflows/diagnostics-image-release.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions packages/attachments/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/attachments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/attachments",
"version": "2.0.12",
"version": "2.0.13",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand All @@ -27,6 +27,6 @@
"watch": "tsc -b -w"
},
"peerDependencies": {
"@powersync/common": "workspace:^"
"@powersync/common": "workspace:^1.14.0"
}
}
6 changes: 6 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @powersync/common

## 1.14.0

### Minor Changes

- 05f3dbd: Add debugMode flag to log queries on the performance timeline

## 1.13.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/common",
"version": "1.13.1",
"version": "1.14.0",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down
11 changes: 11 additions & 0 deletions packages/common/src/client/SQLOpenFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions packages/kysely-driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/kysely-driver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/kysely-driver",
"version": "0.2.8",
"version": "0.2.9",
"description": "Kysely driver for PowerSync",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand All @@ -25,7 +25,7 @@
"test": "pnpm build && vitest"
},
"peerDependencies": {
"@powersync/common": "workspace:^"
"@powersync/common": "workspace:^1.14.0"
},
"dependencies": {
"kysely": "^0.27.2"
Expand Down
10 changes: 10 additions & 0 deletions packages/react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/react-native",
"version": "1.8.3",
"version": "1.8.4",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down Expand Up @@ -31,7 +31,7 @@
"react": "*",
"react-native": "*",
"react-native-polyfill-globals": "^3.1.0",
"@powersync/common": "workspace:^"
"@powersync/common": "workspace:^1.14.0"
},
"dependencies": {
"@powersync/react": "workspace:*",
Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/react",
"version": "1.3.7",
"version": "1.3.8",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions packages/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/vue",
"version": "0.1.9",
"version": "0.1.10",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions packages/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @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
Expand Down
4 changes: 2 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powersync/web",
"version": "1.2.4",
"version": "1.3.0",
"description": "A Web SDK for JourneyApps PowerSync",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,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:*",
Expand Down
16 changes: 16 additions & 0 deletions packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,28 @@ export class WASQLiteDBAdapter extends BaseObserver<DBAdapterListener> 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))
Expand Down
Loading

0 comments on commit d1ec14c

Please sign in to comment.