@arch-cadre/panel 0.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/actions/activity-log/index.cjs +19 -0
  2. package/dist/actions/activity-log/index.d.ts +1 -0
  3. package/dist/actions/activity-log/index.mjs +10 -0
  4. package/dist/actions/rbac/index.cjs +130 -0
  5. package/dist/actions/rbac/index.d.ts +35 -0
  6. package/dist/actions/rbac/index.mjs +92 -0
  7. package/dist/actions/session-manager/index.cjs +99 -0
  8. package/dist/actions/session-manager/index.d.ts +21 -0
  9. package/dist/actions/session-manager/index.mjs +73 -0
  10. package/dist/index.cjs +68 -1
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.mjs +90 -0
  13. package/dist/navigation.cjs +15 -1
  14. package/dist/navigation.mjs +17 -1
  15. package/dist/routes.cjs +31 -6
  16. package/dist/routes.mjs +34 -6
  17. package/dist/schema/activity-log.cjs +23 -0
  18. package/dist/schema/activity-log.d.ts +103 -0
  19. package/dist/schema/activity-log.mjs +15 -0
  20. package/dist/schema.cjs +16 -0
  21. package/dist/schema.d.ts +1 -0
  22. package/dist/schema.mjs +1 -0
  23. package/dist/ui/activity-log/components/ActivityStatsWidget.cjs +35 -0
  24. package/dist/ui/activity-log/components/ActivityStatsWidget.d.ts +2 -0
  25. package/dist/ui/activity-log/components/ActivityStatsWidget.mjs +15 -0
  26. package/dist/ui/activity-log/components/RecentLogsWidget.cjs +50 -0
  27. package/dist/ui/activity-log/components/RecentLogsWidget.d.ts +2 -0
  28. package/dist/ui/activity-log/components/RecentLogsWidget.mjs +29 -0
  29. package/dist/ui/activity-log/pages/log-list.cjs +61 -0
  30. package/dist/ui/activity-log/pages/log-list.d.ts +2 -0
  31. package/dist/ui/activity-log/pages/log-list.mjs +36 -0
  32. package/dist/ui/components/app-user.cjs +4 -5
  33. package/dist/ui/components/app-user.mjs +5 -7
  34. package/dist/ui/components/profile/components.cjs +4 -1
  35. package/dist/ui/components/profile/components.d.ts +4 -3
  36. package/dist/ui/components/profile/components.mjs +1 -0
  37. package/dist/ui/components/profile/link.cjs +10 -1
  38. package/dist/ui/components/profile/link.d.ts +2 -1
  39. package/dist/ui/components/profile/link.mjs +2 -1
  40. package/dist/ui/components/profile/page.cjs +4 -1
  41. package/dist/ui/components/profile/page.d.ts +2 -1
  42. package/dist/ui/components/profile/page.mjs +9 -2
  43. package/dist/ui/dashboard/page.cjs +6 -16
  44. package/dist/ui/dashboard/page.d.ts +1 -1
  45. package/dist/ui/dashboard/page.mjs +14 -6
  46. package/dist/ui/dashboard/widgets/WelcomeBackUserWidget.cjs +43 -0
  47. package/dist/ui/dashboard/widgets/WelcomeBackUserWidget.d.ts +2 -0
  48. package/dist/ui/dashboard/widgets/WelcomeBackUserWidget.mjs +18 -0
  49. package/dist/ui/rbac/pages/rbac-admin.cjs +328 -0
  50. package/dist/ui/rbac/pages/rbac-admin.d.ts +2 -0
  51. package/dist/ui/rbac/pages/rbac-admin.mjs +375 -0
  52. package/dist/ui/session-manager/components/sessions-list.cjs +160 -0
  53. package/dist/ui/session-manager/components/sessions-list.d.ts +13 -0
  54. package/dist/ui/session-manager/components/sessions-list.mjs +193 -0
  55. package/dist/ui/session-manager/pages/sessions-page.cjs +29 -0
  56. package/dist/ui/session-manager/pages/sessions-page.d.ts +2 -0
  57. package/dist/ui/session-manager/pages/sessions-page.mjs +9 -0
  58. package/locales/en/global.json +109 -1
  59. package/locales/pl/global.json +188 -0
  60. package/package.json +7 -6
  61. package/dist/ui/[...catchAll]/page.cjs +0 -127
  62. package/dist/ui/[...catchAll]/page.d.ts +0 -13
  63. package/dist/ui/[...catchAll]/page.mjs +0 -88
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = CatchAllPage;
7
- exports.generateMetadata = generateMetadata;
8
- var _server = require("@arch-cadre/core/server");
9
- var _server2 = require("@arch-cadre/modules/server");
10
- var _button = require("@arch-cadre/ui/components/button");
11
- var _empty = require("@arch-cadre/ui/components/empty");
12
- var _react = require("@iconify/react");
13
- var _navigation = require("next/navigation");
14
- var React = _interopRequireWildcard(require("react"));
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- function matchRoute(pattern, path) {
18
- const paramNames = [];
19
- const regexPattern = pattern.replace(/:([^/]+)/g, (_, name) => {
20
- paramNames.push(name);
21
- return "([^/]+)";
22
- }).replace(/\//g, "\\/");
23
- const regex = new RegExp(`^${regexPattern}$`);
24
- const match = path.match(regex);
25
- if (!match) return null;
26
- const params = {};
27
- paramNames.forEach((name, index) => {
28
- params[name] = match[index + 1];
29
- });
30
- return params;
31
- }
32
- async function findMatchedRoute(path) {
33
- const privateRoutes = await (0, _server2.getPrivateModuleRoutes)();
34
- const routes = [...privateRoutes];
35
- for (const route of routes) {
36
- const params = matchRoute(route.path, path);
37
- if (params) {
38
- return {
39
- route,
40
- params
41
- };
42
- }
43
- }
44
- return null;
45
- }
46
- async function generateMetadata({
47
- params
48
- }) {
49
- const {
50
- catchAll
51
- } = await params;
52
- const path = `/${catchAll.join("/")}`;
53
- const matched = await findMatchedRoute(path);
54
- if (matched?.route.generateMetadata) {
55
- return matched.route.generateMetadata({
56
- params: matched.params,
57
- searchParams: {}
58
- });
59
- }
60
- return {};
61
- }
62
- async function CatchAllPage({
63
- params,
64
- searchParams
65
- }) {
66
- const {
67
- catchAll
68
- } = await params;
69
- const sParams = await searchParams;
70
- const path = `/${catchAll.join("/")}`;
71
- const matched = await findMatchedRoute(path);
72
- if (matched) {
73
- const {
74
- route,
75
- params: routeParams
76
- } = matched;
77
- if (route.auth) {
78
- const {
79
- user,
80
- session
81
- } = await (0, _server.getCurrentSession)();
82
- if (!user || !session) {
83
- return (0, _navigation.redirect)("/signin");
84
- }
85
- const security = await (0, _server.checkSecurity)(session, user, route.roles, route.permissions);
86
- if (!security.satisfied) {
87
- return (0, _navigation.redirect)(security.redirect || "/signin");
88
- }
89
- }
90
- const Component = route.component;
91
- const Layout = route.layout;
92
- const content = /* @__PURE__ */React.createElement(Component, {
93
- params: routeParams,
94
- searchParams: sParams
95
- });
96
- if (Layout) {
97
- return /* @__PURE__ */React.createElement(Layout, null, content);
98
- }
99
- return content;
100
- }
101
- return /* @__PURE__ */React.createElement("div", {
102
- className: "flex-1 flex w-full items-center justify-center"
103
- }, /* @__PURE__ */React.createElement("div", {
104
- className: "flex w-full justify-center h-[calc(100svh-56px-var(--header-height))] items-center"
105
- }, /* @__PURE__ */React.createElement("div", null, /* @__PURE__ */React.createElement(_empty.Empty, null, /* @__PURE__ */React.createElement(_empty.EmptyHeader, null, /* @__PURE__ */React.createElement(_empty.EmptyTitle, {
106
- className: "font-black font-mono text-8xl"
107
- }, "404"), /* @__PURE__ */React.createElement(_empty.EmptyDescription, {
108
- className: "text-nowrap"
109
- }, "The page you're looking for might have been moved or doesn't exist.")), /* @__PURE__ */React.createElement(_empty.EmptyContent, null, /* @__PURE__ */React.createElement("div", {
110
- className: "flex gap-2"
111
- }, /* @__PURE__ */React.createElement(_button.Button, {
112
- size: "sm",
113
- asChild: true
114
- }, /* @__PURE__ */React.createElement("a", {
115
- href: "/"
116
- }, /* @__PURE__ */React.createElement(_react.Icon, {
117
- icon: "solar:home-2-broken"
118
- }), " Go Home")), /* @__PURE__ */React.createElement(_button.Button, {
119
- variant: "outline",
120
- size: "sm",
121
- asChild: true
122
- }, /* @__PURE__ */React.createElement("a", {
123
- href: "/explore"
124
- }, /* @__PURE__ */React.createElement(_react.Icon, {
125
- icon: "solar:compass-broken"
126
- }), " Explore"))))))));
127
- }
@@ -1,13 +0,0 @@
1
- import type { Metadata } from "next";
2
- import * as React from "react";
3
- export declare function generateMetadata({ params, }: {
4
- params: Promise<{
5
- catchAll: string[];
6
- }>;
7
- }): Promise<Metadata>;
8
- export default function CatchAllPage({ params, searchParams, }: {
9
- params: Promise<{
10
- catchAll: string[];
11
- }>;
12
- searchParams: Promise<any>;
13
- }): Promise<React.JSX.Element>;
@@ -1,88 +0,0 @@
1
- import { checkSecurity, getCurrentSession } from "@arch-cadre/core/server";
2
- import { getPrivateModuleRoutes } from "@arch-cadre/modules/server";
3
- import { Button } from "@arch-cadre/ui/components/button";
4
- import {
5
- Empty,
6
- EmptyContent,
7
- EmptyDescription,
8
- EmptyHeader,
9
- EmptyTitle
10
- } from "@arch-cadre/ui/components/empty";
11
- import { Icon } from "@iconify/react";
12
- import { redirect } from "next/navigation";
13
- import * as React from "react";
14
- function matchRoute(pattern, path) {
15
- const paramNames = [];
16
- const regexPattern = pattern.replace(/:([^/]+)/g, (_, name) => {
17
- paramNames.push(name);
18
- return "([^/]+)";
19
- }).replace(/\//g, "\\/");
20
- const regex = new RegExp(`^${regexPattern}$`);
21
- const match = path.match(regex);
22
- if (!match) return null;
23
- const params = {};
24
- paramNames.forEach((name, index) => {
25
- params[name] = match[index + 1];
26
- });
27
- return params;
28
- }
29
- async function findMatchedRoute(path) {
30
- const privateRoutes = await getPrivateModuleRoutes();
31
- const routes = [...privateRoutes];
32
- for (const route of routes) {
33
- const params = matchRoute(route.path, path);
34
- if (params) {
35
- return { route, params };
36
- }
37
- }
38
- return null;
39
- }
40
- export async function generateMetadata({
41
- params
42
- }) {
43
- const { catchAll } = await params;
44
- const path = `/${catchAll.join("/")}`;
45
- const matched = await findMatchedRoute(path);
46
- if (matched?.route.generateMetadata) {
47
- return matched.route.generateMetadata({
48
- params: matched.params,
49
- searchParams: {}
50
- });
51
- }
52
- return {};
53
- }
54
- export default async function CatchAllPage({
55
- params,
56
- searchParams
57
- }) {
58
- const { catchAll } = await params;
59
- const sParams = await searchParams;
60
- const path = `/${catchAll.join("/")}`;
61
- const matched = await findMatchedRoute(path);
62
- if (matched) {
63
- const { route, params: routeParams } = matched;
64
- if (route.auth) {
65
- const { user, session } = await getCurrentSession();
66
- if (!user || !session) {
67
- return redirect("/signin");
68
- }
69
- const security = await checkSecurity(
70
- session,
71
- user,
72
- route.roles,
73
- route.permissions
74
- );
75
- if (!security.satisfied) {
76
- return redirect(security.redirect || "/signin");
77
- }
78
- }
79
- const Component = route.component;
80
- const Layout = route.layout;
81
- const content = /* @__PURE__ */ React.createElement(Component, { params: routeParams, searchParams: sParams });
82
- if (Layout) {
83
- return /* @__PURE__ */ React.createElement(Layout, null, content);
84
- }
85
- return content;
86
- }
87
- return /* @__PURE__ */ React.createElement("div", { className: "flex-1 flex w-full items-center justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-full justify-center h-[calc(100svh-56px-var(--header-height))] items-center" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Empty, null, /* @__PURE__ */ React.createElement(EmptyHeader, null, /* @__PURE__ */ React.createElement(EmptyTitle, { className: "font-black font-mono text-8xl" }, "404"), /* @__PURE__ */ React.createElement(EmptyDescription, { className: "text-nowrap" }, "The page you're looking for might have been moved or doesn't exist.")), /* @__PURE__ */ React.createElement(EmptyContent, null, /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement(Button, { size: "sm", asChild: true }, /* @__PURE__ */ React.createElement("a", { href: "/" }, /* @__PURE__ */ React.createElement(Icon, { icon: "solar:home-2-broken" }), " Go Home")), /* @__PURE__ */ React.createElement(Button, { variant: "outline", size: "sm", asChild: true }, /* @__PURE__ */ React.createElement("a", { href: "/explore" }, /* @__PURE__ */ React.createElement(Icon, { icon: "solar:compass-broken" }), " Explore"))))))));
88
- }