@moh-sso/clients 0.0.0-stage → 1.4.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/README.md +25 -2
- package/dist/_types/apps/clients/src/api/clientRoles.api.d.ts +539 -0
- package/dist/_types/apps/clients/src/api/clients.api.d.ts +1035 -0
- package/dist/_types/apps/clients/src/api/index.d.ts +2 -0
- package/dist/_types/apps/clients/src/api/onboarding.api.d.ts +544 -0
- package/dist/_types/apps/clients/src/components/ClientFilters.d.ts +17 -0
- package/dist/_types/apps/clients/src/components/EnableClientModal.d.ts +9 -0
- package/dist/_types/apps/clients/src/components/client-form-panel.d.ts +9 -0
- package/dist/_types/apps/clients/src/components/client-onboarding-panel.d.ts +5 -0
- package/dist/_types/apps/clients/src/components/onboarding-draft.d.ts +18 -0
- package/dist/_types/apps/clients/src/components/roles/client-roles-panel.d.ts +6 -0
- package/dist/_types/apps/clients/src/components/roles/create-client-role-form.d.ts +6 -0
- package/dist/_types/apps/clients/src/components/useEnableClientModal.d.ts +9 -0
- package/dist/_types/apps/clients/src/components/user-client-roles-panel.d.ts +5 -0
- package/dist/_types/apps/clients/src/index.d.ts +7 -0
- package/dist/_types/apps/clients/src/pages/client-actions-menu.component.d.ts +8 -0
- package/dist/_types/apps/clients/src/pages/client-bulk-actions.component.d.ts +9 -0
- package/dist/_types/apps/clients/src/pages/client.component.d.ts +1 -0
- package/dist/_types/apps/clients/src/root.component.d.ts +2 -0
- package/dist/_types/apps/clients/src/routes.d.ts +2 -0
- package/dist/_types/apps/clients/src/single-spa.d.ts +1 -0
- package/dist/_types/apps/clients/src/types/client-role.types.d.ts +6 -0
- package/dist/_types/apps/clients/src/types/index.d.ts +2 -0
- package/dist/_types/apps/clients/src/types/user-role.types.d.ts +6 -0
- package/dist/_types/apps/rbac/src/api/health-context.api.d.ts +2482 -0
- package/dist/_types/apps/rbac/src/api/index.d.ts +2 -0
- package/dist/_types/apps/rbac/src/api/rbac.api.d.ts +10383 -0
- package/dist/_types/apps/rbac/src/types/health-context.types.d.ts +92 -0
- package/dist/_types/apps/rbac/src/types/index.d.ts +2 -0
- package/dist/_types/apps/rbac/src/types/rbac.types.d.ts +451 -0
- package/dist/_types/packages/api/src/api/baseApi.d.ts +2 -0
- package/dist/_types/packages/api/src/index.d.ts +1 -0
- package/dist/_types/packages/auth/src/api/auth.api.d.ts +531 -0
- package/dist/_types/packages/auth/src/api/health-context.api.d.ts +374 -0
- package/dist/_types/packages/auth/src/auth/AuthBootstrap.d.ts +1 -0
- package/dist/_types/packages/auth/src/auth/HealthContextProvider.d.ts +20 -0
- package/dist/_types/packages/auth/src/auth/PermissionGuard.d.ts +10 -0
- package/dist/_types/packages/auth/src/auth/auth.selectors.d.ts +896 -0
- package/dist/_types/packages/auth/src/auth/auth.slice.d.ts +14 -0
- package/dist/_types/packages/auth/src/auth/auth.types.d.ts +61 -0
- package/dist/_types/packages/auth/src/auth/login-url.d.ts +2 -0
- package/dist/_types/packages/auth/src/auth/permissions.d.ts +58 -0
- package/dist/_types/packages/auth/src/auth/rbac.d.ts +8 -0
- package/dist/_types/packages/auth/src/auth/system-launch-url.d.ts +9 -0
- package/dist/_types/packages/auth/src/auth/useAuthorization.d.ts +14 -0
- package/dist/_types/packages/auth/src/index.d.ts +14 -0
- package/dist/_types/packages/config/src/appMeta.d.ts +3 -0
- package/dist/_types/packages/config/src/index.d.ts +6 -0
- package/dist/_types/packages/config/src/lib/constants/api.constants.d.ts +178 -0
- package/dist/_types/packages/config/src/lib/constants/document-templates.d.ts +11 -0
- package/dist/_types/packages/config/src/lib/errors/errorMessages.d.ts +2 -0
- package/dist/_types/packages/config/src/lib/errors/errorSeverity.d.ts +3 -0
- package/dist/_types/packages/config/src/lib/errors/errorTypes.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/basename.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/index.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/lifecycle.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/navigation.d.ts +2 -0
- package/dist/_types/packages/microfrontend/src/props.d.ts +44 -0
- package/dist/_types/packages/microfrontend/src/react-lifecycle.d.ts +11 -0
- package/dist/_types/packages/microfrontend/src/routes.d.ts +13 -0
- package/dist/_types/packages/state/src/clients/clients.selectors.d.ts +534 -0
- package/dist/_types/packages/state/src/clients/clients.slice.d.ts +4 -0
- package/dist/_types/packages/state/src/document/documents.selectors.d.ts +1 -0
- package/dist/_types/packages/state/src/index.d.ts +29 -0
- package/dist/_types/packages/state/src/ui/ui.state.d.ts +1 -0
- package/dist/_types/packages/types/src/index.d.ts +6 -0
- package/dist/_types/packages/types/src/types/announcement-summary.types.d.ts +16 -0
- package/dist/_types/packages/types/src/types/client-role.types.d.ts +6 -0
- package/dist/_types/packages/types/src/types/client.types.d.ts +46 -0
- package/dist/_types/packages/types/src/types/document-processing.types.d.ts +1 -0
- package/dist/_types/packages/types/src/types/notifications.types.d.ts +96 -0
- package/dist/_types/packages/types/src/types/system-navigation.types.d.ts +18 -0
- package/dist/_types/packages/ui/src/accessibility/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/accessibility/useFocusTrap.d.ts +10 -0
- package/dist/_types/packages/ui/src/branding/BuildMeta.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/PublicFooter.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/data-display/DataTablePagination.d.ts +12 -0
- package/dist/_types/packages/ui/src/data-display/DataTableShell.d.ts +35 -0
- package/dist/_types/packages/ui/src/data-display/RowActionsCell.d.ts +7 -0
- package/dist/_types/packages/ui/src/data-display/TableEmptyState.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/TableStatusTag.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/comingsoon/ComingSoon.d.ts +7 -0
- package/dist/_types/packages/ui/src/feedback/emptystate/EmptyState.d.ts +15 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/ErrorState.d.ts +14 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/MicrofrontendErrorBoundary.d.ts +16 -0
- package/dist/_types/packages/ui/src/feedback/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/loadingstate/LoadingState.d.ts +5 -0
- package/dist/_types/packages/ui/src/forms/CaseFormsGrid.d.ts +1 -0
- package/dist/_types/packages/ui/src/forms/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/index.d.ts +16 -0
- package/dist/_types/packages/ui/src/layout/PageShell/PageShell.d.ts +9 -0
- package/dist/_types/packages/ui/src/layout/SectionCard/SectionCard.d.ts +11 -0
- package/dist/_types/packages/ui/src/layout/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppGridContent.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenu.component.d.ts +6 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenuItem.component.d.ts +13 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/appMenuGroups.d.ts +11 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/AppBreadcrumbs.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/BreadcrumbBar.d.ts +10 -0
- package/dist/_types/packages/ui/src/navigation/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/sidenav/ClientSideNav.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/FormInlineAlert.d.ts +7 -0
- package/dist/_types/packages/ui/src/notifications/NotificationsPanel.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/notifications/toast/ToastProvider.d.ts +20 -0
- package/dist/_types/packages/ui/src/notifications/toast/useToast.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/ReusableHeaderPanel.d.ts +17 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/header-panel.context.d.ts +23 -0
- package/dist/_types/packages/ui/src/overlays/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/overlays/modal/ReusableModal.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/modal/modal.context.d.ts +14 -0
- package/dist/_types/packages/ui/src/shell/ExternalAppHeader.d.ts +22 -0
- package/dist/_types/packages/ui/src/shell/PublicHeader.component.d.ts +8 -0
- package/dist/_types/packages/ui/src/shell/UserHeader.component.d.ts +17 -0
- package/dist/_types/packages/ui/src/shell/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/theme/ThemeProvider.d.ts +8 -0
- package/dist/_types/packages/ui/src/theme/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/utils/severity.d.ts +22 -0
- package/dist/_types/packages/ui/src/utils/status.d.ts +1 -0
- package/dist/api.d.ts +1 -0
- package/dist/api.js +38 -0
- package/dist/api.js.map +1 -0
- package/dist/assets/clients-DjhOVsFS.css +1 -0
- package/dist/assets/clients.api-DqQdrhve.js +169 -0
- package/dist/assets/clients.api-DqQdrhve.js.map +1 -0
- package/dist/assets/root.component-WxWhdR-e.js +1132 -0
- package/dist/assets/root.component-WxWhdR-e.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +811 -0
- package/dist/index.js.map +1 -0
- package/dist/routes.d.ts +1 -0
- package/dist/routes.js +32 -0
- package/dist/routes.js.map +1 -0
- package/dist/single-spa.d.ts +1 -0
- package/dist/single-spa.js +32 -0
- package/dist/single-spa.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ReusableModalProps } from "./ReusableModal";
|
|
3
|
+
type ModalState = Omit<ReusableModalProps, "open"> & {
|
|
4
|
+
open: boolean;
|
|
5
|
+
};
|
|
6
|
+
type ModalContextType = {
|
|
7
|
+
openModal: (config: Omit<ModalState, "open">) => void;
|
|
8
|
+
closeModal: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function ModalProvider({ children }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
export declare function useModal(): ModalContextType;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ExternalAppLink = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
/** Absolute HTTP(S) launch URL approved by the application's backend. */
|
|
5
|
+
href: string;
|
|
6
|
+
};
|
|
7
|
+
export type ExternalAppHeaderProps = {
|
|
8
|
+
appName: string;
|
|
9
|
+
username: string;
|
|
10
|
+
/** Absolute portal launcher URL, including its deployment base path. */
|
|
11
|
+
portalUrl: string;
|
|
12
|
+
/** Supply only applications this user may launch. No portal API is called here. */
|
|
13
|
+
applications?: ExternalAppLink[];
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
onRetry?: () => void;
|
|
17
|
+
onProfile: () => void;
|
|
18
|
+
/** End the local application session and initiate the application's OIDC logout. */
|
|
19
|
+
onLogout: () => void;
|
|
20
|
+
};
|
|
21
|
+
/** Shared MOH chrome for independently hosted React apps. Requires no portal auth/store/router. */
|
|
22
|
+
export declare function ExternalAppHeader({ appName, username, portalUrl, applications, isLoading, isError, onRetry, onProfile, onLogout, }: ExternalAppHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type UserHeaderProps = {
|
|
4
|
+
appName?: string;
|
|
5
|
+
homeHref?: string;
|
|
6
|
+
username?: string | null;
|
|
7
|
+
appMenu?: ReactNode;
|
|
8
|
+
contextSelector?: ReactNode;
|
|
9
|
+
onNavigateHome?: () => void;
|
|
10
|
+
onLogout?: () => void;
|
|
11
|
+
onProfile?: () => void;
|
|
12
|
+
navigationExpanded?: boolean;
|
|
13
|
+
onToggleNavigation?: () => void;
|
|
14
|
+
onGlobalAction?: () => void;
|
|
15
|
+
};
|
|
16
|
+
declare const UserHeader: React.FC<UserHeaderProps>;
|
|
17
|
+
export default UserHeader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as PublicHeader } from "./PublicHeader.component";
|
|
2
|
+
export { default as UserHeader } from "./UserHeader.component";
|
|
3
|
+
export type { UserHeaderProps } from "./UserHeader.component";
|
|
4
|
+
export { ExternalAppHeader } from "./ExternalAppHeader";
|
|
5
|
+
export type { ExternalAppHeaderProps, ExternalAppLink } from "./ExternalAppHeader";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type MohTheme = "white" | "g10" | "g90" | "g100";
|
|
3
|
+
type MohThemeProviderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
theme?: MohTheme;
|
|
6
|
+
};
|
|
7
|
+
export declare function MohThemeProvider({ children, theme }: MohThemeProviderProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MohThemeProvider } from "./ThemeProvider";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ---------------------------------------------------
|
|
3
|
+
* Domain Severity (Business Layer)
|
|
4
|
+
* ---------------------------------------------------
|
|
5
|
+
*/
|
|
6
|
+
export type Severity = "info" | "success" | "warning" | "critical" | "danger";
|
|
7
|
+
/**
|
|
8
|
+
* ---------------------------------------------------
|
|
9
|
+
* Carbon Tag Type
|
|
10
|
+
* ---------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export type CarbonTagType = "red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray" | "high-contrast" | "outline";
|
|
13
|
+
export declare function isSeverity(value: unknown): value is Severity;
|
|
14
|
+
export declare function normalizeSeverity(value?: string | null): Severity;
|
|
15
|
+
/**
|
|
16
|
+
* ---------------------------------------------------
|
|
17
|
+
* Public Helpers
|
|
18
|
+
* ---------------------------------------------------
|
|
19
|
+
*/
|
|
20
|
+
export declare const getSeverityTagType: (severity?: string | null) => CarbonTagType;
|
|
21
|
+
export declare const getSeverityLabel: (severity?: string | null) => string;
|
|
22
|
+
export declare const getSeverityRank: (severity?: string | null) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_types/apps/clients/src/api/index.js";
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
const __mohCssFiles = [new URL("assets/clients-DjhOVsFS.css", import.meta.url).href];
|
|
3
|
+
const __mohInjectCss = () => {
|
|
4
|
+
if (typeof document === "undefined") {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
for (const file of __mohCssFiles) {
|
|
9
|
+
const href = file;
|
|
10
|
+
if (document.querySelector('link[data-moh-css="' + href + '"]')) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const link = document.createElement("link");
|
|
15
|
+
link.rel = "stylesheet";
|
|
16
|
+
link.href = href;
|
|
17
|
+
link.setAttribute("data-moh-css", href);
|
|
18
|
+
document.head.appendChild(link);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
queueMicrotask(__mohInjectCss);
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
import { c as s, a as i, u as a, b as u, d as l, e as n, f as o, g as C, h as r, i as M, j as p } from "./assets/clients.api-DqQdrhve.js";
|
|
25
|
+
export {
|
|
26
|
+
s as clientRolesApi,
|
|
27
|
+
i as clientsApi,
|
|
28
|
+
a as useCreateClientMutation,
|
|
29
|
+
u as useCreateClientRoleMutation,
|
|
30
|
+
l as useDeleteClientMutation,
|
|
31
|
+
n as useDeleteClientRoleMutation,
|
|
32
|
+
o as useGetClientQuery,
|
|
33
|
+
C as useListClientRolesQuery,
|
|
34
|
+
r as useListClientsQuery,
|
|
35
|
+
M as useToggleClientMutation,
|
|
36
|
+
p as useUpdateClientMutation
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.client-filters{width:100%;justify-content:flex-start;align-items:flex-end;flex-wrap:wrap}.client-filters__field--status{width:11.25rem}.client-filters__field--type{width:12.5rem}.client-bulk-actions{margin-bottom:1rem}.client-confirm-modal{display:grid;gap:1rem}.client-confirm-modal__description{color:var(--cds-text-secondary)}.client-confirm-modal__actions{display:flex;justify-content:flex-end;gap:.5rem}@media(max-width:672px){.client-filters{flex-wrap:wrap;justify-content:stretch}.client-filters__field--status,.client-filters__field--type{width:100%}.client-confirm-modal__actions{flex-direction:column-reverse;align-items:stretch}}.client-onboarding{max-width:52rem}.client-onboarding__steps{display:flex;flex-wrap:wrap;gap:1rem;padding:0;list-style:none;color:var(--cds-text-secondary)}.client-onboarding__steps [aria-current=step]{color:var(--cds-link-primary);font-weight:600}.client-onboarding pre{max-height:24rem;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:1rem;background:var(--cds-layer-02);font-size:.75rem}.client-onboarding dt{margin-top:.75rem;color:var(--cds-text-secondary)}.client-onboarding dd{margin:.25rem 0;overflow-wrap:anywhere}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { API as s } from "@moh-sso/config";
|
|
2
|
+
import { baseApi as a } from "@moh-sso/api";
|
|
3
|
+
const o = a.injectEndpoints({
|
|
4
|
+
endpoints: (n) => ({
|
|
5
|
+
/* --------------------------------
|
|
6
|
+
* List roles for a client (AUTH)
|
|
7
|
+
* GET /clients/:id/roles
|
|
8
|
+
* -------------------------------- */
|
|
9
|
+
listClientRoles: n.query({
|
|
10
|
+
query: (e) => ({
|
|
11
|
+
url: s.clients.roles.list(e),
|
|
12
|
+
credentials: "include"
|
|
13
|
+
}),
|
|
14
|
+
transformResponse: (e) => e.data,
|
|
15
|
+
providesTags: (e, t, i) => e ? [
|
|
16
|
+
...e.map((l) => ({
|
|
17
|
+
type: "ClientRole",
|
|
18
|
+
id: `${i}-${l.name}`
|
|
19
|
+
})),
|
|
20
|
+
{ type: "ClientRole", id: `LIST-${i}` }
|
|
21
|
+
] : [{ type: "ClientRole", id: `LIST-${i}` }]
|
|
22
|
+
}),
|
|
23
|
+
/* --------------------------------
|
|
24
|
+
* Create client role (ADMIN)
|
|
25
|
+
* POST /admin/clients/:id/roles
|
|
26
|
+
* -------------------------------- */
|
|
27
|
+
createClientRole: n.mutation({
|
|
28
|
+
query: ({ clientUuid: e, payload: t }) => ({
|
|
29
|
+
url: s.clients.roles.create(e),
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: t,
|
|
32
|
+
credentials: "include"
|
|
33
|
+
}),
|
|
34
|
+
invalidatesTags: (e, t, { clientUuid: i }) => [
|
|
35
|
+
{ type: "ClientRole", id: `LIST-${i}` }
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/* --------------------------------
|
|
39
|
+
* Delete client role (ADMIN)
|
|
40
|
+
* DELETE /admin/clients/:id/roles/:role
|
|
41
|
+
* -------------------------------- */
|
|
42
|
+
deleteClientRole: n.mutation({
|
|
43
|
+
query: ({ clientUuid: e, roleName: t }) => ({
|
|
44
|
+
url: s.clients.roles.delete(e, t),
|
|
45
|
+
method: "DELETE",
|
|
46
|
+
credentials: "include"
|
|
47
|
+
}),
|
|
48
|
+
invalidatesTags: (e, t, { clientUuid: i, roleName: l }) => [
|
|
49
|
+
{ type: "ClientRole", id: `${i}-${l}` },
|
|
50
|
+
{ type: "ClientRole", id: `LIST-${i}` }
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}), { useListClientRolesQuery: p, useCreateClientRoleMutation: C, useDeleteClientRoleMutation: c } = o, d = a.injectEndpoints({
|
|
55
|
+
endpoints: (n) => ({
|
|
56
|
+
/* --------------------------------
|
|
57
|
+
* List clients
|
|
58
|
+
* -------------------------------- */
|
|
59
|
+
listClients: n.query({
|
|
60
|
+
query: () => ({
|
|
61
|
+
url: s.clients.list(),
|
|
62
|
+
credentials: "include"
|
|
63
|
+
}),
|
|
64
|
+
transformResponse: (e) => e.data,
|
|
65
|
+
providesTags: (e) => e ? [
|
|
66
|
+
...e.map((t) => ({
|
|
67
|
+
type: "Client",
|
|
68
|
+
id: t.id
|
|
69
|
+
})),
|
|
70
|
+
{ type: "Client", id: "LIST" }
|
|
71
|
+
] : [{ type: "Client", id: "LIST" }]
|
|
72
|
+
}),
|
|
73
|
+
/* --------------------------------
|
|
74
|
+
* Get single client
|
|
75
|
+
* -------------------------------- */
|
|
76
|
+
getClient: n.query({
|
|
77
|
+
query: (e) => ({
|
|
78
|
+
url: s.clients.byId(e),
|
|
79
|
+
credentials: "include"
|
|
80
|
+
}),
|
|
81
|
+
transformResponse: (e) => e.data,
|
|
82
|
+
providesTags: (e, t, i) => [{ type: "Client", id: i }]
|
|
83
|
+
}),
|
|
84
|
+
/* --------------------------------
|
|
85
|
+
* Create client
|
|
86
|
+
* -------------------------------- */
|
|
87
|
+
createClient: n.mutation({
|
|
88
|
+
query: (e) => ({
|
|
89
|
+
url: s.clients.create(),
|
|
90
|
+
method: "POST",
|
|
91
|
+
body: e,
|
|
92
|
+
credentials: "include"
|
|
93
|
+
}),
|
|
94
|
+
transformResponse: (e) => e.data,
|
|
95
|
+
invalidatesTags: [{ type: "Client", id: "LIST" }]
|
|
96
|
+
}),
|
|
97
|
+
/* --------------------------------
|
|
98
|
+
* Update client (general update)
|
|
99
|
+
* -------------------------------- */
|
|
100
|
+
updateClient: n.mutation({
|
|
101
|
+
query: ({ id: e, data: t }) => ({
|
|
102
|
+
url: s.clients.update(e),
|
|
103
|
+
method: "PUT",
|
|
104
|
+
body: t,
|
|
105
|
+
credentials: "include"
|
|
106
|
+
}),
|
|
107
|
+
transformResponse: (e) => e.data,
|
|
108
|
+
invalidatesTags: (e, t, { id: i }) => [
|
|
109
|
+
{ type: "Client", id: i },
|
|
110
|
+
{ type: "Client", id: "LIST" }
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
/* --------------------------------
|
|
114
|
+
* Enable / Disable client
|
|
115
|
+
* PATCH /clients/:id/toggle
|
|
116
|
+
* -------------------------------- */
|
|
117
|
+
toggleClient: n.mutation({
|
|
118
|
+
query: ({ id: e, enabled: t }) => ({
|
|
119
|
+
url: `${s.clients.byId(e)}/toggle`,
|
|
120
|
+
method: "PATCH",
|
|
121
|
+
body: { enabled: t },
|
|
122
|
+
credentials: "include"
|
|
123
|
+
}),
|
|
124
|
+
transformResponse: () => {
|
|
125
|
+
},
|
|
126
|
+
invalidatesTags: (e, t, { id: i }) => [
|
|
127
|
+
{ type: "Client", id: i },
|
|
128
|
+
{ type: "Client", id: "LIST" }
|
|
129
|
+
]
|
|
130
|
+
}),
|
|
131
|
+
/* --------------------------------
|
|
132
|
+
* Delete client
|
|
133
|
+
* -------------------------------- */
|
|
134
|
+
deleteClient: n.mutation({
|
|
135
|
+
query: (e) => ({
|
|
136
|
+
url: s.clients.delete(e),
|
|
137
|
+
method: "DELETE",
|
|
138
|
+
credentials: "include"
|
|
139
|
+
}),
|
|
140
|
+
transformResponse: () => {
|
|
141
|
+
},
|
|
142
|
+
invalidatesTags: (e, t, i) => [
|
|
143
|
+
{ type: "Client", id: i },
|
|
144
|
+
{ type: "Client", id: "LIST" }
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
}), {
|
|
149
|
+
useListClientsQuery: y,
|
|
150
|
+
useGetClientQuery: m,
|
|
151
|
+
useCreateClientMutation: T,
|
|
152
|
+
useUpdateClientMutation: R,
|
|
153
|
+
useToggleClientMutation: g,
|
|
154
|
+
useDeleteClientMutation: L
|
|
155
|
+
} = d;
|
|
156
|
+
export {
|
|
157
|
+
d as a,
|
|
158
|
+
C as b,
|
|
159
|
+
o as c,
|
|
160
|
+
L as d,
|
|
161
|
+
c as e,
|
|
162
|
+
m as f,
|
|
163
|
+
p as g,
|
|
164
|
+
y as h,
|
|
165
|
+
g as i,
|
|
166
|
+
R as j,
|
|
167
|
+
T as u
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=clients.api-DqQdrhve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.api-DqQdrhve.js","sources":["../../src/api/clientRoles.api.ts","../../src/api/clients.api.ts"],"sourcesContent":["import { API } from \"@moh-sso/config\";\nimport type { ClientRole } from \"@moh-sso/types\";\n\nimport { baseApi } from \"@moh-sso/api\";\n\ntype ApiEnvelope<T> = {\n success: boolean;\n data: T;\n};\n\nexport type RoleRequest = {\n role: string;\n description?: string;\n};\n\nexport const clientRolesApi = baseApi.injectEndpoints({\n endpoints: (builder) => ({\n /* --------------------------------\n * List roles for a client (AUTH)\n * GET /clients/:id/roles\n * -------------------------------- */\n listClientRoles: builder.query<ClientRole[], string>({\n query: (clientUuid) => ({\n url: API.clients.roles.list(clientUuid),\n credentials: \"include\",\n }),\n\n transformResponse: (res: ApiEnvelope<ClientRole[]>) => res.data,\n\n providesTags: (result, _, clientUuid) =>\n result\n ? [\n ...result.map((role) => ({\n type: \"ClientRole\" as const,\n id: `${clientUuid}-${role.name}`,\n })),\n { type: \"ClientRole\", id: `LIST-${clientUuid}` },\n ]\n : [{ type: \"ClientRole\", id: `LIST-${clientUuid}` }],\n }),\n\n /* --------------------------------\n * Create client role (ADMIN)\n * POST /admin/clients/:id/roles\n * -------------------------------- */\n createClientRole: builder.mutation<void, { clientUuid: string; payload: RoleRequest }>({\n query: ({ clientUuid, payload }) => ({\n url: API.clients.roles.create(clientUuid),\n method: \"POST\",\n body: payload,\n credentials: \"include\",\n }),\n\n invalidatesTags: (_r, _e, { clientUuid }) => [\n { type: \"ClientRole\", id: `LIST-${clientUuid}` },\n ],\n }),\n\n /* --------------------------------\n * Delete client role (ADMIN)\n * DELETE /admin/clients/:id/roles/:role\n * -------------------------------- */\n deleteClientRole: builder.mutation<void, { clientUuid: string; roleName: string }>({\n query: ({ clientUuid, roleName }) => ({\n url: API.clients.roles.delete(clientUuid, roleName),\n method: \"DELETE\",\n credentials: \"include\",\n }),\n\n invalidatesTags: (_r, _e, { clientUuid, roleName }) => [\n { type: \"ClientRole\", id: `${clientUuid}-${roleName}` },\n { type: \"ClientRole\", id: `LIST-${clientUuid}` },\n ],\n }),\n }),\n});\n\nexport const { useListClientRolesQuery, useCreateClientRoleMutation, useDeleteClientRoleMutation } =\n clientRolesApi;\n","import { API } from \"@moh-sso/config\";\nimport type { Client, CreateClientPayload, UpdateClientPayload } from \"@moh-sso/types\";\n\nimport { baseApi } from \"@moh-sso/api\";\n\ntype ApiEnvelope<T> = {\n success: boolean;\n data: T;\n};\n\ntype UpdateClientRequest = {\n id: string;\n data: UpdateClientPayload;\n};\n\nexport const clientsApi = baseApi.injectEndpoints({\n endpoints: (builder) => ({\n /* --------------------------------\n * List clients\n * -------------------------------- */\n listClients: builder.query<Client[], void>({\n query: () => ({\n url: API.clients.list(),\n credentials: \"include\",\n }),\n transformResponse: (res: ApiEnvelope<Client[]>) => res.data,\n providesTags: (result) =>\n result\n ? [\n ...result.map((client) => ({\n type: \"Client\" as const,\n id: client.id,\n })),\n { type: \"Client\", id: \"LIST\" },\n ]\n : [{ type: \"Client\", id: \"LIST\" }],\n }),\n\n /* --------------------------------\n * Get single client\n * -------------------------------- */\n getClient: builder.query<Client, string>({\n query: (id) => ({\n url: API.clients.byId(id),\n credentials: \"include\",\n }),\n transformResponse: (res: ApiEnvelope<Client>) => res.data,\n providesTags: (_r, _e, id) => [{ type: \"Client\", id }],\n }),\n\n /* --------------------------------\n * Create client\n * -------------------------------- */\n createClient: builder.mutation<Client, CreateClientPayload>({\n query: (body) => ({\n url: API.clients.create(),\n method: \"POST\",\n body,\n credentials: \"include\",\n }),\n transformResponse: (res: ApiEnvelope<Client>) => res.data,\n invalidatesTags: [{ type: \"Client\", id: \"LIST\" }],\n }),\n\n /* --------------------------------\n * Update client (general update)\n * -------------------------------- */\n updateClient: builder.mutation<Client, UpdateClientRequest>({\n query: ({ id, data }) => ({\n url: API.clients.update(id),\n method: \"PUT\",\n body: data,\n credentials: \"include\",\n }),\n transformResponse: (res: ApiEnvelope<Client>) => res.data,\n invalidatesTags: (_r, _e, { id }) => [\n { type: \"Client\", id },\n { type: \"Client\", id: \"LIST\" },\n ],\n }),\n\n /* --------------------------------\n * Enable / Disable client\n * PATCH /clients/:id/toggle\n * -------------------------------- */\n toggleClient: builder.mutation<void, { id: string; enabled: boolean }>({\n query: ({ id, enabled }) => ({\n url: `${API.clients.byId(id)}/toggle`,\n method: \"PATCH\",\n body: { enabled },\n credentials: \"include\",\n }),\n transformResponse: () => undefined,\n invalidatesTags: (_r, _e, { id }) => [\n { type: \"Client\", id },\n { type: \"Client\", id: \"LIST\" },\n ],\n }),\n\n /* --------------------------------\n * Delete client\n * -------------------------------- */\n deleteClient: builder.mutation<void, string>({\n query: (id) => ({\n url: API.clients.delete(id),\n method: \"DELETE\",\n credentials: \"include\",\n }),\n transformResponse: () => undefined,\n invalidatesTags: (_r, _e, id) => [\n { type: \"Client\", id },\n { type: \"Client\", id: \"LIST\" },\n ],\n }),\n }),\n});\n\nexport const {\n useListClientsQuery,\n useGetClientQuery,\n useCreateClientMutation,\n useUpdateClientMutation,\n useToggleClientMutation,\n useDeleteClientMutation,\n} = clientsApi;\n"],"names":["clientRolesApi","baseApi","builder","clientUuid","API","res","result","_","role","payload","_r","_e","roleName","useListClientRolesQuery","useCreateClientRoleMutation","useDeleteClientRoleMutation","clientsApi","client","id","body","data","enabled","useListClientsQuery","useGetClientQuery","useCreateClientMutation","useUpdateClientMutation","useToggleClientMutation","useDeleteClientMutation"],"mappings":";;AAeO,MAAMA,IAAiBC,EAAQ,gBAAgB;AAAA,EACpD,WAAW,CAACC,OAAa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