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..5842b07 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,14 +62,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: ~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) @@ -147,14 +147,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: ~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) @@ -304,8 +304,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 +323,8 @@ importers: version: 9.0.1 devDependencies: '@journeyapps/wa-sqlite': - specifier: ~0.1.0 - version: 0.1.0 + specifier: ~0.1.1 + version: 0.1.1 '@types/lodash': specifier: ^4.14.200 version: 4.14.200 @@ -2113,17 +2113,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,8 +2134,8 @@ packages: uuid: 3.4.0 dev: false - /@journeyapps/wa-sqlite@0.1.0: - resolution: {integrity: sha512-XvSNX6eDBoQZGnyolL41lHOp1f9bBcPcp9wt+qfww6ea1kg5B/DUiNtzBMSXVeABcvJv+SigHRy/+JTY222gSg==} + /@journeyapps/wa-sqlite@0.1.1: + resolution: {integrity: sha512-cLPddbJYBpzII7ZBAA4fNKW2yLf3H03cGrz+JteXCfSjzxbYhnflAGD8WjefmeLXQUr2vcOYm3SgC82LJYZyzQ==} /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==}