@declarion/react 0.31.2 → 0.34.0

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.
Files changed (55) hide show
  1. package/dist-lib/{ActionRunner-BzaZQtiI.js → ActionRunner-UGGvGypS.js} +925 -788
  2. package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CljdYXd_.js} +30 -30
  3. package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
  4. package/dist-lib/{Grid-BIsiUwPh.js → Grid-5Y_iPqNW.js} +2 -2
  5. package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CoTMmvNW.js} +670 -670
  6. package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-unbncYEV.js} +1 -1
  7. package/dist-lib/RefreshControl-oeKhCjEC.js +837 -0
  8. package/dist-lib/SmartDetailPage.impl-Caxd97q6.js +1771 -0
  9. package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BF_ieDc2.js} +253 -253
  10. package/dist-lib/api/data.d.ts +4 -4
  11. package/dist-lib/api/params.d.ts +1 -1
  12. package/dist-lib/components/layout/Rail.d.ts +5 -5
  13. package/dist-lib/components/layout/TopBar.d.ts +3 -1
  14. package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
  15. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
  16. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  17. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
  18. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
  19. package/dist-lib/components/primitives/Icons.d.ts +1 -0
  20. package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
  21. package/dist-lib/components/primitives/index.d.ts +2 -0
  22. package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
  23. package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
  24. package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
  25. package/dist-lib/components/shared/PageHeader.d.ts +1 -1
  26. package/dist-lib/components/shared/RecordHeader.d.ts +3 -1
  27. package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
  28. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
  29. package/dist-lib/hooks/useBranding.d.ts +8 -0
  30. package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
  31. package/dist-lib/hooks/useLiveObject.d.ts +9 -0
  32. package/dist-lib/hooks/useMutations.d.ts +3 -3
  33. package/dist-lib/hooks/useObject.d.ts +10 -0
  34. package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
  35. package/dist-lib/hooks/useParams.d.ts +10 -1
  36. package/dist-lib/icons.js +1 -1
  37. package/dist-lib/index.d.ts +11 -5
  38. package/dist-lib/index.js +2457 -2335
  39. package/dist-lib/lib/actions.d.ts +6 -2
  40. package/dist-lib/lib/branding.d.ts +10 -1
  41. package/dist-lib/lib/document-templates.d.ts +12 -0
  42. package/dist-lib/lib/download.d.ts +20 -0
  43. package/dist-lib/lib/record-documents-key.d.ts +1 -0
  44. package/dist-lib/{registry-2KliNTHB.js → registry-DnPK3Msj.js} +1658 -1607
  45. package/dist-lib/testing.d.ts +5 -3
  46. package/dist-lib/testing.js +37 -33
  47. package/dist-lib/types/api.d.ts +62 -3
  48. package/dist-lib/types/schema.d.ts +18 -16
  49. package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-CgRhBh0k.js} +70 -70
  50. package/dist-lib/{value-BooGwUik.js → value-GmL5BVFm.js} +29 -29
  51. package/package.json +1 -1
  52. package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
  53. package/dist-lib/SmartDetailPage.impl--EO-9fos.js +0 -1494
  54. package/dist-lib/hooks/useEntityItem.d.ts +0 -10
  55. package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
@@ -4,7 +4,7 @@ import { QueryClient } from "@tanstack/react-query";
4
4
  import { type ResponsiveViewport } from "./hooks/useResponsiveMode";
5
5
  import { type ActionExecuteRequest, type ActionExecuteResponse } from "./api/data";
6
6
  import type { Schema } from "./types/schema";
7
- import type { ListMeta, ListResponse, Refs } from "./types/api";
7
+ import type { DataResponse, ListMeta, ListResponse, Refs } from "./types/api";
8
8
  /** A single action's stubbed outcome: the action's RESULT payload (what
9
9
  * executeDeclarionAction unwraps from response.result), or a function of the
10
10
  * dispatched body returning it. The harness always wraps it in a success
@@ -25,8 +25,10 @@ export interface RenderWithDeclarionOptions {
25
25
  schema?: Schema;
26
26
  /** entity -> rows, { rows, meta }, or an entityDataFixture() ListResponse; resolves useEntityData / useEntityCount. */
