Skip to content

Commit 6e70eb7

Browse files
committed
Merge branch 'main' into op-sqlite-tests
2 parents b7f80f5 + 38d36e2 commit 6e70eb7

File tree

9 files changed

+83
-30
lines changed

9 files changed

+83
-30
lines changed

.changeset/green-buckets-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/op-sqlite': patch
3+
---
4+
5+
Promoting package to Beta release.

.changeset/honest-melons-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/web': patch
3+
---
4+
5+
Fixed issue where broadcast logger wasn't being passed to WebRemote, causing worker remote logs not to be broadcasted to the tab's logs.

demos/react-native-barebones-opsqlite/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# PowerSync React Native Barebones OPSQlite
1+
# PowerSync React Native Barebones OP-SQlite
22

33
## Overview
44

5-
This is a minimal example demonstrating a barebones react native project using OPSQLite . It shows an update to the local SQLite DB on app launch.
5+
This is a minimal example demonstrating a barebones React Native project using OP-SQLite. It shows an update to the local SQLite DB on app launch.
66

77

88
## Getting Started

packages/powersync-op-sqlite/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ This package (`packages/powersync-op-sqlite`) enables using [OP-SQLite](https://
66

77
If you are not yet familiar with PowerSync, please see the [PowerSync React Native SDK README](https://github.com/powersync-ja/powersync-js/tree/main/packages/react-native) for more information.
88

9-
### Alpha release
9+
## Beta Release
1010

11-
This package is currently in an alpha release. If you find a bug or issue, please open a [GitHub issue](https://github.com/powersync-ja/powersync-js/issues). Questions or feedback can be posted on our [community Discord](https://discord.gg/powersync) - we'd love to hear from you.
11+
This package is currently in a beta release.
1212

1313
## Installation
1414

packages/react-native/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @powersync/react-native
22

3+
## 1.20.2
4+
5+
### Patch Changes
6+
7+
- 84cdd9d: Fixed issue where CRUD uploads could fail with the error
8+
9+
```
10+
Exception: require(_dependencyMap[11], "rea(...)/BlobManager").createFromOptions is not a function (it is undefined)
11+
```
12+
313
## 1.20.1
414

515
### Patch Changes

packages/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@powersync/react-native",
3-
"version": "1.20.1",
3+
"version": "1.20.2",
44
"publishConfig": {
55
"registry": "https://registry.npmjs.org/",
66
"access": "public"

packages/react-native/rollup.config.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import inject from '@rollup/plugin-inject';
44
import json from '@rollup/plugin-json';
55
import nodeResolve from '@rollup/plugin-node-resolve';
66
import replace from '@rollup/plugin-replace';
7+
import terser from '@rollup/plugin-terser';
78
import path from 'path';
89
import { fileURLToPath } from 'url';
9-
import terser from '@rollup/plugin-terser';
1010

1111
const __filename = fileURLToPath(import.meta.url);
1212
const __dirname = path.dirname(__filename);
@@ -34,7 +34,7 @@ export default (commandLineArgs) => {
3434
}),
3535
json(),
3636
nodeResolve({
37-
preferBuiltins: false,
37+
preferBuiltins: false
3838
}),
3939
commonjs({}),
4040
inject({
@@ -48,6 +48,10 @@ export default (commandLineArgs) => {
4848
alias({
4949
entries: [
5050
{ find: 'bson', replacement: path.resolve(__dirname, '../../node_modules/bson/lib/bson.rn.cjs') },
51+
{
52+
find: 'react-native/Libraries/Blob/BlobManager',
53+
replacement: path.resolve(__dirname, './vendor/BlobManager.js')
54+
}
5155
]
5256
}),
5357
terser()
@@ -59,7 +63,6 @@ export default (commandLineArgs) => {
5963
'node-fetch',
6064
'js-logger',
6165
'react-native',
62-
'react-native/Libraries/Blob/BlobManager',
6366
'react'
6467
]
6568
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* The current Rollup configuration targets a CommonJs output.
3+
* This translates import statements to require statements.
4+
* React native recently shifted to ESM exports.
5+
* https://github.com/facebook/react-native/pull/48761/files
6+
* This causes requiring this module to return an object
7+
* of the form:
8+
* ```javascript
9+
* {
10+
* _esModule: true,
11+
* default: BlobManager
12+
* }
13+
* ```
14+
* This wrapper provides a small shim to conditionally return the default export of the module.
15+
*/
16+
const BlobManager = require('react-native/Libraries/Blob/BlobManager');
17+
const interop = (mod) => (mod && mod.__esModule ? mod.default : mod);
18+
19+
/**
20+
* Using an ESM export here is important. Rollup compiles this to
21+
* ```javascript
22+
* const BlobManager = require('react-native/Libraries/Blob/BlobManager');
23+
* const interop = (mod) => (mod && mod.__esModule ? mod.default : mod);
24+
* var BlobManager$1 = interop(BlobManager);
25+
* ```
26+
*/
27+
export default interop(BlobManager);

packages/web/src/worker/sync/SharedSyncImplementation.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -306,28 +306,31 @@ export class SharedSyncImplementation
306306
// Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.
307307
return new WebStreamingSyncImplementation({
308308
adapter: new SqliteBucketStorage(this.dbAdapter!, new Mutex(), this.logger),
309-
remote: new WebRemote({
310-
fetchCredentials: async () => {
311-
const lastPort = this.ports[this.ports.length - 1];
312-
return new Promise(async (resolve, reject) => {
313-
const abortController = new AbortController();
314-
this.fetchCredentialsController = {
315-
controller: abortController,
316-
activePort: lastPort
317-
};
318-
319-
abortController.signal.onabort = reject;
320-
try {
321-
this.logger.log('calling the last port client provider for credentials');
322-
resolve(await lastPort.clientProvider.fetchCredentials());
323-
} catch (ex) {
324-
reject(ex);
325-
} finally {
326-
this.fetchCredentialsController = undefined;
327-
}
328-
});
329-
}
330-
}),
309+
remote: new WebRemote(
310+
{
311+
fetchCredentials: async () => {
312+
const lastPort = this.ports[this.ports.length - 1];
313+
return new Promise(async (resolve, reject) => {
314+
const abortController = new AbortController();
315+
this.fetchCredentialsController = {
316+
controller: abortController,
317+
activePort: lastPort
318+
};
319+
320+
abortController.signal.onabort = reject;
321+
try {
322+
this.logger.log('calling the last port client provider for credentials');
323+
resolve(await lastPort.clientProvider.fetchCredentials());
324+
} catch (ex) {
325+
reject(ex);
326+
} finally {
327+
this.fetchCredentialsController = undefined;
328+
}
329+
});
330+
}
331+
},
332+
this.logger
333+
),
331334
uploadCrud: async () => {
332335
const lastPort = this.ports[this.ports.length - 1];
333336

0 commit comments

Comments
 (0)