@powersync/react-native 1.33.1 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { AbstractRemote, AbstractRemoteOptions, BSONImplementation, DataStream, ILogger, RemoteConnector, SyncStreamOptions } from '@powersync/common';
1
+ import { AbstractRemote, AbstractRemoteOptions, ILogger, RemoteConnector, SyncStreamOptions } from '@powersync/common';
2
2
  import { TextDecoder } from 'text-encoding';
3
3
  export declare const STREAMING_POST_TIMEOUT_MS = 30000;
4
4
  export declare class ReactNativeRemote extends AbstractRemote {
@@ -6,7 +6,10 @@ export declare class ReactNativeRemote extends AbstractRemote {
6
6
  protected logger: ILogger;
7
7
  constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial<AbstractRemoteOptions>);
8
8
  getUserAgent(): string;
9
- getBSON(): Promise<BSONImplementation>;
10
- protected createTextDecoder(): TextDecoder;
11
- postStreamRaw<T>(options: SyncStreamOptions, mapLine: (line: string) => T): Promise<DataStream<T>>;
9
+ createTextDecoder(): TextDecoder;
10
+ protected get supportsStreamingBinaryResponses(): boolean;
11
+ protected fetchStreamRaw(options: SyncStreamOptions): Promise<{
12
+ isBson: boolean;
13
+ stream: import("@powersync/common").SimpleAsyncIterator<Uint8Array>;
14
+ }>;
12
15
  }
@@ -1,7 +1,5 @@
1
1
  import { AbstractRemote, DEFAULT_REMOTE_LOGGER, FetchImplementationProvider } from '@powersync/common';
2
2
  import { Platform } from 'react-native';
3
- // Note docs for React Native https://github.com/mongodb/js-bson?tab=readme-ov-file#react-native
4
- import { BSON } from 'bson';
5
3
  import { TextDecoder } from 'text-encoding';
6
4
  import { fetch } from 'react-native-fetch-api';
7
5
  export const STREAMING_POST_TIMEOUT_MS = 30_000;
@@ -34,20 +32,21 @@ export class ReactNativeRemote extends AbstractRemote {
34
32
  `${Platform.OS}/${Platform.Version}`
35
33
  ].join(' ');
36
34
  }
37
- async getBSON() {
38
- return BSON;
39
- }
40
35
  createTextDecoder() {
41
36
  return new TextDecoder();
42
37
  }