27
27
  entityData?: Record<string, Record<string, unknown>[] | EntityDataFixture | ListResponse>;
28
- /** entity -> { [id]: row }; resolves useEntityItem. */
29
- entityItems?: Record<string, Record<string, Record<string, unknown>>>;
28
+ /** entity -> { [id]: row | Error }; resolves useObject. Error entries let tests model 404/403 without network. */
29
+ entityItems?: Record<string, Record<string, Record<string, unknown> | Error>>;
30
+ /** entity -> { [id]: DataResponse | Error }; resolves useObject when a test needs envelope metadata like `$refs`. */
31
+ entityItemResponses?: Record<string, Record<string, DataResponse | Error>>;
30
32
  /** action code -> result | (body) => result; resolves executeAction (and create/update/delete/restore). */
31
33
  actionResults?: Record<string, ActionResult>;
32
34
  /** Initial path for the memory router (e.g. "/replay/abc/compare"). Default "/". */
@@ -1,4 +1,4 @@
1
- import { H as e, Nn as t, X as n, Y as r, Z as i, mt as a, t as o } from "./ActionRunner-BzaZQtiI.js";
1
+ import { In as e, _t as t, at as n, ft as r, mt as i, pt as a, t as o } from "./ActionRunner-UGGvGypS.js";
2
2
  import { useState as s } from "react";
3
3
  import { MemoryRouter as c } from "react-router-dom";
4
4
  import { QueryClient as l, QueryClientProvider as u } from "@tanstack/react-query";
@@ -59,7 +59,7 @@ function x() {
59
59
  code: "test",
60
60
  name: "Test",
61
61
  role: "admin"
62
- }, t = {
62
+ }, n = {
63
63
  id: "test-user",
64
64
  email: "test@example.com",
65
65
  display_name: "Test User",
@@ -70,7 +70,7 @@ function x() {
70
70
  created_at: "2026-01-01T00:00:00Z",
71
71
  updated_at: "2026-01-01T00:00:00Z"
72
72
  };
73
- a.getState().setUser(t, e);
73
+ t.getState().setUser(n, e);
74
74
  }
75
75
  function S(e) {
76
76
  if (e === void 0) return { rows: [] };
@@ -85,50 +85,54 @@ function S(e) {
85
85
  }
86
86
  return e;
87
87
  }
