@multiplatform.one/backoffice 7.50.0 → 7.50.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/backoffice",
3
- "version": "7.50.0",
3
+ "version": "7.50.2",
4
4
  "description": "Embeddable Frappe desk recreation (backoffice) for the multiplatform.one stack",
5
5
  "keywords": [
6
6
  "backoffice",
@@ -71,21 +71,21 @@
71
71
  "access": "public"
72
72
  },
73
73
  "dependencies": {
74
- "@multiplatform.one/components": "^7.50.0",
75
- "@multiplatform.one/forms": "^7.50.0",
76
- "@multiplatform.one/frappe": "^7.50.0",
77
- "@multiplatform.one/frappe-ui": "^7.50.0",
78
- "@multiplatform.one/i18n": "^7.50.0",
79
- "@multiplatform.one/platform": "^7.50.0",
80
- "@multiplatform.one/store": "^7.50.0",
81
- "@multiplatform.one/table": "^7.50.0",
82
- "@multiplatform.one/theme": "^7.50.0",
74
+ "@multiplatform.one/components": "^7.50.2",
75
+ "@multiplatform.one/forms": "^7.50.2",
76
+ "@multiplatform.one/frappe": "^7.50.2",
77
+ "@multiplatform.one/frappe-ui": "^7.50.2",
78
+ "@multiplatform.one/i18n": "^7.50.2",
79
+ "@multiplatform.one/platform": "^7.50.2",
80
+ "@multiplatform.one/store": "^7.50.2",
81
+ "@multiplatform.one/table": "^7.50.2",
82
+ "@multiplatform.one/theme": "^7.50.2",
83
83
  "@phosphor-icons/react": "^2.1.10",
84
84
  "tamagui": "2.7.6"
85
85
  },
86
86
  "devDependencies": {
87
- "@multiplatform.one/config": "7.50.0",
88
- "@multiplatform.one/test-utils": "7.50.0",
87
+ "@multiplatform.one/config": "7.50.2",
88
+ "@multiplatform.one/test-utils": "7.50.2",
89
89
  "@tamagui/build": "2.7.6",
90
90
  "@testing-library/react": "^16.3.3",
91
91
  "@types/react-dom": "^19.2.3",
@@ -49,8 +49,10 @@ beforeEach(() => {
49
49
  return json({ message: ["Pokemon Reader"] });
50
50
  }
51
51
  if (method === "frappe.desk.form.load.getdoctype") return json({ docs: [meta] });
52
- if (method === "frappe.client.get_count") return json({ message: 21 });
53
52
  if (url.pathname === `/api/resource/${doctype}`) {
53
+ if (url.searchParams.get("fields")?.includes("_aggregate_value")) {
54
+ return json({ data: [{ _aggregate_value: 21 }] });
55
+ }
54
56
  return json({ data: [{ name: "bulbasaur", doctype, pokemon_name: "Bulbasaur" }] });
55
57
  }
56
58
  return json({ data: [], message: [] });
@@ -77,7 +79,7 @@ describe("DoctypeListScreen auth", () => {
77
79
  );
78
80
 
79
81
  await waitFor(() => expect(screen.getByText("21 results")).toBeTruthy(), { timeout: 5000 });
80
- const counts = calls.filter((call) => call.path.includes("frappe.client.get_count"));
82
+ const counts = calls.filter((call) => call.path.includes("_aggregate_value"));
81
83
  expect(counts.length).toBeGreaterThan(0);
82
84
  expect(calls.filter((call) => call.authorization !== bearer)).toEqual([]);
83
85
  });
@@ -1,10 +1,11 @@
1
1
  import { StrictMode } from "react";
2
2
  // LC-96 on the desk list (MPO-477), the list twin of MPO-473. Signed out,
3
3
  // pokemon's bench refuses getdoctype, get_count and every desk RPC to Guest
4
- // while Guest can still read the rows through /api/resource, and the desk list
5
- // stopped at its own "Could not load Pokemon". The bench below answers the way
6
- // Frappe's is_whitelisted refuses Guest (one message, a <details> summary and
7
- // body) and answers or refuses the rows per test.
4
+ // while Guest can still read the rows, and their count, through /api/resource
5
+ // (FZ-7901), and the desk list stopped at its own "Could not load Pokemon".
6
+ // The bench below answers the way Frappe's is_whitelisted refuses Guest (one
7
+ // message, a <details> summary and body) and answers or refuses the rows per
8
+ // test.
8
9
  import { renderWithProviders } from "@multiplatform.one/test-utils";
9
10
  import { fireEvent, screen, waitFor } from "@testing-library/react";
10
11
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -116,16 +117,17 @@ beforeEach(() => {
116
117
  ? refused(method)
117
118
  : json({ exc_type: "ValidationError", exception: "Pokemon is being migrated" }, 417);
118
119
  }
119
- if (method === "frappe.client.get_count") {
120
- countReads += 1;
121
- await countGate;
122
- return refused(method);
123
- }
124
120
  if (url.pathname.startsWith("/api/method/")) return refused(method);
125
121
  if (url.pathname === `/api/resource/${doctype}`) {
122
+ const count = url.searchParams.get("fields")?.includes("_aggregate_value");
123
+ if (count) {
124
+ countReads += 1;
125
+ await countGate;
126
+ }
126
127
  if (!rowsReadable) {
127
128
  return json({ exc_type: "PermissionError", exception: "Not permitted" }, 403);
128
129
  }
130
+ if (count) return json({ data: [{ _aggregate_value: rows.length }] });
129
131
  const limit = Number(url.searchParams.get("limit_page_length") ?? rows.length);
130
132
  return json({ data: rows.slice(0, limit || rows.length) });
131
133
  }
@@ -198,6 +200,7 @@ describe("DoctypeListScreen with DocType meta refused (LC-96)", () => {
198
200
  await waitFor(() => expect(screen.getByText("Bulbasaur")).toBeTruthy(), settle);
199
201
  expect(screen.getByText("Ivysaur")).toBeTruthy();
200
202
  expect(screen.getByText("142")).toBeTruthy();
203
+ await waitFor(() => expect(screen.getByText("2 results")).toBeTruthy(), settle);
201
204
  expect(screen.queryByText(/Could not load/)).toBeNull();
202
205
  expect(screen.queryByText(/Error loading/)).toBeNull();
203
206
  expect(metaReads).toBe(1);
@@ -211,7 +214,6 @@ describe("DoctypeListScreen with DocType meta refused (LC-96)", () => {
211
214
  expect(button("Add to liked")).toBeUndefined();
212
215
  expect(screen.queryByLabelText("List filters sidebar")).toBeNull();
213
216
  expect(button("Sort")).toBeUndefined();
214
- expect(screen.queryByText(/\d+ results?$/)).toBeNull();
215
217
  fireEvent.click(screen.getByTestId("list-view-switcher"));
216
218
  await waitFor(() => expect(screen.getByRole("menu")).toBeTruthy(), settle);
217
219
  const views = Array.from(document.querySelectorAll('[role="menuitemcheckbox"]')).map((node) =>