Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

94 lines
2.5 KiB
Markdown

# @alga-psa/portal-shared
Shared infrastructure for client portal functionality.
## Purpose
This package is an **Infrastructure Layer (Layer 2)** component that provides:
- Type definitions for portal invitation management
- Re-exports of portal-related actions from `@alga-psa/client-portal`
- A shared interface that multiple domain packages can depend on without creating cross-layer dependencies
## Architecture
### Layering Solution
This package solves a layering violation where domain packages (`@alga-psa/clients` and `@alga-psa/client-portal`) were directly depending on each other.
**Before (Violation):**
```
@alga-psa/clients (Layer 3 - Domain)
↓ imports from ↓
@alga-psa/client-portal (Layer 3 - Domain) ❌ Horizontal dependency!
```
**After (Fixed):**
```
@alga-psa/clients (Layer 3 - Domain)
↓ imports from ↓
@alga-psa/portal-shared (Layer 2 - Infrastructure)
↓ re-exports from ↓
@alga-psa/client-portal (Layer 3 - Domain) ✅ Vertical dependency!
```
## Exports
### Types
```typescript
import type {
SendInvitationResult,
VerifyTokenResult,
CompleteSetupResult,
InvitationHistoryItem,
CreateClientPortalUserParams,
} from '@alga-psa/portal-shared/types';
```
### Actions
```typescript
import {
sendPortalInvitation,
getPortalInvitations,
revokePortalInvitation,
verifyPortalToken,
completePortalSetup,
createClientPortalUser,
uploadContactAvatar,
deleteContactAvatar,
updateClientUser,
} from '@alga-psa/portal-shared/actions';
```
## Dependencies
This package depends on:
- `@alga-psa/types` - Type definitions
- `@alga-psa/core` - Shared utilities
- `@alga-psa/db` - Database infrastructure
- `@alga-psa/email` - Email services
- `@alga-psa/tenancy` - Tenant management
And re-exports from:
- `@alga-psa/client-portal` - Portal functionality implementation
## Usage
Both domain packages can safely import from portal-shared without creating circular dependencies:
```typescript
// In @alga-psa/clients
import { sendPortalInvitation } from '@alga-psa/portal-shared/actions';
// In @alga-psa/client-portal
import type { InvitationHistoryItem } from '@alga-psa/portal-shared/types';
```
## Implementation Note
The actual implementations of these functions are in `@alga-psa/client-portal`. This package simply re-exports them to break the direct dependency chain between domain layers.
In the future, if portal functionality needs to be shared more extensively, the implementations can be moved into this package directly.