mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 16:14:07 +00:00
An edit that removed an entry was dropped at flush, because a server value with more keys counted as already applied. Other fixes in the same path: - the local copy after a flush is the server's read-back, never what was sent, since Stalwart 1.0 stores a data: URI as a blob - a delete or a newer edit after a lost response no longer reads as a change on the server, and an edit made during a refused send stays - a create only becomes a card with its uid if that card holds what was sent, otherwise it is a refused conflict - a refused or failed flush no longer stops contacts syncing - request limits come from the session - answers wait for the first full pass - paging goes by anchor, so a deleted card doesn't make the next one get skipped and swept contacts.test.ts: "continues a stopped full sync" now checks the anchor instead of position 2000, because the cursor no longer pages by position.
32 lines
1005 B
TypeScript
32 lines
1005 B
TypeScript
/** What one request may hold: the session's limits, never past the ones the engine was built for. */
|
|
|
|
import type { StoreSession } from './transport';
|
|
|
|
export interface RequestLimits {
|
|
maxObjectsInGet: number;
|
|
maxObjectsInSet: number;
|
|
maxCallsInRequest: number;
|
|
maxSizeRequest: number;
|
|
}
|
|
|
|
const DEFAULTS: RequestLimits = {
|
|
maxObjectsInGet: 500,
|
|
maxObjectsInSet: 500,
|
|
maxCallsInRequest: 16,
|
|
maxSizeRequest: 10 * 1024 * 1024,
|
|
};
|
|
|
|
export function requestLimits(session: StoreSession): RequestLimits {
|
|
const core = (session.capabilities['urn:ietf:params:jmap:core'] ?? {}) as Partial<RequestLimits>;
|
|
const limit = (key: keyof RequestLimits) => {
|
|
const value = core[key];
|
|
return typeof value === 'number' && value > 0 ? Math.min(value, DEFAULTS[key]) : DEFAULTS[key];
|
|
};
|
|
return {
|
|
maxObjectsInGet: limit('maxObjectsInGet'),
|
|
maxObjectsInSet: limit('maxObjectsInSet'),
|
|
maxCallsInRequest: limit('maxCallsInRequest'),
|
|
maxSizeRequest: limit('maxSizeRequest'),
|
|
};
|
|
}
|