-
Notifications
You must be signed in to change notification settings - Fork 15
Initial support for email query and get actions #5
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks good to me, I don't know yet when it will merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this very nice contribution! Those remarks are not related to this (nice!) PR but more to this repository code base in general.
Simple question but it would be really nice to use back-reference to chain JMAP calls and reduce server roundtrips.
(For someone like me based in Vietnam this is actually critical!)
You could:
- start with a mailbox query to retrieve the guy INBOX
- Then back-reference the INBOX in the email/query
- And finally back-reference the ids in the Email/get
Doing all of that with a single network roundtrip, with a single API call.
Is there planned support for back-references in jmap-client-ts?
I would advise the maintainer to implement it early, in order to avoid generating technical debt.
(No tests?)
I would suggest using linagora/james-memory docker image in order to start a JMAP server against which to test the client... :-)
Edit: I opened dedicated issues ;-)
| .c9/ | ||
| *.launch | ||
| .settings/ | ||
| *.sublime-workspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a local, global ~/.gitignore for your own tool related stuff, a good practice is to put only build related ignores in a given project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can remove those.
Just as a separate question:
Wouldn't that make life easier for other developers who would join development contributions in the future? So that they would not need to discover, that "Ah, my IDE sees some workspace related files, that I don't want to accidentally add to commit"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't mind if there are some lines in the .gitignore since there is a comment to explain what they are related to.
| list: IMailbox[]; | ||
| notFound: string; | ||
| }> { | ||
| ): Promise<IMailboxGetResponse> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for this strong typing! <3
* Also added type for Email keywords
src/types.ts
Outdated
| createdModSeq: number; | ||
| updatedModSeq: number; | ||
| deleted: Date | null; | ||
| receivedAt: Date; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this and other Date fields should even be present as Date fields. You can't pass Date via JSON, it will be number or string, which end user will then need to convert. They look nice in type, but I feel like this is the wrong type for it. Library is intended to work with raw data. And raw data type for Date is string/number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (here in the specs https://jmap.io/spec-core.html#the-date-and-utcdate-data-types)
We could use string or custom types
export type IDate = string;
export type IUtcDate = string;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this ^ would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JMAP mandat String ( date-time format [@!RFC3339]): https://jmap.io/spec-core.html#the-date-and-utcdate-data-types
* Added type for boolean true value * Added UtcDate meta type as string * Removed date and deleted properties, since was unable to locate them in specs
|
|
| $forwarded?: ITrue; | ||
| $phishing?: ITrue; | ||
| $junk?: ITrue; | ||
| $notjunk?: ITrue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fluent in JavaScript but I got the feeling we only offer a close set of Keyworks.
JMAP allows passing arbitrary keywords. Set<String> is likely a better data structure to represent it (convenience methods can be exposed)
At least it can come in follow up refactorings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those keywords are related only to Email entity https://jmap.io/spec-mail.html#metadata as far as I can tell.
However:
Users may add arbitrary keywords to an Email. For compatibility with IMAP, a keyword is a case-insensitive string of 1–255 characters in the ASCII subset %x21–%x7e (excludes control chars and space), and it MUST NOT include any of these characters
I would assume, that it could be added in future changes. Why I am offering it at the moment? Due to it still being in early stages it is easier to limit our logic to use of interfaces, enums and types. If we start to introduce classes it might become a bit more complex.
Due to JSON structure being returned the way it is (regarding keywords), we can't set it as Set without some conversion logic.
| attachments: Attachment[] | null; | ||
| createdModSeq: number; | ||
| updatedModSeq: number; | ||
| deleted: Date | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these createdModSeq updatedModSeq properties?
Looking at it in the spec I have 0 matches...
Is it necessary?
(I agree, this is not related to your work)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering the same, but decided to lessen the overhead of changes. I was unable to locate those as well. However, they are present here https://jmap.io/server.html#3-mailboxes and as far as I understand, it is (draft aka not based on confirmed standard). Maybe @alagane can add some more detail in regards to it?
At the moment when I make Postman requests towards James I don't have this property in response. This is why I removed it at the moment. Also as a separate question. If I plan to add more changes, can I base them on this PR? Don't really want to introduce anymore changes here if they are not related to original changes, that I made. |
|
I merged it, you can also create issues if needed, for example for things that are unrelated to the merge request but need to be done later. |
No description provided.