@remit/web-client 0.0.284 → 0.0.286
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/mail/RoleAppointmentPromptProvider.render.test.ts +3 -1
- package/src/hooks/escalated-run-refusal.render.test.ts +4 -1
- package/src/hooks/useRulePreview.ts +1 -0
- package/src/lib/organize/rule-model.test.ts +30 -0
- package/src/lib/organize/rule-model.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/web-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.286",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
|
|
6
6
|
"exports": {
|
|
@@ -214,7 +214,9 @@ describe("the appointment ceremony", () => {
|
|
|
214
214
|
message: "not settled",
|
|
215
215
|
details: { mailboxId: "mbx-trash", syncStatus: "pending" },
|
|
216
216
|
}),
|
|
217
|
-
|
|
217
|
+
// 422: the folder being appointed has not settled, which is a
|
|
218
|
+
// different answer from a 409's "somebody else is changing it".
|
|
219
|
+
{ status: 422, headers: { "content-type": "application/json" } },
|
|
218
220
|
);
|
|
219
221
|
});
|
|
220
222
|
|
|
@@ -165,11 +165,14 @@ describe("a bulk delete refused for its folder role", () => {
|
|
|
165
165
|
await mount((path) => {
|
|
166
166
|
if (path.endsWith("/config")) return CONFIG;
|
|
167
167
|
if (path.endsWith("/messages/delete"))
|
|
168
|
+
// A conflict with no code this prompt knows: the status class's own,
|
|
169
|
+
// which is what every refusal that names nothing more specific
|
|
170
|
+
// answers with.
|
|
168
171
|
return new Response(
|
|
169
172
|
JSON.stringify({
|
|
170
173
|
status: 409,
|
|
171
174
|
message: "boom",
|
|
172
|
-
code: "
|
|
175
|
+
code: "conflict",
|
|
173
176
|
}),
|
|
174
177
|
{ status: 409, headers: { "content-type": "application/json" } },
|
|
175
178
|
);
|
|
@@ -276,6 +276,36 @@ describe("derivePreview", () => {
|
|
|
276
276
|
);
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
+
it("carries the empty-index answer through, so a zero can say why (#452)", () => {
|
|
280
|
+
assert.deepEqual(
|
|
281
|
+
derivePreview(
|
|
282
|
+
{ count: 0, indexEmpty: true, previewedSignature: signature },
|
|
283
|
+
signature,
|
|
284
|
+
),
|
|
285
|
+
{ status: "ready", count: 0, indexEmpty: true },
|
|
286
|
+
);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it("keeps the empty-index answer on a stale count", () => {
|
|
290
|
+
assert.deepEqual(
|
|
291
|
+
derivePreview(
|
|
292
|
+
{ count: 0, indexEmpty: true, previewedSignature: "sig-old" },
|
|
293
|
+
signature,
|
|
294
|
+
),
|
|
295
|
+
{ status: "ready", count: 0, stale: true, indexEmpty: true },
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it("leaves the flag off when the index answered", () => {
|
|
300
|
+
assert.deepEqual(
|
|
301
|
+
derivePreview(
|
|
302
|
+
{ count: 0, indexEmpty: false, previewedSignature: signature },
|
|
303
|
+
signature,
|
|
304
|
+
),
|
|
305
|
+
{ status: "ready", count: 0 },
|
|
306
|
+
);
|
|
307
|
+
});
|
|
308
|
+
|
|
279
309
|
it("surfaces an error raised for the current predicate", () => {
|
|
280
310
|
assert.deepEqual(
|
|
281
311
|
derivePreview(
|
|
@@ -253,6 +253,8 @@ export interface PreviewState {
|
|
|
253
253
|
count?: number;
|
|
254
254
|
/** The ids that count was counted over, as the server bounded them. */
|
|
255
255
|
matchedIds?: readonly string[];
|
|
256
|
+
/** The server said the semantic index had nothing to answer with (#452). */
|
|
257
|
+
indexEmpty?: boolean;
|
|
256
258
|
/** The signature the {@link count} was counted for. */
|
|
257
259
|
previewedSignature?: string;
|
|
258
260
|
/** The signature the last error was raised for. */
|
|
@@ -274,10 +276,11 @@ export const derivePreview = (
|
|
|
274
276
|
return { status: "error", reason: state.error };
|
|
275
277
|
}
|
|
276
278
|
if (state.count === undefined) return { status: "loading" };
|
|
279
|
+
const indexEmpty = state.indexEmpty === true ? { indexEmpty: true } : {};
|
|
277
280
|
if (state.previewedSignature === currentSignature) {
|
|
278
|
-
return { status: "ready", count: state.count };
|
|
281
|
+
return { status: "ready", count: state.count, ...indexEmpty };
|
|
279
282
|
}
|
|
280
|
-
return { status: "ready", count: state.count, stale: true };
|
|
283
|
+
return { status: "ready", count: state.count, stale: true, ...indexEmpty };
|
|
281
284
|
};
|
|
282
285
|
|
|
283
286
|
/** How long a rule change settles before the next preview fires. */
|