Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta PR: Implement offline support through CozyPouchLink #1507

Merged
merged 84 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
e2f4929
fix: Clean types folder before running `types` script
Ldoppea Jul 16, 2024
b6c523a
feat: Add types.d.ts generation on cozy-pouch-link through TSC
Ldoppea Jul 16, 2024
d99a97f
feat: Add doc generation to cozy-pouch-link through Typedoc
Ldoppea Jul 16, 2024
32366c5
fix: Clean `docs/api` folder before generating documentation
Ldoppea Jul 16, 2024
803a558
fix: Call Travis type generation from project root instead
Ldoppea Jul 17, 2024
a90648e
refactor(pouch-link): Make localStorage a class an return async methods
Ldoppea May 28, 2024
31ec182
feat(pouch-link): Allow to inject a local storage in CozyPouchLink
Ldoppea May 31, 2024
5a4e129
feat(pouch-link): Allow to inject a Pouch adapter in CozyPouchLink
Ldoppea May 28, 2024
254d682
feat(pouch-link): Allow to inject an `isOnline` method in CozyPouchLink
Ldoppea May 31, 2024
2113781
feat(pouch-link): Allow to inject event methods in CozyPouchLink
Ldoppea May 28, 2024
fbbc313
docs: Update types and documentation
Ldoppea Jul 16, 2024
73adba2
feat: Persist documents to local Pouch when they have no `rev`
Ldoppea May 31, 2024
ef5843f
feat(pouch-link): Prevent synchronizing `cozyLocalOnly` documents
Ldoppea May 31, 2024
fcd3014
test: Fix `normalizeDoc` test to add doctype
Ldoppea Jul 15, 2024
980c531
fix: Do not persist virtual documents when served from CozyPouchLink
Ldoppea Jun 18, 2024
7ad0bad
feat: Handle io.cozy.apps_registry query
Ldoppea Jul 12, 2024
d9dfb29
fix: Persist `io.cozy.files.shortcuts` even if they have a `meta.rev`
Ldoppea Jul 22, 2024
3e1157d
feat: Add check to `_rev` attribute when persisting virtual documents
Ldoppea Aug 13, 2024
9cc04e0
docs: Update types and documentation
Ldoppea Jul 16, 2024
0ca8ba3
feat: Forward operation in `StackLink.request()` when offline
Ldoppea May 31, 2024
2a029d9
feat: Forward operation in `StackLink.request()` on Network error
Ldoppea May 31, 2024
b42b269
docs: Update types and documentation
Ldoppea Jul 17, 2024
e9474d5
refactor: Nest startReplication tests in corresponding describe block
Ldoppea Jun 13, 2024
40c4111
test: Check for correct calls in startReplication tests
Ldoppea Jun 13, 2024
d5ea629
fix: Do not call pouch.replication on initial replication
Ldoppea Jun 13, 2024
ef32d13
test: Improve test coverage for startReplication
Ldoppea Jun 13, 2024
b5fc2a9
fix: Make cancelling replication work
Ldoppea Jun 13, 2024
8b9d683
test: Add unit tests for remote.js
Ldoppea Jun 19, 2024
ce44cc2
feat: Throw errors from remote.js when HTTP result is not `ok`
Ldoppea Jun 19, 2024
ea3e3db
refactor: Extract replicateOnce from PouchManager
Ldoppea Jun 19, 2024
e849bdc
feat: Do not fail replication when some databases do no exist
Ldoppea Jun 19, 2024
3c823da
feat: Do not fail replication when some databases are unreadable
Ldoppea Jun 19, 2024
c2dffe2
feat: Discriminate not_synced doctypes from ones with non-blocking error
Ldoppea Jul 16, 2024
6a1a3c1
fix: Call the correct storage method in `getLastReplicatedDocID`
Ldoppea Jul 12, 2024
44e5036
docs: Update types and documentation
Ldoppea Jul 26, 2024
8c8401c
feat: Upgrade cozy-intent to `2.23.0`
Ldoppea Jul 26, 2024
f0d4fd7
feat: Implement FlagshipLink
Ldoppea Jun 18, 2024
26ee739
docs: Update types and documentation
Ldoppea Jul 26, 2024
3a196fa
fix(pouch-link): Make CozyPouchLink use native partial indexes
Ldoppea Jun 18, 2024
b7405c6
refactor: Homogenize index creation in CozyPouchLink/DocumentCollection
Ldoppea Jun 19, 2024
0605410
refactor: Remove unnecessary var
Ldoppea Jul 15, 2024
7edb9cf
feat(pouch-link): Handle missing selector predicates for indexed values
Ldoppea Jul 30, 2024
cc4fdb9
feat(pouch-link): Support empty selector for PouchDB
Ldoppea Jul 30, 2024
10aae41
feat(pouch-link): Apply new index naming algorithm on CozyPouchLink
Ldoppea Jul 22, 2024
ccba8cf
fix(pouch-link): Add relationships to jsonapi's normalizeDoc
Ldoppea Jun 18, 2024
fdac5b8
feat(pouch-link): Add links to jsonapi's normalizeDoc
Ldoppea Jul 15, 2024
b543812
feat(pouch-link): Allow to ignore warmup
Ldoppea Jul 16, 2024
5bc807c
docs: Update types and documentation
Ldoppea Jul 30, 2024
1eae0c4
docs: Extract types for StackLink and CozyPouchLink
Ldoppea Jul 30, 2024
d0f7555
docs: Fix type for CozyPouchLink constructor
Ldoppea Jul 30, 2024
2952954
docs: Update types and documentation
Ldoppea Jul 30, 2024
a18c9f9
feat: Add `downloadFile` method in `file` model
Ldoppea Aug 3, 2024
83a76b9
docs: Update types and documentation
Ldoppea Aug 22, 2024
0bb184e
feat: Ensure storageEngine implements correct interface
Ldoppea Aug 27, 2024
310317d
refactor: Use parameter destructuring for `replicateAllDocs`
Ldoppea Aug 27, 2024
adaebbb
refactor: Remove unused client/stackClient parameters from FlagshipLink
Ldoppea Aug 27, 2024
5147fc3
refactor: Use parameter destructuring for `jsonapi.fromPouchResult`
Ldoppea Aug 27, 2024
fd3414c
refactor: Extract `normalizeFindSelector` method from `executeQuery`
Ldoppea Aug 27, 2024
66e8275
test: Add a unit test for `ensureIndex` that tests a partial filter
Ldoppea Sep 4, 2024
3133d09
feat: Add a warning when an indexedField is missing in query selector
Ldoppea Aug 27, 2024
d7bd364
refactor: Rename `persistData` into `persistCozyData`
Ldoppea Aug 28, 2024
3903b71
refactor: Rename `normalizeLinks` into `normalizeAppsLinks`
Ldoppea Aug 28, 2024
824633a
feat: Force _rev for queries with .select fields
Ldoppea Aug 28, 2024
185c5c2
feat(pouch-link): Handle missing selector predicates for sorted values
Ldoppea Aug 28, 2024
ba711e4
revert: Remove `cozyFromPouch` guard
Ldoppea Sep 4, 2024
09226ae
revert: Remove `ignoreWarmup` option
Ldoppea Sep 4, 2024
d4f0adc
docs: Update types and documentation
Ldoppea Sep 4, 2024
118a343
fix: Remove `attributes` and `meta` attributes before persisting docs
Ldoppea Aug 28, 2024
5dbeeac
fix: Don't use attributes on loadInstanceOptionsFromStack
Ldoppea Sep 3, 2024
bf8af38
fix: Don't use attributes on HasManyFiles
Ldoppea Sep 4, 2024
44ad68a
fix: Don't use attributes on useCapabilities
Ldoppea Sep 4, 2024
6f6df5c
fix: Don't use attributes on useFetchShortctut
Ldoppea Sep 4, 2024
98453f8
fix: Don't use attributes on models/applications
Ldoppea Sep 4, 2024
1870537
fix: Don't use attributes on models/instance
Ldoppea Sep 4, 2024
cb7297e
docs: Update types and documentation
Ldoppea Sep 4, 2024
480b406
fix(cozy-pouch-link): Merge partialFilter into selector on `find` query
Ldoppea Sep 11, 2024
a5da8fa
fix: Check for Flagship's downloadFile method support before calling it
Ldoppea Sep 11, 2024
2b05e1d
fix: Await for `persistVirtualDocuments` result before finishing request
Ldoppea Sep 11, 2024
f2d30b1
docs: Update types and documentation
Ldoppea Sep 11, 2024
339e5a6
feat: Improve CozyLink typing and add `reset()` method
Ldoppea Sep 15, 2024
3b7d9fa
docs: Update types and documentation
Ldoppea Sep 19, 2024
6f23dbe
feat: Handle queries that fetch Konnectors by channel
Ldoppea Sep 19, 2024
7e5f1de
feat: Rename FlagshipLink to WebFlagshipLink
Ldoppea Sep 23, 2024
b13b3db
docs: Update types and documentation
Ldoppea Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/cozy-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cozy-client
* [QueryDefinition](classes/QueryDefinition.md)
* [Registry](classes/Registry.md)
* [StackLink](classes/StackLink.md)
* [WebFlagshipLink](classes/WebFlagshipLink.md)