88
- function C(t) {
89
- let a = t.entityData ?? {};
90
- i((e, t) => {
91
- let n = a[e], r = S(n), i = r.meta?.per_page ?? 50, o = r.meta?.total ?? r.rows.length;
92
- return t.count === "only" ? {
88
+ function C(e) {
89
+ let t = e.entityData ?? {};
90
+ i((e, n) => {
91
+ let r = t[e], i = S(r), a = i.meta?.per_page ?? 50, o = i.meta?.total ?? i.rows.length;
92
+ return n.count === "only" ? {
93
93
  data: [],
94
94
  meta: {
95
95
  page: 1,
96
- per_page: i,
96
+ per_page: a,
97
97
  total: o,
98
- total_pages: r.meta?.total_pages ?? Math.max(1, Math.ceil(o / i)),
99
- count_mode: r.meta?.count_mode ?? "exact"
98
+ total_pages: i.meta?.total_pages ?? Math.max(1, Math.ceil(o / a)),
99
+ count_mode: i.meta?.count_mode ?? "exact"
100
100
  }
101
101
  } : {
102
- data: r.rows,
102
+ data: i.rows,
103
103
  meta: {
104
- page: r.meta?.page ?? 1,
105
- per_page: i,
106
- has_more: r.meta?.has_more ?? !1
104
+ page: i.meta?.page ?? 1,
105
+ per_page: a,
106
+ has_more: i.meta?.has_more ?? !1
107
107
  },
108
- ...r.refs === void 0 ? {} : { $refs: r.refs }
108
+ ...i.refs === void 0 ? {} : { $refs: i.refs }
109
109
  };
110
110
  });
111
- let o = t.entityItems ?? {};
112
- n((t, n) => {
113
- let r = typeof n == "string" ? n : e(n);
114
- return { data: o[t]?.[r] };
111
+ let o = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
112
+ a((e, t) => {
113
+ let r = typeof t == "string" ? t : n(t), i = s[e]?.[r];
114
+ if (i instanceof Error) throw i;
115
+ if (i !== void 0) return i;
116
+ let a = o[e]?.[r];
117
+ if (a instanceof Error) throw a;
118
+ return { data: a };
115
119
  });
116
- let s = t.actionResults ?? {};
120
+ let c = e.actionResults ?? {};
117
121
  r(async (e, t) => {
118
- if (!(e in s)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
119
- let n = s[e];
122
+ if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
123
+ let n = c[e];
120
124
  return b(typeof n == "function" ? await n(t) : n);
121
125
  });
122
126
  }
123
127
  function w() {
124
- i(null), n(null), r(null), a.setState({
128
+ i(null), a(null), r(null), t.setState({
125
129
  user: null,
126
130
  isAuthenticated: !1,
127
131
  activeTenant: null,
128
132
  tenants: []
129
133
  });
130
134
  }
131
- function T(e, n = {}) {
135
+ function T(t, n = {}) {
132
136
  let r = new l({ defaultOptions: { queries: {
133
137
  retry: !1,
134
138
  gcTime: Infinity
@@ -138,31 +142,31 @@ function T(e, n = {}) {
138
142
  client: r,
139
143
  children: [/* @__PURE__ */ f(c, {
140
144
  initialEntries: [n.route ?? "/"],
141
- children: /* @__PURE__ */ f(o, { children: e })
145
+ children: /* @__PURE__ */ f(o, { children: t })
142
146
  }), /* @__PURE__ */ f(d, {})]
143
- }), a = m(n.viewport ? /* @__PURE__ */ f(t, {
147
+ }), a = m(n.viewport ? /* @__PURE__ */ f(e, {
144
148
  viewportOverride: n.viewport,
145
149
  children: i
146
150
  }) : i);
147
151
  return Object.assign(a, { queryClient: r });
148
152
  }
149
- function E({ children: e, authenticated: t = !0, ...n }) {
150
- let [r] = s(() => {
153
+ function E({ children: e, authenticated: n = !0, ...r }) {
154
+ let [i] = s(() => {
151
155
  let e = new l({ defaultOptions: { queries: {
152
156
  retry: !1,
153
157
  gcTime: Infinity
154
158
  } } });
155
- return t ? (x(), e.setQueryData(["schema", !0], n.schema ?? h())) : a.setState({
159
+ return n ? (x(), e.setQueryData(["schema", !0], r.schema ?? h())) : t.setState({
156
160
  user: null,
157
161
  isAuthenticated: !1,
158
162
  activeTenant: null,
159
163
  tenants: []
160
- }), C(n), e;
164
+ }), C(r), e;
161
165
  });
162
166
  return /* @__PURE__ */ p(u, {
163
- client: r,
167
+ client: i,
164
168
  children: [/* @__PURE__ */ f(c, {
165
- initialEntries: [n.route ?? "/"],
169
+ initialEntries: [r.route ?? "/"],
166
170
  children: /* @__PURE__ */ f(o, { children: e })
167
171
  }), /* @__PURE__ */ f(d, {})]
168
172
  });
@@ -30,6 +30,7 @@ export interface ListResponse<T = Record<string, unknown>> {
30
30
  }
31
31
  export interface DataResponse<T = Record<string, unknown>> {
32
32
  data: T;
33
+ $refs?: Refs;
33
34
  }
34
35
  export interface ApiErrorBody {
35
36
  error: {
@@ -148,6 +149,7 @@ export interface PublicParam {
148
149
  code: string;
149
150
  name: LocalizedString;
150
151
  type: string;
152
+ structure?: string;
151
153
  category: string;
152
154
  description?: LocalizedString;
153
155
  value: unknown;
@@ -159,8 +161,7 @@ export interface PublicLegalLinks {
159
161
  terms_url?: string;
160
162
  docs_url?: string;
161
163
  }
162
- /** Subset of branding exposed pre-login by /api/params/public. */
163
- export interface PublicBranding {
164
+ export interface BrandingIdentity {
164
165
  app_name?: string;
165
166
  app_logo?: string;
166
167
  app_initial?: string;
@@ -176,6 +177,65 @@ export interface PublicBranding {
176
177
  workspace_domain?: string;
177
178
  legal_links?: PublicLegalLinks;
178
179
  }
180
+ export interface BrandingThemeColors {
181
+ accent?: string;
182
+ accent_hover?: string;
183
+ accent_soft?: string;
184
+ primary?: string;
185
+ primary_hover?: string;
186
+ sidebar?: string;
187
+ rail?: string;
188
+ surface?: string;
189
+ surface_2?: string;
190
+ background?: string;
191
+ text?: string;
192
+ text_muted?: string;
193
+ border?: string;
194
+ }
195
+ export interface BrandingTheme {
196
+ css_url?: string;
197
+ font_sans?: string;
198
+ font_mono?: string;
199
+ radius?: string;
200
+ density?: string;
201
+ colors?: BrandingThemeColors;
202
+ }
203
+ export interface BrandingSurfaceFlags {
204
+ show_title?: boolean;
205
+ show_breadcrumbs?: boolean;
206
+ show_actions?: boolean;
207
+ show_count?: boolean;
208
+ show_sidebar?: boolean;
209
+ show_topbar?: boolean;
210
+ show_rail?: boolean;
211
+ show_tabs?: boolean;
212
+ show_tenant_switcher?: boolean;
213
+ }
214
+ export interface BrandingChrome {
215
+ full?: {
216
+ shell?: BrandingSurfaceFlags;
217
+ surfaces?: {
218
+ list?: BrandingSurfaceFlags;
219
+ detail?: BrandingSurfaceFlags;
220
+ record_list?: BrandingSurfaceFlags;
221
+ custom?: BrandingSurfaceFlags;
222
+ };
223
+ };
224
+ embed?: {
225
+ surfaces?: {
226
+ list?: BrandingSurfaceFlags;
227
+ detail?: BrandingSurfaceFlags;
228
+ record_list?: BrandingSurfaceFlags;
229
+ custom?: BrandingSurfaceFlags;
230
+ };
231
+ };
232
+ }
233
+ /** Structured value of the public `branding` parameter. */
234
+ export interface PublicBranding {
235
+ identity?: BrandingIdentity;
236
+ theme?: BrandingTheme;
237
+ chrome?: BrandingChrome;
238
+ }
179
239
  /**
180
240
  * Deploy-time identity exposed pre-login by /api/params/public so the
181
241
  * auth shell can render real region/build values (no mockup placeholders).
@@ -193,7 +253,6 @@ export interface PublicParamsResponse {
193
253
  parameters: PublicParam[];
194
254
  accents?: Record<string, AccentDef>;
195
255
  messages?: Record<string, LocalizedString>;
196
- branding?: PublicBranding;
197
256
  meta?: PublicMeta;
198
257
  }
199
258
  /**
@@ -29,7 +29,7 @@ export declare function getDisplayValue(row: Record<string, unknown> | null | un
29
29
  display_field?: string;
30
30
  };
31
31
  } | null | undefined): string | undefined;
32
- export declare function resolveRefRecordLabel(record: Record<string, unknown>, displayField: string | undefined, fallback: string): string;
32
+ export declare function resolveRefRecordLabel(record: Record<string, unknown>, displayKey: string | undefined, fallback: string): string;
33
33
  export declare function screenTitleForPath(pathname: string, screens: Record<string, Screen> | undefined, entities?: Record<string, Entity>): {
34
34
  title: string;
35
35
  icon?: string;
@@ -261,6 +261,7 @@ export interface ParameterDef {
261
261
  name: LocalizedString;
262
262
  description?: LocalizedString;
263
263
  type: string;
264
+ structure?: string;
264
265
  default?: unknown;
265
266
  is_public?: boolean;
266
267
  category?: string;
@@ -412,6 +413,22 @@ export interface Entity {
412
413
  * list UI on this. See docs/plans/2026-06-20-cross-store-list-cursor-pagination.md.
413
414
  */
414
415
  list_pagination?: "offset" | "cursor";
416
+ /**
417
+ * Static, per-caller document-generation capability computed from the
418
+ * SYSTEM document template registry at schema projection (registry-only,
419
+ * no DB read, no ETag impact - system templates are boot-static and are
420
+ * covered by the schema fingerprint). Absent (or both flags falsy) means
421
+ * no system template applies for this caller/tenant/entity - the
422
+ * frontend's Generate affordance renders nothing UNLESS a tenant-uploaded
423
+ * template is found via the lazy `document.templates.available` runtime
424
+ * probe (tenant templates are runtime data and are never baked into the
425
+ * schema). `generate_one` gates the detail-scope toolbar; `generate_many`
426
+ * gates the list-scope toolbar. See docs/document-generation.md.
427
+ */
428
+ documents?: {
429
+ generate_one?: boolean;
430
+ generate_many?: boolean;
431
+ };
415
432
  }
416
433
  export interface ExportConfig {
417
434
  enabled?: boolean;
@@ -925,20 +942,6 @@ export interface HandlerDef {
925
942
  params?: OrderedMap<HandlerParam>;
926
943
  success_event?: string;
927
944
  }
928
- export interface Branding {
929
- app_name?: string;
930
- app_logo?: string;
931
- app_initial?: string;
932
- accent_color?: string;
933
- ai_name?: string;
934
- wordmark?: string;
935
- version_label?: string;
936
- status_url?: string;
937
- auth_tagline?: LocalizedString;
938
- auth_subtagline?: LocalizedString;
939
- auth_badges?: LocalizedString[];
940
- css_url?: string;
941
- }
942
945
  export interface Schema {
943
946
  languages: LanguageDef[];
944
947
  structures: Record<string, StructureDef>;
@@ -950,7 +953,6 @@ export interface Schema {
950
953
  enums: Record<string, EnumDef>;
951
954
  parameters: Record<string, ParameterDef>;
952
955
  messages?: Record<string, LocalizedString>;
953
- branding?: Branding;
954
956
  areas?: AreaDef[];
955
957
  accents?: Record<string, AccentDef>;
956
958
  /**
@@ -1,5 +1,5 @@
1
- import { $ as e, Ot as t, U as n, Yt as r, gn as i, kt as a, lt as o, on as s } from "./ActionRunner-BzaZQtiI.js";
2
- import { ht as c } from "./registry-2KliNTHB.js";
1
+ import { Mt as e, Qt as t, V as n, Z as r, jt as i, ln as a, ot as o, yn as s } from "./ActionRunner-UGGvGypS.js";
2
+ import { vt as c } from "./registry-DnPK3Msj.js";
3
3
  import { useEffect as l, useMemo as u } from "react";
4
4
  import { useSearchParams as d } from "react-router-dom";
5
5
  import { useInfiniteQuery as f, useMutation as p, useQueryClient as m } from "@tanstack/react-query";
@@ -47,33 +47,33 @@ var b = class {
47
47
  this.entity = e, this.refs = t ?? new v();
48
48
  }
49
49
  async get(e) {
50
- let n = new URLSearchParams(typeof e == "string" ? { id: e } : e);
51
- return _((await t(`/api/data/${this.entity}?${n.toString()}`)).data);
50
+ let t = new URLSearchParams(typeof e == "string" ? { id: e } : e);
51
+ return _((await i(`/api/data/${this.entity}?${t.toString()}`)).data);
52
52
  }
53
53
  async list(e = {}) {
54
- let n, i = !1;
54
+ let n, r = !1;
55
55
  try {
56
- n = await t(y(this.entity, e));
56
+ n = await i(y(this.entity, e));
57
57
  } catch (a) {
58
- if (e.after && r(a)) {
59
- let { after: r, ...a } = e;
60
- n = await t(y(this.entity, a)), i = !0;
58
+ if (e.after && t(a)) {
59
+ let { after: t, ...a } = e;
60
+ n = await i(y(this.entity, a)), r = !0;
61
61
  } else throw a;
62
62
  }
63
63
  return this.refs.merge(n.$refs), {
64
64
  data: n.data.map((e) => _(e)),
65
65
  meta: n.meta,
66
66
  $refs: this.refs.all(),
67
- reset: i
67
+ reset: r
68
68
  };
69
69
  }
70
70
  async create(e) {
71
71
  return (await this.createMany([e]))[0];
72
72
  }
73
- async createMany(e) {
74
- if (e.length === 0) return [];
75
- let t = await a("system.batch", {
76
- actions: e.map((e) => ({
73
+ async createMany(t) {
74
+ if (t.length === 0) return [];
75
+ let n = await e("system.batch", {
76
+ actions: t.map((e) => ({
77
77
  action: `${this.entity}.__create`,
78
78
  params: {
79
79
  entity: this.entity,
@@ -82,7 +82,7 @@ var b = class {
82
82
  })),
83
83
  atomic: !0
84
84
  });
85
- return x(t, `${this.entity}.__create`), t.results.map((e) => _(S(e)));
85
+ return x(n, `${this.entity}.__create`), n.results.map((e) => _(S(e)));
86
86
  }
87
87
  async update(e, t) {
88
88
  return (await this.updateMany([{
@@ -90,10 +90,10 @@ var b = class {
90
90
  ...t
91
91
  }]))[0];
92
92
  }
93
- async updateMany(e) {
94
- if (e.length === 0) return [];
95
- let t = await a("system.batch", {
96
- actions: e.map(({ id: e, ...t }) => ({
93
+ async updateMany(t) {
94
+ if (t.length === 0) return [];
95
+ let n = await e("system.batch", {
96
+ actions: t.map(({ id: e, ...t }) => ({
97
97
  action: `${this.entity}.__update`,
98
98
  params: {
99
99
  object_ids: [e],
@@ -103,13 +103,13 @@ var b = class {
103
103
  })),
104
104
  atomic: !0
105
105
  });
106
- return x(t, `${this.entity}.__update`), t.results.map((e) => _(S(e)));
106
+ return x(n, `${this.entity}.__update`), n.results.map((e) => _(S(e)));
107
107
  }
108
108
  async delete(e) {
109
109
  await this.deleteMany([e]);
110
110
  }
111
111
  async deleteMany(e) {
112
- return e.length === 0 ? { count: 0 } : { count: (await n(`${this.entity}.__delete`, {
112
+ return e.length === 0 ? { count: 0 } : { count: (await o(`${this.entity}.__delete`, {
113
113
  object_ids: e,
114
114
  entity: this.entity
115
115
  })).object_count ?? e.length };
@@ -118,7 +118,7 @@ var b = class {
118
118
  await this.restoreMany([e]);
119
119
  }
120
120
  async restoreMany(e) {
121
- return e.length === 0 ? { count: 0 } : { count: (await n(`${this.entity}.__restore`, {
121
+ return e.length === 0 ? { count: 0 } : { count: (await o(`${this.entity}.__restore`, {
122
122
  object_ids: e,
123
123
  entity: this.entity
124
124
  })).object_count ?? e.length };
@@ -126,20 +126,20 @@ var b = class {
126
126
  async upsert(e, t) {
127
127
  return (await this.upsertMany([e], t))[0];
128
128
  }
129
- async upsertMany(e, t) {
130
- if (e.length === 0) return [];
131
- let n = await a("system.batch", {
132
- actions: e.map((e) => ({
129
+ async upsertMany(t, n) {
130
+ if (t.length === 0) return [];
131
+ let r = await e("system.batch", {
132
+ actions: t.map((e) => ({
133
133
  action: `${this.entity}.__upsert`,
134
134
  params: {
135
135
  entity: this.entity,
136
136
  fields: e,
137
- unique_by: t
137
+ unique_by: n
138
138
  }
139
139
  })),
140
140
  atomic: !0
141
141
  });
142
- return x(n, `${this.entity}.__upsert`), n.results.map((e) => _(C(e)));
142
+ return x(r, `${this.entity}.__upsert`), r.results.map((e) => _(C(e)));
143
143
  }
144
144
  };
145
145
  function x(e, t) {
@@ -233,7 +233,7 @@ function O(e, t, n) {
233
233
  //#endregion
234
234
  //#region src/hooks/useTabSearchMirror.ts
235
235
  function k(e) {
236
- let t = o(), [n] = d();
236
+ let t = r(), [n] = d();
237
237
  l(() => {
238
238
  if (!e || t.enabled) return;
239
239
  let r = c.getState(), i = r.findTabByPathname(e);
@@ -246,12 +246,12 @@ function k(e) {
246
246
  }
247
247
  //#endregion
248
248
  //#region src/hooks/useRegisterScreenTab.ts
249
- function A(e, t, n, r) {
250
- let i = o();
249
+ function A(e, t, n, i) {
250
+ let a = r();
251
251
  l(() => {
252
- !e || i.enabled || c.getState().openTab({
252
+ !e || a.enabled || c.getState().openTab({
253
253
  pathname: e,
254
- search: r,
254
+ search: i,
255
255
  title: t,
256
256
  icon: n,
257
257
  closable: !0
@@ -260,12 +260,12 @@ function A(e, t, n, r) {
260
260
  e,
261
261
  t,
262
262
  n,
263
- i.enabled
263
+ a.enabled
264
264
  ]);
265
265
  }
266
266
  function j(e, t, n) {
267
- let r = e?.route, i = t ? s(e?.display?.name) || s(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
268
- A(t ? r : void 0, i, a, n);
267
+ let r = e?.route, i = t ? a(e?.display?.name) || a(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
268
+ A(t ? r : void 0, i, o, n);
269
269
  }
270
270
  //#endregion
271
271
  //#region src/lib/filters.ts
@@ -332,14 +332,14 @@ function z(e, t) {
332
332
  if (!e.field || !e.op) return "";
333
333
  let n = N[e.op] || e.op;
334
334
  if (M.has(e.op)) return `${n}`;
335
- let r = e.field, a = (e) => {
335
+ let r = e.field, i = (e) => {
336
336
  if (t) {
337
337
  let n = t(r, e);
338
338
  return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
339
339
  }
340
- return i(e);
340
+ return s(e);
341
341
  };
342
- return `${n} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
342
+ return `${n} ${Array.isArray(e.value) ? e.value.map(i).join(", ") : i(e.value)}`;
343
343
  }
344
344
  function B(e, t) {
345
345
  return {
@@ -373,79 +373,79 @@ function V(e, t) {
373
373
  }
374
374
  //#endregion
375
375
  //#region src/api/status.ts
376
- async function H(e, t, r, i, a) {
377
- let o = {
378
- status_group_code: r,
379
- status_code: i
376
+ async function H(e, t, n, r, i) {
377
+ let a = {
378
+ status_group_code: n,
379
+ status_code: r
380
380
  };
381
- a != null && (o.note = a);
382
- let s = (await n(`${e}.__update`, {
381
+ i != null && (a.note = i);
382
+ let s = (await o(`${e}.__update`, {
383
383
  object_ids: [t],
384
384
  entity: e,
385
- fields: { $statuses: [o] }
385
+ fields: { $statuses: [a] }
386
386
  })).result?.rows?.[0]?.$statuses ?? [];
387
- return s.find((e) => e.group_code === r) ?? s[0];
387
+ return s.find((e) => e.group_code === n) ?? s[0];
388
388
  }
389
389
  //#endregion
390
390
  //#region src/hooks/useObjectStatus.ts
391
- function U(t, n) {
391
+ function U(e, t) {
392
392
  let r = m();
393
393
  return p({
394
- mutationFn: ({ groupCode: e, statusCode: r, note: i }) => H(t, n, e, r, i),
394
+ mutationFn: ({ groupCode: n, statusCode: r, note: i }) => H(e, t, n, r, i),
395
395
  onSuccess: () => {
396
- r.invalidateQueries({ queryKey: ["entity-item", t] });
396
+ r.invalidateQueries({ queryKey: ["entity-item", e] });
397
397
  },
398
- onError: (t) => {
399
- e.error(t.message);
398
+ onError: (e) => {
399
+ n.error(e.message);
400
400
  }
401
401
  });
402
402
  }
403
403
  //#endregion
404
404
  //#region src/api/properties.ts
405
- async function W(e, t, r, i) {
406
- let a = (await n(`${e}.__update`, {
405
+ async function W(e, t, n, r) {
406
+ let i = (await o(`${e}.__update`, {
407
407
  object_ids: [t],
408
408
  entity: e,
409
409
  fields: { $properties: [{
410
- property_code: r,
411
- value: i
410
+ property_code: n,
411
+ value: r
412
412
  }] }
413
413
  })).result?.rows?.[0]?.$properties ?? [];
414
- return a.find((e) => e.property_code === r) ?? a[0];
414
+ return i.find((e) => e.property_code === n) ?? i[0];
415
415
  }
416
- async function G(e, t, r) {
417
- await n(`${e}.__update`, {
416
+ async function G(e, t, n) {
417
+ await o(`${e}.__update`, {
418
418
  object_ids: [t],
419
419
  entity: e,
420
420
  fields: { $properties: [{
421
- property_code: r,
421
+ property_code: n,
422
422
  value: null
423
423
  }] }
424
424
  });
425
425
  }
426
426
  //#endregion
427
427
  //#region src/hooks/useProperties.ts
428
- function K(t, n) {
428
+ function K(e, t) {
429
429
  let r = m();
430
430
  return p({
431
- mutationFn: ({ propertyCode: e, value: r }) => W(t, n, e, r),
431
+ mutationFn: ({ propertyCode: n, value: r }) => W(e, t, n, r),
432
432
  onSuccess: () => {
433
- r.invalidateQueries({ queryKey: ["entity-item", t] });
433
+ r.invalidateQueries({ queryKey: ["entity-item", e] });
434
434
  },
435
- onError: (t) => {
436
- e.error(t.message);
435
+ onError: (e) => {
436
+ n.error(e.message);
437
437
  }
438
438
  });
439
439
  }
440
- function q(t, n) {
440
+ function q(e, t) {
441
441
  let r = m();
442
442
  return p({
443
- mutationFn: (e) => G(t, n, e),
443
+ mutationFn: (n) => G(e, t, n),
444
444
  onSuccess: () => {
445
- r.invalidateQueries({ queryKey: ["entity-item", t] });
445
+ r.invalidateQueries({ queryKey: ["entity-item", e] });
446
446
  },
447
- onError: (t) => {
448
- e.error(t.message);
447
+ onError: (e) => {
448
+ n.error(e.message);
449
449
  }
450
450
  });
451
451
  }