Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vuu-ui/docs/authentication-refactor-proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document defines authentication and VUU connection handling for:
- `PortalShell`, the authenticated portal runtime container.
- `Feature`, which lazy-loads module-federation remotes.
- `RemoteModule`, which establishes the VUU connection required by a remote.
- `@vuu-ui/vuu-auth`, which owns identity authentication and VUU token
- `@vuu-ui/core`, which owns identity authentication and VUU token
exchange.
- `@vuu-ui/vuu-data-react`, which supplies VUU data-source implementations
without performing authentication.
Expand Down Expand Up @@ -64,7 +64,7 @@ VUU token.

## Package Responsibilities

### `@vuu-ui/vuu-auth`
### `@vuu-ui/core`

The auth package owns:

Expand Down
431 changes: 228 additions & 203 deletions vuu-ui/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @vuu-ui/vuu-portal
# @vuu-ui/core portal

Reusable VUU portal host and Module Federation integration components.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @vuu-ui/vuu-auth
# @vuu-ui/core authentication

Authentication contracts and React integration for VUU UI applications.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Purpose

`@vuu-ui/vuu-portal` provides the reusable components, types, and utilities
`@vuu-ui/core` provides the reusable components, types, and utilities
needed to build VUU portals with Module Federation. It is the package boundary
for portal host behavior and remote-module integration.

Expand Down Expand Up @@ -38,7 +38,7 @@ module instead of implicitly using the portal host's connection.
## Package Structure

