@medha-analytics/medha-one-access-react 1.0.10 → 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
@@ -18639,8 +18639,13 @@ function rw({ className: e, ...t }) {
18639
18639
  });
18640
18640
  }
18641
18641
  //#endregion
18642
- //#region src/core/hooks/useUsers.ts
18642
+ //#region src/core/lib/performed-by.ts
18643
18643
  function iw(e) {
18644
+ return e.currentUserEmail;
18645
+ }
18646
+ //#endregion
18647
+ //#region src/core/hooks/useUsers.ts
18648
+ function aw(e) {
18644
18649
  let t = e.user_metadata ?? {};
18645
18650
  return {
18646
18651
  ...e,
@@ -18649,10 +18654,12 @@ function iw(e) {
18649
18654
  email: e.email || t.email || "",
18650
18655
  department: e.department || t.department || "",
18651
18656
  role: e.role || t.role || "",
18652
- 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 || []
18653
18660
  };
18654
18661
  }
18655
- function aw(e = {}) {
18662
+ function ow(e = {}) {
18656
18663
  let t = G(), { skip: n, limit: r, activeOnly: i, search: a } = e;
18657
18664
  return C({
18658
18665
  queryKey: ["users", e],
@@ -18660,11 +18667,11 @@ function aw(e = {}) {
18660
18667
  let e = { user_type: "USER" };
18661
18668
  n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i);
18662
18669
  let o = a && a.trim() ? "/users/search" : "/users/";
18663
- 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);
18664
18671
  }
18665
18672
  });
18666
18673
  }
