index overview
Service layer exports for the PingOne CLI.
This module provides Effect-ts service layers for:
- HttpClientWithRetry: Wrapper layer that adds automatic retry logic to HttpClient
- CacheService: Response caching with schema validation (used in helpers)
- RetryService: Retry logic service (used internally by HttpClientWithRetry)
- CredentialService: Secure credential storage
- OAuthService: OAuth token management
Architecture
Retry logic is applied via the wrapper layer pattern at app entry point:
- HttpClientWithRetry wraps HttpClient.execute with retry logic
- All HTTP requests automatically get retry behavior
- No need to yield RetryService in application code
Caching is applied via helper functions (requires schema validation):
- Use
executeCachedRequesthelper for cached operations - Use
executeRequesthelper for non-cached operations
Added in v0.0.1
Table of contents
layers
CacheServiceLive
Live implementation of CacheService.
Creates separate cache instances for each resource type with:
- TTL: 5 minutes
- Capacity: 100 entries per resource type
Signature
export declare const CacheServiceLive: Layer<CacheService, never, never>
Added in v0.0.1
CredentialServiceLive
Live implementation of CredentialService.
Provides secure credential storage with automatic fallback:
- Environment variables (read-only)
- System keychain (preferred for storage)
- Encrypted file (fallback)
Signature
export declare const CredentialServiceLive: Layer<CredentialService, never, never>
Added in v0.0.3
HttpClientWithRetry
Wrapper layer that adds retry logic to HttpClient.
Wraps HttpClient.execute to apply automatic retry logic for transient failures. This is a cross-cutting concern applied via the wrapper layer pattern.
Signature
export declare const HttpClientWithRetry: Layer<HttpClient, never, HttpClient | RetryService>
Added in v0.3.0
OAuthServiceLive
Live implementation of OAuthService.
Provides OAuth token management with in-memory caching and automatic refresh.
Signature
export declare const OAuthServiceLive: Layer<OAuthService, never, HttpClient | CredentialService>
Added in v0.0.3
RetryServiceLive
Live implementation of RetryService.
Provides retry logic with exponential backoff and Retry-After header support.
Signature
export declare const RetryServiceLive: Layer<RetryService, never, never>
Added in v0.0.1
models
ResourceType
Resource types that can be cached.
| Supported types: “users” | “groups” | “applications” | “populations” |
Signature
export declare const ResourceType: any
Added in v0.0.1
services
CacheService
Context tag for CacheService.
Provides response caching with schema validation for PingOne API requests. Each resource type (users, groups, applications, populations) has its own cache instance with independent TTL and capacity settings.
Signature
export declare const CacheService: Tag<CacheService, CacheService>
Added in v0.0.1
CredentialService
Context tag for CredentialService.
Provides secure credential storage across multiple platforms. Supports keychain, encrypted file fallback, and environment variables.
Signature
export declare const CredentialService: Tag<CredentialService, CredentialService>
Added in v0.0.3
OAuthService
Context tag for OAuthService.
Orchestrates OAuth client credentials flow with automatic token refresh. Manages token lifecycle including acquisition, caching, and expiration.
Signature
export declare const OAuthService: Tag<OAuthService, OAuthService>
Added in v0.0.3
RetryService
Context tag for RetryService.
Provides retry logic for HTTP requests with exponential backoff. Retries transient errors (network failures, rate limits, server errors).
Signature
export declare const RetryService: Tag<RetryService, RetryService>
Added in v0.0.1