## Properties

Expand Down
184 changes: 92 additions & 92 deletions docs/api/cozy-client/classes/CozyClient.md

Large diffs are not rendered by default.

62 changes: 53 additions & 9 deletions docs/api/cozy-client/classes/CozyLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,84 @@

↳ [`StackLink`](StackLink.md)

↳ [`WebFlagshipLink`](WebFlagshipLink.md)

## Constructors

### constructor

• **new CozyLink**(`requestHandler`)
• **new CozyLink**(`requestHandler`, `persistHandler`)

*Parameters*

| Name | Type |
| :------ | :------ |
| `requestHandler` | `any` |
| `persistHandler` | `any` |

*Defined in*

[packages/cozy-client/src/CozyLink.js:2](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L2)

## Methods

### persistCozyData

▸ **persistCozyData**(`data`, `forward`): `Promise`<`any`>

Persist the given data into the links storage

*Parameters*

| Name | Type | Description |
| :------ | :------ | :------ |
| `data` | `any` | The document to persist |
| `forward` | `any` | The next persistCozyData of the chain |

*Returns*

`Promise`<`any`>

*Defined in*

[packages/cozy-client/src/CozyLink.js:31](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L31)

***

### request

▸ **request**(`operation`, `result`, `forward`): `void`
▸ **request**(`operation`, `result`, `forward`): `Promise`<`any`>

