Commit Graph

21 Commits

Author SHA1 Message Date
Pascal Bleser
74e48caa5c groupware: fully implement suppliers for addressbooks and contacts
* implement supplier templating to allow addressbooks and contacts to
   come from various sources ("suppliers", thus) as opposed to solely
   from JMAP

 * add creating, deleting, updating, getting changes

 * add some search filter parameters, currently incomplete
2026-07-09 14:30:14 +02:00
Pascal Bleser
5ee5dddf5e groupware: add suppliers support for object changes 2026-07-09 14:30:14 +02:00
Pascal Bleser
487004706b groupware: fix NPE when flattening durations in slist() 2026-07-09 14:30:14 +02:00
Pascal Bleser
6cbd695d7f groupware: add tracking of backend call durations
* add new configuration setting GROUPWARE_SEND_DURATIONS_RESPONSE
   (defaults to false)

 * keep track of lists of durations of backend calls

 * when enabled, report them as response headers Durations (human
   readable) and Durations-Nanos (as raw nanosecond values for machine
   consumption)
2026-07-09 14:30:13 +02:00
Pascal Bleser
c807c64d1c groupware: add strongly typed aliases for AccountId, PrincipalId and SupplierId
Purpose is to make APIs and parameters easier to understand, since plain
strings are used all over the place for all sorts of identifiers.
2026-07-09 14:30:13 +02:00
Pascal Bleser
b26c6cadce groupware: refactoring for pagination and support for multiple query suppliers
* refactor APIs in JMAP and Groupware in order to implement pagination
   across multiple accountIds and multiple suppliers (currently
   implemented using a mock supplier for contacts)

 * requires go 1.26 due to use of self-reflecting generics type
   constraints

 * still missing: query criteria and sorting parameters

 * still missing: multi-accountId support for emails

 * errors are now all just 'error' in the APIs, instead of the
   specialized implementations, and are interpreted dynamically where
   necessary in order to transform them into HTTP responses

 * remove position, anchor, anchorOffset as individual query parameters
   as we now only support a 'next=...' token for subsequent pages
   (except in emails for now), and use jmap.QueryParams instead; those
   tokens have a header character for the format, followed by a JSON
   encoded QueryParams map, all wrapped into base62 to make it clearer
   that it is meant to be an opaque token, and not a parameter clients
   should tinker with or construct themselves

 * introduce QueryParamsSupplier as an interface to provide QueryParams
   for various scenarios (single supplier, multiple supplier, ...) per
   accountId

 * implement multi-supplier template methods slist and squery
2026-07-09 14:30:13 +02:00
Pascal Bleser
a2ef9349b8 groupware: fix use of ?limit=0
* JMAP query limit of 0 is synonymous with "no limit", but we actually
   want to be able to perform queries without any results, for cases
   where we only want to count the total number of objects, and also
   because it makes more sense semantically

 * introduce query parameter validation checks, in order to only allow
   query parameters that are actually supported, which is going to be
   useful during development of clients
2026-07-09 14:30:13 +02:00
Pascal Bleser
ee8622dbe7 structs: add tests and documentation 2026-07-09 14:30:13 +02:00
Pascal Bleser
e887259b43 groupware: significant refactorings of the JMAP framework, adding methods and more intelligence to the various request and response types to improve the use of template functions, reducing the risks of typos and copy/paste mistakes 2026-07-09 14:15:53 +02:00
Pascal Bleser
f0ff78ac49 groupware: add retrieving and adding mailboxIds for drafts and sent if they are missing 2026-07-09 14:15:52 +02:00
Pascal Bleser
afab0c5c38 groupware: WS push improvements, add getting email changes to WS integration test 2026-07-09 14:15:51 +02:00
Pascal Bleser
e994a9315f groupware: finalize JMAP events integration test, with multiple changes to the model to conform with draft-ietf-calext-jscalendarbis-10 and fields that are currently not implemented in Stalwart 2026-07-09 14:15:51 +02:00
Pascal Bleser
6ca0003859 groupware: improve JMAP integration tests for ContactCards 2026-07-09 14:15:51 +02:00
Pascal Bleser
36b5fef005 groupware: add getting a contact by ID + add integration tests for contacts 2026-07-09 14:15:51 +02:00
Pascal Bleser
515d7974ac groupware: implement/fix email submission 2026-07-09 14:15:51 +02:00
Pascal Bleser
d23b5313f6 groupware: add identity deletion 2026-07-09 14:15:51 +02:00
Pascal Bleser
2869fe87cf groupware:
* made several email related operations multi-account:
   QueryEmailSnippets, QueryEmails, QueryEmailsWithSnippets

 * add GetIdentitiesForAllAccounts

 * add GetEmailsForAllAccounts

 * jmap: add CreateIdentity, UpdateIdentity; groupware: add
   GetIdentityById, AddIdentity, ModifyIdentity

 * add temporary workaround until Calendars, Tasks, Contacts are
   implemented in Stalwart when determining the default account for
   those: use the mail one in the mean time
2026-07-09 14:15:51 +02:00
Pascal Bleser
f103bff7ed groupware: improve jmap integration tests
* use gofakeit instead of loremipsum, as it can also fake images for
   attachments

 * random emails for testing: generate threads, add attachments
2026-07-09 14:15:50 +02:00
Pascal Bleser
c4001026e6 groupware: add /bootstrap
* add a GET /accounts/{a}/boostrap URI that delivers the same as GET /
   but also mailboxes for a given account, in case the UI remembers the
   last used account identifier, to avoid an additional roundtrip

 * streamline the use of simpleError()

 * add logging of errors at the calling site

 * add logging of evictions of Sessions from the cache

 * change default Session cache TTL to 5min instead of 30sec
2026-07-09 14:15:49 +02:00
Pascal Bleser
35fd72eda6 Groupware improvements
* ensure that all the jmap responses contain the SessionState

 * implement missing errors that were marked as TODO

 * moved common functions from pkg/jmap and pkg/services/groupware to
   pkg/log and pkg/structs to commonalize them across both source trees

 * implement error handling for SetError occurences

 * Email: replace anonymous map[string]bool for mailbox rights with a
   MailboxRights struct, as the keys are well-defined, which allows for
   properly documenting them

 * introduce ObjectType as an "enum"

 * fix JSON marshalling and unmarshalling of EmailBodyStructure

 * move the swagger documentation structs from groupware_api.go to
   groupware_docs.go

 * fix: change verb for /groupware/accounts/*/vacation from POST to PUT
2026-07-09 14:15:49 +02:00
Jörn Friedrich Dreyer
b07b5a1149 use plain pkg module
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:42:19 +01:00