@medha-analytics/medha-one-access-react 1.0.9 → 1.1.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.
package/dist/index.js CHANGED
@@ -14400,27 +14400,31 @@ function vb({ className: e, ...t }) {
14400
14400
  }
14401
14401
  //#endregion
14402
14402
  //#region src/components/shared/DataTable.tsx
14403
- function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessage: i = "No results found", onSearchChange: a, onPaginationChange: s, pageSize: l = 20, searchPlaceholder: u = "Search...", toolbar: p, statusFilter: m, onStatusFilterChange: h }) {
14404
- let [v, y] = f({
14403
+ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessage: i = "No results found", onSearchChange: a, searchValue: s, onPaginationChange: l, pageSize: u = 20, searchPlaceholder: p = "Search...", toolbar: m, statusFilter: h, onStatusFilterChange: v }) {
14404
+ let [y, b] = f({
14405
14405
  pageIndex: 0,
14406
- pageSize: l
14407
- }), [b, x] = f(""), S = d(void 0), C = o((e) => {
14408
- x(e), S.current && clearTimeout(S.current), S.current = setTimeout(() => a?.(e), 400);
14406
+ pageSize: u
14407
+ }), [x, S] = f(s ?? ""), C = d(void 0);
14408
+ c(() => {
14409
+ s !== void 0 && S(s);
14410
+ }, [s]);
14411
+ let w = o((e) => {
14412
+ S(e), C.current && clearTimeout(C.current), C.current = setTimeout(() => a?.(e), 400);
14409
14413
  }, [a]);
14410
14414
  c(() => () => {
14411
- S.current && clearTimeout(S.current);
14415
+ C.current && clearTimeout(C.current);
14412
14416
  }, []), c(() => {
14413
- s?.(v);
14414
- }, [v, s]);
14415
- let w = Cn({
14417
+ l?.(y);
14418
+ }, [y, l]);
14419
+ let T = Cn({
14416
14420
  data: t,
14417
14421
  columns: e,
14418
- pageCount: Math.ceil(n / v.pageSize),
14419
- state: { pagination: v },
14420
- onPaginationChange: y,
14422
+ pageCount: Math.ceil(n / y.pageSize),
14423
+ state: { pagination: y },
14424
+ onPaginationChange: b,
14421
14425
  getCoreRowModel: vn(),
14422
14426
  manualPagination: !0
14423
- }), T = Math.ceil(n / v.pageSize);
14427
+ }), E = Math.ceil(n / y.pageSize);
14424
14428
  return /* @__PURE__ */ _("div", {
14425
14429
  className: "space-y-4",
14426
14430
  children: [
@@ -14430,45 +14434,45 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14430
14434
  a && /* @__PURE__ */ _("div", {
14431
14435
  className: "relative flex-1 max-w-sm",
14432
14436
  children: [/* @__PURE__ */ g(xe, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ g(ub, {
14433
- placeholder: u,
14434
- value: b,
14435
- onChange: (e) => C(e.target.value),
14437
+ placeholder: p,
14438
+ value: x,
14439
+ onChange: (e) => w(e.target.value),
14436
14440
  className: "pl-8"
14437
14441
  })]
14438
14442
  }),
14439
- h && /* @__PURE__ */ g("div", {
14443
+ v && /* @__PURE__ */ g("div", {
14440
14444
  className: "flex items-center rounded-md border",
14441
14445
  children: [
14442
14446
  "all",
14443
14447
  "active",
14444
14448
  "inactive"
14445
14449
  ].map((e) => /* @__PURE__ */ g("button", {
14446
- onClick: () => h(e),
14447
- className: H("cursor-pointer px-3 py-1.5 text-xs font-medium capitalize transition-colors first:rounded-l-md last:rounded-r-md", m === e ? "bg-primary text-primary-foreground" : "bg-background text-muted-foreground hover:bg-accent"),
14450
+ onClick: () => v(e),
14451
+ className: H("cursor-pointer px-3 py-1.5 text-xs font-medium capitalize transition-colors first:rounded-l-md last:rounded-r-md", h === e ? "bg-primary text-primary-foreground" : "bg-background text-muted-foreground hover:bg-accent"),
14448
14452
  children: e
14449
14453
  }, e))
14450
14454
  }),
14451
- p && /* @__PURE__ */ g("div", {
14455
+ m && /* @__PURE__ */ g("div", {
14452
14456
  className: "flex items-center gap-2",
14453
- children: p
14457
+ children: m
14454
14458
  })
14455
14459
  ]
14456
14460
  }),
14457
14461
  /* @__PURE__ */ g("div", {
14458
14462
  className: "rounded-md border",
14459
- children: /* @__PURE__ */ _(ib, { children: [/* @__PURE__ */ g(ab, { children: w.getHeaderGroups().map((e) => /* @__PURE__ */ g(sb, { children: e.headers.map((e) => /* @__PURE__ */ g(cb, { children: e.isPlaceholder ? null : yn(e.column.columnDef.header, e.getContext()) }, e.id)) }, e.id)) }), /* @__PURE__ */ g(ob, { children: r ? Array.from({ length: v.pageSize }).map((t, n) => /* @__PURE__ */ g(sb, { children: e.map((e, t) => /* @__PURE__ */ g(lb, { children: /* @__PURE__ */ g(vb, { className: "h-4 w-full animate-pulse" }) }, t)) }, n)) : w.getRowModel().rows.length === 0 ? /* @__PURE__ */ g(sb, { children: /* @__PURE__ */ g(lb, {
14463
+ children: /* @__PURE__ */ _(ib, { children: [/* @__PURE__ */ g(ab, { children: T.getHeaderGroups().map((e) => /* @__PURE__ */ g(sb, { children: e.headers.map((e) => /* @__PURE__ */ g(cb, { children: e.isPlaceholder ? null : yn(e.column.columnDef.header, e.getContext()) }, e.id)) }, e.id)) }), /* @__PURE__ */ g(ob, { children: r ? Array.from({ length: y.pageSize }).map((t, n) => /* @__PURE__ */ g(sb, { children: e.map((e, t) => /* @__PURE__ */ g(lb, { children: /* @__PURE__ */ g(vb, { className: "h-4 w-full animate-pulse" }) }, t)) }, n)) : T.getRowModel().rows.length === 0 ? /* @__PURE__ */ g(sb, { children: /* @__PURE__ */ g(lb, {
14460
14464
  colSpan: e.length,
14461
14465
  className: "h-24 text-center text-muted-foreground",
14462
14466
  children: i
14463
- }) }) : w.getRowModel().rows.map((e) => /* @__PURE__ */ g(sb, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ g(lb, { children: yn(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })] })
14467
+ }) }) : T.getRowModel().rows.map((e) => /* @__PURE__ */ g(sb, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ g(lb, { children: yn(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })] })
14464
14468
  }),
14465
14469
  n > 0 && /* @__PURE__ */ _("div", {
14466
14470
  className: "flex items-center justify-between",
14467
14471
  children: [/* @__PURE__ */ _("div", {
14468
14472
  className: "flex items-center gap-2 text-sm text-muted-foreground",
14469
14473
  children: [/* @__PURE__ */ g("span", { children: "Rows per page:" }), /* @__PURE__ */ _(db, {
14470
- value: String(v.pageSize),
14471
- onValueChange: (e) => y({
14474
+ value: String(y.pageSize),
14475
+ onValueChange: (e) => b({
14472
14476
  pageIndex: 0,
14473
14477
  pageSize: Number(e)
14474
14478
  }),
@@ -14490,9 +14494,9 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14490
14494
  /* @__PURE__ */ _("span", {
14491
14495
  className: "text-muted-foreground",
14492
14496
  children: [
14493
- v.pageIndex * v.pageSize + 1,
14497
+ y.pageIndex * y.pageSize + 1,
14494
14498
  "–",
14495
- Math.min((v.pageIndex + 1) * v.pageSize, n),
14499
+ Math.min((y.pageIndex + 1) * y.pageSize, n),
14496
14500
  " of ",
14497
14501
  n
14498
14502
  ]
@@ -14500,21 +14504,21 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14500
14504
  /* @__PURE__ */ g(qh, {
14501
14505
  variant: "ghost",
14502
14506
  size: "icon",
14503
- onClick: () => y((e) => ({
14507
+ onClick: () => b((e) => ({
14504
14508
  ...e,
14505
14509
  pageIndex: e.pageIndex - 1
14506
14510
  })),
14507
- disabled: v.pageIndex === 0,
14511
+ disabled: y.pageIndex === 0,
14508
14512
  children: /* @__PURE__ */ g(pe, { className: "h-4 w-4" })
14509
14513
  }),
14510
14514
  /* @__PURE__ */ g(qh, {
14511
14515
  variant: "ghost",
14512
14516
  size: "icon",
14513
- onClick: () => y((e) => ({
14517
+ onClick: () => b((e) => ({
14514
14518
  ...e,
14515
14519
  pageIndex: e.pageIndex + 1
14516
14520
  })),
14517
- disabled: v.pageIndex >= T - 1,
14521
+ disabled: y.pageIndex >= E - 1,
14518
14522
  children: /* @__PURE__ */ g(me, { className: "h-4 w-4" })
14519
14523
  })
14520
14524
  ]
@@ -18635,8 +18639,13 @@ function rw({ className: e, ...t }) {
18635
18639
  });
18636
18640
  }
18637
18641
  //#endregion
18638
- //#region src/core/hooks/useUsers.ts
18642
+ //#region src/core/lib/performed-by.ts
18639
18643
  function iw(e) {
18644
+ return e.currentUserEmail;
18645
+ }
18646
+ //#endregion
18647
+ //#region src/core/hooks/useUsers.ts
18648
+ function aw(e) {
18640
18649
  let t = e.user_metadata ?? {};
18641
18650
  return {
18642
18651
  ...e,
@@ -18645,10 +18654,12 @@ function iw(e) {
18645
18654
  email: e.email || t.email || "",
18646
18655
  department: e.department || t.department || "",
18647
18656
  role: e.role || t.role || "",
18648
- manager_id: e.manager_id || t.manager_id || ""
18657
+ manager_id: e.manager_id || t.manager_id || "",
18658
+ lifecycleStatus: e.status || "live",
18659
+ auditLog: e.audit_log || []
18649
18660
  };
18650
18661
  }
18651
- function aw(e = {}) {
18662
+ function ow(e = {}) {
18652
18663
  let t = G(), { skip: n, limit: r, activeOnly: i, search: a } = e;
18653
18664
  return C({
18654
18665
  queryKey: ["users", e],
@@ -18656,11 +18667,11 @@ function aw(e = {}) {
18656
18667
  let e = { user_type: "USER" };
18657
18668
  n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i);
18658
18669
  let o = a && a.trim() ? "/users/search" : "/users/";
18659
- return a && a.trim() && (e.search = a.trim()), ((await t.get(o, { params: e })).data ?? []).map(iw);
18670
+ return a && a.trim() && (e.search = a.trim()), ((await t.get(o, { params: e })).data ?? []).map(aw);
18660
18671
  }
18661
18672
  });
18662
18673
  }
18663
- function ow(e = {}) {
18674
+ function sw(e = {}) {
18664
18675
  let t = G(), { activeOnly: n, search: r } = e;
18665
18676
  return C({
18666
18677
  queryKey: [
@@ -18674,15 +18685,15 @@ function ow(e = {}) {
18674
18685
  }
18675
18686
  });
18676
18687
  }
18677
- function sw(e) {
18688
+ function cw(e) {
18678
18689
  let t = G();
18679
18690
  return C({
18680
18691
  queryKey: ["users", e],
18681
- queryFn: async () => (await t.get(`/users/${e}`)).data,
18692
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}`)).data,
18682
18693
  enabled: !!e
18683
18694
  });
18684
18695
  }
18685
- function cw() {
18696
+ function lw() {
18686
18697
  let e = G();
18687
18698
  return C({
18688
18699
  queryKey: ["users", "all-groups"],
@@ -18695,7 +18706,7 @@ function cw() {
18695
18706
  })
18696
18707
  });
18697
18708
  }
18698
- function lw(e) {
18709
+ function uw(e) {
18699
18710
  let t = G();
18700
18711
  return C({
18701
18712
  queryKey: [
@@ -18703,11 +18714,11 @@ function lw(e) {
18703
18714
  e,
18704
18715
  "groups"
18705
18716
  ],
18706
- queryFn: async () => (await t.get(`/users/${e}/groups`)).data.groups ?? [],
18717
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}/groups`)).data.groups ?? [],
18707
18718
  enabled: !!e
18708
18719
  });
18709
18720
  }
18710
- function uw() {
18721
+ function dw() {
18711
18722
  let e = G();
18712
18723
  return C({
18713
18724
  queryKey: ["users", "departments"],
@@ -18717,7 +18728,7 @@ function uw() {
18717
18728
  }
18718
18729
  });
18719
18730
  }
18720
- function dw() {
18731
+ function fw() {
18721
18732
  let e = G();
18722
18733
  return C({
18723
18734
  queryKey: ["users", "roles"],
@@ -18727,65 +18738,71 @@ function dw() {
18727
18738
  }
18728
18739
  });
18729
18740
  }
18730
- function fw() {
18731
- let e = G(), t = w();
18741
+ function pw() {
18742
+ let e = G(), t = Jy(), n = w();
18732
18743
  return S({
18733
- mutationFn: async (t) => {
18734
- let n = t.id || t.email || "", r = t.first_name ?? "", i = t.last_name ?? "", a = t.email ?? "", o = t.department ?? "", s = t.role ?? "", c = t.manager_id || null, l = {
18735
- type: t.type ?? "USER",
18736
- active: t.active ?? !0,
18737
- id: n,
18738
- first_name: r,
18739
- last_name: i,
18740
- email: a,
18741
- department: o,
18742
- role: s,
18743
- manager_id: c,
18744
- parent_group_id: t.parent_group_id ?? null,
18745
- owner_id: t.owner_id ?? null,
18746
- expression: t.expression ?? null,
18744
+ mutationFn: async (n) => {
18745
+ let r = (n.id || n.email || "").trim(), i = n.first_name ?? "", a = n.last_name ?? "", o = n.email ?? "", s = n.department ?? "", c = n.role ?? "", l = n.manager_id || null, u = {
18746
+ type: n.type ?? "USER",
18747
+ active: n.active ?? !0,
18748
+ id: r,
18749
+ first_name: i,
18750
+ last_name: a,
18751
+ email: o,
18752
+ department: s,
18753
+ role: c,
18754
+ manager_id: l,
18755
+ parent_group_id: n.parent_group_id ?? null,
18756
+ owner_id: n.owner_id ?? null,
18757
+ expression: n.expression ?? null,
18747
18758
  user_metadata: {
18748
- name: `${r} ${i}`.trim(),
18749
- first_name: r,
18750
- last_name: i,
18751
- email: a,
18752
- department: o,
18753
- role: s,
18754
- manager_id: c
18759
+ name: `${i} ${a}`.trim(),
18760
+ first_name: i,
18761
+ last_name: a,
18762
+ email: o,
18763
+ department: s,
18764
+ role: c,
18765
+ manager_id: l
18755
18766
  }
18756
- };
18757
- return (await e.post("/users/", l)).data;
18767
+ }, d = { performed_by: iw(t) };
18768
+ return (await e.post("/users/", u, { params: d })).data;
18758
18769
  },
18759
- onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18770
+ onSuccess: () => n.invalidateQueries({ queryKey: ["users"] })
18760
18771
  });
18761
18772
  }
18762
- function pw() {
18763
- let e = G(), t = w();
18773
+ function mw() {
18774
+ let e = G(), t = Jy(), n = w();
18764
18775
  return S({
18765
- mutationFn: async (t) => (await e.put(`/users/${t.id}`, t)).data,
18766
- onSuccess: (e, n) => {
18767
- t.invalidateQueries({ queryKey: ["users"] }), t.invalidateQueries({ queryKey: ["users", n.id] });
18776
+ mutationFn: async (n) => {
18777
+ let r = { performed_by: iw(t) };
18778
+ return (await e.put(`/users/${encodeURIComponent(n.id)}`, n, { params: r })).data;
18779
+ },
18780
+ onSuccess: (e, t) => {
18781
+ n.invalidateQueries({ queryKey: ["users"] }), n.invalidateQueries({ queryKey: ["users", t.id] });
18768
18782
  }
18769
18783
  });
18770
18784
  }
18771
- function mw() {
18772
- let e = G(), t = w();
18785
+ function hw() {
18786
+ let e = G(), t = Jy(), n = w();
18773
18787
  return S({
18774
- mutationFn: async (t) => {
18775
- await e.delete(`/users/${t}`);
18788
+ mutationFn: async (n) => {
18789
+ let r = { performed_by: iw(t) };
18790
+ await e.delete(`/users/${encodeURIComponent(n)}`, { params: r });
18776
18791
  },
18777
- onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18792
+ onSuccess: () => n.invalidateQueries({ queryKey: ["users"] })
18778
18793
  });
18779
18794
  }
18780
18795
  //#endregion
18781
18796
  //#region src/core/hooks/useAccessRules.ts
18782
- function hw(e) {
18797
+ function gw(e) {
18783
18798
  let t = e.time_constraints;
18784
18799
  return {
18785
18800
  ...e,
18786
18801
  userExpression: e.userExpression ?? e.user_expression ?? "",
18787
18802
  resourceExpression: e.resourceExpression ?? e.resource_expression ?? "",
18788
18803
  status: e.status ?? (e.active ? "Active" : "Inactive"),
18804
+ lifecycleStatus: e.lifecycleStatus || e.status || "live",
18805
+ auditLog: e.auditLog || e.audit_log || [],
18789
18806
  timeConstraints: t ? {
18790
18807
  startDate: t.start_date,
18791
18808
  endDate: t.end_date,
@@ -18795,7 +18812,7 @@ function hw(e) {
18795
18812
  } : void 0
18796
18813
  };
18797
18814
  }
18798
- function gw(e = {}) {
18815
+ function _w(e = {}) {
18799
18816
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, search: o } = e;
18800
18817
  return C({
18801
18818
  queryKey: ["access-rules", e],
@@ -18803,11 +18820,11 @@ function gw(e = {}) {
18803
18820
  let e = {};
18804
18821
  n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a);
18805
18822
  let s = o && o.trim() ? "/access-rules/search" : "/access-rules/";
18806
- return o && o.trim() && (e.search = o.trim()), ((await t.get(s, { params: e })).data ?? []).map(hw);
18823
+ return o && o.trim() && (e.search = o.trim()), ((await t.get(s, { params: e })).data ?? []).map(gw);
18807
18824
  }
18808
18825
  });
18809
18826
  }
18810
- function _w(e = {}) {
18827
+ function vw(e = {}) {
18811
18828
  let t = G(), { appName: n, search: r, activeOnly: i } = e;
18812
18829
  return C({
18813
18830
  queryKey: [
@@ -18821,15 +18838,15 @@ function _w(e = {}) {
18821
18838
  }
18822
18839
  });
18823
18840
  }
18824
- function vw(e) {
18841
+ function yw(e) {
18825
18842
  let t = G();
18826
18843
  return C({
18827
18844
  queryKey: ["access-rules", e],
18828
- queryFn: async () => hw((await t.get(`/access-rules/${e}`)).data),
18845
+ queryFn: async () => gw((await t.get(`/access-rules/${encodeURIComponent(e)}`)).data),
18829
18846
  enabled: !!e
18830
18847
  });
18831
18848
  }
18832
- function yw(e, t, n) {
18849
+ function bw(e, t, n) {
18833
18850
  let r = G();
18834
18851
  return C({
18835
18852
  queryKey: [
@@ -18847,7 +18864,7 @@ function yw(e, t, n) {
18847
18864
  enabled: !!e && !!t && !!n
18848
18865
  });
18849
18866
  }
18850
- function bw(e) {
18867
+ function xw(e) {
18851
18868
  let t = e?.resolved_access_detailed;
18852
18869
  if (t && Object.keys(t).length > 0) return Object.entries(t).map(([e, t]) => ({
18853
18870
  id: e,
@@ -18861,14 +18878,14 @@ function bw(e) {
18861
18878
  permissions: Array.isArray(t) ? t : []
18862
18879
  }));
18863
18880
  }
18864
- function xw(e) {
18881
+ function Sw(e) {
18865
18882
  return Object.entries(e ?? {}).map(([e, t]) => ({
18866
18883
  id: e,
18867
18884
  label: e,
18868
18885
  permissions: Array.isArray(t) ? t : []
18869
18886
  }));
18870
18887
  }
18871
- function Sw(e) {
18888
+ function Cw(e) {
18872
18889
  let t = G();
18873
18890
  return C({
18874
18891
  queryKey: [
@@ -18876,11 +18893,11 @@ function Sw(e) {
18876
18893
  "user",
18877
18894
  e
18878
18895
  ],
18879
- queryFn: async () => bw((await t.get(`/access/user/${e}`)).data),
18896
+ queryFn: async () => xw((await t.get(`/access/user/${e}`)).data),
18880
18897
  enabled: !!e
18881
18898
  });
18882
18899
  }
18883
- function Cw(e) {
18900
+ function ww(e) {
18884
18901
  let t = G();
18885
18902
  return C({
18886
18903
  queryKey: [
@@ -18888,11 +18905,11 @@ function Cw(e) {
18888
18905
  "usergroup",
18889
18906
  e
18890
18907
  ],
18891
- queryFn: async () => xw((await t.get(`/access/usergroup/${e}`)).data.resolvedAccess),
18908
+ queryFn: async () => Sw((await t.get(`/access/usergroup/${encodeURIComponent(e)}`)).data.resolvedAccess),
18892
18909
  enabled: !!e
18893
18910
  });
18894
18911
  }
18895
- function ww(e) {
18912
+ function Tw(e) {
18896
18913
  let t = G();
18897
18914
  return C({
18898
18915
  queryKey: [
@@ -18900,11 +18917,11 @@ function ww(e) {
18900
18917
  "resource",
18901
18918
  e
18902
18919
  ],
18903
- queryFn: async () => xw((await t.get(`/access/resource/${e}`)).data.users_with_access),
18920
+ queryFn: async () => Sw((await t.get(`/access/resource/${encodeURIComponent(e)}`)).data.users_with_access),
18904
18921
  enabled: !!e
18905
18922
  });
18906
18923
  }
18907
- function Tw(e) {
18924
+ function Ew(e) {
18908
18925
  let t = G();
18909
18926
  return C({
18910
18927
  queryKey: [
@@ -18912,11 +18929,11 @@ function Tw(e) {
18912
18929
  "resourcegroup",
18913
18930
  e
18914
18931
  ],
18915
- queryFn: async () => xw((await t.get(`/access/resourcegroup/${e}`)).data.users_with_access),
18932
+ queryFn: async () => Sw((await t.get(`/access/resourcegroup/${encodeURIComponent(e)}`)).data.users_with_access),
18916
18933
  enabled: !!e
18917
18934
  });
18918
18935
  }
18919
- function Ew(e, t) {
18936
+ function Dw(e, t) {
18920
18937
  let n = G();
18921
18938
  return C({
18922
18939
  queryKey: [
@@ -18932,7 +18949,7 @@ function Ew(e, t) {
18932
18949
  enabled: !!e
18933
18950
  });
18934
18951
  }
18935
- function Dw(e) {
18952
+ function Ow(e) {
18936
18953
  let t = e.timeConstraints, n = t ? {
18937
18954
  start_date: t.startDate ?? null,
18938
18955
  end_date: t.endDate ?? null,
@@ -18956,34 +18973,41 @@ function Dw(e) {
18956
18973
  }
18957
18974
  };
18958
18975
  }
18959
- function Ow() {
18960
- let e = G(), t = w();
18976
+ function kw() {
18977
+ let e = G(), t = Jy(), n = w();
18961
18978
  return S({
18962
- mutationFn: async (t) => (await e.post("/access-rules/", Dw(t))).data,
18963
- onSuccess: () => t.invalidateQueries({ queryKey: ["access-rules"] })
18979
+ mutationFn: async (n) => {
18980
+ let r = { performed_by: iw(t) };
18981
+ return (await e.post("/access-rules/", Ow(n), { params: r })).data;
18982
+ },
18983
+ onSuccess: () => n.invalidateQueries({ queryKey: ["access-rules"] })
18964
18984
  });
18965
18985
  }
18966
- function kw() {
18967
- let e = G(), t = w();
18986
+ function Aw() {
18987
+ let e = G(), t = Jy(), n = w();
18968
18988
  return S({
18969
- mutationFn: async (t) => (await e.put(`/access-rules/${t.id}`, Dw(t))).data,
18970
- onSuccess: (e, n) => {
18971
- t.invalidateQueries({ queryKey: ["access-rules"] }), t.invalidateQueries({ queryKey: ["access-rules", n.id] });
18989
+ mutationFn: async (n) => {
18990
+ let r = { performed_by: iw(t) };
18991
+ return (await e.put(`/access-rules/${encodeURIComponent(n.id)}`, Ow(n), { params: r })).data;
18992
+ },
18993
+ onSuccess: (e, t) => {
18994
+ n.invalidateQueries({ queryKey: ["access-rules"] }), n.invalidateQueries({ queryKey: ["access-rules", t.id] });
18972
18995
  }
18973
18996
  });
18974
18997
  }
18975
- function Aw() {
18976
- let e = G(), t = w();
18998
+ function jw() {
18999
+ let e = G(), t = Jy(), n = w();
18977
19000
  return S({
18978
- mutationFn: async (t) => {
18979
- await e.delete(`/access-rules/${t}`);
19001
+ mutationFn: async (n) => {
19002
+ let r = { performed_by: iw(t) };
19003
+ await e.delete(`/access-rules/${encodeURIComponent(n)}`, { params: r });
18980
19004
  },
18981
- onSuccess: () => t.invalidateQueries({ queryKey: ["access-rules"] })
19005
+ onSuccess: () => n.invalidateQueries({ queryKey: ["access-rules"] })
18982
19006
  });
18983
19007
  }
18984
19008
  //#endregion
18985
19009
  //#region src/components/dialogs/UserDialog.tsx
18986
- var jw = JC({
19010
+ var Mw = JC({
18987
19011
  first_name: KC().min(1, "First name is required"),
18988
19012
  last_name: KC().min(1, "Last name is required"),
18989
19013
  email: KC().refine((e) => !e || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e), { message: "Invalid email" }),
@@ -18991,7 +19015,7 @@ var jw = JC({
18991
19015
  role: KC().optional(),
18992
19016
  manager_id: KC().optional()
18993
19017
  });
18994
- function Mw({ id: e, label: t, value: n, onChange: r, suggestions: i }) {
19018
+ function Nw({ id: e, label: t, value: n, onChange: r, suggestions: i }) {
18995
19019
  let [a, o] = f(!1), s = n ? i.filter((e) => e.toLowerCase().includes(n.toLowerCase())) : i;
18996
19020
  return /* @__PURE__ */ _("div", {
18997
19021
  className: "space-y-1.5 relative",
@@ -19024,9 +19048,9 @@ function Mw({ id: e, label: t, value: n, onChange: r, suggestions: i }) {
19024
19048
  ]
19025
19049
  });
19026
19050
  }
19027
- function Nw({ open: e, onClose: t, user: n }) {
19028
- let r = !!n, i = fw(), a = pw(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19029
- resolver: gS(jw),
19051
+ function Pw({ open: e, onClose: t, user: n }) {
19052
+ let r = !!n, i = pw(), a = mw(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19053
+ resolver: gS(Mw),
19030
19054
  defaultValues: {
19031
19055
  first_name: "",
19032
19056
  last_name: "",
@@ -19063,7 +19087,7 @@ function Nw({ open: e, onClose: t, user: n }) {
19063
19087
  function m() {
19064
19088
  f(), t();
19065
19089
  }
19066
- let { data: h = [], isLoading: v } = lw(r ? n.id : ""), { data: y = [], isLoading: b } = Sw(r ? n.email || n.id : ""), { data: x = [] } = aw({ activeOnly: !0 }), { data: S = [] } = uw(), { data: C = [] } = dw(), w = x.filter((e) => e.id !== n?.id);
19090
+ let { data: h = [], isLoading: v } = uw(r ? n.id : ""), { data: y = [], isLoading: b } = Cw(r ? n.email || n.id : ""), { data: x = [] } = ow({ activeOnly: !0 }), { data: S = [] } = dw(), { data: C = [] } = fw(), w = x.filter((e) => e.id !== n?.id);
19067
19091
  return /* @__PURE__ */ g(XC, {
19068
19092
  open: e,
19069
19093
  onOpenChange: (e) => !e && m(),
@@ -19150,13 +19174,13 @@ function Nw({ open: e, onClose: t, user: n }) {
19150
19174
  }),
19151
19175
  /* @__PURE__ */ _("div", {
19152
19176
  className: "grid grid-cols-2 gap-4",
19153
- children: [/* @__PURE__ */ g(Mw, {
19177
+ children: [/* @__PURE__ */ g(Nw, {
19154
19178
  id: "department",
19155
19179
  label: "Department",
19156
19180
  value: l("department") ?? "",
19157
19181
  onChange: (e) => u("department", e),
19158
19182
  suggestions: S
19159
- }), /* @__PURE__ */ g(Mw, {
19183
+ }), /* @__PURE__ */ g(Nw, {
19160
19184
  id: "role",
19161
19185
  label: "Role",
19162
19186
  value: l("role") ?? "",
@@ -19252,7 +19276,14 @@ function Nw({ open: e, onClose: t, user: n }) {
19252
19276
  }
19253
19277
  //#endregion
19254
19278
  //#region src/core/hooks/useArtifacts.ts
19255
- function Pw(e = {}) {
19279
+ function Fw(e) {
19280
+ return {
19281
+ ...e,
19282
+ lifecycleStatus: e.lifecycleStatus || e.status || "live",
19283
+ auditLog: e.auditLog || e.audit_log || []
19284
+ };
19285
+ }
19286
+ function Iw(e = {}) {
19256
19287
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, type: o, search: s } = e;
19257
19288
  return C({
19258
19289
  queryKey: ["artifacts", e],
@@ -19260,11 +19291,11 @@ function Pw(e = {}) {
19260
19291
  let e = {};
19261
19292
  n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a), o && (e.artifact_type = o);
19262
19293
  let c = s && s.trim() ? "/artifacts/search" : "/artifacts/";
19263
- return s && s.trim() && (e.search = s.trim()), (await t.get(c, { params: e })).data;
19294
+ return s && s.trim() && (e.search = s.trim()), ((await t.get(c, { params: e })).data ?? []).map((e) => Fw(e));
19264
19295
  }
19265
19296
  });
19266
19297
  }
19267
- function Fw(e = {}) {
19298
+ function Lw(e = {}) {
19268
19299
  let t = G(), { type: n, appName: r, search: i, activeOnly: a } = e;
19269
19300
  return C({
19270
19301
  queryKey: [
@@ -19278,33 +19309,33 @@ function Fw(e = {}) {
19278
19309
  }
19279
19310
  });
19280
19311
  }
19281
- function Iw(e) {
19312
+ function Rw(e) {
19282
19313
  let t = G();
19283
19314
  return C({
19284
19315
  queryKey: ["artifacts", e],
19285
- queryFn: async () => (await t.get(`/artifacts/${e}`)).data,
19316
+ queryFn: async () => Fw((await t.get(`/artifacts/${encodeURIComponent(e)}`)).data),
19286
19317
  enabled: !!e
19287
19318
  });
19288
19319
  }
19289
- function Lw(e = {}) {
19320
+ function zw(e = {}) {
19290
19321
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a } = e;
19291
19322
  return C({
19292
19323
  queryKey: ["artifact-groups", e],
19293
19324
  queryFn: async () => {
19294
19325
  let e = { artifact_type: "RESOURCEGROUP" };
19295
- return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a), (await t.get("/artifacts/", { params: e })).data;
19326
+ return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a), ((await t.get("/artifacts/", { params: e })).data ?? []).map((e) => Fw(e));
19296
19327
  }
19297
19328
  });
19298
19329
  }
19299
- function Rw(e) {
19330
+ function Bw(e) {
19300
19331
  let t = G();
19301
19332
  return C({
19302
19333
  queryKey: ["artifact-groups", e],
19303
- queryFn: async () => (await t.get(`/artifacts/${e}`)).data,
19334
+ queryFn: async () => Fw((await t.get(`/artifacts/${encodeURIComponent(e)}`)).data),
19304
19335
  enabled: !!e
19305
19336
  });
19306
19337
  }
19307
- function zw(e) {
19338
+ function Vw(e) {
19308
19339
  let t = G();
19309
19340
  return C({
19310
19341
  queryKey: [
@@ -19312,11 +19343,11 @@ function zw(e) {
19312
19343
  e,
19313
19344
  "contents"
19314
19345
  ],
19315
- queryFn: async () => (await t.get(`/resourcegroups/${e}/contents`)).data.contents ?? [],
19346
+ queryFn: async () => (await t.get(`/resourcegroups/${encodeURIComponent(e)}/contents`)).data.contents ?? [],
19316
19347
  enabled: !!e
19317
19348
  });
19318
19349
  }
19319
- function Bw(e) {
19350
+ function Hw(e) {
19320
19351
  let t = G();
19321
19352
  return C({
19322
19353
  queryKey: [
@@ -19324,11 +19355,11 @@ function Bw(e) {
19324
19355
  e,
19325
19356
  "groups"
19326
19357
  ],
19327
- queryFn: async () => (await t.get(`/artifacts/${e}/groups`)).data.groups ?? [],
19358
+ queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}/groups`)).data.groups ?? [],
19328
19359
  enabled: !!e
19329
19360
  });
19330
19361
  }
19331
- function Vw() {
19362
+ function Uw() {
19332
19363
  let e = G();
19333
19364
  return C({
19334
19365
  queryKey: ["applications"],
@@ -19338,34 +19369,41 @@ function Vw() {
19338
19369
  }
19339
19370
  });
19340
19371
  }
19341
- function Hw() {
19342
- let e = G(), t = w();
19372
+ function Ww() {
19373
+ let e = G(), t = Jy(), n = w();
19343
19374
  return S({
19344
- mutationFn: async (t) => (await e.post("/artifacts/", t)).data,
19345
- onSuccess: () => t.invalidateQueries({ queryKey: ["artifacts"] })
19375
+ mutationFn: async (n) => {
19376
+ let r = { performed_by: iw(t) };
19377
+ return (await e.post("/artifacts/", n, { params: r })).data;
19378
+ },
19379
+ onSuccess: () => n.invalidateQueries({ queryKey: ["artifacts"] })
19346
19380
  });
19347
19381
  }
19348
- function Uw() {
19349
- let e = G(), t = w();
19382
+ function Gw() {
19383
+ let e = G(), t = Jy(), n = w();
19350
19384
  return S({
19351
- mutationFn: async (t) => (await e.put(`/artifacts/${t.id}`, t)).data,
19352
- onSuccess: (e, n) => {
19353
- t.invalidateQueries({ queryKey: ["artifacts"] }), t.invalidateQueries({ queryKey: ["artifacts", n.id] });
19385
+ mutationFn: async (n) => {
19386
+ let r = { performed_by: iw(t) };
19387
+ return (await e.put(`/artifacts/${encodeURIComponent(n.id)}`, n, { params: r })).data;
19388
+ },
19389
+ onSuccess: (e, t) => {
19390
+ n.invalidateQueries({ queryKey: ["artifacts"] }), n.invalidateQueries({ queryKey: ["artifacts", t.id] });
19354
19391
  }
19355
19392
  });
19356
19393
  }
19357
- function Ww() {
19358
- let e = G(), t = w();
19394
+ function Kw() {
19395
+ let e = G(), t = Jy(), n = w();
19359
19396
  return S({
19360
- mutationFn: async (t) => {
19361
- await e.delete(`/artifacts/${t}`);
19397
+ mutationFn: async (n) => {
19398
+ let r = { performed_by: iw(t) };
19399
+ await e.delete(`/artifacts/${encodeURIComponent(n)}`, { params: r });
19362
19400
  },
19363
- onSuccess: () => t.invalidateQueries({ queryKey: ["artifacts"] })
19401
+ onSuccess: () => n.invalidateQueries({ queryKey: ["artifacts"] })
19364
19402
  });
19365
19403
  }
19366
19404
  //#endregion
19367
19405
  //#region src/components/shared/ExpressionInput.tsx
19368
- function Gw(e) {
19406
+ function qw(e) {
19369
19407
  if (!e) return [];
19370
19408
  let t = [], n = /([+-]?)("(?:[^"]+)"|[^+\-\s]+)/g, r;
19371
19409
  for (; (r = n.exec(e)) !== null;) {
@@ -19378,18 +19416,18 @@ function Gw(e) {
19378
19416
  }
19379
19417
  return t;
19380
19418
  }
19381
- function Kw(e) {
19419
+ function Jw(e) {
19382
19420
  return e.map((e, t) => {
19383
19421
  let n = e.entity.includes(" ") || e.entity.includes("-") ? `"${e.entity}"` : e.entity;
19384
19422
  return `${t === 0 && e.operator === "+" ? "" : e.operator}${n}`;
19385
19423
  }).join("");
19386
19424
  }
19387
- var qw = {
19425
+ var Yw = {
19388
19426
  user: "user",
19389
19427
  resource: "artifact"
19390
19428
  };
19391
- function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19392
- let [a, s] = f(""), [c, l] = f(!1), u = d(null), p = aw({ activeOnly: !0 }), m = cw(), h = Pw({ type: "RESOURCE" }), v = Pw({ type: "RESOURCEGROUP" }), { data: y } = Ew(t, e), b = e === "user" ? p.isLoading || m.isLoading : h.isLoading || v.isLoading, x = a.startsWith("-") ? "-" : "+", S = a.replace(/^[+-]/, "").trim().toLowerCase(), C = (() => {
19429
+ function Xw({ type: e, value: t, onChange: n, label: r, required: i }) {
19430
+ let [a, s] = f(""), [c, l] = f(!1), u = d(null), p = ow({ activeOnly: !0 }), m = lw(), h = Iw({ type: "RESOURCE" }), v = Iw({ type: "RESOURCEGROUP" }), { data: y } = Dw(t, e), b = e === "user" ? p.isLoading || m.isLoading : h.isLoading || v.isLoading, x = a.startsWith("-") ? "-" : "+", S = a.replace(/^[+-]/, "").trim().toLowerCase(), C = (() => {
19393
19431
  if (e === "user") {
19394
19432
  let e = p.data ?? [], t = m.data ?? [], n = (S ? e.filter((e) => {
19395
19433
  let t = `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim().toLowerCase();
@@ -19431,20 +19469,20 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19431
19469
  for (let e of v.data ?? []) t.set(e.id, e.name ?? e.id);
19432
19470
  }
19433
19471
  return t;
19434
- })(), T = Gw(t).map((e) => ({
19472
+ })(), T = qw(t).map((e) => ({
19435
19473
  ...e,
19436
19474
  label: w.get(e.entity) ?? e.entity
19437
19475
  })), E = o((e, t, r) => {
19438
- T.find((t) => t.entity === e) || (n(Kw([...T, {
19476
+ T.find((t) => t.entity === e) || (n(Jw([...T, {
19439
19477
  raw: `${r}${e}`,
19440
19478
  operator: r,
19441
19479
  entity: e,
19442
19480
  label: t
19443
19481
  }])), s(""), l(!1), u.current?.focus());
19444
19482
  }, [T, n]), D = o((e) => {
19445
- n(Kw(T.filter((t, n) => n !== e)));
19483
+ n(Jw(T.filter((t, n) => n !== e)));
19446
19484
  }, [T, n]), O = o((e) => {
19447
- n(Kw(T.map((t, n) => {
19485
+ n(Jw(T.map((t, n) => {
19448
19486
  if (n !== e) return t;
19449
19487
  let r = t.operator === "+" ? "-" : "+";
19450
19488
  return {
@@ -19501,7 +19539,7 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19501
19539
  onKeyDown: A,
19502
19540
  onFocus: () => l(!0),
19503
19541
  onBlur: () => setTimeout(() => l(!1), 150),
19504
- placeholder: T.length === 0 ? `Type + or - then ${qw[e]} name…` : "",
19542
+ placeholder: T.length === 0 ? `Type + or - then ${Yw[e]} name…` : "",
19505
19543
  className: "flex-1 min-w-28 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
19506
19544
  })]
19507
19545
  }),
@@ -19514,7 +19552,7 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19514
19552
  className: "px-3 py-2 text-sm text-muted-foreground",
19515
19553
  children: [
19516
19554
  "No ",
19517
- qw[e],
19555
+ Yw[e],
19518
19556
  "s found"
19519
19557
  ]
19520
19558
  }) : /* @__PURE__ */ g("ul", {
@@ -19552,14 +19590,16 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19552
19590
  }
19553
19591
  //#endregion
19554
19592
  //#region src/core/hooks/useGroups.ts
19555
- function Yw(e) {
19593
+ function Zw(e) {
19556
19594
  let t = e.user_metadata ?? {}, n = e.id;
19557
19595
  return t.name ? n = t.name : e.first_name || e.last_name ? n = `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim() : e.description && (n = e.description), {
19558
19596
  ...e,
19559
- name: n
19597
+ name: n,
19598
+ lifecycleStatus: e.lifecycleStatus || e.status || "live",
19599
+ auditLog: e.auditLog || e.audit_log || []
19560
19600
  };
19561
19601
  }
19562
- function Xw(e = {}) {
19602
+ function Qw(e = {}) {
19563
19603
  let t = G(), { skip: n, limit: r, activeOnly: i, search: a } = e;
19564
19604
  return C({
19565
19605
  queryKey: ["groups", e],
@@ -19567,13 +19607,13 @@ function Xw(e = {}) {
19567
19607
  let e = { user_type: "USERGROUP" };
19568
19608
  if (i !== void 0 && (e.active = i), a && a.trim()) {
19569
19609
  let n = await t.get("/users/", { params: e }), r = a.trim().toLowerCase();
19570
- return (n.data ?? []).map(Yw).filter((e) => (e.name ?? "").toLowerCase().includes(r) || (e.description ?? "").toLowerCase().includes(r) || e.id.toLowerCase().includes(r));
19610
+ return (n.data ?? []).map(Zw).filter((e) => (e.name ?? "").toLowerCase().includes(r) || (e.description ?? "").toLowerCase().includes(r) || e.id.toLowerCase().includes(r));
19571
19611
  }
19572
- return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), ((await t.get("/users/", { params: e })).data ?? []).map(Yw);
19612
+ return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), ((await t.get("/users/", { params: e })).data ?? []).map(Zw);
19573
19613
  }
19574
19614
  });
19575
19615
  }
19576
- function Zw(e = {}) {
19616
+ function $w(e = {}) {
19577
19617
  let t = G(), { activeOnly: n } = e;
19578
19618
  return C({
19579
19619
  queryKey: [
@@ -19587,15 +19627,15 @@ function Zw(e = {}) {
19587
19627
  }
19588
19628
  });
19589
19629
  }
19590
- function Qw(e) {
19630
+ function eT(e) {
19591
19631
  let t = G();
19592
19632
  return C({
19593
19633
  queryKey: ["groups", e],
19594
- queryFn: async () => (await t.get(`/users/${e}`)).data,
19634
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}`)).data,
19595
19635
  enabled: !!e
19596
19636
  });
19597
19637
  }
19598
- function $w(e) {
19638
+ function tT(e) {
19599
19639
  let t = G();
19600
19640
  return C({
19601
19641
  queryKey: [
@@ -19603,7 +19643,7 @@ function $w(e) {
19603
19643
  e,
19604
19644
  "members"
19605
19645
  ],
19606
- queryFn: async () => ((await t.get(`/usergroups/${e}/members`)).data.members ?? []).map((e) => ({
19646
+ queryFn: async () => ((await t.get(`/usergroups/${encodeURIComponent(e)}/members`)).data.members ?? []).map((e) => ({
19607
19647
  id: e.id,
19608
19648
  name: [e.first_name, e.last_name].filter(Boolean).join(" ") || e.id,
19609
19649
  email: e.email,
@@ -19612,52 +19652,56 @@ function $w(e) {
19612
19652
  enabled: !!e
19613
19653
  });
19614
19654
  }
19615
- function eT() {
19616
- let e = G(), t = w();
19655
+ function nT() {
19656
+ let e = G(), t = Jy(), n = w();
19617
19657
  return S({
19618
- mutationFn: async (t) => {
19619
- let n = t.id || t.name || "", r = t.description ?? "", i = {
19620
- id: n,
19658
+ mutationFn: async (n) => {
19659
+ let r = (n.id || n.name || "").trim(), i = n.description ?? "", a = {
19660
+ id: r,
19621
19661
  type: "USERGROUP",
19622
- active: t.active ?? !0,
19623
- expression: t.expression ?? null,
19662
+ active: n.active ?? !0,
19663
+ expression: n.expression ?? null,
19624
19664
  manager_id: null,
19625
- parent_group_id: t.parent_group_id ?? null,
19626
- owner_id: t.owner_id ?? null,
19627
- description: r,
19665
+ parent_group_id: n.parent_group_id ?? null,
19666
+ owner_id: n.owner_id ?? null,
19667
+ description: i,
19628
19668
  user_metadata: {
19629
- name: t.name ?? n,
19630
- description: r
19669
+ name: n.name ?? r,
19670
+ description: i
19631
19671
  }
19632
- };
19633
- return (await e.post("/users/", i)).data;
19672
+ }, o = { performed_by: iw(t) };
19673
+ return (await e.post("/users/", a, { params: o })).data;
19634
19674
  },
19635
- onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19675
+ onSuccess: () => n.invalidateQueries({ queryKey: ["groups"] })
19636
19676
  });
19637
19677
  }
19638
- function tT() {
19639
- let e = G(), t = w();
19678
+ function rT() {
19679
+ let e = G(), t = Jy(), n = w();
19640
19680
  return S({
19641
- mutationFn: async (t) => (await e.put(`/users/${t.id}`, t)).data,
19642
- onSuccess: (e, n) => {
19643
- t.invalidateQueries({ queryKey: ["groups"] }), t.invalidateQueries({ queryKey: ["groups", n.id] });
19681
+ mutationFn: async (n) => {
19682
+ let r = { performed_by: iw(t) };
19683
+ return (await e.put(`/users/${encodeURIComponent(n.id)}`, n, { params: r })).data;
19684
+ },
19685
+ onSuccess: (e, t) => {
19686
+ n.invalidateQueries({ queryKey: ["groups"] }), n.invalidateQueries({ queryKey: ["groups", t.id] });
19644
19687
  }
19645
19688
  });
19646
19689
  }
19647
- function nT() {
19648
- let e = G(), t = w();
19690
+ function iT() {
19691
+ let e = G(), t = Jy(), n = w();
19649
19692
  return S({
19650
- mutationFn: async (t) => {
19651
- await e.delete(`/users/${t}`);
19693
+ mutationFn: async (n) => {
19694
+ let r = { performed_by: iw(t) };
19695
+ await e.delete(`/users/${encodeURIComponent(n)}`, { params: r });
19652
19696
  },
19653
- onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19697
+ onSuccess: () => n.invalidateQueries({ queryKey: ["groups"] })
19654
19698
  });
19655
19699
  }
19656
- function rT() {
19700
+ function aT() {
19657
19701
  let e = G(), t = w();
19658
19702
  return S({
19659
19703
  mutationFn: async ({ groupId: t, userId: n }) => {
19660
- await e.post(`/usergroups/${t}/members`, { user_id: n });
19704
+ await e.post(`/usergroups/${encodeURIComponent(t)}/members`, { user_id: n });
19661
19705
  },
19662
19706
  onSuccess: (e, { groupId: n }) => t.invalidateQueries({ queryKey: [
19663
19707
  "groups",
@@ -19666,11 +19710,11 @@ function rT() {
19666
19710
  ] })
19667
19711
  });
19668
19712
  }
19669
- function iT() {
19713
+ function oT() {
19670
19714
  let e = G(), t = w();
19671
19715
  return S({
19672
19716
  mutationFn: async ({ groupId: t, userId: n }) => {
19673
- await e.delete(`/usergroups/${t}/members/${n}`);
19717
+ await e.delete(`/usergroups/${encodeURIComponent(t)}/members/${encodeURIComponent(n)}`);
19674
19718
  },
19675
19719
  onSuccess: (e, { groupId: n }) => t.invalidateQueries({ queryKey: [
19676
19720
  "groups",
@@ -19681,14 +19725,14 @@ function iT() {
19681
19725
  }
19682
19726
  //#endregion
19683
19727
  //#region src/components/dialogs/GroupDialog.tsx
19684
- var aT = JC({
19728
+ var sT = JC({
19685
19729
  name: KC().min(1, "Name is required"),
19686
19730
  description: KC().optional(),
19687
19731
  expression: KC().min(1, "Expression is required")
19688
19732
  });
19689
- function oT({ open: e, onClose: t, group: n }) {
19690
- let r = !!n, i = eT(), a = tT(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19691
- resolver: gS(aT),
19733
+ function cT({ open: e, onClose: t, group: n }) {
19734
+ let r = !!n, i = nT(), a = rT(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19735
+ resolver: gS(sT),
19692
19736
  defaultValues: {
19693
19737
  name: "",
19694
19738
  description: "",
@@ -19719,7 +19763,7 @@ function oT({ open: e, onClose: t, group: n }) {
19719
19763
  function m() {
19720
19764
  f(), t();
19721
19765
  }
19722
- let { data: h = [], isLoading: v } = $w(r ? n.id : ""), { data: y = [], isLoading: b } = Cw(r ? n.id : "");
19766
+ let { data: h = [], isLoading: v } = tT(r ? n.id : ""), { data: y = [], isLoading: b } = ww(r ? n.id : "");
19723
19767
  return /* @__PURE__ */ g(XC, {
19724
19768
  open: e,
19725
19769
  onOpenChange: (e) => !e && m(),
@@ -19777,7 +19821,7 @@ function oT({ open: e, onClose: t, group: n }) {
19777
19821
  ...o("description")
19778
19822
  })]
19779
19823
  }),
19780
- /* @__PURE__ */ g(Jw, {
19824
+ /* @__PURE__ */ g(Xw, {
19781
19825
  type: "user",
19782
19826
  value: l("expression"),
19783
19827
  onChange: (e) => u("expression", e),
@@ -19853,12 +19897,12 @@ function oT({ open: e, onClose: t, group: n }) {
19853
19897
  }
19854
19898
  //#endregion
19855
19899
  //#region src/components/views/GroupsView.tsx
19856
- function sT() {
19857
- let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f(!1), [c, l] = f(), [u, d] = f(), { data: p = [], isLoading: m, isError: h, refetch: v } = Xw({
19900
+ function lT() {
19901
+ let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f(!1), [c, l] = f(), [u, d] = f(), { data: p = [], isLoading: m, isError: h, refetch: v } = Qw({
19858
19902
  skip: e,
19859
19903
  limit: n,
19860
19904
  search: i
19861
- }), { data: y = 0 } = Zw(), b = nT();
19905
+ }), { data: y = 0 } = $w(), b = iT();
19862
19906
  return /* @__PURE__ */ _("div", {
19863
19907
  className: "space-y-4",
19864
19908
  children: [
@@ -19935,7 +19979,7 @@ function sT() {
19935
19979
  t(e.pageIndex * e.pageSize), r(e.pageSize);
19936
19980
  }
19937
19981
  }),
19938
- /* @__PURE__ */ g(oT, {
19982
+ /* @__PURE__ */ g(cT, {
19939
19983
  open: o,
19940
19984
  onClose: () => {
19941
19985
  s(!1), l(void 0);
@@ -19957,7 +20001,7 @@ function sT() {
19957
20001
  }
19958
20002
  //#endregion
19959
20003
  //#region src/core/lib/expression.ts
19960
- function cT(e) {
20004
+ function uT(e) {
19961
20005
  if (!e) return [];
19962
20006
  let t = e.replace(/“/g, "\"").replace(/”/g, "\""), n = [], r = /([+-]?)\s*(".*?"|[^+-]+)/g, i, a = !0;
19963
20007
  for (; (i = r.exec(t)) !== null;) {
@@ -19972,13 +20016,13 @@ function cT(e) {
19972
20016
  }
19973
20017
  return n;
19974
20018
  }
19975
- function lT(e, t, n) {
20019
+ function dT(e, t, n) {
19976
20020
  if (!t) return !1;
19977
20021
  let r = /* @__PURE__ */ new Set();
19978
20022
  function i(t, a = 0) {
19979
20023
  if (a > 10) return !1;
19980
20024
  let o = !1;
19981
- for (let s of cT(t)) {
20025
+ for (let s of uT(t)) {
19982
20026
  let t = s.entity.trim();
19983
20027
  if (t === e) {
19984
20028
  o = s.type === "include";
@@ -19997,20 +20041,20 @@ function lT(e, t, n) {
19997
20041
  }
19998
20042
  //#endregion
19999
20043
  //#region src/core/hooks/useHierarchy.ts
20000
- function uT(e) {
20044
+ function fT(e) {
20001
20045
  return e.user_metadata?.name || e.name || e.id;
20002
20046
  }
20003
- function dT(e) {
20047
+ function pT(e) {
20004
20048
  return e.name || [e.first_name, e.last_name].filter(Boolean).join(" ") || e.id;
20005
20049
  }
20006
- function fT(e, t) {
20050
+ function mT(e, t) {
20007
20051
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
20008
20052
  for (let t of e) if (n.set(t.id, {
20009
20053
  id: t.id,
20010
- name: uT(t),
20054
+ name: fT(t),
20011
20055
  type: "USERGROUP",
20012
20056
  children: []
20013
- }), t.expression) for (let n of cT(t.expression)) {
20057
+ }), t.expression) for (let n of uT(t.expression)) {
20014
20058
  let i = n.entity.trim();
20015
20059
  n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
20016
20060
  }
@@ -20021,9 +20065,9 @@ function fT(e, t) {
20021
20065
  }
20022
20066
  let o = e.find((e) => e.id === i);
20023
20067
  if (!o?.expression) continue;
20024
- let s = t.filter((t) => lT(t.id, o.expression, e)).map((e) => ({
20068
+ let s = t.filter((t) => dT(t.id, o.expression, e)).map((e) => ({
20025
20069
  id: e.id,
20026
- name: dT(e),
20070
+ name: pT(e),
20027
20071
  type: "USER",
20028
20072
  children: [],
20029
20073
  email: e.email,
@@ -20036,9 +20080,9 @@ function fT(e, t) {
20036
20080
  name: "Groups",
20037
20081
  type: "USERGROUP",
20038
20082
  children: Array.from(n.values())
20039
- }], a = t.filter((t) => !e.some((n) => n.expression && lT(t.id, n.expression, e))).map((e) => ({
20083
+ }], a = t.filter((t) => !e.some((n) => n.expression && dT(t.id, n.expression, e))).map((e) => ({
20040
20084
  id: e.id,
20041
- name: dT(e),
20085
+ name: pT(e),
20042
20086
  type: "USER",
20043
20087
  children: [],
20044
20088
  email: e.email,
@@ -20051,24 +20095,24 @@ function fT(e, t) {
20051
20095
  children: a
20052
20096
  }), i;
20053
20097
  }
20054
- function pT() {
20098
+ function hT() {
20055
20099
  let e = G();
20056
20100
  return C({
20057
20101
  queryKey: ["hierarchy", "org"],
20058
20102
  queryFn: async () => (await e.get("/reporting/organization-chart")).data
20059
20103
  });
20060
20104
  }
20061
- function mT() {
20105
+ function gT() {
20062
20106
  let e = G();
20063
20107
  return C({
20064
20108
  queryKey: ["hierarchy", "combined"],
20065
20109
  queryFn: async () => {
20066
20110
  let [t, n] = await Promise.all([e.get("/users/", { params: { user_type: "USERGROUP" } }), e.get("/users/", { params: { user_type: "USER" } })]);
20067
- return fT(t.data ?? [], n.data ?? []);
20111
+ return mT(t.data ?? [], n.data ?? []);
20068
20112
  }
20069
20113
  });
20070
20114
  }
20071
- function hT(e, t) {
20115
+ function _T(e, t) {
20072
20116
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
20073
20117
  for (let t of e) if (n.set(t.id, {
20074
20118
  id: t.id,
@@ -20076,7 +20120,7 @@ function hT(e, t) {
20076
20120
  type: "RESOURCEGROUP",
20077
20121
  children: [],
20078
20122
  application: t.application
20079
- }), t.expression) for (let n of cT(t.expression)) {
20123
+ }), t.expression) for (let n of uT(t.expression)) {
20080
20124
  let i = n.entity.trim();
20081
20125
  n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
20082
20126
  }
@@ -20087,7 +20131,7 @@ function hT(e, t) {
20087
20131
  }
20088
20132
  let o = e.find((e) => e.id === i);
20089
20133
  if (!o?.expression) continue;
20090
- let s = t.filter((t) => lT(t.id, o.expression, e)).map((e) => ({
20134
+ let s = t.filter((t) => dT(t.id, o.expression, e)).map((e) => ({
20091
20135
  id: e.id,
20092
20136
  name: e.name || e.id,
20093
20137
  type: "RESOURCE",
@@ -20101,7 +20145,7 @@ function hT(e, t) {
20101
20145
  name: "Artifact Groups",
20102
20146
  type: "RESOURCEGROUP",
20103
20147
  children: Array.from(n.values())
20104
- }], a = t.filter((t) => !e.some((n) => n.expression && lT(t.id, n.expression, e))).map((e) => ({
20148
+ }], a = t.filter((t) => !e.some((n) => n.expression && dT(t.id, n.expression, e))).map((e) => ({
20105
20149
  id: e.id,
20106
20150
  name: e.name || e.id,
20107
20151
  type: "RESOURCE",
@@ -20115,25 +20159,25 @@ function hT(e, t) {
20115
20159
  children: a
20116
20160
  }), i;
20117
20161
  }
20118
- function gT() {
20162
+ function vT() {
20119
20163
  let e = G();
20120
20164
  return C({
20121
20165
  queryKey: ["hierarchy", "artifacts-combined"],
20122
20166
  queryFn: async () => {
20123
20167
  let [t, n] = await Promise.all([e.get("/artifacts/", { params: { artifact_type: "RESOURCEGROUP" } }), e.get("/artifacts/", { params: { artifact_type: "RESOURCE" } })]);
20124
- return hT(t.data ?? [], n.data ?? []);
20168
+ return _T(t.data ?? [], n.data ?? []);
20125
20169
  }
20126
20170
  });
20127
20171
  }
20128
20172
  //#endregion
20129
20173
  //#region src/components/views/UsersView.tsx
20130
- function _T() {
20131
- let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f("all"), [c, l] = f("users"), [u, d] = f(!1), [p, m] = f(), [h, v] = f(!1), [y, b] = f(), { data: x = [], isLoading: S, isError: C, refetch: w } = aw({
20174
+ function yT() {
20175
+ let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f("all"), [c, l] = f("users"), [u, d] = f(!1), [p, m] = f(), [h, v] = f(!1), [y, b] = f(), { data: x = [], isLoading: S, isError: C, refetch: w } = ow({
20132
20176
  skip: e,
20133
20177
  limit: n,
20134
20178
  search: i,
20135
20179
  activeOnly: o === "active" ? !0 : o === "inactive" ? !1 : void 0
20136
- }), { data: T = 0 } = ow({ search: i }), E = mw(), { data: D = [] } = mT();
20180
+ }), { data: T = 0 } = sw({ search: i }), E = hw(), { data: D = [] } = gT();
20137
20181
  return /* @__PURE__ */ _("div", {
20138
20182
  className: "space-y-4",
20139
20183
  children: [
@@ -20257,7 +20301,7 @@ function _T() {
20257
20301
  }),
20258
20302
  /* @__PURE__ */ g(Gh, {
20259
20303
  value: "groups",
20260
- children: /* @__PURE__ */ g(sT, {})
20304
+ children: /* @__PURE__ */ g(lT, {})
20261
20305
  }),
20262
20306
  /* @__PURE__ */ g(Gh, {
20263
20307
  value: "hierarchy",
@@ -20268,14 +20312,14 @@ function _T() {
20268
20312
  })
20269
20313
  ]
20270
20314
  }),
20271
- /* @__PURE__ */ g(Nw, {
20315
+ /* @__PURE__ */ g(Pw, {
20272
20316
  open: u,
20273
20317
  onClose: () => {
20274
20318
  d(!1), m(void 0);
20275
20319
  },
20276
20320
  user: p
20277
20321
  }),
20278
- /* @__PURE__ */ g(oT, {
20322
+ /* @__PURE__ */ g(cT, {
20279
20323
  open: h,
20280
20324
  onClose: () => v(!1)
20281
20325
  }),
@@ -20294,7 +20338,7 @@ function _T() {
20294
20338
  }
20295
20339
  //#endregion
20296
20340
  //#region src/components/dialogs/ArtifactDialog.tsx
20297
- var vT = JC({
20341
+ var bT = JC({
20298
20342
  name: KC().min(1, "Name is required"),
20299
20343
  description: KC().optional(),
20300
20344
  type: YC(["RESOURCE", "RESOURCEGROUP"]),
@@ -20302,9 +20346,9 @@ var vT = JC({
20302
20346
  expression: KC().optional(),
20303
20347
  status: YC(["Active", "Inactive"])
20304
20348
  });
20305
- function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin: i }) {
20306
- let a = !!n, o = Hw(), s = Uw(), { register: l, handleSubmit: u, watch: d, setValue: p, formState: { errors: m }, reset: h } = uS({
20307
- resolver: gS(vT),
20349
+ function xT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin: i }) {
20350
+ let a = !!n, o = Ww(), s = Gw(), { register: l, handleSubmit: u, watch: d, setValue: p, formState: { errors: m }, reset: h } = uS({
20351
+ resolver: gS(bT),
20308
20352
  defaultValues: {
20309
20353
  name: "",
20310
20354
  description: "",
@@ -20371,7 +20415,7 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20371
20415
  function ee() {
20372
20416
  h(), t();
20373
20417
  }
20374
- let N = a && n?.type === "RESOURCEGROUP", te = ww(!N && a ? n.id : ""), P = Tw(N ? n.id : ""), { data: ne = [], isLoading: re } = N ? P : te, ie = zw(N && a ? n.id : ""), ae = Bw(!N && a ? n.id : "");
20418
+ let N = a && n?.type === "RESOURCEGROUP", te = Tw(!N && a ? n.id : ""), P = Ew(N ? n.id : ""), { data: ne = [], isLoading: re } = N ? P : te, ie = Vw(N && a ? n.id : ""), ae = Hw(!N && a ? n.id : "");
20375
20419
  return /* @__PURE__ */ g(XC, {
20376
20420
  open: e,
20377
20421
  onOpenChange: (e) => !e && ee(),
@@ -20563,7 +20607,7 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20563
20607
  })
20564
20608
  ]
20565
20609
  }),
20566
- v === "RESOURCEGROUP" && /* @__PURE__ */ g(Jw, {
20610
+ v === "RESOURCEGROUP" && /* @__PURE__ */ g(Xw, {
20567
20611
  type: "resource",
20568
20612
  value: d("expression") ?? "",
20569
20613
  onChange: (e) => p("expression", e),
@@ -20657,19 +20701,30 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20657
20701
  }
20658
20702
  //#endregion
20659
20703
  //#region src/components/views/ArtifactsView.tsx
20660
- function bT() {
20661
- let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f("RESOURCE"), [u, d] = f("all"), [p, m] = f("all"), [h, v] = f(!1), [y, b] = f(), [x, S] = f(), { data: C = [] } = Vw(), w = t ? p === "all" ? void 0 : p : e, { data: T = [], isLoading: E, isError: D, refetch: O } = Pw({
20704
+ function ST() {
20705
+ let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f(0), [u, d] = f(20), [p, m] = f(""), [h, v] = f("RESOURCE"), [y, b] = f("all"), [x, S] = f("all"), [C, w] = f(!1), [T, E] = f(), [D, O] = f(), { data: k = [] } = Uw(), A = t ? x === "all" ? void 0 : x : e, j = y === "active" ? !0 : y === "inactive" ? !1 : void 0, { data: M = [], isLoading: ee, isError: N, refetch: te } = Iw({
20662
20706
  skip: n,
20663
20707
  limit: i,
20664
- type: c,
20665
- appName: w,
20666
- activeOnly: u === "active" ? !0 : u === "inactive" ? !1 : void 0,
20708
+ type: "RESOURCE",
20709
+ appName: A,
20710
+ activeOnly: j,
20667
20711
  search: o
20668
- }), { data: k = 0 } = Fw({
20669
- type: c,
20670
- appName: w,
20712
+ }), { data: P = 0 } = Lw({
20713
+ type: "RESOURCE",
20714
+ appName: A,
20671
20715
  search: o
20672
- }), A = Ww(), { data: j = [] } = gT(), M = [
20716
+ }), { data: ne = [], isLoading: re, isError: ie, refetch: ae } = Iw({
20717
+ skip: c,
20718
+ limit: u,
20719
+ type: "RESOURCEGROUP",
20720
+ appName: A,
20721
+ activeOnly: j,
20722
+ search: p
20723
+ }), { data: oe = 0 } = Lw({
20724
+ type: "RESOURCEGROUP",
20725
+ appName: A,
20726
+ search: p
20727
+ }), se = Kw(), { data: ce = [] } = vT(), le = [
20673
20728
  {
20674
20729
  accessorKey: "name",
20675
20730
  header: "Name"
@@ -20700,27 +20755,27 @@ function bT() {
20700
20755
  variant: "ghost",
20701
20756
  size: "icon",
20702
20757
  onClick: () => {
20703
- b(e.original), v(!0);
20758
+ E(e.original), w(!0);
20704
20759
  },
20705
20760
  children: /* @__PURE__ */ g(ye, { className: "h-4 w-4" })
20706
20761
  }), /* @__PURE__ */ g(qh, {
20707
20762
  variant: "ghost",
20708
20763
  size: "icon",
20709
- onClick: () => S(e.original),
20764
+ onClick: () => O(e.original),
20710
20765
  children: /* @__PURE__ */ g(Ce, { className: "h-4 w-4 text-destructive" })
20711
20766
  })]
20712
20767
  })
20713
20768
  }
20714
- ], ee = t ? /* @__PURE__ */ _(db, {
20715
- value: p,
20716
- onValueChange: m,
20769
+ ], F = t ? /* @__PURE__ */ _(db, {
20770
+ value: x,
20771
+ onValueChange: S,
20717
20772
  children: [/* @__PURE__ */ g(pb, {
20718
20773
  className: "h-8 w-40",
20719
20774
  children: /* @__PURE__ */ g(fb, { placeholder: "All applications" })
20720
20775
  }), /* @__PURE__ */ _(mb, { children: [/* @__PURE__ */ g(hb, {
20721
20776
  value: "all",
20722
20777
  children: "All applications"
20723
- }), C.map((e) => /* @__PURE__ */ g(hb, {
20778
+ }), k.map((e) => /* @__PURE__ */ g(hb, {
20724
20779
  value: e,
20725
20780
  children: e
20726
20781
  }, e))] })]
@@ -20731,7 +20786,7 @@ function bT() {
20731
20786
  /* @__PURE__ */ _(Vh, {
20732
20787
  defaultValue: "resources",
20733
20788
  onValueChange: (e) => {
20734
- e === "resources" ? l("RESOURCE") : e === "groups" && l("RESOURCEGROUP");
20789
+ e === "resources" ? v("RESOURCE") : e === "groups" && v("RESOURCEGROUP");
20735
20790
  },
20736
20791
  children: [
20737
20792
  /* @__PURE__ */ _("div", {
@@ -20751,18 +20806,18 @@ function bT() {
20751
20806
  })
20752
20807
  ] }), /* @__PURE__ */ _(qh, {
20753
20808
  onClick: () => {
20754
- b(void 0), v(!0);
20809
+ E(void 0), w(!0);
20755
20810
  },
20756
20811
  children: [
20757
20812
  /* @__PURE__ */ g(ge, { className: "mr-2 h-4 w-4" }),
20758
20813
  " Add ",
20759
- c === "RESOURCE" ? "Artifact" : "Group"
20814
+ h === "RESOURCE" ? "Artifact" : "Group"
20760
20815
  ]
20761
20816
  })]
20762
20817
  }),
20763
20818
  /* @__PURE__ */ g(Gh, {
20764
20819
  value: "resources",
20765
- children: D ? /* @__PURE__ */ _("div", {
20820
+ children: N ? /* @__PURE__ */ _("div", {
20766
20821
  className: "rounded-md border border-destructive/50 p-4 flex items-center justify-between",
20767
20822
  children: [/* @__PURE__ */ g("span", {
20768
20823
  className: "text-sm text-destructive",
@@ -20770,86 +20825,103 @@ function bT() {
20770
20825
  }), /* @__PURE__ */ g(qh, {
20771
20826
  variant: "outline",
20772
20827
  size: "sm",
20773
- onClick: () => O(),
20828
+ onClick: () => te(),
20774
20829
  children: "Retry"
20775
20830
  })]
20776
20831
  }) : /* @__PURE__ */ g(yb, {
20777
- columns: M,
20778
- data: T,
20779
- totalCount: k,
20780
- isLoading: E,
20832
+ columns: le,
20833
+ data: M,
20834
+ totalCount: P,
20835
+ isLoading: ee,
20781
20836
  emptyMessage: "No artifacts found",
20782
20837
  searchPlaceholder: "Search artifacts...",
20838
+ searchValue: o,
20783
20839
  onSearchChange: (e) => {
20784
20840
  s(e), r(0);
20785
20841
  },
20786
20842
  onPaginationChange: (e) => {
20787
20843
  r(e.pageIndex * e.pageSize), a(e.pageSize);
20788
20844
  },
20789
- statusFilter: u,
20845
+ statusFilter: y,
20790
20846
  onStatusFilterChange: (e) => {
20791
- d(e), r(0);
20847
+ b(e), r(0);
20792
20848
  },
20793
- toolbar: ee
20849
+ toolbar: F
20794
20850
  })
20795
20851
  }),
20796
20852
  /* @__PURE__ */ g(Gh, {
20797
20853
  value: "groups",
20798
- children: /* @__PURE__ */ g(yb, {
20799
- columns: M,
20800
- data: T,
20801
- totalCount: k,
20802
- isLoading: E,
20854
+ children: ie ? /* @__PURE__ */ _("div", {
20855
+ className: "rounded-md border border-destructive/50 p-4 flex items-center justify-between",
20856
+ children: [/* @__PURE__ */ g("span", {
20857
+ className: "text-sm text-destructive",
20858
+ children: "Failed to load artifact groups"
20859
+ }), /* @__PURE__ */ g(qh, {
20860
+ variant: "outline",
20861
+ size: "sm",
20862
+ onClick: () => ae(),
20863
+ children: "Retry"
20864
+ })]
20865
+ }) : /* @__PURE__ */ g(yb, {
20866
+ columns: le,
20867
+ data: ne,
20868
+ totalCount: oe,
20869
+ isLoading: re,
20803
20870
  emptyMessage: "No artifact groups found",
20871
+ searchPlaceholder: "Search artifact groups...",
20872
+ searchValue: p,
20873
+ onSearchChange: (e) => {
20874
+ m(e), l(0);
20875
+ },
20804
20876
  onPaginationChange: (e) => {
20805
- r(e.pageIndex * e.pageSize), a(e.pageSize);
20877
+ l(e.pageIndex * e.pageSize), d(e.pageSize);
20806
20878
  },
20807
- statusFilter: u,
20879
+ statusFilter: y,
20808
20880
  onStatusFilterChange: (e) => {
20809
- d(e), r(0);
20881
+ b(e), l(0);
20810
20882
  },
20811
- toolbar: ee
20883
+ toolbar: F
20812
20884
  })
20813
20885
  }),
20814
20886
  /* @__PURE__ */ g(Gh, {
20815
20887
  value: "hierarchy",
20816
20888
  children: /* @__PURE__ */ g(Rb, {
20817
- nodes: j,
20889
+ nodes: ce,
20818
20890
  searchable: !0
20819
20891
  })
20820
20892
  })
20821
20893
  ]
20822
20894
  }),
20823
- /* @__PURE__ */ g(yT, {
20824
- open: h,
20895
+ /* @__PURE__ */ g(xT, {
20896
+ open: C,
20825
20897
  onClose: () => {
20826
- v(!1), b(void 0);
20898
+ w(!1), E(void 0);
20827
20899
  },
20828
- artifact: y,
20900
+ artifact: T,
20829
20901
  currentApplication: e,
20830
20902
  isAdmin: t
20831
20903
  }),
20832
20904
  /* @__PURE__ */ g(Ab, {
20833
- open: !!x,
20905
+ open: !!D,
20834
20906
  title: "Delete Artifact",
20835
- description: `Delete "${x?.name}"? This cannot be undone.`,
20907
+ description: `Delete "${D?.name}"? This cannot be undone.`,
20836
20908
  confirmLabel: "Delete",
20837
20909
  onConfirm: async () => {
20838
- x && await A.mutateAsync(x.id), S(void 0);
20910
+ D && await se.mutateAsync(D.id), O(void 0);
20839
20911
  },
20840
- onCancel: () => S(void 0)
20912
+ onCancel: () => O(void 0)
20841
20913
  })
20842
20914
  ]
20843
20915
  });
20844
20916
  }
20845
20917
  //#endregion
20846
20918
  //#region src/components/dialogs/AccessRuleDialog.tsx
20847
- var xT = [
20919
+ var CT = [
20848
20920
  "Read",
20849
20921
  "Write",
20850
20922
  "Execute",
20851
20923
  "Export"
20852
- ], ST = JC({
20924
+ ], wT = JC({
20853
20925
  name: KC().min(1, "Name is required"),
20854
20926
  description: KC().optional(),
20855
20927
  userExpression: KC().min(1, "User expression is required"),
@@ -20862,9 +20934,9 @@ var xT = [
20862
20934
  startTime: KC().optional(),
20863
20935
  endTime: KC().optional()
20864
20936
  });
20865
- function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i }) {
20866
- let a = !!n, o = Ow(), s = kw(), [l, u] = f(xT), [d, p] = f(""), { register: m, handleSubmit: h, watch: v, setValue: y, formState: { errors: b }, reset: x } = uS({
20867
- resolver: gS(ST),
20937
+ function TT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i }) {
20938
+ let a = !!n, o = kw(), s = Aw(), [l, u] = f(CT), [d, p] = f(""), { register: m, handleSubmit: h, watch: v, setValue: y, formState: { errors: b }, reset: x } = uS({
20939
+ resolver: gS(wT),
20868
20940
  defaultValues: {
20869
20941
  name: "",
20870
20942
  description: "",
@@ -20881,8 +20953,8 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
20881
20953
  });
20882
20954
  c(() => {
20883
20955
  if (e) {
20884
- let e = (n?.permissions ?? []).filter((e) => !xT.includes(e));
20885
- u(e.length ? [...xT, ...e] : xT), p(""), x({
20956
+ let e = (n?.permissions ?? []).filter((e) => !CT.includes(e));
20957
+ u(e.length ? [...CT, ...e] : CT), p(""), x({
20886
20958
  name: n?.name ?? "",
20887
20959
  description: n?.description ?? "",
20888
20960
  userExpression: n?.userExpression ?? "",
@@ -20975,7 +21047,7 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
20975
21047
  ...m("description")
20976
21048
  })]
20977
21049
  }),
20978
- /* @__PURE__ */ g(Jw, {
21050
+ /* @__PURE__ */ g(Xw, {
20979
21051
  type: "user",
20980
21052
  value: v("userExpression"),
20981
21053
  onChange: (e) => y("userExpression", e),
@@ -20988,7 +21060,7 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
20988
21060
  className: "text-xs text-destructive",
20989
21061
  children: b.userExpression.message
20990
21062
  }),
20991
- /* @__PURE__ */ g(Jw, {
21063
+ /* @__PURE__ */ g(Xw, {
20992
21064
  type: "resource",
20993
21065
  value: v("resourceExpression"),
20994
21066
  onChange: (e) => y("resourceExpression", e),
@@ -21137,18 +21209,18 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
21137
21209
  }
21138
21210
  //#endregion
21139
21211
  //#region src/components/views/AccessRulesView.tsx
21140
- function wT() {
21141
- let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f("all"), [u, d] = f("all"), [p, m] = f(!1), [h, v] = f(), [y, b] = f(), { data: x = [] } = Vw(), S = t ? u === "all" ? void 0 : u : e, C = c === "active" ? !0 : c === "inactive" ? !1 : void 0, { data: w = [], isLoading: T, isError: E, refetch: D } = gw({
21212
+ function ET() {
21213
+ let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f("all"), [u, d] = f("all"), [p, m] = f(!1), [h, v] = f(), [y, b] = f(), { data: x = [] } = Uw(), S = t ? u === "all" ? void 0 : u : e, C = c === "active" ? !0 : c === "inactive" ? !1 : void 0, { data: w = [], isLoading: T, isError: E, refetch: D } = _w({
21142
21214
  skip: n,
21143
21215
  limit: i,
21144
21216
  appName: S,
21145
21217
  activeOnly: C,
21146
21218
  search: o
21147
- }), { data: O = 0 } = _w({
21219
+ }), { data: O = 0 } = vw({
21148
21220
  search: o,
21149
21221
  appName: S,
21150
21222
  activeOnly: C
21151
- }), k = Aw(), A = [
21223
+ }), k = jw(), A = [
21152
21224
  {
21153
21225
  accessorKey: "name",
21154
21226
  header: "Name"
@@ -21274,7 +21346,7 @@ function wT() {
21274
21346
  },
21275
21347
  toolbar: j
21276
21348
  }),
21277
- /* @__PURE__ */ g(CT, {
21349
+ /* @__PURE__ */ g(TT, {
21278
21350
  open: p,
21279
21351
  onClose: () => {
21280
21352
  m(!1), v(void 0);
@@ -21298,7 +21370,7 @@ function wT() {
21298
21370
  }
21299
21371
  //#endregion
21300
21372
  //#region src/MedhaOneAccess.tsx
21301
- var TT = [
21373
+ var DT = [
21302
21374
  {
21303
21375
  id: "users",
21304
21376
  label: "Users",
@@ -21315,7 +21387,7 @@ var TT = [
21315
21387
  Icon: Se
21316
21388
  }
21317
21389
  ];
21318
- function ET() {
21390
+ function OT() {
21319
21391
  let [e, t] = f("users");
21320
21392
  return /* @__PURE__ */ _("div", {
21321
21393
  className: "flex h-full bg-background",
@@ -21328,7 +21400,7 @@ function ET() {
21328
21400
  className: "text-sm font-bold text-slate-600 uppercase tracking-wider",
21329
21401
  children: "Access Control"
21330
21402
  })
21331
- }), TT.map(({ id: n, label: r, Icon: i }) => /* @__PURE__ */ _("button", {
21403
+ }), DT.map(({ id: n, label: r, Icon: i }) => /* @__PURE__ */ _("button", {
21332
21404
  onClick: () => t(n),
21333
21405
  className: H("flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium transition-colors text-left w-full", e === n ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-background/60 hover:text-foreground"),
21334
21406
  children: [/* @__PURE__ */ g(i, { className: "h-4 w-4 shrink-0" }), r]
@@ -21339,9 +21411,9 @@ function ET() {
21339
21411
  children: /* @__PURE__ */ _("div", {
21340
21412
  className: "max-w-7xl mx-auto",
21341
21413
  children: [
21342
- e === "users" && /* @__PURE__ */ g(_T, {}),
21343
- e === "artifacts" && /* @__PURE__ */ g(bT, {}),
21344
- e === "access-rules" && /* @__PURE__ */ g(wT, {})
21414
+ e === "users" && /* @__PURE__ */ g(yT, {}),
21415
+ e === "artifacts" && /* @__PURE__ */ g(ST, {}),
21416
+ e === "access-rules" && /* @__PURE__ */ g(ET, {})
21345
21417
  ]
21346
21418
  })
21347
21419
  }),
@@ -21353,6 +21425,6 @@ function ET() {
21353
21425
  });
21354
21426
  }
21355
21427
  //#endregion
21356
- export { CT as AccessRuleDialog, wT as AccessRulesView, yT as ArtifactDialog, bT as ArtifactsView, Yh as Badge, qh as Button, Ab as ConfirmDialog, yb as DataTable, Jw as ExpressionInput, oT as GroupDialog, sT as GroupsView, Rb as HierarchyTree, ub as Input, rw as Label, ET as MedhaOneAccess, Xy as MedhaOneAccessProvider, Nw as UserDialog, _T as UsersView, H as cn, Wy as generateToken, vw as useAccessRule, gw as useAccessRules, _w as useAccessRulesCount, rT as useAddGroupMember, Iw as useArtifact, ww as useArtifactAccess, gT as useArtifactCombinedHierarchy, Rw as useArtifactGroup, Tw as useArtifactGroupAccess, zw as useArtifactGroupContents, Lw as useArtifactGroups, Pw as useArtifacts, Fw as useArtifactsCount, yw as useCheckAccess, mT as useCombinedHierarchy, Ow as useCreateAccessRule, Hw as useCreateArtifact, eT as useCreateGroup, fw as useCreateUser, Aw as useDeleteAccessRule, Ww as useDeleteArtifact, nT as useDeleteGroup, mw as useDeleteUser, uw as useDepartments, Qw as useGroup, $w as useGroupMembers, Xw as useGroups, Zw as useGroupsCount, Bw as useGroupsForArtifact, Jy as useMedhaConfig, G as useMedhaHttp, pT as useOrgChart, iT as useRemoveGroupMember, dw as useRoles, Vw as useUniqueApplications, kw as useUpdateAccessRule, Uw as useUpdateArtifact, tT as useUpdateGroup, pw as useUpdateUser, sw as useUser, Sw as useUserAccess, Cw as useUserGroupAccess, lw as useUserGroups, aw as useUsers, ow as useUsersCount, Ew as useValidateExpression };
21428
+ export { TT as AccessRuleDialog, ET as AccessRulesView, xT as ArtifactDialog, ST as ArtifactsView, Yh as Badge, qh as Button, Ab as ConfirmDialog, yb as DataTable, Xw as ExpressionInput, cT as GroupDialog, lT as GroupsView, Rb as HierarchyTree, ub as Input, rw as Label, OT as MedhaOneAccess, Xy as MedhaOneAccessProvider, Pw as UserDialog, yT as UsersView, H as cn, Wy as generateToken, yw as useAccessRule, _w as useAccessRules, vw as useAccessRulesCount, aT as useAddGroupMember, Rw as useArtifact, Tw as useArtifactAccess, vT as useArtifactCombinedHierarchy, Bw as useArtifactGroup, Ew as useArtifactGroupAccess, Vw as useArtifactGroupContents, zw as useArtifactGroups, Iw as useArtifacts, Lw as useArtifactsCount, bw as useCheckAccess, gT as useCombinedHierarchy, kw as useCreateAccessRule, Ww as useCreateArtifact, nT as useCreateGroup, pw as useCreateUser, jw as useDeleteAccessRule, Kw as useDeleteArtifact, iT as useDeleteGroup, hw as useDeleteUser, dw as useDepartments, eT as useGroup, tT as useGroupMembers, Qw as useGroups, $w as useGroupsCount, Hw as useGroupsForArtifact, Jy as useMedhaConfig, G as useMedhaHttp, hT as useOrgChart, oT as useRemoveGroupMember, fw as useRoles, Uw as useUniqueApplications, Aw as useUpdateAccessRule, Gw as useUpdateArtifact, rT as useUpdateGroup, mw as useUpdateUser, cw as useUser, Cw as useUserAccess, ww as useUserGroupAccess, uw as useUserGroups, ow as useUsers, sw as useUsersCount, Dw as useValidateExpression };
21357
21429
 
21358
21430
  //# sourceMappingURL=index.js.map