Request the given operation from the link

*Parameters*

| Name | Type |
| :------ | :------ |
| `operation` | `any` |
| `result` | `any` |
| `forward` | `any` |
| Name | Type | Description |
| :------ | :------ | :------ |
| `operation` | `any` | The operation to request |
| `result` | `any` | The result from the previous request of the chain |
| `forward` | `any` | The next request of the chain |

*Returns*

`Promise`<`any`>

*Defined in*

[packages/cozy-client/src/CozyLink.js:20](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L20)

***

### reset

▸ **reset**(): `Promise`<`any`>

Reset the link data

*Returns*

`void`
`Promise`<`any`>

*Defined in*

[packages/cozy-client/src/CozyLink.js:8](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L8)
[packages/cozy-client/src/CozyLink.js:40](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L40)
67 changes: 55 additions & 12 deletions docs/api/cozy-client/classes/StackLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,35 @@ Transfers queries and mutations to a remote stack

| Name | Type | Description |
| :------ | :------ | :------ |
| `[options]` | `Object` | Options |
| `[options].client` | `any` | - |
| `[options].stackClient` | `any` | - |
| `[options]` | `StackLinkOptions` | Options |

*Overrides*

[CozyLink](CozyLink.md).[constructor](CozyLink.md#constructor)

*Defined in*

[packages/cozy-client/src/StackLink.js:62](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L62)
[packages/cozy-client/src/StackLink.js:68](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L68)

## Properties

### isOnline

• **isOnline**: `any`

*Defined in*

[packages/cozy-client/src/StackLink.js:76](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L76)

***

### stackClient

• **stackClient**: `any`

*Defined in*

[packages/cozy-client/src/StackLink.js:69](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L69)
[packages/cozy-client/src/StackLink.js:75](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L75)

## Methods

Expand All @@ -62,7 +70,7 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:114](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L114)
[packages/cozy-client/src/StackLink.js:136](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L136)