18667
- function ow(e = {}) {
18674
+ function sw(e = {}) {
18668
18675
  let t = G(), { activeOnly: n, search: r } = e;
18669
18676
  return C({
18670
18677
  queryKey: [
@@ -18678,7 +18685,7 @@ function ow(e = {}) {
18678
18685
  }
18679
18686
  });
18680
18687
  }
18681
- function sw(e) {
18688
+ function cw(e) {
18682
18689
  let t = G();
18683
18690
  return C({
18684
18691
  queryKey: ["users", e],
@@ -18686,7 +18693,7 @@ function sw(e) {
18686
18693
  enabled: !!e
18687
18694
  });
18688
18695
  }
18689
- function cw() {
18696
+ function lw() {
18690
18697
  let e = G();
18691
18698
  return C({
18692
18699
  queryKey: ["users", "all-groups"],
@@ -18699,7 +18706,7 @@ function cw() {
18699
18706
  })
18700
18707
  });
18701
18708
  }
18702
- function lw(e) {
18709
+ function uw(e) {
18703
18710
  let t = G();
18704
18711
  return C({
18705
18712
  queryKey: [
@@ -18711,7 +18718,7 @@ function lw(e) {
18711
18718
  enabled: !!e
18712
18719
  });
18713
18720
  }
18714
- function uw() {
18721
+ function dw() {
18715
18722
  let e = G();
18716
18723
  return C({
18717
18724
  queryKey: ["users", "departments"],
@@ -18721,7 +18728,7 @@ function uw() {
18721
18728
  }
18722
18729
  });
18723
18730
  }
18724
- function dw() {
18731
+ function fw() {
18725
18732
  let e = G();
18726
18733
  return C({
18727
18734
  queryKey: ["users", "roles"],
@@ -18731,65 +18738,71 @@ function dw() {
18731
18738
  }
18732
18739
  });
18733
18740
  }
18734
- function fw() {
18735
- let e = G(), t = w();
18741
+ function pw() {
18742
+ let e = G(), t = Jy(), n = w();
18736
18743
  return S({
18737
- mutationFn: async (t) => {
18738
- let n = (t.id || t.email || "").trim(), r = t.first_name ?? "", i = t.last_name ?? "", a = t.email ?? "", o = t.department ?? "", s = t.role ?? "", c = t.manager_id || null, l = {
18739
- type: t.type ?? "USER",
18740
- active: t.active ?? !0,
18741
- id: n,
18742
- first_name: r,
18743
- last_name: i,
18744
- email: a,
18745
- department: o,
18746
- role: s,
18747
- manager_id: c,
18748
- parent_group_id: t.parent_group_id ?? null,
18749
- owner_id: t.owner_id ?? null,
18750
- 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,
18751
18758
  user_metadata: {
18752
- name: `${r} ${i}`.trim(),
18753
- first_name: r,
18754
- last_name: i,
18755
- email: a,
18756
- department: o,
18757
- role: s,
18758
- 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
18759
18766
  }
18760
- };
18761
- return (await e.post("/users/", l)).data;
18767
+ }, d = { performed_by: iw(t) };
18768
+ return (await e.post("/users/", u, { params: d })).data;
18762
18769
  },
18763
- onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18770
+ onSuccess: () => n.invalidateQueries({ queryKey: ["users"] })
18764
18771
  });
18765
18772
  }
18766
- function pw() {
18767
- let e = G(), t = w();
18773
+ function mw() {
18774
+ let e = G(), t = Jy(), n = w();
18768
18775
  return S({
18769
- mutationFn: async (t) => (await e.put(`/users/${encodeURIComponent(t.id)}`, t)).data,
18770
- onSuccess: (e, n) => {
18771
- 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] });
18772
18782
  }
18773
18783
  });
18774
18784
  }
18775
- function mw() {
18776
- let e = G(), t = w();
18785
+ function hw() {
18786
+ let e = G(), t = Jy(), n = w();
18777
18787
  return S({
18778
- mutationFn: async (t) => {
18779
- await e.delete(`/users/${encodeURIComponent(t)}`);
18788
+ mutationFn: async (n) => {
18789
+ let r = { performed_by: iw(t) };
18790
+ await e.delete(`/users/${encodeURIComponent(n)}`, { params: r });
18780
18791
  },
18781
- onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18792
+ onSuccess: () => n.invalidateQueries({ queryKey: ["users"] })
18782
18793
  });
18783
18794
  }
18784
18795
  //#endregion
18785
18796
  //#region src/core/hooks/useAccessRules.ts
18786
- function hw(e) {
18797
+ function gw(e) {
18787
18798
  let t = e.time_constraints;
18788
18799
  return {
18789
18800
  ...e,
18790
18801
  userExpression: e.userExpression ?? e.user_expression ?? "",
18791
18802
  resourceExpression: e.resourceExpression ?? e.resource_expression ?? "",
18792
18803
  status: e.status ?? (e.active ? "Active" : "Inactive"),
18804
+ lifecycleStatus: e.lifecycleStatus || e.status || "live",
18805
+ auditLog: e.auditLog || e.audit_log || [],
18793
18806
  timeConstraints: t ? {
18794
18807
  startDate: t.start_date,
18795
18808
  endDate: t.end_date,
@@ -18799,7 +18812,7 @@ function hw(e) {
18799
18812
  } : void 0
18800
18813
  };
18801
18814
  }
18802
- function gw(e = {}) {
18815
+ function _w(e = {}) {
18803
18816
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, search: o } = e;
18804
18817
  return C({
18805
18818
  queryKey: ["access-rules", e],
@@ -18807,11 +18820,11 @@ function gw(e = {}) {
18807
18820
  let e = {};
18808
18821
  n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a);
18809
18822
  let s = o && o.trim() ? "/access-rules/search" : "/access-rules/";
18810
- 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);
18811
18824
  }
18812
18825
  });
18813
18826
  }
18814
- function _w(e = {}) {
18827
+ function vw(e = {}) {
18815
18828
  let t = G(), { appName: n, search: r, activeOnly: i } = e;
18816
18829
  return C({
18817
18830
  queryKey: [
@@ -18825,15 +18838,15 @@ function _w(e = {}) {
18825
18838
  }
18826
18839
  });
18827
18840
  }
18828
- function vw(e) {
18841
+ function yw(e) {
18829
18842
  let t = G();
18830
18843
  return C({
18831
18844
  queryKey: ["access-rules", e],
18832
- queryFn: async () => hw((await t.get(`/access-rules/${encodeURIComponent(e)}`)).data),
18845
+ queryFn: async () => gw((await t.get(`/access-rules/${encodeURIComponent(e)}`)).data),
18833
18846
  enabled: !!e
18834
18847
  });
18835
18848
  }
18836
- function yw(e, t, n) {
18849
+ function bw(e, t, n) {
18837
18850
  let r = G();
18838
18851
  return C({
18839
18852
  queryKey: [
@@ -18851,7 +18864,7 @@ function yw(e, t, n) {
18851
18864
  enabled: !!e && !!t && !!n
18852
18865
  });
18853
18866
  }
18854
- function bw(e) {
18867
+ function xw(e) {
18855
18868
  let t = e?.resolved_access_detailed;
18856
18869
  if (t && Object.keys(t).length > 0) return Object.entries(t).map(([e, t]) => ({
18857
18870
  id: e,
@@ -18865,14 +18878,14 @@ function bw(e) {
18865
18878
  permissions: Array.isArray(t) ? t : []
18866
18879
  }));
18867
18880
  }
18868
- function xw(e) {
18881
+ function Sw(e) {
18869
18882
  return Object.entries(e ?? {}).map(([e, t]) => ({
18870
18883
  id: e,
18871
18884
  label: e,
18872
18885
  permissions: Array.isArray(t) ? t : []
18873
18886
  }));
18874
18887
  }
18875
- function Sw(e) {
18888
+ function Cw(e) {
18876
18889
  let t = G();
18877
18890
  return C({
18878
18891
  queryKey: [
@@ -18880,11 +18893,11 @@ function Sw(e) {
18880
18893
  "user",
18881
18894
  e
18882
18895
  ],
18883
- queryFn: async () => bw((await t.get(`/access/user/${e}`)).data),
18896
+ queryFn: async () => xw((await t.get(`/access/user/${e}`)).data),
18884
18897
  enabled: !!e
18885
18898
  });
18886
18899
  }
18887
- function Cw(e) {
18900
+ function ww(e) {
18888
18901
  let t = G();
18889
18902
  return C({
18890
18903
  queryKey: [
@@ -18892,11 +18905,11 @@ function Cw(e) {
18892
18905
  "usergroup",
18893
18906
  e
18894
18907
  ],
18895
- queryFn: async () => xw((await t.get(`/access/usergroup/${encodeURIComponent(e)}`)).data.resolvedAccess),
18908
+ queryFn: async () => Sw((await t.get(`/access/usergroup/${encodeURIComponent(e)}`)).data.resolvedAccess),
18896
18909
  enabled: !!e
18897
18910
  });
18898
18911
  }
18899
- function ww(e) {
18912
+ function Tw(e) {
18900
18913
  let t = G();
18901
18914
  return C({
18902
18915
  queryKey: [
@@ -18904,11 +18917,11 @@ function ww(e) {
18904
18917
  "resource",
18905
18918
  e
18906
18919
  ],
18907
- queryFn: async () => xw((await t.get(`/access/resource/${encodeURIComponent(e)}`)).data.users_with_access),
18920
+ queryFn: async () => Sw((await t.get(`/access/resource/${encodeURIComponent(e)}`)).data.users_with_access),
18908
18921
  enabled: !!e
18909
18922
  });
18910
18923
  }
18911
- function Tw(e) {
18924
+ function Ew(e) {
18912
18925
  let t = G();
18913
18926
  return C({
18914
18927
  queryKey: [
@@ -18916,11 +18929,11 @@ function Tw(e) {
18916
18929
  "resourcegroup",
18917
18930
  e
18918
18931
  ],
18919
- queryFn: async () => xw((await t.get(`/access/resourcegroup/${encodeURIComponent(e)}`)).data.users_with_access),
18932
+ queryFn: async () => Sw((await t.get(`/access/resourcegroup/${encodeURIComponent(e)}`)).data.users_with_access),
18920
18933
  enabled: !!e
18921
18934
  });
18922
18935
  }
18923
- function Ew(e, t) {
18936
+ function Dw(e, t) {
18924
18937
  let n = G();
18925
18938
  return C({
18926
18939
  queryKey: [
@@ -18936,7 +18949,7 @@ function Ew(e, t) {
18936
18949
  enabled: !!e
18937
18950
  });
18938
18951
  }
18939
- function Dw(e) {
18952
+ function Ow(e) {
18940
18953
  let t = e.timeConstraints, n = t ? {
18941
18954
  start_date: t.startDate ?? null,
18942
18955
  end_date: t.endDate ?? null,
@@ -18960,34 +18973,41 @@ function Dw(e) {
18960
18973
  }
18961
18974
  };
18962
18975
  }
18963
- function Ow() {
18964
- let e = G(), t = w();
18976
+ function kw() {
18977
+ let e = G(), t = Jy(), n = w();
18965
18978
  return S({
18966
- mutationFn: async (t) => (await e.post("/access-rules/", Dw(t))).data,
18967
- 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"] })
18968
18984
  });
18969
18985
  }
18970
- function kw() {
18971
- let e = G(), t = w();
18986
+ function Aw() {
18987
+ let e = G(), t = Jy(), n = w();
18972
18988
  return S({
18973
- mutationFn: async (t) => (await e.put(`/access-rules/${encodeURIComponent(t.id)}`, Dw(t))).data,
18974
- onSuccess: (e, n) => {
18975
- 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] });
18976
18995
  }
18977
18996
  });
18978
18997
  }
18979
- function Aw() {
18980
- let e = G(), t = w();
18998
+ function jw() {
18999
+ let e = G(), t = Jy(), n = w();
18981
19000
  return S({
18982
- mutationFn: async (t) => {
18983
- await e.delete(`/access-rules/${encodeURIComponent(t)}`);
19001
+ mutationFn: async (n) => {
19002
+ let r = { performed_by: iw(t) };
19003
+ await e.delete(`/access-rules/${encodeURIComponent(n)}`, { params: r });
18984
19004
  },
18985
- onSuccess: () => t.invalidateQueries({ queryKey: ["access-rules"] })
19005
+ onSuccess: () => n.invalidateQueries({ queryKey: ["access-rules"] })
18986
19006
  });
18987
19007
  }
18988
19008
  //#endregion
18989
19009
  //#region src/components/dialogs/UserDialog.tsx
18990
- var jw = JC({
19010
+ var Mw = JC({
18991
19011
  first_name: KC().min(1, "First name is required"),
18992
19012
  last_name: KC().min(1, "Last name is required"),
18993
19013
  email: KC().refine((e) => !e || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e), { message: "Invalid email" }),
@@ -18995,7 +19015,7 @@ var jw = JC({
18995
19015
  role: KC().optional(),
18996
19016
  manager_id: KC().optional()
18997
19017
  });
18998
- 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 }) {
18999
19019
  let [a, o] = f(!1), s = n ? i.filter((e) => e.toLowerCase().includes(n.toLowerCase())) : i;
19000
19020
  return /* @__PURE__ */ _("div", {
19001
19021
  className: "space-y-1.5 relative",
@@ -19028,9 +19048,9 @@ function Mw({ id: e, label: t, value: n, onChange: r, suggestions: i }) {
19028
19048
  ]
19029
19049
  });
19030
19050
  }
19031
- function Nw({ open: e, onClose: t, user: n }) {
19032
- let r = !!n, i = fw(), a = pw(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19033
- 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),
19034
19054
  defaultValues: {
19035
19055
  first_name: "",
19036
19056
  last_name: "",
@@ -19067,7 +19087,7 @@ function Nw({ open: e, onClose: t, user: n }) {
19067
19087
  function m() {
19068
19088
  f(), t();
19069
19089
  }
19070
- 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);
19071
19091
  return /* @__PURE__ */ g(XC, {
19072
19092
  open: e,
19073
19093
  onOpenChange: (e) => !e && m(),
@@ -19154,13 +19174,13 @@ function Nw({ open: e, onClose: t, user: n }) {
19154
19174
  }),
19155
19175
  /* @__PURE__ */ _("div", {
19156
19176
  className: "grid grid-cols-2 gap-4",
19157
- children: [/* @__PURE__ */ g(Mw, {
19177
+ children: [/* @__PURE__ */ g(Nw, {
19158
19178
  id: "department",
19159
19179
  label: "Department",
19160
19180
  value: l("department") ?? "",
19161
19181
  onChange: (e) => u("department", e),
19162
19182
  suggestions: S
19163
- }), /* @__PURE__ */ g(Mw, {
19183
+ }), /* @__PURE__ */ g(Nw, {
19164
19184
  id: "role",
19165
19185
  label: "Role",
19166
19186
  value: l("role") ?? "",
@@ -19256,7 +19276,14 @@ function Nw({ open: e, onClose: t, user: n }) {
19256
19276
  }
19257
19277
  //#endregion
19258
19278
  //#region src/core/hooks/useArtifacts.ts
19259
- 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 = {}) {
19260
19287
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, type: o, search: s } = e;
19261
19288
  return C({
19262
19289
  queryKey: ["artifacts", e],
@@ -19264,11 +19291,11 @@ function Pw(e = {}) {
19264
19291
  let e = {};
19265
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);
19266
19293
  let c = s && s.trim() ? "/artifacts/search" : "/artifacts/";
19267
- 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));
19268
19295
  }
19269
19296
  });
19270
19297
  }
19271
- function Fw(e = {}) {
19298
+ function Lw(e = {}) {
19272
19299
  let t = G(), { type: n, appName: r, search: i, activeOnly: a } = e;
19273
19300
  return C({
19274
19301
  queryKey: [
@@ -19282,33 +19309,33 @@ function Fw(e = {}) {
19282
19309
  }
19283
19310
  });
19284
19311
  }
19285
- function Iw(e) {
19312
+ function Rw(e) {
19286
19313
  let t = G();
19287
19314
  return C({
19288
19315
  queryKey: ["artifacts", e],
19289
- queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}`)).data,
19316
+ queryFn: async () => Fw((await t.get(`/artifacts/${encodeURIComponent(e)}`)).data),
19290
19317
  enabled: !!e
19291
19318
  });
19292
19319
  }
19293
- function Lw(e = {}) {
19320
+ function zw(e = {}) {
19294
19321
  let t = G(), { skip: n, limit: r, activeOnly: i, appName: a } = e;
19295
19322
  return C({
19296
19323
  queryKey: ["artifact-groups", e],
19297
19324
  queryFn: async () => {
19298
19325
  let e = { artifact_type: "RESOURCEGROUP" };
19299
- 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));
19300
19327
  }
19301
19328
  });
19302
19329
  }
19303
- function Rw(e) {
19330
+ function Bw(e) {
19304
19331
  let t = G();
19305
19332
  return C({
19306
19333
  queryKey: ["artifact-groups", e],
19307
- queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}`)).data,
19334
+ queryFn: async () => Fw((await t.get(`/artifacts/${encodeURIComponent(e)}`)).data),
19308
19335
  enabled: !!e
19309
19336
  });
19310
19337
  }
19311
- function zw(e) {
19338
+ function Vw(e) {
19312
19339
  let t = G();
19313
19340
  return C({
19314
19341
  queryKey: [
@@ -19320,7 +19347,7 @@ function zw(e) {
19320
19347
  enabled: !!e
19321
19348
  });
19322
19349
  }
19323
- function Bw(e) {
19350
+ function Hw(e) {
19324
19351
  let t = G();
19325
19352
  return C({
19326
19353
  queryKey: [
@@ -19332,7 +19359,7 @@ function Bw(e) {
19332
19359
  enabled: !!e
19333
19360
  });
19334
19361
  }
19335
- function Vw() {
19362
+ function Uw() {
19336
19363
  let e = G();
19337
19364
  return C({
19338
19365
  queryKey: ["applications"],
@@ -19342,34 +19369,41 @@ function Vw() {
19342
19369
  }
19343
19370
  });
19344
19371
  }
19345
- function Hw() {
19346
- let e = G(), t = w();
19372
+ function Ww() {
19373
+ let e = G(), t = Jy(), n = w();
19347
19374
  return S({
19348
- mutationFn: async (t) => (await e.post("/artifacts/", t)).data,
19349
- 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"] })
19350
19380
  });
19351
19381
  }
19352
- function Uw() {
19353
- let e = G(), t = w();
19382
+ function Gw() {
19383
+ let e = G(), t = Jy(), n = w();
19354
19384
  return S({
19355
- mutationFn: async (t) => (await e.put(`/artifacts/${encodeURIComponent(t.id)}`, t)).data,
19356
- onSuccess: (e, n) => {
19357
- 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] });
19358
19391
  }
19359
19392
  });
19360
19393
  }
19361
- function Ww() {
19362
- let e = G(), t = w();
19394
+ function Kw() {
19395
+ let e = G(), t = Jy(), n = w();
19363
19396
  return S({
19364
- mutationFn: async (t) => {
19365
- await e.delete(`/artifacts/${encodeURIComponent(t)}`);
19397
+ mutationFn: async (n) => {
19398
+ let r = { performed_by: iw(t) };
19399
+ await e.delete(`/artifacts/${encodeURIComponent(n)}`, { params: r });
19366
19400
  },
19367
- onSuccess: () => t.invalidateQueries({ queryKey: ["artifacts"] })
19401
+ onSuccess: () => n.invalidateQueries({ queryKey: ["artifacts"] })
19368
19402
  });
19369
19403
  }
19370
19404
  //#endregion
19371
19405
  //#region src/components/shared/ExpressionInput.tsx
19372
- function Gw(e) {
19406
+ function qw(e) {
19373
19407
  if (!e) return [];
19374
19408
  let t = [], n = /([+-]?)("(?:[^"]+)"|[^+\-\s]+)/g, r;
19375
19409
  for (; (r = n.exec(e)) !== null;) {
@@ -19382,18 +19416,18 @@ function Gw(e) {
19382
19416
  }
19383
19417
  return t;
19384
19418
  }
19385
- function Kw(e) {
19419
+ function Jw(e) {
19386
19420
  return e.map((e, t) => {
19387
19421
  let n = e.entity.includes(" ") || e.entity.includes("-") ? `"${e.entity}"` : e.entity;
19388
19422
  return `${t === 0 && e.operator === "+" ? "" : e.operator}${n}`;
19389
19423
  }).join("");
19390
19424
  }
19391
- var qw = {
19425
+ var Yw = {
19392
19426
  user: "user",
19393
19427
  resource: "artifact"
19394
19428
  };
19395
- function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19396
- 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 = (() => {
19397
19431
  if (e === "user") {
19398
19432
  let e = p.data ?? [], t = m.data ?? [], n = (S ? e.filter((e) => {
19399
19433
  let t = `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim().toLowerCase();
@@ -19435,20 +19469,20 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19435
19469
  for (let e of v.data ?? []) t.set(e.id, e.name ?? e.id);
19436
19470
  }
19437
19471
  return t;
19438
- })(), T = Gw(t).map((e) => ({
19472
+ })(), T = qw(t).map((e) => ({
19439
19473
  ...e,
19440
19474
  label: w.get(e.entity) ?? e.entity
19441
19475
  })), E = o((e, t, r) => {
19442
- T.find((t) => t.entity === e) || (n(Kw([...T, {
19476
+ T.find((t) => t.entity === e) || (n(Jw([...T, {
19443
19477
  raw: `${r}${e}`,
19444
19478
  operator: r,
19445
19479
  entity: e,
19446
19480
  label: t
19447
19481
  }])), s(""), l(!1), u.current?.focus());
19448
19482
  }, [T, n]), D = o((e) => {
19449
- n(Kw(T.filter((t, n) => n !== e)));
19483
+ n(Jw(T.filter((t, n) => n !== e)));
19450
19484
  }, [T, n]), O = o((e) => {
19451
- n(Kw(T.map((t, n) => {
19485
+ n(Jw(T.map((t, n) => {
19452
19486
  if (n !== e) return t;
19453
19487
  let r = t.operator === "+" ? "-" : "+";
19454
19488
  return {
@@ -19505,7 +19539,7 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19505
19539
  onKeyDown: A,
19506
19540
  onFocus: () => l(!0),
19507
19541
  onBlur: () => setTimeout(() => l(!1), 150),
19508
- placeholder: T.length === 0 ? `Type + or - then ${qw[e]} name…` : "",
19542
+ placeholder: T.length === 0 ? `Type + or - then ${Yw[e]} name…` : "",
19509
19543
  className: "flex-1 min-w-28 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
19510
19544
  })]
19511
19545
  }),
@@ -19518,7 +19552,7 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19518
19552
  className: "px-3 py-2 text-sm text-muted-foreground",
19519
19553
  children: [
19520
19554
  "No ",
19521
- qw[e],
19555
+ Yw[e],
19522
19556
  "s found"
19523
19557
  ]
19524
19558
  }) : /* @__PURE__ */ g("ul", {
@@ -19556,14 +19590,16 @@ function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
19556
19590
  }
19557
19591
  //#endregion
19558
19592
  //#region src/core/hooks/useGroups.ts
19559
- function Yw(e) {
19593
+ function Zw(e) {
19560
19594
  let t = e.user_metadata ?? {}, n = e.id;
19561
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), {
19562
19596
  ...e,
19563
- name: n
19597
+ name: n,
19598
+ lifecycleStatus: e.lifecycleStatus || e.status || "live",
19599
+ auditLog: e.auditLog || e.audit_log || []
19564
19600
  };
19565
19601
  }
19566
- function Xw(e = {}) {
19602
+ function Qw(e = {}) {
19567
19603
  let t = G(), { skip: n, limit: r, activeOnly: i, search: a } = e;
19568
19604
  return C({
19569
19605
  queryKey: ["groups", e],
@@ -19571,13 +19607,13 @@ function Xw(e = {}) {
19571
19607
  let e = { user_type: "USERGROUP" };
19572
19608
  if (i !== void 0 && (e.active = i), a && a.trim()) {
19573
19609
  let n = await t.get("/users/", { params: e }), r = a.trim().toLowerCase();
19574
- 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));
19575
19611
  }
19576
- 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);
19577
19613
  }
19578
19614
  });
19579
19615
  }
19580
- function Zw(e = {}) {
19616
+ function $w(e = {}) {
19581
19617
  let t = G(), { activeOnly: n } = e;
19582
19618
  return C({
19583
19619
  queryKey: [
@@ -19591,7 +19627,7 @@ function Zw(e = {}) {
19591
19627
  }
19592
19628
  });
19593
19629
  }
19594
- function Qw(e) {
19630
+ function eT(e) {
19595
19631
  let t = G();
19596
19632
  return C({
19597
19633
  queryKey: ["groups", e],
@@ -19599,7 +19635,7 @@ function Qw(e) {
19599
19635
  enabled: !!e
19600
19636
  });
19601
19637
  }
19602
- function $w(e) {
19638
+ function tT(e) {
19603
19639
  let t = G();
19604
19640
  return C({
19605
19641
  queryKey: [
@@ -19616,48 +19652,52 @@ function $w(e) {
19616
19652
  enabled: !!e
19617
19653
  });
19618
19654
  }
19619
- function eT() {
19620
- let e = G(), t = w();
19655
+ function nT() {
19656
+ let e = G(), t = Jy(), n = w();
19621
19657
  return S({
19622
- mutationFn: async (t) => {
19623
- let n = (t.id || t.name || "").trim(), r = t.description ?? "", i = {
19624
- id: n,
19658
+ mutationFn: async (n) => {
19659
+ let r = (n.id || n.name || "").trim(), i = n.description ?? "", a = {
19660
+ id: r,
19625
19661
  type: "USERGROUP",
19626
- active: t.active ?? !0,
19627
- expression: t.expression ?? null,
19662
+ active: n.active ?? !0,
19663
+ expression: n.expression ?? null,
19628
19664
  manager_id: null,
19629
- parent_group_id: t.parent_group_id ?? null,
19630
- owner_id: t.owner_id ?? null,
19631
- description: r,
19665
+ parent_group_id: n.parent_group_id ?? null,
19666
+ owner_id: n.owner_id ?? null,
19667
+ description: i,
19632
19668
  user_metadata: {
19633
- name: t.name ?? n,
19634
- description: r
19669
+ name: n.name ?? r,
19670
+ description: i
19635
19671
  }
19636
- };
19637
- return (await e.post("/users/", i)).data;
19672
+ }, o = { performed_by: iw(t) };
19673
+ return (await e.post("/users/", a, { params: o })).data;
19638
19674
  },
19639
- onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19675
+ onSuccess: () => n.invalidateQueries({ queryKey: ["groups"] })
19640
19676
  });
19641
19677
  }
19642
- function tT() {
19643
- let e = G(), t = w();
19678
+ function rT() {
19679
+ let e = G(), t = Jy(), n = w();
19644
19680
  return S({
19645
- mutationFn: async (t) => (await e.put(`/users/${encodeURIComponent(t.id)}`, t)).data,
19646
- onSuccess: (e, n) => {
19647
- 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] });
19648
19687
  }
19649
19688
  });
19650
19689
  }
19651
- function nT() {
19652
- let e = G(), t = w();
19690
+ function iT() {
19691
+ let e = G(), t = Jy(), n = w();
19653
19692
  return S({
19654
- mutationFn: async (t) => {
19655
- await e.delete(`/users/${encodeURIComponent(t)}`);
19693
+ mutationFn: async (n) => {
19694
+ let r = { performed_by: iw(t) };
19695
+ await e.delete(`/users/${encodeURIComponent(n)}`, { params: r });
19656
19696
  },
19657
- onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19697
+ onSuccess: () => n.invalidateQueries({ queryKey: ["groups"] })
19658
19698
  });
19659
19699
  }
19660
- function rT() {
19700
+ function aT() {
19661
19701
  let e = G(), t = w();
19662
19702
  return S({
19663
19703
  mutationFn: async ({ groupId: t, userId: n }) => {
@@ -19670,7 +19710,7 @@ function rT() {
19670
19710
  ] })
19671
19711
  });
19672
19712
  }
19673
- function iT() {
19713
+ function oT() {
19674
19714
  let e = G(), t = w();
19675
19715
  return S({
19676
19716
  mutationFn: async ({ groupId: t, userId: n }) => {
@@ -19685,14 +19725,14 @@ function iT() {
19685
19725
  }
19686
19726
  //#endregion
19687
19727
  //#region src/components/dialogs/GroupDialog.tsx
19688
- var aT = JC({
19728
+ var sT = JC({
19689
19729
  name: KC().min(1, "Name is required"),
19690
19730
  description: KC().optional(),
19691
19731
  expression: KC().min(1, "Expression is required")
19692
19732
  });
19693
- function oT({ open: e, onClose: t, group: n }) {
19694
- let r = !!n, i = eT(), a = tT(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
19695
- 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),
19696
19736
  defaultValues: {
19697
19737
  name: "",
19698
19738
  description: "",
@@ -19723,7 +19763,7 @@ function oT({ open: e, onClose: t, group: n }) {
19723
19763
  function m() {
19724
19764
  f(), t();
19725
19765
  }
19726
- 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 : "");
19727
19767
  return /* @__PURE__ */ g(XC, {
19728
19768
  open: e,
19729
19769
  onOpenChange: (e) => !e && m(),
@@ -19781,7 +19821,7 @@ function oT({ open: e, onClose: t, group: n }) {
19781
19821
  ...o("description")
19782
19822
  })]
19783
19823
  }),
19784
- /* @__PURE__ */ g(Jw, {
19824
+ /* @__PURE__ */ g(Xw, {
19785
19825
  type: "user",
19786
19826
  value: l("expression"),
19787
19827
  onChange: (e) => u("expression", e),
@@ -19857,12 +19897,12 @@ function oT({ open: e, onClose: t, group: n }) {
19857
19897
  }
19858
19898
  //#endregion
19859
19899
  //#region src/components/views/GroupsView.tsx
19860
- function sT() {
19861
- 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({
19862
19902
  skip: e,
19863
19903
  limit: n,
19864
19904
  search: i
19865
- }), { data: y = 0 } = Zw(), b = nT();
19905
+ }), { data: y = 0 } = $w(), b = iT();
19866
19906
  return /* @__PURE__ */ _("div", {
19867
19907
  className: "space-y-4",
19868
19908
  children: [
@@ -19939,7 +19979,7 @@ function sT() {
19939
19979
  t(e.pageIndex * e.pageSize), r(e.pageSize);
19940
19980
  }
19941
19981
  }),
19942
- /* @__PURE__ */ g(oT, {
19982
+ /* @__PURE__ */ g(cT, {
19943
19983
  open: o,
19944
19984
  onClose: () => {
19945
19985
  s(!1), l(void 0);
@@ -19961,7 +20001,7 @@ function sT() {
19961
20001
  }
19962
20002
  //#endregion
19963
20003
  //#region src/core/lib/expression.ts
19964
- function cT(e) {
20004
+ function uT(e) {
19965
20005
  if (!e) return [];
19966
20006
  let t = e.replace(/“/g, "\"").replace(/”/g, "\""), n = [], r = /([+-]?)\s*(".*?"|[^+-]+)/g, i, a = !0;
19967
20007
  for (; (i = r.exec(t)) !== null;) {
@@ -19976,13 +20016,13 @@ function cT(e) {
19976
20016
  }
19977
20017
  return n;
19978
20018
  }
19979
- function lT(e, t, n) {
20019
+ function dT(e, t, n) {
19980
20020
  if (!t) return !1;
19981
20021
  let r = /* @__PURE__ */ new Set();
19982
20022
  function i(t, a = 0) {
19983
20023
  if (a > 10) return !1;
19984
20024
  let o = !1;
19985
- for (let s of cT(t)) {
20025
+ for (let s of uT(t)) {
19986
20026
  let t = s.entity.trim();
19987
20027
  if (t === e) {
19988
20028
  o = s.type === "include";
@@ -20001,20 +20041,20 @@ function lT(e, t, n) {
20001
20041
  }
20002
20042
  //#endregion
20003
20043
  //#region src/core/hooks/useHierarchy.ts
20004
- function uT(e) {
20044
+ function fT(e) {
20005
20045
  return e.user_metadata?.name || e.name || e.id;
20006
20046
  }
20007
- function dT(e) {
20047
+ function pT(e) {
20008
20048
  return e.name || [e.first_name, e.last_name].filter(Boolean).join(" ") || e.id;
20009
20049
  }
20010
- function fT(e, t) {
20050
+ function mT(e, t) {
20011
20051
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
20012
20052
  for (let t of e) if (n.set(t.id, {
20013
20053
  id: t.id,
20014
- name: uT(t),
20054
+ name: fT(t),
20015
20055
  type: "USERGROUP",
20016
20056
  children: []
20017
- }), t.expression) for (let n of cT(t.expression)) {
20057
+ }), t.expression) for (let n of uT(t.expression)) {
20018
20058
  let i = n.entity.trim();
20019
20059
  n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
20020
20060
  }
@@ -20025,9 +20065,9 @@ function fT(e, t) {
20025
20065
  }
20026
20066
  let o = e.find((e) => e.id === i);
20027
20067
  if (!o?.expression) continue;
20028
- 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) => ({
20029
20069
  id: e.id,
20030
- name: dT(e),
20070
+ name: pT(e),
20031
20071
  type: "USER",
20032
20072
  children: [],
20033
20073
  email: e.email,
@@ -20040,9 +20080,9 @@ function fT(e, t) {
20040
20080
  name: "Groups",
20041
20081
  type: "USERGROUP",
20042
20082
  children: Array.from(n.values())
20043
- }], 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) => ({
20044
20084
  id: e.id,
20045
- name: dT(e),
20085
+ name: pT(e),
20046
20086
  type: "USER",
20047
20087
  children: [],
20048
20088
  email: e.email,
@@ -20055,24 +20095,24 @@ function fT(e, t) {
20055
20095
  children: a
20056
20096
  }), i;
20057
20097
  }
20058
- function pT() {
20098
+ function hT() {
20059
20099
  let e = G();
20060
20100
  return C({
20061
20101
  queryKey: ["hierarchy", "org"],
20062
20102
  queryFn: async () => (await e.get("/reporting/organization-chart")).data
20063
20103
  });
20064
20104
  }
20065
- function mT() {
20105
+ function gT() {
20066
20106
  let e = G();
20067
20107
  return C({
20068
20108
  queryKey: ["hierarchy", "combined"],
20069
20109
  queryFn: async () => {
20070
20110
  let [t, n] = await Promise.all([e.get("/users/", { params: { user_type: "USERGROUP" } }), e.get("/users/", { params: { user_type: "USER" } })]);
20071
- return fT(t.data ?? [], n.data ?? []);
20111
+ return mT(t.data ?? [], n.data ?? []);
20072
20112
  }
20073
20113
  });
20074
20114
  }
20075
- function hT(e, t) {
20115
+ function _T(e, t) {
20076
20116
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
20077
20117
  for (let t of e) if (n.set(t.id, {
20078
20118
  id: t.id,
@@ -20080,7 +20120,7 @@ function hT(e, t) {
20080
20120
  type: "RESOURCEGROUP",
20081
20121
  children: [],
20082
20122
  application: t.application
20083
- }), t.expression) for (let n of cT(t.expression)) {
20123
+ }), t.expression) for (let n of uT(t.expression)) {
20084
20124
  let i = n.entity.trim();
20085
20125
  n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
20086
20126
  }
@@ -20091,7 +20131,7 @@ function hT(e, t) {
20091
20131
  }
20092
20132
  let o = e.find((e) => e.id === i);
20093
20133
  if (!o?.expression) continue;
20094
- 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) => ({
20095
20135
  id: e.id,
20096
20136
  name: e.name || e.id,
20097
20137
  type: "RESOURCE",
@@ -20105,7 +20145,7 @@ function hT(e, t) {
20105
20145
  name: "Artifact Groups",
20106
20146
  type: "RESOURCEGROUP",
20107
20147
  children: Array.from(n.values())
20108
- }], 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) => ({
20109
20149
  id: e.id,
20110
20150
  name: e.name || e.id,
20111
20151
  type: "RESOURCE",
@@ -20119,25 +20159,25 @@ function hT(e, t) {
20119
20159
  children: a
20120
20160
  }), i;
20121
20161
  }
20122
- function gT() {
20162
+ function vT() {
20123
20163
  let e = G();
20124
20164
  return C({
20125
20165
  queryKey: ["hierarchy", "artifacts-combined"],
20126
20166
  queryFn: async () => {
20127
20167
  let [t, n] = await Promise.all([e.get("/artifacts/", { params: { artifact_type: "RESOURCEGROUP" } }), e.get("/artifacts/", { params: { artifact_type: "RESOURCE" } })]);
20128
- return hT(t.data ?? [], n.data ?? []);
20168
+ return _T(t.data ?? [], n.data ?? []);
20129
20169
  }
20130
20170
  });
20131
20171
  }
20132
20172
  //#endregion
20133
20173
  //#region src/components/views/UsersView.tsx
20134
- function _T() {
20135
- 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({
20136
20176
  skip: e,
20137
20177
  limit: n,
20138
20178
  search: i,
20139
20179
  activeOnly: o === "active" ? !0 : o === "inactive" ? !1 : void 0
20140
- }), { data: T = 0 } = ow({ search: i }), E = mw(), { data: D = [] } = mT();
20180
+ }), { data: T = 0 } = sw({ search: i }), E = hw(), { data: D = [] } = gT();
20141
20181
  return /* @__PURE__ */ _("div", {
20142
20182
  className: "space-y-4",
20143
20183
  children: [
@@ -20261,7 +20301,7 @@ function _T() {
20261
20301
  }),
20262
20302
  /* @__PURE__ */ g(Gh, {
20263
20303
  value: "groups",
20264
- children: /* @__PURE__ */ g(sT, {})
20304
+ children: /* @__PURE__ */ g(lT, {})
20265
20305
  }),
20266
20306
  /* @__PURE__ */ g(Gh, {
20267
20307
  value: "hierarchy",
@@ -20272,14 +20312,14 @@ function _T() {
20272
20312
  })
20273
20313
  ]
20274
20314
  }),
20275
- /* @__PURE__ */ g(Nw, {
20315
+ /* @__PURE__ */ g(Pw, {
20276
20316
  open: u,
20277
20317
  onClose: () => {
20278
20318
  d(!1), m(void 0);
20279
20319
  },
20280
20320
  user: p
20281
20321
  }),
20282
- /* @__PURE__ */ g(oT, {
20322
+ /* @__PURE__ */ g(cT, {
20283
20323
  open: h,
20284
20324
  onClose: () => v(!1)
20285
20325
  }),
@@ -20298,7 +20338,7 @@ function _T() {
20298
20338
  }
20299
20339
  //#endregion
20300
20340
  //#region src/components/dialogs/ArtifactDialog.tsx
20301
- var vT = JC({
20341
+ var bT = JC({
20302
20342
  name: KC().min(1, "Name is required"),
20303
20343
  description: KC().optional(),
20304
20344
  type: YC(["RESOURCE", "RESOURCEGROUP"]),
@@ -20306,9 +20346,9 @@ var vT = JC({
20306
20346
  expression: KC().optional(),
20307
20347
  status: YC(["Active", "Inactive"])
20308
20348
  });
20309
- function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin: i }) {
20310
- let a = !!n, o = Hw(), s = Uw(), { register: l, handleSubmit: u, watch: d, setValue: p, formState: { errors: m }, reset: h } = uS({
20311
- 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),
20312
20352
  defaultValues: {
20313
20353
  name: "",
20314
20354
  description: "",
@@ -20375,7 +20415,7 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20375
20415
  function ee() {
20376
20416
  h(), t();
20377
20417
  }
20378
- 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 : "");
20379
20419
  return /* @__PURE__ */ g(XC, {
20380
20420
  open: e,
20381
20421
  onOpenChange: (e) => !e && ee(),
@@ -20567,7 +20607,7 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20567
20607
  })
20568
20608
  ]
20569
20609
  }),
20570
- v === "RESOURCEGROUP" && /* @__PURE__ */ g(Jw, {
20610
+ v === "RESOURCEGROUP" && /* @__PURE__ */ g(Xw, {
20571
20611
  type: "resource",
20572
20612
  value: d("expression") ?? "",
20573
20613
  onChange: (e) => p("expression", e),
@@ -20661,30 +20701,30 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20661
20701
  }
20662
20702
  //#endregion
20663
20703
  //#region src/components/views/ArtifactsView.tsx
20664
- function bT() {
20665
- 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 = [] } = Vw(), 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 } = 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({
20666
20706
  skip: n,
20667
20707
  limit: i,
20668
20708
  type: "RESOURCE",
20669
20709
  appName: A,
20670
20710
  activeOnly: j,
20671
20711
  search: o
20672
- }), { data: P = 0 } = Fw({
20712
+ }), { data: P = 0 } = Lw({
20673
20713
  type: "RESOURCE",
20674
20714
  appName: A,
20675
20715
  search: o
20676
- }), { data: ne = [], isLoading: re, isError: ie, refetch: ae } = Pw({
20716
+ }), { data: ne = [], isLoading: re, isError: ie, refetch: ae } = Iw({
20677
20717
  skip: c,
20678
20718
  limit: u,
20679
20719
  type: "RESOURCEGROUP",
20680
20720
  appName: A,
20681
20721
  activeOnly: j,
20682
20722
  search: p
20683
- }), { data: oe = 0 } = Fw({
20723
+ }), { data: oe = 0 } = Lw({
20684
20724
  type: "RESOURCEGROUP",
20685
20725
  appName: A,
20686
20726
  search: p
20687
- }), se = Ww(), { data: ce = [] } = gT(), le = [
20727
+ }), se = Kw(), { data: ce = [] } = vT(), le = [
20688
20728
  {
20689
20729
  accessorKey: "name",
20690
20730
  header: "Name"
@@ -20852,7 +20892,7 @@ function bT() {
20852
20892
  })
20853
20893
  ]
20854
20894
  }),
20855
- /* @__PURE__ */ g(yT, {
20895
+ /* @__PURE__ */ g(xT, {
20856
20896
  open: C,
20857
20897
  onClose: () => {
20858
20898
  w(!1), E(void 0);
@@ -20876,12 +20916,12 @@ function bT() {
20876
20916
  }
20877
20917
  //#endregion
20878
20918
  //#region src/components/dialogs/AccessRuleDialog.tsx
20879
- var xT = [
20919
+ var CT = [
20880
20920
  "Read",
20881
20921
  "Write",
20882
20922
  "Execute",
20883
20923
  "Export"
20884
- ], ST = JC({
20924
+ ], wT = JC({
20885
20925
  name: KC().min(1, "Name is required"),
20886
20926
  description: KC().optional(),
20887
20927
  userExpression: KC().min(1, "User expression is required"),
@@ -20894,9 +20934,9 @@ var xT = [
20894
20934
  startTime: KC().optional(),
20895
20935
  endTime: KC().optional()
20896
20936
  });
20897
- function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i }) {
20898
- 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({
20899
- 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),
20900
20940
  defaultValues: {
20901
20941
  name: "",
20902
20942
  description: "",
@@ -20913,8 +20953,8 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
20913
20953
  });
20914
20954
  c(() => {
20915
20955
  if (e) {
20916
- let e = (n?.permissions ?? []).filter((e) => !xT.includes(e));
20917
- 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({
20918
20958
  name: n?.name ?? "",
20919
20959
  description: n?.description ?? "",
20920
20960
  userExpression: n?.userExpression ?? "",
@@ -21007,7 +21047,7 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
21007
21047
  ...m("description")
21008
21048
  })]
21009
21049
  }),
21010
- /* @__PURE__ */ g(Jw, {
21050
+ /* @__PURE__ */ g(Xw, {
21011
21051
  type: "user",
21012
21052
  value: v("userExpression"),
21013
21053
  onChange: (e) => y("userExpression", e),
@@ -21020,7 +21060,7 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
21020
21060
  className: "text-xs text-destructive",
21021
21061
  children: b.userExpression.message
21022
21062
  }),
21023
- /* @__PURE__ */ g(Jw, {
21063
+ /* @__PURE__ */ g(Xw, {
21024
21064
  type: "resource",
21025
21065
  value: v("resourceExpression"),
21026
21066
  onChange: (e) => y("resourceExpression", e),
@@ -21169,18 +21209,18 @@ function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
21169
21209
  }
21170
21210
  //#endregion
21171
21211
  //#region src/components/views/AccessRulesView.tsx
21172
- function wT() {
21173
- 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({
21174
21214
  skip: n,
21175
21215
  limit: i,
21176
21216
  appName: S,
21177
21217
  activeOnly: C,
21178
21218
  search: o
21179
- }), { data: O = 0 } = _w({
21219
+ }), { data: O = 0 } = vw({
21180
21220
  search: o,
21181
21221
  appName: S,
21182
21222
  activeOnly: C
21183
- }), k = Aw(), A = [
21223
+ }), k = jw(), A = [
21184
21224
  {
21185
21225
  accessorKey: "name",
21186
21226
  header: "Name"
@@ -21306,7 +21346,7 @@ function wT() {
21306
21346
  },
21307
21347
  toolbar: j
21308
21348
  }),
21309
- /* @__PURE__ */ g(CT, {
21349
+ /* @__PURE__ */ g(TT, {
21310
21350
  open: p,
21311
21351
  onClose: () => {
21312
21352
  m(!1), v(void 0);
@@ -21330,7 +21370,7 @@ function wT() {
21330
21370
  }
21331
21371
  //#endregion
21332
21372
  //#region src/MedhaOneAccess.tsx
21333
- var TT = [
21373
+ var DT = [
21334
21374
  {
21335
21375
  id: "users",
21336
21376
  label: "Users",
@@ -21347,7 +21387,7 @@ var TT = [
21347
21387
  Icon: Se
21348
21388
  }
21349
21389
  ];
21350
- function ET() {
21390
+ function OT() {
21351
21391
  let [e, t] = f("users");
21352
21392
  return /* @__PURE__ */ _("div", {
21353
21393
  className: "flex h-full bg-background",
@@ -21360,7 +21400,7 @@ function ET() {
21360
21400
  className: "text-sm font-bold text-slate-600 uppercase tracking-wider",
21361
21401
  children: "Access Control"
21362
21402
  })
21363
- }), TT.map(({ id: n, label: r, Icon: i }) => /* @__PURE__ */ _("button", {
21403
+ }), DT.map(({ id: n, label: r, Icon: i }) => /* @__PURE__ */ _("button", {
21364
21404
  onClick: () => t(n),
21365
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"),
21366
21406
  children: [/* @__PURE__ */ g(i, { className: "h-4 w-4 shrink-0" }), r]
@@ -21371,9 +21411,9 @@ function ET() {
21371
21411
  children: /* @__PURE__ */ _("div", {
21372
21412
  className: "max-w-7xl mx-auto",
21373
21413
  children: [
21374
- e === "users" && /* @__PURE__ */ g(_T, {}),
21375
- e === "artifacts" && /* @__PURE__ */ g(bT, {}),
21376
- 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, {})
21377
21417
  ]
21378
21418
  })
21379
21419
  }),
@@ -21385,6 +21425,6 @@ function ET() {
21385
21425
  });
21386
21426
  }
21387
21427
  //#endregion
21388
- 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 };
21389
21429
 
21390
21430
  //# sourceMappingURL=index.js.map