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

feat: Enable docs and types in cozy-pouch-link using Typedoc and TSC #1500

Merged
merged 42 commits into from
Jul 26, 2024

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Jul 16, 2024

We will start to use PouchLink in cozy-flagship-app (that uses typescript) and so we want to enable typing for this project

Merkur39 and others added 30 commits May 21, 2024 15:29
Via OCR, the value comes from a text field,
and it can have values like "fra," "bob," "aa," etc.
These changes prevent any bad UI/UX behavior.
To use the enabled option, the definition is passed in the form of a general function. I've adapted the typing to this practice. This allows me to display the warning also for definition passed with a function
Add tax_certificate qualification for initial requirement in Mes Papiers
The resetQuery method can be used to reset a query in the cache to its
initial state based on its id. The query will refetch after.

This can be useful after a mutation without response. Because you know
that some of the data in a query is no longer fresh, you can choose to
update them before fetchPolicy expires.
When cozy-client receives a request, it re-evaluates the other
requests in memory to ensure that they are up to date with the added or
updated documents.

However, this re-evaluation did not work for requests retrieving the
contents of a Nextcloud folder. Unlike `io.cozy.files` which has a
`dir_id`, we use the folder path to retrieve its contents. File paths
include their names, which stops a direct match with the query selector
based on the path to the parent folder. For example, the file path
`/folder1/file1.txt` would not directly match a query looking for all
files in `/folder1`.

To resolve this problem, this commit adds a `parentPath` property to
files, corresponding to the path of their parent folder. This attribute
allows the path comparison to correctly identify files located in the
same parent folder, even if their names vary.

So, after moving files, we can query the contents of the destination
folder. Files that have been moved are automatically removed from the
query in the source folder, ensuring consistency in the interface and
the data displayed.
This change allow to manage logic around moves from Cozy, Nextcloud
and between them.

BREAKING CHANGE : You should pass object directly not only props

Before: `move(client, "fileId1234", { folderId: "folderId1234" }, true)`

After:
```
move(
  client,
  { _id: "fileId1234", _type: "io.cozy.files" },
  { _id: "folderId1234", _type: "io.cozy.files", type: "directory" },
  { force: true }
)
```
Added `createArchiveLinkByIds` method
and depreciated `getArchiveLinkByIds` method.

The name is more accurate and it allows us to refine
the selection by giving the pages we want for each file.
cballevre and others added 8 commits July 8, 2024 08:47
The partialFilter values are static. As this does not change, we
decided to integrate them into the index naming. Before this change,
the index was not recalculated when a value changed. So the query
always returned the same result.
When CouchDB creates an index with a partialFilter, it adds explicit
operators when they are implicit, typically the $and and $eq operators.
This causes a mismatch when comparing the partialFilter from the
request definition with the partialFilter from the index. To address
this, we added a step to make the operators in the partialFilter from
the request definition explicit.

This makes it possible to migrate indexes after they have been
renamed rather than re-creating them, which has a non-negligible cost.
When calling `yarn types` all cozy-client's types are generated inside
of the `cozy-client/types` folder

However, there is no mechanism to remove types when their corresponding
class is deleted

To fix this, we want to clean the types folder before regenerating
types so we ensure no fantom type would persist
Copy link
Contributor

@paultranvan paultranvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Ldoppea Ldoppea force-pushed the feat/enable_type_generation_pouch branch from a8ce717 to 0c3b7f3 Compare July 17, 2024 06:55
We will start to use PouchLink in cozy-flagship-app (that uses
typescript) and so we want to enable typing for this project

This commit adds types generation using TSC and fixes all TSC errors
With current implementation the documentation would be generated using
`jsdoc2md`

This package generates doc for both public and private classes

Also it does not handle correctly typescript notations (i.e. imports)

Like for `cozy-client` we now want to generate `cozy-pouch-link`
documentation using Typedoc
When calling `yarn docs` all API documentation is generated inside of
the `docs/api` folder

However, there is no mechanism to remove documentations when their
corresponding code is deleted

To fix this, we want to clean the `docs/api` folder before regenerating
documentation so we ensure no fantom doc would persist
@Ldoppea Ldoppea force-pushed the feat/enable_type_generation_pouch branch from 3642a16 to f5d019b Compare July 17, 2024 07:22
@Ldoppea Ldoppea changed the base branch from master to feat/meta_offline July 26, 2024 14:26
@Ldoppea Ldoppea merged commit 16237f8 into feat/meta_offline Jul 26, 2024
4 checks passed
@Ldoppea Ldoppea deleted the feat/enable_type_generation_pouch branch July 26, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants