From 0d19d556a2bf3485ab579371549e485d19368d4c Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 1 Feb 2024 11:15:46 +0200 Subject: [PATCH 1/2] updated common sdk v1.2.0 --- .changeset/lovely-steaks-guess.md | 5 +++ demos/powersync-nextjs-demo/package.json | 4 +- .../package.json | 4 +- packages/powersync-sdk-web/package.json | 6 +-- .../src/db/PowerSyncDatabase.ts | 2 +- .../SharedWebStreamingSyncImplementation.ts | 2 +- .../db/sync/WebStreamingSyncImplementation.ts | 10 +---- pnpm-lock.yaml | 40 +++++++++---------- 8 files changed, 36 insertions(+), 37 deletions(-) create mode 100644 .changeset/lovely-steaks-guess.md diff --git a/.changeset/lovely-steaks-guess.md b/.changeset/lovely-steaks-guess.md new file mode 100644 index 0000000..e269a3a --- /dev/null +++ b/.changeset/lovely-steaks-guess.md @@ -0,0 +1,5 @@ +--- +'@journeyapps/powersync-sdk-web': minor +--- + +Updated common SDK. Changes https://github.com/powersync-ja/powersync-react-native-sdk/pull/46 diff --git a/demos/powersync-nextjs-demo/package.json b/demos/powersync-nextjs-demo/package.json index e409c5c..d40164d 100644 --- a/demos/powersync-nextjs-demo/package.json +++ b/demos/powersync-nextjs-demo/package.json @@ -14,9 +14,9 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@fontsource/roboto": "^5.0.8", - "@journeyapps/powersync-react": "1.0.1", + "@journeyapps/powersync-react": "1.0.3", "@journeyapps/powersync-sdk-web": "workspace:*", - "@journeyapps/wa-sqlite": "~0.1.0", + "@journeyapps/wa-sqlite": "~0.1.1", "@mui/icons-material": "^5.14.16", "@mui/material": "^5.14.16", "@mui/x-data-grid": "^6.17.0", diff --git a/demos/powersync-supabase-yjs-text-collab-demo/package.json b/demos/powersync-supabase-yjs-text-collab-demo/package.json index 5e51b4d..aa6065e 100644 --- a/demos/powersync-supabase-yjs-text-collab-demo/package.json +++ b/demos/powersync-supabase-yjs-text-collab-demo/package.json @@ -13,9 +13,9 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@fontsource/roboto": "^5.0.8", - "@journeyapps/powersync-react": "^1.0.1", + "@journeyapps/powersync-react": "1.0.3", "@journeyapps/powersync-sdk-web": "workspace:*", - "@journeyapps/wa-sqlite": "~0.1.0", + "@journeyapps/wa-sqlite": "~0.1.1", "@lexical/react": "^0.11.1", "@mui/icons-material": "^5.14.16", "@mui/material": "^5.14.16", diff --git a/packages/powersync-sdk-web/package.json b/packages/powersync-sdk-web/package.json index ebc8fe5..aea884a 100644 --- a/packages/powersync-sdk-web/package.json +++ b/packages/powersync-sdk-web/package.json @@ -32,16 +32,16 @@ "author": "JOURNEYAPPS", "license": "Apache-2.0", "devDependencies": { - "@journeyapps/wa-sqlite": "~0.1.0", + "@journeyapps/wa-sqlite": "~0.1.1", "@types/lodash": "^4.14.200", "@types/uuid": "^9.0.6", "typescript": "^5.2.2" }, "peerDependencies": { - "@journeyapps/wa-sqlite": "~0.1.0" + "@journeyapps/wa-sqlite": "~0.1.1" }, "dependencies": { - "@journeyapps/powersync-sdk-common": "1.0.1", + "@journeyapps/powersync-sdk-common": "1.2.0", "async-mutex": "^0.4.0", "comlink": "^4.4.1", "js-logger": "^1.6.1", diff --git a/packages/powersync-sdk-web/src/db/PowerSyncDatabase.ts b/packages/powersync-sdk-web/src/db/PowerSyncDatabase.ts index b8077fb..55a7881 100644 --- a/packages/powersync-sdk-web/src/db/PowerSyncDatabase.ts +++ b/packages/powersync-sdk-web/src/db/PowerSyncDatabase.ts @@ -55,7 +55,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase { await this.waitForReady(); await connector.uploadData(this); }, - workerIdentifier: this.options.database.name + identifier: this.options.database.name }; const { flags } = this.options; diff --git a/packages/powersync-sdk-web/src/db/sync/SharedWebStreamingSyncImplementation.ts b/packages/powersync-sdk-web/src/db/sync/SharedWebStreamingSyncImplementation.ts index f500418..8261629 100644 --- a/packages/powersync-sdk-web/src/db/sync/SharedWebStreamingSyncImplementation.ts +++ b/packages/powersync-sdk-web/src/db/sync/SharedWebStreamingSyncImplementation.ts @@ -26,7 +26,7 @@ export class SharedWebStreamingSyncImplementation extends WebStreamingSyncImplem this.syncTabId = uuid(); const worker = new SharedWorker(new URL('../../worker/sync/SharedSyncImplementation.worker.js', import.meta.url), { /* @vite-ignore */ - name: `shared-sync-${this.webOptions.workerIdentifier}`, + name: `shared-sync-${this.webOptions.identifier}`, type: 'module' }); diff --git a/packages/powersync-sdk-web/src/db/sync/WebStreamingSyncImplementation.ts b/packages/powersync-sdk-web/src/db/sync/WebStreamingSyncImplementation.ts index b07b8d5..076e02c 100644 --- a/packages/powersync-sdk-web/src/db/sync/WebStreamingSyncImplementation.ts +++ b/packages/powersync-sdk-web/src/db/sync/WebStreamingSyncImplementation.ts @@ -6,13 +6,7 @@ import { LockType } from '@journeyapps/powersync-sdk-common'; -export interface WebStreamingSyncImplementationOptions extends AbstractStreamingSyncImplementationOptions { - /** - * An identifier for which PowerSync DB this sync implementation is - * linked to. Most commonly DB name, but not restricted to DB name. - */ - workerIdentifier: string; -} +export interface WebStreamingSyncImplementationOptions extends AbstractStreamingSyncImplementationOptions {} export class WebStreamingSyncImplementation extends AbstractStreamingSyncImplementation { constructor(options: WebStreamingSyncImplementationOptions) { @@ -25,7 +19,7 @@ export class WebStreamingSyncImplementation extends AbstractStreamingSyncImpleme } obtainLock(lockOptions: LockOptions): Promise { - const identifier = `streaming-sync-${lockOptions.type}-${this.webOptions.workerIdentifier}`; + const identifier = `streaming-sync-${lockOptions.type}-${this.webOptions.identifier}`; lockOptions.type == LockType.SYNC && console.debug('requesting lock for ', identifier); return navigator.locks.request(identifier, { signal: lockOptions.signal }, lockOptions.callback); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 80688fa..ee7ccf5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,9 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + '@journeyapps/wa-sqlite': link:../wa-sqlite + importers: .: @@ -62,14 +65,14 @@ importers: specifier: ^5.0.8 version: 5.0.8 '@journeyapps/powersync-react': - specifier: 1.0.1 - version: 1.0.1(react@18.0.0) + specifier: 1.0.3 + version: 1.0.3(react@18.0.0) '@journeyapps/powersync-sdk-web': specifier: workspace:* version: link:../../packages/powersync-sdk-web '@journeyapps/wa-sqlite': - specifier: ~0.1.0 - version: 0.1.0 + specifier: link:../../../wa-sqlite + version: link:../../../wa-sqlite '@mui/icons-material': specifier: ^5.14.16 version: 5.14.16(@mui/material@5.14.16)(@types/react@18.0.0)(react@18.0.0) @@ -147,14 +150,14 @@ importers: specifier: ^5.0.8 version: 5.0.8 '@journeyapps/powersync-react': - specifier: ^1.0.1 - version: 1.0.1(react@18.0.0) + specifier: 1.0.3 + version: 1.0.3(react@18.0.0) '@journeyapps/powersync-sdk-web': specifier: workspace:* version: link:../../packages/powersync-sdk-web '@journeyapps/wa-sqlite': - specifier: ~0.1.0 - version: 0.1.0 + specifier: link:../../../wa-sqlite + version: link:../../../wa-sqlite '@lexical/react': specifier: ^0.11.1 version: 0.11.3(lexical@0.11.3)(react-dom@18.0.0)(react@18.0.0)(yjs@13.6.10) @@ -304,8 +307,8 @@ importers: packages/powersync-sdk-web: dependencies: '@journeyapps/powersync-sdk-common': - specifier: 1.0.1 - version: 1.0.1 + specifier: 1.2.0 + version: 1.2.0 async-mutex: specifier: ^0.4.0 version: 0.4.0 @@ -323,8 +326,8 @@ importers: version: 9.0.1 devDependencies: '@journeyapps/wa-sqlite': - specifier: ~0.1.0 - version: 0.1.0 + specifier: link:../../../wa-sqlite + version: link:../../../wa-sqlite '@types/lodash': specifier: ^4.14.200 version: 4.14.200 @@ -2113,17 +2116,17 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true - /@journeyapps/powersync-react@1.0.1(react@18.0.0): - resolution: {integrity: sha512-0DCF4C2OijDnxT03dEsrnP2Qhn4k/XwOzdQeLJR7aPS6vr3TTbn//TFSPO8caJmWfZnh3a65uSVlXOvodfpfXQ==} + /@journeyapps/powersync-react@1.0.3(react@18.0.0): + resolution: {integrity: sha512-hTpeQ6TvqiqvC6RVqa7fwhhE1xtanxMu8InWPf0uL7nR7b5GNdvpIcs38V99j7k0oWEFP+mnc0i/OeMY2Lx3MQ==} peerDependencies: react: '*' dependencies: - '@journeyapps/powersync-sdk-common': 1.0.1 + '@journeyapps/powersync-sdk-common': 1.2.0 react: 18.0.0 dev: false - /@journeyapps/powersync-sdk-common@1.0.1: - resolution: {integrity: sha512-MTAAHyL3jbvknXBuroDheoNDvyntH1Wt/HPLopnaFupg13eJRx/1vvAPd5KRmMwpPpGL+j7P5zMJ+YgvRYIXzw==} + /@journeyapps/powersync-sdk-common@1.2.0: + resolution: {integrity: sha512-R6gkDXMCMLh8T8xvgcCxt4/djMYfjL4r1opmrUVFTxk/Kbs/P3nqinlcF6sE8ZEYtv+UZoc168hA6NDpJp47xA==} dependencies: async-mutex: 0.4.0 can-ndjson-stream: 1.0.2 @@ -2134,9 +2137,6 @@ packages: uuid: 3.4.0 dev: false - /@journeyapps/wa-sqlite@0.1.0: - resolution: {integrity: sha512-XvSNX6eDBoQZGnyolL41lHOp1f9bBcPcp9wt+qfww6ea1kg5B/DUiNtzBMSXVeABcvJv+SigHRy/+JTY222gSg==} - /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} From fd28d33b59d759a45f1d0329dfad795bfffb5670 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 1 Feb 2024 11:18:25 +0200 Subject: [PATCH 2/2] update lockfile --- pnpm-lock.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee7ccf5..5842b07 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,9 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - '@journeyapps/wa-sqlite': link:../wa-sqlite - importers: .: @@ -71,8 +68,8 @@ importers: specifier: workspace:* version: link:../../packages/powersync-sdk-web '@journeyapps/wa-sqlite': - specifier: link:../../../wa-sqlite - version: link:../../../wa-sqlite + specifier: ~0.1.1 + version: 0.1.1 '@mui/icons-material': specifier: ^5.14.16 version: 5.14.16(@mui/material@5.14.16)(@types/react@18.0.0)(react@18.0.0) @@ -156,8 +153,8 @@ importers: specifier: workspace:* version: link:../../packages/powersync-sdk-web '@journeyapps/wa-sqlite': - specifier: link:../../../wa-sqlite - version: link:../../../wa-sqlite + specifier: ~0.1.1 + version: 0.1.1 '@lexical/react': specifier: ^0.11.1 version: 0.11.3(lexical@0.11.3)(react-dom@18.0.0)(react@18.0.0)(yjs@13.6.10) @@ -326,8 +323,8 @@ importers: version: 9.0.1 devDependencies: '@journeyapps/wa-sqlite': - specifier: link:../../../wa-sqlite - version: link:../../../wa-sqlite + specifier: ~0.1.1 + version: 0.1.1 '@types/lodash': specifier: ^4.14.200 version: 4.14.200 @@ -2137,6 +2134,9 @@ packages: uuid: 3.4.0 dev: false + /@journeyapps/wa-sqlite@0.1.1: + resolution: {integrity: sha512-cLPddbJYBpzII7ZBAA4fNKW2yLf3H03cGrz+JteXCfSjzxbYhnflAGD8WjefmeLXQUr2vcOYm3SgC82LJYZyzQ==} + /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'}