```text
vuu-portal/
core/
|-- src/
| |-- portal-header/
| |-- portal-nav/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"name": "@vuu-ui/vuu-portal",
"name": "@vuu-ui/core",
"version": "3.1.0",
"description": "VUU portal and Module Federation support",
"description": "Core VUU authentication, data context, portal, and Module Federation APIs",
"files": [
"DESIGN.md"
"docs"
],
"main": "src/index.ts",
"author": "heswell",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"build": "node ../../scripts/run-build-rslib.ts",
"test": "cd ../.. && vitest run packages/core/test",
"type-defs": "node ../../scripts/build-type-defs.mjs"
},
"dependencies": {
"@module-federation/enhanced": "2.8.0",
"@salt-ds/core": "1.67.0",
"@vuu-ui/vuu-auth": "3.1.0",
"@vuu-ui/vuu-data-react": "3.1.0",
"@vuu-ui/vuu-data-remote": "3.1.0",
"@vuu-ui/vuu-data-types": "3.1.0",
"@vuu-ui/vuu-icons": "3.1.0",
"@vuu-ui/vuu-ui-controls": "3.1.0",
"keycloak-js": "26.2.4",
"react-router-dom": "^6.2.1"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RemoteModuleConnection } from "@vuu-ui/vuu-auth";
import type { RemoteModuleConnection } from "./auth";

export interface RemoteModuleDescriptor {
description: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
DataSourceConstructorProps,
RemoteModuleConnection,
} from "@vuu-ui/vuu-data-types";
import { DataProvider } from "@vuu-ui/vuu-utils2";
import { DataProvider } from "../context-definitions/DataProvider";
import {
createContext,
useCallback,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useOptionalVuuConnectionId } from "@vuu-ui/vuu-auth";
import { useOptionalVuuConnectionId } from "../auth/AuthenticationProvider";
import { ConnectionManager, VuuDataSource } from "@vuu-ui/vuu-data-remote";
import type { DataSourceConstructorProps } from "@vuu-ui/vuu-data-types";
import { useMemo, type ReactNode } from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export * from "./auth";
export { DataContext } from "./context-definitions/DataContext";
export {
DataProvider,
useData,
} from "./context-definitions/DataProvider";
export {
PortalHeader,
type PortalHeaderProps,
Expand Down
35 changes: 35 additions & 0 deletions vuu-ui/packages/core/src/portal-header/PortalHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Button, Toolbar, ToolbarContent, Tooltray } from "@salt-ds/core";
import { useLogout } from "../auth";
import cx from "clsx";
import type { HTMLAttributes } from "react";

import "./PortalHeader.css";

const classBase = "vuuPortalHeader";

export interface PortalHeaderProps extends HTMLAttributes<HTMLDivElement> {}

export const PortalHeader = ({
className: classNameProp,
...htmlAttributes
}: PortalHeaderProps) => {
const className = cx(classBase, classNameProp);
const logout = useLogout();

return (
<Toolbar className={className} role="banner" {...htmlAttributes}>
<ToolbarContent position="end">
<Tooltray align="end">
<Button
appearance="transparent"
className={`${classBase}-menuItem`}
onClick={logout}
sentiment="neutral"
>
Log out
</Button>
</Tooltray>
</ToolbarContent>
</Toolbar>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
AuthenticationProvider,
type RemoteModuleConnection,
} from "@vuu-ui/vuu-auth";
import { AuthenticationProvider, type RemoteModuleConnection } from "../auth";
import {
loadRemote,
registerRemotes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
import {
AuthenticationConfigurationError,
normalizeVuuAuthTarget,
} from "../src/AuthenticationProvider";
} from "../../src/auth/AuthenticationProvider";

const portalTarget = {
connectionId: "portal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ describe("KeycloakAuthHandler", () => {
});

it("initializes Keycloak once and refreshes the identity token", async () => {
const { KeycloakAuthHandler } = await import("../src/KeycloakAuthHandler");
const { KeycloakAuthHandler } = await import(
"../../src/auth/KeycloakAuthHandler"
);
const handler = new KeycloakAuthHandler({
authUrl: "https://identity.example.test",
restUrl: "https://vuu.example.test/api/authn",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it } from "vitest";
import { DirectVuuSessionResolver } from "../src/DirectVuuSessionResolver";
import { VuuAuthHandler } from "../src/VuuAuthHandler";
import { DirectVuuSessionResolver } from "../../src/auth/DirectVuuSessionResolver";
import { VuuAuthHandler } from "../../src/auth/VuuAuthHandler";

const config = {
authUrl: "https://login.example.test",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import type { AuthHandler } from "../src/AuthHandler";
import type { AuthHandler } from "../../src/auth/AuthHandler";
import {
VuuConnectionRegistry,
type VuuConnectionClient,
} from "../src/VuuConnectionRegistry";
import type { VuuAuthTarget, VuuSession } from "../src/VuuTokenExchange";
} from "../../src/auth/VuuConnectionRegistry";
import type {
VuuAuthTarget,
VuuSession,
} from "../../src/auth/VuuTokenExchange";

const target: VuuAuthTarget = {
connectionId: "orders",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
exchangeVuuToken,
VuuTokenExchangeError,
type VuuAuthTarget,
} from "../src/VuuTokenExchange";
} from "../../src/auth/VuuTokenExchange";

const target: VuuAuthTarget = {
connectionId: "orders",
Expand Down Expand Up @@ -36,7 +36,7 @@ describe("exchangeVuuToken", () => {
});
expect(fetch).toHaveBeenCalledWith(target.restUrl, {
headers: { Authorization: "Bearer identity-token" },
method: "POST"
method: "POST",
});
});

Expand Down
24 changes: 0 additions & 24 deletions vuu-ui/packages/vuu-auth/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-data-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@vuu-ui/vuu-ui-controls": "3.1.0",
"@vuu-ui/vuu-utils": "3.1.0",
"@vuu-ui/vuu-table": "3.1.0",
"@vuu-ui/vuu-auth": "3.1.0"
"@vuu-ui/core": "3.1.0"
},
"peerDependencies": {
"clsx": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useOptionalVuuConnectionId } from "@vuu-ui/vuu-auth";
import { useOptionalVuuConnectionId } from "@vuu-ui/core";
import { ConnectionManager, VuuDataSource } from "@vuu-ui/vuu-data-remote";
import type { DataSourceConstructorProps } from "@vuu-ui/vuu-data-types";
import { DataProvider } from "@vuu-ui/vuu-utils2";
import { DataProvider } from "@vuu-ui/core";
import { useMemo, type ReactNode } from "react";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
DataSourceConfigChangeHandler,
DataSourceConstructorProps,
} from "@vuu-ui/vuu-data-types";
import { useData } from "@vuu-ui/vuu-utils2";
import { useData } from "@vuu-ui/core";
import { useCallback, useRef } from "react";

const sessionState = new Map<string, DataSource>();
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-data-react/src/hooks/useVuuTables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TableSchema } from "@vuu-ui/vuu-data-types";
import { useData } from "@vuu-ui/vuu-utils2";
import { useData } from "@vuu-ui/core";
import { useEffect, useState } from "react";

export const useVuuTables = () => {
Expand Down
41 changes: 0 additions & 41 deletions vuu-ui/packages/vuu-portal/src/portal-header/PortalHeader.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions vuu-ui/packages/vuu-portal/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@vuu-ui/vuu-ui-controls": "3.1.0",
"@vuu-ui/vuu-utils": "3.1.0",
"@module-federation/enhanced": "2.8.0",
"@vuu-ui/vuu-auth": "3.1.0",
"@vuu-ui/core": "3.1.0",
"html-to-image": "^1.11.11"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-shell/src/app-header/AppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from "@salt-ds/core";
import { useComponentCssInjection } from "@salt-ds/styles";
import { useWindow } from "@salt-ds/window";
import { useLogout } from "@vuu-ui/vuu-auth";
import { useLogout } from "@vuu-ui/core";
import { useLayoutOperation } from "@vuu-ui/vuu-layout";
import { NotificationType, useNotifications } from "@vuu-ui/vuu-notifications";
import { Toolbar } from "@vuu-ui/vuu-ui-controls";
Expand Down
4 changes: 2 additions & 2 deletions vuu-ui/packages/vuu-shell/src/feature/Feature.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RemoteModule } from "@vuu-ui/vuu-portal";
import { RemoteModule } from "@vuu-ui/core";
import { registerComponent } from "@vuu-ui/vuu-utils";

/** @deprecated Use RemoteModule from @vuu-ui/vuu-portal. */
/** @deprecated Use RemoteModule from @vuu-ui/core. */
export const Feature = RemoteModule;
Feature.displayName = "Feature";
registerComponent("Feature", Feature, "view");
4 changes: 2 additions & 2 deletions vuu-ui/packages/vuu-shell/src/feature/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './Feature';
export * from "./Feature";
export {
RemoteModule,
type RemoteModuleProps,
} from "@vuu-ui/vuu-portal";
} from "@vuu-ui/core";
Loading
Loading