Skip to content

Commit b343f01

Browse files
Add v1.1 documentation with v1.0 versioning
Enable Docusaurus version dropdown (v1.1 current, v1.0 archived), v1.1 migration and New Architecture docs, v1.0 snapshot fixes, and doc content/link cleanup.
1 parent b549bf4 commit b343f01

59 files changed

Lines changed: 18327 additions & 9154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If you are using GitHub pages for hosting, this command is a convenient way to b
4747
We truly appreciate your interest in this project!
4848
This project is **community-maintained**, which means it's **not officially supported** by our support team.
4949

50-
If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here by [opening a GitHub issue](https://github.com/Couchbase-Ecosystem/cbl-reactnative-docs/issues).
50+
If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here - by [opening a GitHub issue](https://github.com/Couchbase-Ecosystem/cbl-reactnative-docs/issues).
5151
Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.
5252

53-
Your collaboration helps us all move forward together thank you!
53+
Your collaboration helps us all move forward together - thank you!

docs/DataSync/remote-sync-gateway.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 2
55

66
# Remote Sync
77

8-
> Description - _Couchbase Lite for Ionic — Synchronizing data changes between local and remote databases using Sync Gateway or Capella App Services_
8+
> Description - _Couchbase Lite for Ionic - Synchronizing data changes between local and remote databases using Sync Gateway or Capella App Services_
99
1010
:::note
1111
All code examples are indicative only. They demonstrate the basic concepts and approaches to using a feature. Use them as inspiration and adapt these examples to best practice when developing applications for your platform.
@@ -56,7 +56,7 @@ Couchbase Mobile uses a replication protocol based on WebSockets for replication
5656

5757
#### Incompatibilities
5858

59-
Couchbase Lite’s replication protocol is incompatible with CouchDB-based databases. And since Couchbase Lite 2.x+ only supports the new protocol, you will need to run a version of Sync Gateway that supports it — see: [Compatibility](../ProductNotes/compatibility.md).
59+
Couchbase Lite’s replication protocol is incompatible with CouchDB-based databases. And since Couchbase Lite 2.x+ only supports the new protocol, you will need to run a version of Sync Gateway that supports it - see: [Compatibility](../ProductNotes/compatibility.md).
6060

6161
### Ordering
6262

@@ -86,15 +86,15 @@ For backward compatibility with the code prior to >= 3.1, when you set up the re
8686

8787
<div align="center">
8888

89-
![Cbl Replication Scopes Collections 1](../../static/img/cbl-replication-scopes-collections-1.png)
89+
![Cbl Replication Scopes Collections 1](/img/cbl-replication-scopes-collections-1.png)
9090

9191
</div>
9292

9393
#### Sync Couchbase Lite default collection with default collection on Sync Gateway
9494

9595
<div align="center">
9696

97-
![Cbl Replication Scopes Collections 2](../../static/img/cbl-replication-scopes-collections-2.png)
97+
![Cbl Replication Scopes Collections 2](/img/cbl-replication-scopes-collections-2.png)
9898

9999
</div>
100100

@@ -106,15 +106,15 @@ The user-defined collections specified in the Couchbase Lite replicator setup mu
106106

107107
<div align="center">
108108

109-
![Cbl Replication Scopes Collections 3](../../static/img/cbl-replication-scopes-collections-3.png)
109+
![Cbl Replication Scopes Collections 3](/img/cbl-replication-scopes-collections-3.png)
110110

111111
</div>
112112

113113
#### Syncing scope with user-defined collections. Couchbase Lite has more collections than the Sync Gateway configuration (with collection filters)
114114

115115
<div align="center">
116116

117-
![Cbl Replication Scopes Collections 4](../../static/img/cbl-replication-scopes-collections-4.png)
117+
![Cbl Replication Scopes Collections 4](/img/cbl-replication-scopes-collections-4.png)
118118

119119
</div>
120120

@@ -259,7 +259,7 @@ config.addCollection(collectionName);
259259
```
260260

261261
:::note
262-
Note use of the scheme prefix (`wss://` to ensure TLS encryption — strongly recommended in production — or `ws://`)
262+
Note use of the scheme prefix (`wss://` to ensure TLS encryption - strongly recommended in production - or `ws://`)
263263
:::
264264

265265
### Sync Mode
@@ -298,7 +298,7 @@ In the event it detects a transient error, the replicator will attempt to reconn
298298

299299
On each retry the interval between attempts is increased exponentially (exponential backoff) up to the maximum wait time limit (5 minutes).
300300

301-
The REST API provides configurable control over this replication retry logic using a set of configiurable properties — see: [Table 1](#table-1-replication-retry-configuration-properties).
301+
The REST API provides configurable control over this replication retry logic using a set of configiurable properties - see: [Table 1](#table-1-replication-retry-configuration-properties).
302302

303303
#### Table 1. Replication Retry Configuration Properties
304304

@@ -308,7 +308,7 @@ The REST API provides configurable control over this replication retry logic usi
308308
| `maxAttempts()` | Change this to limit or extend the number of retry attempts. | The maximum number of retry attempts. <br/> <br/> Set to zero (0) to use default values. <br/> <br/> Set to one (1) to prevent any retry attempt. <br/> <br/> The retry attempt count is reset when the replicator is able to connect and replicate. <br/> <br/> Default values are: <br/> - Single-shot replication = 9 <br/> - Continuous replication = maximum integer value. <br/> <br/> Negative values generate a Couchbase exception `InvalidArgumentException`. |
309309
| `maxAttemptWaitTime()` | Change this to adjust the interval between retries. | The maximum interval between retry attempts. <br/> <br/> While you can configure the maximum permitted wait time, the replicator’s exponential backoff algorithm calculates each individual interval which is not configurable. <br/> <br/> Default value: 300 seconds (5 minutes). <br/> <br/> Zero sets the maximum interval between retries to the default of 300 seconds. <br/> <br/> 300 sets the maximum interval between retries to the default of 300 seconds. <br/> <br/> A negative value generates a Couchbase exception, `InvalidArgumentException`. |
310310

311-
When necessary you can adjust any or all of those configurable values — see: [Example 5](#example-5-configuring-replication-retries) for how to do this.
311+
When necessary you can adjust any or all of those configurable values - see: [Example 5](#example-5-configuring-replication-retries) for how to do this.
312312

313313
#### Example 5. Configuring Replication Retries
314314

@@ -462,7 +462,7 @@ await replicator.start();
462462

463463
Custom headers can be set on the configuration object. The replicator will then include those headers in every request.
464464

465-
This feature is useful in passing additional credentials, perhaps when an authentication or authorization step is being done by a proxy server (between Couchbase Lite and Sync Gateway) — see [Example 10](#example-10-setting-custom-headers).
465+
This feature is useful in passing additional credentials, perhaps when an authentication or authorization step is being done by a proxy server (between Couchbase Lite and Sync Gateway) - see [Example 10](#example-10-setting-custom-headers).
466466

467467
#### Example 10. Setting custom headers
468468

@@ -506,6 +506,10 @@ await replicator.start();
506506

507507
1. The callback should follow the semantics of a [pure function](https://en.wikipedia.org/wiki/Pure_function). Otherwise, long running functions would slow down the replicator considerably.
508508

509+
:::note Version 1.1
510+
Android replication filters now support JavaScript arrow functions in the V8 evaluation path.
511+
:::
512+
509513
##### Pull Filter
510514

511515
The pull filter gives an app the ability to validate documents being pulled, and skip ones that fail. This is an important security mechanism in a peer-to-peer topology with peers that are not fully trusted.
@@ -585,7 +589,7 @@ Users may lose access to channels in a number of ways:
585589
* User is removed from a role
586590
* A channel is removed from a role the user is assigned to
587591

588-
By default, when a user loses access to a channel, the next Couchbase Lite Pull replication auto-purges all documents in the channel from local Couchbase Lite databases (on devices belonging to the user) unless they belong to any of the user’s other channels — see: [Table 2](#table-2-behavior-following-access-revocation).
592+
By default, when a user loses access to a channel, the next Couchbase Lite Pull replication auto-purges all documents in the channel from local Couchbase Lite databases (on devices belonging to the user) unless they belong to any of the user’s other channels - see: [Table 2](#table-2-behavior-following-access-revocation).
589593

590594
Documents that exist in multiple channels belonging to the user (even if they are not actively replicating that channel) are not auto-purged unless the user loses access to all channels.
591595

@@ -604,7 +608,7 @@ Users will be receive an `AccessRemoved` notification from the DocumentListener
604608
| | Sync Function includes `requireAccess(revokedChannel)` | Local changes continue to be pushed to remote but are rejected by Sync Gateway |
605609

606610

607-
If a user subsequently regains access to a lost channel, then any previously auto-purged documents still assigned to any of their channels are automatically pulled down by the active Sync Gateway when they are next updated — see behavior summary in [Table 3](#table-3-behavior-if-access-is-regained).
611+
If a user subsequently regains access to a lost channel, then any previously auto-purged documents still assigned to any of their channels are automatically pulled down by the active Sync Gateway when they are next updated - see behavior summary in [Table 3](#table-3-behavior-if-access-is-regained).
608612

609613
#### Table 3. Behavior if access is regained
610614

@@ -639,7 +643,7 @@ This is an [Enterprise Edition](https://www.couchbase.com/products/editions/) fe
639643

640644
With Delta Sync, only the changed parts of a Couchbase document are replicated. This can result in significant savings in bandwidth consumption as well as throughput improvements, especially when network bandwidth is typically constrained.
641645

642-
Replications to a Server (for example, a Sync Gateway, or passive listener) automatically use delta sync if the property is enabled at database level by the server — see: [databases.$db.delta_sync.enabled](https://docs.couchbase.com/sync-gateway/current/configuration-properties-legacy.html#databases-foo_db-delta_sync).
646+
Replications to a Server (for example, a Sync Gateway, or passive listener) automatically use delta sync if the property is enabled at database level by the server - see: [databases.$db.delta_sync.enabled](https://docs.couchbase.com/sync-gateway/current/configuration-properties-legacy.html#databases-foo_db-delta_sync).
643647

644648
Intra-Device replications automatically disable delta sync, whilst Peer-to-Peer replications automatically enable delta sync.
645649

@@ -669,7 +673,7 @@ Replicators use `checkpoints` to keep track of documents sent to the target data
669673

670674
Without `checkpoints`, Couchbase Lite would replicate the entire database content to the target database on each connection, even though previous replications may already have replicated some or all of that content.
671675

672-
This functionality is generally not a concern to application developers. However, if you do want to force the replication to start again from zero, use the `checkpoint` reset argument when starting the replicator — as shown in Example 13.
676+
This functionality is generally not a concern to application developers. However, if you do want to force the replication to start again from zero, use the `checkpoint` reset argument when starting the replicator - as shown in Example 13.
673677

674678
#### Example 13. Resetting checkpoints
675679

@@ -691,7 +695,7 @@ The default `false` is shown here for completeness only; it is unlikely you woul
691695

692696
You can monitor a replication’s status by using a combination of `Change Listeners` and the `Replicator.getStatus()` property. This enables you to know, for example, when the replication is actively transferring data and when it has stopped.
693697

694-
You can also choose to monitor document changes — see: [Monitor Document Changes](#monitor-document-changes).
698+
You can also choose to monitor document changes - see: [Monitor Document Changes](#monitor-document-changes).
695699

696700
### Change Listeners
697701

@@ -701,21 +705,21 @@ Use this to monitor changes and to inform on sync progress; this is an optional
701705
Don’t forget to save the token so you can remove the listener later
702706
:::
703707

704-
Use the `Replicator` class to add a change listener as a callback to the Replicator (`addChangeListener()`) — see: [Example 14](#example-14-monitor-replication). You will then be asynchronously notified of state changes.
708+
Use the `Replicator` class to add a change listener as a callback to the Replicator (`addChangeListener()`) - see: [Example 14](#example-14-monitor-replication). You will then be asynchronously notified of state changes.
705709

706710
You can remove a change listener with `removeChangeListener(token)`.
707711

708712
### Replicator Status
709713

710-
You can use the `Replicator.getStatus()` property to check the replicator status. That is, whether it is actively transferring data or if it has stopped — see: [Example 14](#example-14-monitor-replication).
714+
You can use the `Replicator.getStatus()` property to check the replicator status. That is, whether it is actively transferring data or if it has stopped - see: [Example 14](#example-14-monitor-replication).
711715

712716
The returned *ReplicationStatus* structure comprises:
713717

714-
* `ActivityLevel` — stopped, offline, connecting, idle or busy — see states described in: [Table 5](#table-5-replicator-activity-levels)
718+
* `ActivityLevel` - stopped, offline, connecting, idle or busy - see states described in: [Table 5](#table-5-replicator-activity-levels)
715719

716720
* `Progress`
717-
* completed — the total number of changes completed
718-
* total — the total number of changes to be processed
721+
* completed - the total number of changes completed
722+
* total - the total number of changes to be processed
719723

720724
* `Error` - the current error, if any.
721725

@@ -804,7 +808,7 @@ await token.remove();
804808

805809
The following diagram describes the status changes when the application starts a replication, and when the application is being backgrounded or foregrounded by the OS. It applies to iOS only.
806810

807-
![Replicator States](../../static/img/replicator-states.png)
811+
![Replicator States](/img/replicator-states.png)
808812

809813
Additionally, on iOS, an app already in the background may be terminated. In this case, the `Database` and `Replicator` instances will be `null` when the app returns to the foreground. Therefore, as preventive measure, it is recommended to do a `null` check when the app enters the foreground, and to re-initialize the database and replicator if any of those is `null`.
810814

@@ -964,7 +968,7 @@ By default, the WebSocket protocol uses compression to optimize for speed and ba
964968

965969
### Logs
966970

967-
As always, when there is a problem with replication, logging is your friend. You can increase the log output for activity related to replication with Sync Gateway — see [Example 21](#example-21-set-logging-verbosity).
971+
As always, when there is a problem with replication, logging is your friend. You can increase the log output for activity related to replication with Sync Gateway - see [Example 21](#example-21-set-logging-verbosity).
968972

969973
#### Example 21. Set logging verbosity
970974

@@ -986,15 +990,15 @@ For more on troubleshooting with logs, see: [Using Logs](../Troubleshooting/usin
986990

987991
### Authentication Errors
988992

989-
If Sync Gateway is configured with a self signed certificate but your app points to a `ws` scheme instead of `wss` you will encounter an error with status code 11006 — see: [Example 22](#example-22-protocol-mismatch)
993+
If Sync Gateway is configured with a self signed certificate but your app points to a `ws` scheme instead of `wss` you will encounter an error with status code 11006 - see: [Example 22](#example-22-protocol-mismatch)
990994

991995
#### Example 22. Protocol Mismatch
992996

993997
```console
994998
CouchbaseLite Replicator ERROR: {Repl#2} Got LiteCore error: WebSocket error 1006 "connection closed abnormally"
995999
```
9961000

997-
If Sync Gateway is configured with a self signed certificate, and your app points to a `wss` scheme but the replicator configuration isn’t using the certificate you will encounter an error with status code `5011` — see: [Example 23](#example-23-certificate-mismatch-or-not-found)
1001+
If Sync Gateway is configured with a self signed certificate, and your app points to a `wss` scheme but the replicator configuration isn’t using the certificate you will encounter an error with status code `5011` - see: [Example 23](#example-23-certificate-mismatch-or-not-found)
9981002

9991003
#### Example 23. Certificate Mismatch or Not Found
10001004

docs/Guides/Migration/v1.1.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
id: migration-guide-v1-1
3+
sidebar_position: 2
4+
---
5+
6+
# Version 1.1
7+
8+
> Description - _Quick reference for customer-facing changes in cbl-reactnative version 1.1_
9+
> Related Content - [Release Notes](../../ProductNotes/release-notes.md) | [Using Logs](../../Troubleshooting/using-logs.md)
10+
11+
## At a Glance
12+
13+
Version 1.1 is focused on React Native New Architecture support and better troubleshooting:
14+
15+
1. **TurboModules** - iOS and Android modules now support the React Native New Architecture.
16+
2. **Improved file logging** - React Native wrapper diagnostics can be written to file and custom log sinks.
17+
3. **LogSinks.write()** - application code can write messages into configured Couchbase Lite log sinks.
18+
4. **Reliability fixes** - listener cleanup, document expiration, and conflict-aware deletes are improved.
19+
20+
## TurboModule Support
21+
22+
Version 1.1 supports [React Native New Architecture](https://reactnative.dev/architecture/overview) through TurboModules. Existing application-level Couchbase Lite APIs remain largely compatible, but New Architecture should be enabled to use the TurboModule implementation.
23+
24+
For Expo development builds, enable New Architecture in `app.json`:
25+
26+
```json
27+
{
28+
"expo": {
29+
"newArchEnabled": true
30+
}
31+
}
32+
```
33+
34+
For React Native Android projects, make sure `newArchEnabled=true` is set in the Android project configuration.
35+
36+
## Logging Changes
37+
38+
### React Native Logs in File and Custom Sinks
39+
40+
When a file or custom log sink is enabled, version 1.1 can forward React Native wrapper diagnostics into the same logging pipeline as native Couchbase Lite logs.
41+
42+
React Native-originated lines are prefixed with `RN`:
43+
44+
```text
45+
RN ::DEBUG:: database_Open
46+
RN ::WARNING:: query_RemoveChangeListener rejected: no listener for token
47+
RN ::ERROR:: collection_Save failed
48+
```
49+
50+
This helps diagnose issues that cross the JavaScript/native boundary while keeping sensitive payloads out of forwarded logs.
51+
52+
### Writing Application Logs
53+
54+
Use `LogSinks.write()` to write application messages into configured Couchbase Lite sinks:
55+
56+
```typescript
57+
import { LogSinks, LogLevel, LogDomain } from 'cbl-reactnative';
58+
59+
await LogSinks.write(
60+
LogLevel.WARNING,
61+
LogDomain.DATABASE,
62+
'Retrying database open after transient failure'
63+
);
64+
```
65+
66+
## Smaller Behavior Improvements
67+
68+
- Passing `null` to `setDocumentExpiration()` clears a document expiration.
69+
- Delete operations using `ConcurrencyControl.FAIL_ON_CONFLICT` reject stale revisions more consistently.
70+
- Query, collection, and replicator listener routing is more consistent on New Architecture builds.
71+
- Android replication filters support JavaScript arrow functions.
72+
- `FileSystem.getFilesInDirectory(path)` can list generated log files.
73+
74+
## Repository Links
75+
76+
- [couchbase/couchbase-lite-react-native](https://github.com/couchbase/couchbase-lite-react-native)
77+
- [couchbase/couchbase-lite-js-common](https://github.com/couchbase/couchbase-lite-js-common)

docs/Guides/Migration/v1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ sidebar_position: 1
55

66
# Version 1.0
77

8-
> Description _Quick reference for all API changes in cbl-reactnative version 1.0_
9-
> Related Content [Release Notes](../../ProductNotes/release-notes.md) | [Using Logs](../../Troubleshooting/using-logs.md)
8+
> Description - _Quick reference for all API changes in cbl-reactnative version 1.0_
9+
> Related Content - [Release Notes](../../ProductNotes/release-notes.md) | [Using Logs](../../Troubleshooting/using-logs.md)
1010
1111
:::important AT A GLANCE
1212
Version 1.0 introduces several API changes:

0 commit comments

Comments
 (0)