43
- async postStreamRaw(options, mapLine) {
38
+ get supportsStreamingBinaryResponses() {
39
+ // We have to pass textStreaming: true to get streamed responses at all, and those don't support binary data.
40
+ return false;
41
+ }
42
+ async fetchStreamRaw(options) {
44
43
  const timeout = Platform.OS == 'android'
45
44
  ? setTimeout(() => {
46
45
  this.logger.warn(`HTTP Streaming POST is taking longer than ${Math.ceil(STREAMING_POST_TIMEOUT_MS / 1000)} seconds to resolve. If using a debug build, please ensure Flipper Network plugin is disabled.`);
47
46
  }, STREAMING_POST_TIMEOUT_MS)
48
47
  : null;
49
48
  try {
50
- return await super.postStreamRaw({
49
+ return await super.fetchStreamRaw({
51
50
  ...options,
52
51
  fetchOptions: {
53
52
  ...options.fetchOptions,
@@ -59,7 +58,7 @@ export class ReactNativeRemote extends AbstractRemote {
59
58
  // @ts-expect-error https://github.com/react-native-community/fetch#enable-text-streaming
60
59
  reactNative: { textStreaming: true }
61
60
  }
62
- }, mapLine);
61
+ });
63
62
  }
64
63
  finally {
65
64
  if (timeout) {
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNativeRemote.js","sourceRoot":"","sources":["../../../src/sync/stream/ReactNativeRemote.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAGd,qBAAqB,EAGrB,2BAA2B,EAI5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,gGAAgG;AAChG,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;;;GAIG;AACH,MAAM,wBAAyB,SAAQ,2BAA2B;IAChE,QAAQ;QACN,OAAO,KAAK,CAAC,IAAI,CAAC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,SAAS,CAAC,kBAAkB,CAAC,KAAK,IAAI,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE;YAC5G,GAAG,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE;SACrC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IAED,IAAc,gCAAgC;QAC5C,6GAA6G;QAC7G,OAAO,KAAK,CAAC;IACf,CAAC;IAES,KAAK,CAAC,cAAc,CAAC,OAA0B;QACvD,MAAM,OAAO,GACX,QAAQ,CAAC,EAAE,IAAI,SAAS;YACtB,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,6CAA6C,IAAI,CAAC,IAAI,CACpD,yBAAyB,GAAG,IAAI,CACjC,gGAAgG,CAClG,CAAC;YACJ,CAAC,EAAE,yBAAyB,CAAC;YAC/B,CAAC,CAAC,IAAI,CAAC;QAEX,IAAI,CAAC;YACH,OAAO,MAAM,KAAK,CAAC,cAAc,CAAC;gBAChC,GAAG,OAAO;gBACV,YAAY,EAAE;oBACZ,GAAG,OAAO,CAAC,YAAY;oBACvB;;;;uBAIG;oBACH,yFAAyF;oBACzF,WAAW,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;iBACrC;aACF,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,OAAO,EAAE,CAAC;gBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/react-native",
3
- "version": "1.33.1",
3
+ "version": "1.35.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -18,15 +18,15 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/powersync-ja/powersync-js.git"
20
20
  },
21
- "author": "JOURNEYAPPS",
21
+ "author": "PowerSync",
22
22
  "license": "Apache-2.0",
23
23
  "bugs": {
24
24
  "url": "https://github.com/powersync-ja/powersync-js/issues"
25
25
  },
26
26
  "homepage": "https://docs.powersync.com/",
27
27
  "peerDependencies": {
28
- "@journeyapps/react-native-quick-sqlite": "^2.5.1",
29
- "@powersync/common": "^1.51.0",
28
+ "@journeyapps/react-native-quick-sqlite": "^2.5.2",
29
+ "@powersync/common": "^1.53.0",
30
30
  "react": "*",
31
31
  "react-native": "*"
32
32
  },
@@ -36,12 +36,12 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@powersync/common": "1.51.0",
39
+ "@powersync/common": "1.53.0",
40
40
  "@powersync/react": "1.10.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@craftzdog/react-native-buffer": "^6.0.5",
44
- "@journeyapps/react-native-quick-sqlite": "^2.5.1",
44
+ "@journeyapps/react-native-quick-sqlite": "^2.5.2",
45
45
  "@rollup/plugin-alias": "^5.1.0",
46
46
  "@rollup/plugin-commonjs": "^29.0.0",
47
47
  "@rollup/plugin-inject": "^5.0.5",
@@ -50,7 +50,6 @@
50
50
  "@rollup/plugin-replace": "^5.0.7",
51
51
  "@rollup/plugin-terser": "^0.4.4",
52
52
  "@types/react": "^19.1.1",
53
- "bson": "^6.10.4",
54
53
  "react": "^19.2.0",
55
54
  "react-native": "0.83.1",
56
55
  "react-native-fetch-api": "^3.0.0",
@@ -1,9 +1,7 @@
1
1
  import {
2
2
  AbstractRemote,
3
3
  AbstractRemoteOptions,
4
- BSONImplementation,
5
4
  DEFAULT_REMOTE_LOGGER,
6
- DataStream,
7
5
  FetchImplementation,
8
6
  FetchImplementationProvider,
9
7
  ILogger,
@@ -11,8 +9,6 @@ import {
11
9
  SyncStreamOptions
12
10
  } from '@powersync/common';
13
11
  import { Platform } from 'react-native';
14
- // Note docs for React Native https://github.com/mongodb/js-bson?tab=readme-ov-file#react-native
15
- import { BSON } from 'bson';
16
12
  import { TextDecoder } from 'text-encoding';
17
13
 
18
14
  import { fetch } from 'react-native-fetch-api';
@@ -51,15 +47,16 @@ export class ReactNativeRemote extends AbstractRemote {
51
47
  ].join(' ');
52
48
  }
53
49
 
54
- async getBSON(): Promise<BSONImplementation> {
55
- return BSON;
50
+ createTextDecoder(): TextDecoder {
51
+ return new TextDecoder();
56
52
  }
57
53
 
58
- protected createTextDecoder(): TextDecoder {
59
- return new TextDecoder();
54
+ protected get supportsStreamingBinaryResponses(): boolean {
55
+ // We have to pass textStreaming: true to get streamed responses at all, and those don't support binary data.
56
+ return false;
60
57
  }
61
58
 
62
- async postStreamRaw<T>(options: SyncStreamOptions, mapLine: (line: string) => T): Promise<DataStream<T>> {
59
+ protected async fetchStreamRaw(options: SyncStreamOptions) {
63
60
  const timeout =
64
61
  Platform.OS == 'android'
65
62
  ? setTimeout(() => {
@@ -72,22 +69,19 @@ export class ReactNativeRemote extends AbstractRemote {
72
69
  : null;
73
70
 
74
71
  try {
75
- return await super.postStreamRaw(
76
- {
77
- ...options,
78
- fetchOptions: {
79
- ...options.fetchOptions,
80
- /**
81
- * The `react-native-fetch-api` polyfill provides streaming support via
82
- * this non-standard flag
83
- * https://github.com/react-native-community/fetch#enable-text-streaming
84
- */
85
- // @ts-expect-error https://github.com/react-native-community/fetch#enable-text-streaming
86
- reactNative: { textStreaming: true }
87
- }
88
- },
89
- mapLine
90
- );
72
+ return await super.fetchStreamRaw({
73
+ ...options,
74
+ fetchOptions: {
75
+ ...options.fetchOptions,
76
+ /**
77
+ * The `react-native-fetch-api` polyfill provides streaming support via
78
+ * this non-standard flag
79
+ * https://github.com/react-native-community/fetch#enable-text-streaming
80
+ */
81
+ // @ts-expect-error https://github.com/react-native-community/fetch#enable-text-streaming
82
+ reactNative: { textStreaming: true }
83
+ }
84
+ });
91
85
  } finally {
92
86
  if (timeout) {
93
87
  clearTimeout(timeout);