***

Expand All @@ -82,7 +90,34 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:91](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L91)
[packages/cozy-client/src/StackLink.js:113](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L113)

***

### persistCozyData

▸ **persistCozyData**(`data`, `forward`): `Promise`<`any`>

Persist the given data into the links storage

*Parameters*

| Name | Type |
| :------ | :------ |
| `data` | `any` |
| `forward` | `any` |

*Returns*

`Promise`<`any`>

*Overrides*

[CozyLink](CozyLink.md).[persistCozyData](CozyLink.md#persistcozydata)

*Defined in*

[packages/cozy-client/src/StackLink.js:105](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L105)

***

Expand All @@ -102,14 +137,16 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:72](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L72)
[packages/cozy-client/src/StackLink.js:79](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L79)

***

### request

▸ **request**(`operation`, `result`, `forward`): `Promise`<`any`>

Request the given operation from the link

*Parameters*

| Name | Type |
Expand All @@ -128,18 +165,24 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:80](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L80)
[packages/cozy-client/src/StackLink.js:87](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L87)

***

### reset

▸ **reset**(): `void`
▸ **reset**(): `Promise`<`void`>

Reset the link data

*Returns*

`void`
`Promise`<`void`>

*Overrides*

[CozyLink](CozyLink.md).[reset](CozyLink.md#reset)

*Defined in*

[packages/cozy-client/src/StackLink.js:76](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L76)
[packages/cozy-client/src/StackLink.js:83](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L83)
135 changes: 135 additions & 0 deletions docs/api/cozy-client/classes/WebFlagshipLink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
[cozy-client](../README.md) / WebFlagshipLink

# Class: WebFlagshipLink

## Hierarchy

* [`CozyLink`](CozyLink.md)

↳ **`WebFlagshipLink`**

## Constructors

### constructor

• **new WebFlagshipLink**(`[options]?`)

*Parameters*

| Name | Type | Description |
| :------ | :------ | :------ |
| `[options]` | `Object` | Options |
| `[options].webviewIntent` | `WebviewService` | - |

*Overrides*

[CozyLink](CozyLink.md).[constructor](CozyLink.md#constructor)

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:8](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L8)

## Properties

### webviewIntent

• **webviewIntent**: `WebviewService`

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:10](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L10)

## Methods

### persistCozyData

▸ **persistCozyData**(`data`, `forward`): `Promise`<`void`>

Persist the given data into the links storage

*Parameters*

| Name | Type |
| :------ | :------ |
| `data` | `any` |
| `forward` | `any` |

*Returns*

`Promise`<`void`>

*Overrides*

[CozyLink](CozyLink.md).[persistCozyData](CozyLink.md#persistcozydata)

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:25](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L25)

***

### registerClient

▸ **registerClient**(`client`): `void`

*Parameters*

| Name | Type |
| :------ | :------ |
| `client` | `any` |

*Returns*

`void`

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:13](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L13)

***

### request

▸ **request**(`operation`, `result`, `forward`): `Promise`<`boolean`>

Request the given operation from the link

*Parameters*

| Name | Type |
| :------ | :------ |
| `operation` | `any` |
| `result` | `any` |
| `forward` | `any` |

*Returns*

`Promise`<`boolean`>

*Overrides*

[CozyLink](CozyLink.md).[request](CozyLink.md#request)

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:21](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L21)

***

### reset

▸ **reset**(): `Promise`<`void`>

Reset the link data

*Returns*

`Promise`<`void`>

*Overrides*

[CozyLink](CozyLink.md).[reset](CozyLink.md#reset)

*Defined in*

[packages/cozy-client/src/WebFlagshipLink.js:17](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/WebFlagshipLink.js#L17)
Loading
Loading