import { LinkedProvider, LinkResult, LinkBlockedResult, LinkHistoryEntry, AccountLinkingConfig, CapabilityMatrix, CapabilityMatrixItem, CapabilityMatrixModule, CapabilityUsageStatus, AccessEntitlements, AccessMeSnapshot, AccessSubscriptionStatus, AccessCommercialUsageSnapshot, CapabilityBootstrapOptions, CapabilityBootstrapSnapshot } from '@customyai/client'; export { AccessApplicationEntitlements, AccessCommercialUsageSnapshot, AccessEntitlementItem, AccessEntitlements, AccessMeSnapshot, AccessSubscriptionRecord, AccessSubscriptionStatus, AccountLinkingConfig, CapabilityBootstrapOptions, CapabilityBootstrapSnapshot, CapabilityDecision, CapabilityMatrix, CapabilityMatrixItem, CapabilityMatrixModule, CapabilityState, CapabilityUsagePressureSummary, CapabilityUsageStatus, LinkBlockedResult, LinkHistoryEntry, LinkResult, LinkedProvider, getCapabilityFromMatrix, getModuleFromMatrix, isCapabilityDecisionAllowed, isCapabilityStateAllowed, summarizeCapabilityUsage } from '@customyai/client'; /** * Customy Access — cliente de administración de Node.js / TypeScript. * Published as: @customyai/customy-access * * @deprecated Este paquete es el adaptador de la plataforma nueva durante un * ciclo major. La sesión y las capacidades del usuario están en * `@customyai/client` (y aquí se reexportan sus tipos y ayudantes); la * administración de un entorno (`CustomyAccess`, `createAccessClient`) no tiene * todavía equivalente y queda congelada tal cual en este paquete. * * @example * ```ts * import { CustomyAccess } from "@customyai/customy-access"; * * const customy = new CustomyAccess({ * baseUrl: "https://access.customy.ai", * adminSecret: process.env.CUSTOMY_ADMIN_SECRET, * }); * * const users = await customy.users.list("env_123"); * ``` */ interface CustomyAccessConfig { baseUrl: string; apiKey?: string; adminSecret?: string; bearerToken?: string; sessionToken?: string; /** Publishable key for environment identification */ publishableKey?: string; organizationId?: string; projectId?: string; environmentId?: string; applicationId?: string; timeout?: number; retries?: number; userAgent?: string; fetch?: typeof fetch; allowUnsafeBrowserCredentials?: boolean; autoIdempotencyKey?: boolean; hooks?: CustomyAccessHooks; } interface CustomyAccessRequestContext { method: string; url: string; path: string; headers: Record; attempt: number; } interface CustomyAccessResponseContext extends CustomyAccessRequestContext { status: number; requestId?: string; } interface CustomyAccessHooks { beforeRequest?: (context: CustomyAccessRequestContext) => void | Promise; afterResponse?: (context: CustomyAccessResponseContext) => void | Promise; onRetry?: (context: CustomyAccessResponseContext & { delayMs: number; }) => void | Promise; } interface PaginationOptions { limit?: number; startPage?: number; maxPages?: number; pageParam?: string; limitParam?: string; itemsKey?: string; totalKey?: string; } declare class APIError extends Error { status: number; body: unknown; requestId?: string; code?: string; constructor(status: number, message: string, body: unknown, requestId?: string, code?: string); } declare class BaseClient { protected config: CustomyAccessConfig; constructor(config: CustomyAccessConfig); protected request(method: string, path: string, body?: unknown, overrideHeaders?: Record): Promise; } declare class RawClient extends BaseClient { request(method: string, path: string, body?: unknown, overrideHeaders?: Record): Promise; paginate(path: string, options?: PaginationOptions): AsyncGenerator; } interface Organization { id: string; name: string; slug: string; logo?: string; createdAt: string; } interface Project { id: string; name: string; organizationId: string; createdAt: string; } interface Application { id: string; name: string; projectId: string; type: string; createdAt: string; } interface Environment { id: string; name: string; type: string; applicationId: string; createdAt: string; } interface HierarchyTree { organizations: Array; }>; }>; } declare class HierarchyClient extends BaseClient { getTree(): Promise; listOrganizations(): Promise; listProjects(envId: string): Promise; listEnvironments(envId: string): Promise; } interface Connection { id: string; name: string; provider_id: string; client_id: string; client_secret?: string; strategy: string; enabled: boolean; is_primary?: boolean; domain_hint?: string; scopes?: string; app_type?: string; environment_id?: string; organization_id?: string; created_at?: string; updated_at?: string; } interface ConnectionTestResult { connectionId: string; passed: boolean; checks: Array<{ name: string; passed: boolean; message: string; durationMs?: number; }>; warnings?: string[]; connectionType?: string; testedAt?: string; } interface ConnectionStats { totalConnections: number; totalUsers: number; mostPopularProvider: string; ssoAdoptionRate: number; connections: Array<{ connectionId: string; providerId: string; name: string; totalUsers: number; activeUsers30d: number; signupsThisMonth: number; failedLoginsThisMonth: number; }>; } declare class ConnectionsClient extends BaseClient { list(envId: string): Promise; get(envId: string, connectionId: string): Promise; create(envId: string, connection: Partial): Promise; update(envId: string, connectionId: string, updates: Partial): Promise; delete(envId: string, connectionId: string): Promise<{ success: boolean; }>; test(envId: string, connectionId: string): Promise; toggle(envId: string, connectionId: string, enabled: boolean): Promise; stats(envId: string): Promise; discover(envId: string, email: string): Promise<{ providerId: string | null; providerName?: string; method?: string; connectionId?: string; socialProviders?: string[]; }>; } interface User { id: string; name: string | null; email: string; image: string | null; emailVerified: boolean; createdAt: string; role?: string; banned?: boolean; banReason?: string; } declare class UsersClient extends BaseClient { list(envId: string, params?: { search?: string; page?: number; limit?: number; sort?: string; order?: string; }): Promise<{ users: User[]; total: number; }>; get(envId: string, userId: string): Promise; update(envId: string, userId: string, data: Partial): Promise; ban(envId: string, userId: string, reason?: string): Promise<{ success: boolean; }>; unban(envId: string, userId: string): Promise<{ success: boolean; }>; delete(envId: string, userId: string): Promise<{ success: boolean; }>; impersonate(envId: string, userId: string, reason?: string): Promise<{ token: string; url: string; }>; import(envId: string, users: Array<{ email: string; name?: string; role?: string; }>): Promise<{ total: number; success: number; failed: number; errors: Array<{ email: string; error: string; }>; duration_ms: number; }>; export(envId: string, format?: "json" | "csv"): Promise<{ users: unknown[]; }>; getSessions(envId: string, userId: string): Promise<{ sessions: Array<{ id: string; deviceType: string; ipAddress: string; createdAt: string; expiresAt: string; }>; }>; } interface Session { id: string; userId: string; token: string; expiresAt: string; createdAt: string; updatedAt?: string; ipAddress?: string; userAgent?: string; userName?: string; userEmail?: string; } declare class SessionsClient extends BaseClient { list(envId: string, params?: { page?: number; limit?: number; userId?: string; }): Promise<{ sessions: Session[]; total: number; }>; get(envId: string, sessionId: string): Promise; revoke(envId: string, sessionId: string): Promise<{ success: boolean; }>; revokeAll(envId: string, userId: string): Promise<{ revoked: number; }>; } interface Role { id: string; name: string; description?: string; permissions: string[]; environment_id?: string; is_system?: boolean; created_at?: string; } interface Permission { code: string; resource: string; action: string; category: string; description: string; } interface EntitlementFeature { id: string; lookupKey: string; name: string; type: "boolean" | "metered" | "config"; productKey: string; moduleKey?: string; meterCode?: string | null; defaultValue?: unknown; status: "draft" | "active" | "archived"; version: number; requiredPermissions: string[]; compatibilitySignals: string[]; metadata: Record; } interface EntitlementPlan { code: string; version: number; name: string; status: "draft" | "active" | "archived"; rank: number; eligibleAddOns: string[]; limits: Record; metadata: Record; } interface EntitlementPlanFeature { planCode: string; planVersion: number; featureLookupKey: string; config: Record; } interface EntitlementAddOn { code: string; version: number; name: string; status: "draft" | "active" | "archived"; limits: Record; metadata: Record; } interface EntitlementAddOnFeature { addOnCode: string; addOnVersion: number; featureLookupKey: string; config: Record; } interface EntitlementPrice { id: string; planCode?: string | null; planVersion?: number | null; addOnCode?: string | null; addOnVersion?: number | null; model: "flat" | "per_unit" | "tiered" | "volume" | "graduated" | "package" | "usage"; config: Record; currency: string; recurrence: "one_time" | "monthly" | "annual" | "usage"; version: number; meterCode?: string | null; status: "draft" | "active" | "archived"; metadata: Record; } interface EntitlementMeter { meterCode: string; aggregation: "sum" | "count" | "last"; unit: string; status: "draft" | "active" | "archived"; metadata: Record; } interface EntitlementCatalogOverlay { id: string; applicationId: string; environmentId?: string | null; kind: "feature" | "plan" | "addon" | "price" | "meter" | "catalog"; payload: Record; status: "draft" | "active" | "archived"; version: number; } interface EntitlementCatalogSnapshot { version: string; source: string; features: EntitlementFeature[]; plans: EntitlementPlan[]; planFeatures: EntitlementPlanFeature[]; addOns: EntitlementAddOn[]; addOnFeatures: EntitlementAddOnFeature[]; prices: EntitlementPrice[]; meters: EntitlementMeter[]; } type CommercialCatalogKind = "workspace_bundle" | "product_catalog" | "access_catalog" | "external_app_catalog" | "consumer_only"; interface CommercialCatalogScope { organizationId?: string; projectId?: string; productKey?: string; catalogOwnerId?: string; catalogKind?: CommercialCatalogKind; } interface CommercialCatalogOwner { catalogKind: CommercialCatalogKind; catalogOwnerId: string; productKey: string | null; displayName: string; pricingOwner: string; sourceOfTruth: "customy-access"; canManagePlans: boolean; canPublishCatalog: boolean; inheritsWorkspaceAccess: boolean; mergePolicy: "never_without_migration"; permissionsEditableInAccess: boolean; externalPricingEnabled: boolean; catalogRegistrationSource: "sdk" | "ui" | "api" | "seed" | "product_catalog"; status: string; reason: string; } interface PricingCatalogResponse { context: Record; commercialCatalogOwner: CommercialCatalogOwner; catalog: EntitlementCatalogSnapshot; publishState: { publishedVersion: number | null; lastPublishedAt?: string | null; syncState?: string; }; } interface RegisterPricingCatalogInput { productKey: string; displayName?: string; catalogKind?: CommercialCatalogKind; applicationId?: string | null; metadata?: Record; meters?: Partial[]; features?: Partial[]; plans?: Partial[]; planFeatures?: Partial[]; addOns?: Partial[]; addOnFeatures?: Partial[]; prices?: Partial[]; } interface WorkspaceSubscription { id?: string; organizationId: string; projectId: string; environmentId: string; planCode?: string | null; planVersionPin?: number | null; status: "trialing" | "active" | "paused" | "canceled" | "expired"; addOnCodes: string[]; metadata: Record; approvedBy?: string | null; reason?: string | null; approvalRequestId?: string | null; expiresAt?: string | null; createdAt?: string | null; updatedAt?: string | null; } interface WorkspacePriceOverride { id?: string; organizationId: string; projectId: string; environmentId: string; targetKind: "plan" | "addon" | "meter"; targetCode: string; targetVersion?: number | null; priceId?: string | null; model: EntitlementPrice["model"]; config: Record; currency: string; recurrence: EntitlementPrice["recurrence"]; status: EntitlementPrice["status"]; metadata: Record; approvedBy?: string | null; reason?: string | null; approvalRequestId?: string | null; expiresAt?: string | null; } interface WorkspaceEntitlementOverride { id?: string; organizationId: string; projectId: string; environmentId: string; kind: "plan_feature" | "addon_feature" | "plan_limit" | "addon_limit" | "feature" | "catalog"; operation: "grant" | "revoke" | "replace" | "merge"; targetCode?: string | null; targetVersion?: number | null; featureLookupKey?: string | null; payload: Record; status: EntitlementPrice["status"]; metadata: Record; approvedBy?: string | null; reason?: string | null; approvalRequestId?: string | null; expiresAt?: string | null; } declare class RolesClient extends BaseClient { list(envId: string): Promise; create(envId: string, role: { name: string; description?: string; permissions: string[]; }): Promise; update(envId: string, roleId: string, updates: Partial): Promise; delete(envId: string, roleId: string): Promise<{ success: boolean; }>; assign(envId: string, userId: string, roleId: string): Promise<{ success: boolean; }>; revoke(envId: string, userId: string, roleId: string): Promise<{ success: boolean; }>; listPermissions(envId: string): Promise; checkPermission(envId: string, userId: string, permission: string): Promise<{ allowed: boolean; reason?: string; matchedRule?: string; }>; getEffective(envId: string, userId: string): Promise<{ permissions: string[]; roles: string[]; }>; } interface Policy { id: string; name: string; description?: string; effect: "allow" | "deny"; resource: string; action: string; conditions: Record; priority: number; enabled: boolean; environment_id?: string; created_at?: string; } declare class PoliciesClient extends BaseClient { list(envId: string): Promise; create(envId: string, policy: Partial): Promise; update(envId: string, policyId: string, updates: Partial): Promise; delete(envId: string, policyId: string): Promise<{ success: boolean; }>; evaluate(envId: string, params: { userId: string; resource: string; action: string; context?: Record; }): Promise<{ allowed: boolean; matchedPolicies: string[]; reason: string; }>; } interface AuditEvent { id: string; event: string; actor_id?: string; actor_email?: string; target_id?: string; target_type?: string; ip_address?: string; user_agent?: string; metadata?: Record; environment_id?: string; created_at: string; } declare class AuditClient extends BaseClient { list(envId: string, params?: { page?: number; limit?: number; event?: string; actorId?: string; from?: string; to?: string; }): Promise<{ events: AuditEvent[]; total: number; }>; } interface BruteForceConfig { enabled: boolean; maxAttempts: number; lockoutDurationMinutes: number; windowMinutes: number; blockByIp: boolean; blockByEmail: boolean; notifyAdmin: boolean; } declare class BruteForceClient extends BaseClient { getConfig(envId: string): Promise; updateConfig(envId: string, config: Partial): Promise; getLockedAccounts(envId: string): Promise>; unlock(envId: string, email: string): Promise<{ success: boolean; }>; } interface ImpersonationSession { id: string; adminUserId: string; adminEmail: string; targetUserId: string; targetEmail: string; reason: string; startedAt: string; expiresAt: string; endedAt?: string | null; endReason?: string | null; } declare class ImpersonationClient extends BaseClient { createActorToken(envId: string, params: { targetUserId: string; reason: string; }): Promise<{ actorTokenId: string; token: string; url: string; expiresAt: string; }>; authenticate(envId: string, token: string): Promise<{ sessionToken: string; impersonationId: string; targetUser: { id: string; email: string; name: string; }; actor: { sub: string; email: string; name: string; }; expiresAt: string; }>; stop(envId: string, impersonationId: string, reason?: string): Promise<{ stopped: boolean; duration: number; }>; listActive(envId: string): Promise<{ items: ImpersonationSession[]; total: number; }>; getHistory(envId: string, params?: { page?: number; limit?: number; adminUserId?: string; targetUserId?: string; }): Promise<{ items: ImpersonationSession[]; total: number; page: number; }>; getConfig(envId: string): Promise<{ enabled: boolean; maxDurationMinutes: number; maxActivePerAdmin: number; monthlyLimit: number | null; requireReason: boolean; allowedRoles: string[]; blockedTargetRoles: string[]; notifyTarget: boolean; restrictWriteOps: boolean; webhookUrl: string | null; }>; updateConfig(envId: string, config: Record): Promise>; } interface Webhook { id: string; url: string; events: string[]; secret?: string; enabled: boolean; description?: string; created_at?: string; } declare class WebhooksClient extends BaseClient { list(envId: string): Promise; create(envId: string, webhook: Partial): Promise; update(envId: string, webhookId: string, updates: Partial): Promise; delete(envId: string, webhookId: string): Promise<{ success: boolean; }>; test(envId: string, webhookId: string): Promise<{ success: boolean; statusCode: number; responseTime: number; }>; getLogs(envId: string, webhookId: string): Promise>; /** Verify an incoming webhook signature (static, no request needed) */ static verifySignature(params: { payload: string; signature: string; secret: string; }): boolean; } interface MFAConfig { enabled: boolean; methods: string[]; enforcementLevel: "optional" | "required" | "step_up"; gracePeriodDays?: number; } declare class MFAClient extends BaseClient { getConfig(envId: string): Promise; updateConfig(envId: string, config: Partial): Promise; listEnrollments(envId: string, userId: string): Promise>; deleteEnrollment(envId: string, enrollmentId: string): Promise<{ success: boolean; }>; } interface BrandingConfig { logo_url?: string; favicon_url?: string; primary_color?: string; primaryColor?: string; effective_primary_color?: string; effectivePrimaryColor?: string; primary_color_source?: string; primaryColorSource?: string; accent_color?: string; company_name?: string; support_email?: string; custom_css?: string; login_page_title?: string; login_page_subtitle?: string; } declare class BrandingClient extends BaseClient { get(envId: string): Promise; update(envId: string, branding: Partial): Promise; } interface Delegation { id: string; delegator_id: string; delegate_id: string; permissions: string[]; starts_at: string; expires_at?: string; environment_id?: string; } declare class DelegationsClient extends BaseClient { list(envId: string): Promise; create(envId: string, delegation: Partial): Promise; revoke(envId: string, delegationId: string): Promise<{ success: boolean; }>; } interface RelationshipTuple { id: string; object_type: string; object_id: string; relation: string; subject_type: string; subject_id: string; environment_id?: string; created_at?: string; } declare class RelationshipsClient extends BaseClient { list(envId: string, params?: { objectType?: string; relation?: string; }): Promise; create(envId: string, tuple: Partial): Promise; delete(envId: string, tupleId: string): Promise<{ success: boolean; }>; check(envId: string, params: { objectType: string; objectId: string; relation: string; subjectType: string; subjectId: string; }): Promise<{ allowed: boolean; path?: string[]; }>; } declare class GDPRClient extends BaseClient { exportUserData(envId: string, userId: string): Promise<{ data: Record; exportedAt: string; }>; deleteUserData(envId: string, userId: string): Promise<{ deleted: boolean; deletedItems: string[]; }>; getConsentStatus(envId: string, userId: string): Promise<{ consents: Array<{ type: string; granted: boolean; grantedAt?: string; }>; }>; } declare class AccountLinkingClient extends BaseClient { /** Get linked providers for a user */ getProviders(envId: string, userId: string): Promise; /** Auto-link accounts by email (called internally from auth callbacks) */ autoLink(envId: string, params: { email: string; userId: string; providerId: string; emailVerified: boolean; }): Promise; /** Manually link two users (admin action) */ manualLink(envId: string, params: { primaryUserId: string; secondaryUserId: string; reason?: string; }): Promise; /** Admin unlink a provider from a user */ unlinkProvider(envId: string, userId: string, providerId: string): Promise<{ unlinked: boolean; message: string; }>; /** User-initiated: start OAuth flow to link a new provider */ initiateLink(envId: string, params: { providerId: string; redirectUrl?: string; }): Promise<{ redirectUrl: string; state: string; expiresIn: number; }>; /** User-initiated: unlink own provider */ userUnlink(envId: string, providerId: string): Promise<{ unlinked: boolean; message: string; }>; /** Get link history for a specific user */ getUserHistory(envId: string, userId: string): Promise; /** Get link history for the entire organization */ getOrgHistory(envId: string): Promise; /** Rollback a previous merge */ rollback(envId: string, historyId: string): Promise<{ rolledBack: boolean; }>; /** Get account linking config for an org */ getConfig(envId: string): Promise; /** Update account linking config (partial) */ updateConfig(envId: string, config: Partial): Promise; /** Get provider trust levels for an org */ getTrustLevels(envId: string): Promise<{ configured: Array<{ providerId: string; trustLevel: string; }>; defaults: { trusted: string[]; untrusted: string[]; }; }>; /** Set trust level for a provider */ setTrustLevel(envId: string, params: { providerId: string; trustLevel: "trusted" | "untrusted"; }): Promise<{ success: boolean; providerId: string; trustLevel: string; }>; } declare class TokenExchangeClient extends BaseClient { getConfig(envId: string): Promise>; updateConfig(envId: string, config: Record): Promise>; exchange(envId: string, params: { grantType: string; subjectToken: string; subjectTokenType: string; scope?: string; }): Promise<{ access_token: string; token_type: string; expires_in: number; }>; } declare class PushMFAClient extends BaseClient { getConfig(envId: string): Promise>; updateConfig(envId: string, config: Record): Promise>; } declare class RateLimitsClient extends BaseClient { getConfig(envId: string): Promise>; updateConfig(envId: string, config: Record): Promise>; } declare class EmailConfigClient extends BaseClient { get(envId: string): Promise>; update(envId: string, config: Record): Promise>; testEmail(envId: string, to: string): Promise<{ sent: boolean; }>; } declare class SCIMClient extends BaseClient { listGroups(envId: string): Promise<{ schemas: string[]; totalResults: number; Resources: unknown[]; }>; createGroup(envId: string, displayName: string, members?: string[]): Promise; getConfig(envId: string): Promise>; updateConfig(envId: string, config: Record): Promise>; } declare class M2MClient extends BaseClient { /** * @deprecated Returns an OPAQUE token from /api/v1/oauth/token that Billing, * Send and Data reject. Use {@link M2MClient.getMachineToken} (signed JWT * with an audience) for product integrations. */ getToken(params: { clientId: string; clientSecret: string; scopes?: string[]; audience?: string; }): Promise<{ access_token: string; token_type: "Bearer"; expires_in: number; scope: string; }>; /** * Token de máquina firmado (JWT) para un producto: `client_credentials` en el * token endpoint OIDC estándar. La audiencia es obligatoria y el producto lo * verifica con el JWKS de Access sin consultar Access por request. */ getMachineToken(params: { clientId: string; clientSecret: string; audience: string; scopes?: string[]; }): Promise<{ access_token: string; token_type: "Bearer"; expires_in: number; scope: string; }>; /** * Token exchange (RFC 8693): un producto cambia el token de una app que * recibió por uno para otro producto, en nombre de esa app. El token * resultante conserva el tenant de la app y lleva al producto en `act`. */ exchangeToken(params: { clientId: string; clientSecret: string; subjectToken: string; audience: string; scopes: string[]; }): Promise<{ access_token: string; issued_token_type: string; token_type: "Bearer"; expires_in: number; scope: string; }>; createApiKey(envId: string, params: { name: string; scopes: string[]; expiresInDays?: number; machineIdentityType?: "service" | "agent" | "worker" | "integration" | "automation"; machineIdentityId?: string; ownerService?: string; allowedAudiences?: string[]; /** * Obligatorio (≥ 10 caracteres) solo cuando el secreto de administración * emite una clave que excede el manifiesto `app/v1` del entorno; queda * en la auditoría. Dentro del manifiesto se ignora. */ reason?: string; }): Promise<{ id: string; rawKey: string; prefix: string; scopes: string[]; machineIdentityType?: string; machineIdentityId?: string | null; ownerService?: string | null; allowedAudiences?: string[]; }>; listApiKeys(envId: string): Promise>; revokeApiKey(envId: string, keyId: string): Promise<{ success: true; }>; /** * Introspección de un token M2M opaco heredado. `envId` se conserva por * compatibilidad: el servidor resuelve el entorno a partir del token. */ introspect(_envId: string, token: string): Promise<{ active: boolean; environmentId?: string; scope?: string; exp?: number; audiences?: string[]; }>; } declare class LogStreamsClient extends BaseClient { list(envId: string): Promise>>; create(envId: string, stream: Record): Promise>; update(envId: string, streamId: string, updates: Record): Promise>; delete(envId: string, streamId: string): Promise<{ success: boolean; }>; } declare class DevicesClient extends BaseClient { list(envId: string, userId?: string): Promise>>; revoke(envId: string, deviceId: string): Promise<{ success: boolean; }>; } declare class OrganizationsClient extends BaseClient { list(): Promise; get(envId: string): Promise; getMembers(envId: string): Promise>; } declare class HealthClient extends BaseClient { check(): Promise<{ status: "ok" | "degraded" | "down"; service: string; version: string; uptime: number; db: "connected" | "disconnected"; timestamp: string; }>; } interface AuthorizeResult { allowed: boolean; evaluationMs?: number; } interface BatchAuthorizeResult { results: Record; evaluationMs: number; } interface SimulateResult { before: Record; after: Record; changes: Array<{ permission: string; before: boolean; after: boolean; }>; } declare class AuthorizationClient extends BaseClient { /** Check a single permission */ authorize(envId: string, params: { userId: string; action: string; resource?: string; resourceId?: string; workspaceId?: string; context?: Record; }): Promise; /** Batch check multiple permissions */ batchAuthorize(envId: string, params: { userId: string; permissions: string[]; workspaceId?: string; }): Promise; /** Simulate a role/policy change and see permission impact */ simulate(envId: string, params: { scenario: "add_role" | "remove_role" | "add_policy" | "remove_policy"; params: { userId: string; roleId?: string; policyId?: string; workspaceId?: string; }; checks: string[]; }): Promise; /** Explain why a permission is granted or denied */ explain(envId: string, params: { userId: string; permission: string; }): Promise<{ allowed: boolean; reason?: string; matchedRule?: string; }>; /** Get effective permissions for a user */ getEffective(envId: string, userId: string): Promise<{ permissions: string[]; roles: string[]; }>; } declare class PermissionsClient extends BaseClient { can(params: { environmentId?: string; userId: string; action: string; resource?: string; resourceId?: string; workspaceId?: string; context?: Record; }): Promise; } interface AccessApplicationContract { organizationId: string; organizationName: string; projectId: string; projectName: string; applicationId: string; applicationName: string; applicationSlug?: string | null; productKey?: string | null; purpose: "platform_control_plane" | "product_tenant_control_plane" | "customer_application"; applicationPurpose: string; applicationType: string; status: string; allowedOrigins: string[]; callbackUrls: string[]; cookieNamespace?: string | null; environmentId: string; environmentName: string; environmentType: string; publishableKey: string; appUrl?: string | null; sessionPolicy?: Record | null; rateLimitPolicy?: Record | null; metadata?: Record; } interface CreateAccessApplicationInput { name: string; slug?: string; productKey?: string | null; purpose?: "platform_control_plane" | "product_tenant_control_plane" | "customer_application"; type?: "spa" | "web" | "native" | "m2m"; allowedOrigins?: string[]; callbackUrls?: string[]; cookieNamespace?: string | null; metadata?: Record; } interface UpdateAccessApplicationInput { purpose?: "platform_control_plane" | "product_tenant_control_plane" | "customer_application"; name?: string; slug?: string; productKey?: string | null; status?: string; allowedOrigins?: string[]; callbackUrls?: string[]; cookieNamespace?: string | null; } declare class AppClient extends BaseClient { getContract(environmentId?: string | undefined): Promise; listConnectedProducts(environmentId?: string | undefined): Promise<{ products: Array>; count: number; }>; createApplication(environmentId: string, input: CreateAccessApplicationInput): Promise<{ application: Application & Record; }>; updateApplication(environmentId: string, applicationId: string, input: UpdateAccessApplicationInput): Promise<{ application: Application & Record; }>; } declare class CredentialsClient extends BaseClient { list(environmentId?: string | undefined): Promise<{ credentials: Array>; count?: number; }>; } interface Group { id: string; name: string; description?: string; parent_id?: string; member_count?: number; environment_id?: string; created_at?: string; } declare class GroupsClient extends BaseClient { list(envId: string): Promise; create(envId: string, group: { name: string; description?: string; parentId?: string; }): Promise<{ success: boolean; id: string; }>; update(envId: string, groupId: string, updates: Partial): Promise; delete(envId: string, groupId: string): Promise<{ success: boolean; }>; listMembers(envId: string, groupId: string): Promise>; addMembers(envId: string, groupId: string, userIds: string[]): Promise<{ success: boolean; }>; removeMember(envId: string, groupId: string, userId: string): Promise<{ success: boolean; }>; listRoles(envId: string, groupId: string): Promise>; assignRole(envId: string, groupId: string, roleId: string): Promise<{ success: boolean; id: string; }>; removeRole(envId: string, groupId: string, roleId: string): Promise<{ success: boolean; }>; } interface LimitDefinition { id: string; code: string; name: string; description?: string; category?: string; default_value?: number; period?: string; is_active: boolean; } declare class LimitsClient extends BaseClient { list(envId: string): Promise; create(envId: string, limit: { code: string; name: string; defaultValue?: number; period?: string; }): Promise<{ success: boolean; id: string; }>; update(envId: string, limitId: string, updates: Partial): Promise; getUsage(envId: string, userId: string, workspaceId: string): Promise>>; assign(envId: string, params: { userId: string; workspaceId: string; limitDefinitionId: string; maxValue: number; }): Promise<{ success: boolean; }>; reset(envId: string, params?: { userId?: string; workspaceId?: string; limitDefinitionId?: string; }): Promise<{ success: boolean; }>; } declare class CapabilitiesClient extends BaseClient { getMatrix(envId: string, params?: { userId?: string; }): Promise; check(envId: string, capability: string, params?: { userId?: string; }): Promise; listVisibleModules(envId: string, params?: { userId?: string; }): Promise; getUsageStatus(envId: string, params?: { userId?: string; capability?: string; }): Promise; getEntitlements(envId: string, params?: { userId?: string; }): Promise; /** * Subscription, entitlements, visible modules and usage for one environment. * Requires a credential: a user session (the snapshot is always the session's * own user; `userId` must match it), an API key / M2M token of `envId` with * the `capabilities:read` scope, or the admin secret. */ getMe(envId: string, params?: { userId?: string; }): Promise; getSubscriptionStatus(envId: string): Promise; getCommercialUsage(envId: string, params?: { userId?: string; capability?: string; }): Promise; canUseCapability(envId: string, capability: string, params?: { userId?: string; accessMode?: "read" | "write"; }): Promise; canAccessModule(envId: string, moduleKey: string, params?: { userId?: string; accessMode?: "read" | "write"; }): Promise; bootstrap(envId: string, options?: CapabilityBootstrapOptions): Promise; } declare class ApprovalsClient extends BaseClient { list(envId: string): Promise>>; approve(envId: string, approvalId: string, comment?: string): Promise<{ success: boolean; }>; reject(envId: string, approvalId: string, reason?: string): Promise<{ success: boolean; }>; listWorkflows(envId: string): Promise>>; createWorkflow(envId: string, workflow: Record): Promise<{ success: boolean; id: string; }>; } declare class PolicyTemplatesClient extends BaseClient { list(envId: string): Promise; }>>; apply(envId: string, templateId: string, params?: { workspaceId?: string; name?: string; }): Promise<{ success: boolean; id: string; }>; } declare class AuthClient extends BaseClient { getSession(token?: string): Promise<{ session: Record; user: Record; } | null>; signIn(body?: Record, path?: string): Promise>; } declare class AgentBridgeClient extends BaseClient { getHierarchy(envId: string): Promise>; verifySk(envId: string, secretKey: string): Promise<{ valid: boolean; }>; validateApiKey(apiKey: string): Promise<{ valid: boolean; keyId?: string; userId?: string; environmentId?: string; permissions?: string[]; machineIdentityType?: string; machineIdentityId?: string | null; ownerService?: string | null; allowedAudiences?: string[]; }>; getPermissions(userId: string, envId?: string, orgId?: string): Promise<{ permissions: string[]; role: string; groupIds?: string[]; }>; decide(input: { userId: string; envId: string; orgId?: string; projectId?: string; action: string; resourceType?: string; resourceId?: string; context?: Record; }): Promise<{ allowed: boolean; reason: string; uxState: string; title: string; message: string; action: string; resourceType: string; requiredPermissions: string[]; missingPermissions: string[]; effectivePermissions: string[]; limits: Record; capability?: string; capabilityState?: string | null; capabilityReason?: string | null; usage?: unknown; paywallHook?: string; approvalWorkflowId?: string; primaryAction?: { kind: string; label: string; href?: string; }; secondaryAction?: { kind: string; label: string; href?: string; }; auditId: string; }>; getOrganization(orgId: string): Promise>; getDefaultEnvironment(orgId: string): Promise<{ environmentId: string; }>; } declare class CatalogClient extends BaseClient { seed(envId: string): Promise<{ success: boolean; catalog: EntitlementCatalogSnapshot; }>; get(envId: string): Promise; pricingContext(envId: string, scope?: CommercialCatalogScope): Promise>; pricingCatalog(envId: string, scope?: CommercialCatalogScope): Promise; registerPricingCatalog(envId: string, catalog: RegisterPricingCatalogInput): Promise<{ product: Record; commercialCatalogOwner: CommercialCatalogOwner | null; }>; publishPricingCatalog(envId: string, params?: { authorId?: string | null; approvalId?: string | null; requireApproval?: boolean; }): Promise<{ success: boolean; id: string; environmentId: string; version: number; snapshot: EntitlementCatalogSnapshot; }>; pricingBillingOps(envId: string, scope?: CommercialCatalogScope): Promise>; listFeatures(envId: string): Promise; listPlans(envId: string): Promise; listAddOns(envId: string): Promise; listPrices(envId: string): Promise; listMeters(envId: string): Promise; upsertFeature(envId: string, feature: EntitlementFeature): Promise<{ success: boolean; feature: EntitlementFeature; }>; upsertPlan(envId: string, plan: EntitlementPlan): Promise<{ success: boolean; plan: EntitlementPlan; }>; upsertPlanFeature(envId: string, planFeature: EntitlementPlanFeature): Promise<{ success: boolean; planFeature: EntitlementPlanFeature; }>; upsertAddOn(envId: string, addOn: EntitlementAddOn): Promise<{ success: boolean; addOn: EntitlementAddOn; }>; upsertAddOnFeature(envId: string, addOnFeature: EntitlementAddOnFeature): Promise<{ success: boolean; addOnFeature: EntitlementAddOnFeature; }>; upsertPrice(envId: string, price: EntitlementPrice): Promise<{ success: boolean; price: EntitlementPrice; }>; upsertMeter(envId: string, meter: EntitlementMeter): Promise<{ success: boolean; meter: EntitlementMeter; }>; upsertOverlay(envId: string, overlay: EntitlementCatalogOverlay): Promise<{ success: boolean; overlay: EntitlementCatalogOverlay; }>; publish(envId: string, params?: { authorId?: string | null; }): Promise<{ success: boolean; id: string; environmentId: string; version: number; snapshot: EntitlementCatalogSnapshot; }>; } declare class WorkspaceClient extends BaseClient { getSubscription(envId: string, orgId: string, projectId: string): Promise; setSubscription(envId: string, orgId: string, subscription: Omit): Promise<{ success: boolean; subscription: WorkspaceSubscription; }>; listPriceOverrides(envId: string, orgId: string, projectId: string): Promise; upsertPriceOverride(envId: string, orgId: string, override: Omit): Promise<{ success: boolean; override: WorkspacePriceOverride; }>; listEntitlementOverrides(envId: string, orgId: string, projectId: string): Promise; upsertEntitlementOverride(envId: string, orgId: string, override: Omit): Promise<{ success: boolean; override: WorkspaceEntitlementOverride; }>; } declare class CustomyAccess { readonly hierarchy: HierarchyClient; readonly connections: ConnectionsClient; readonly users: UsersClient; readonly sessions: SessionsClient; readonly roles: RolesClient; readonly policies: PoliciesClient; readonly audit: AuditClient; readonly bruteForce: BruteForceClient; readonly impersonation: ImpersonationClient; readonly webhooks: WebhooksClient; readonly mfa: MFAClient; readonly branding: BrandingClient; readonly delegations: DelegationsClient; readonly relationships: RelationshipsClient; readonly gdpr: GDPRClient; readonly accountLinking: AccountLinkingClient; readonly tokenExchange: TokenExchangeClient; readonly pushMfa: PushMFAClient; readonly rateLimits: RateLimitsClient; readonly emailConfig: EmailConfigClient; readonly scim: SCIMClient; readonly m2m: M2MClient; readonly logStreams: LogStreamsClient; readonly devices: DevicesClient; readonly organizations: OrganizationsClient; readonly health: HealthClient; readonly authorization: AuthorizationClient; readonly groups: GroupsClient; readonly limits: LimitsClient; readonly capabilities: CapabilitiesClient; readonly catalog: CatalogClient; readonly workspace: WorkspaceClient; readonly approvals: ApprovalsClient; readonly policyTemplates: PolicyTemplatesClient; readonly agentBridge: AgentBridgeClient; readonly auth: AuthClient; readonly permissions: PermissionsClient; readonly credentials: CredentialsClient; readonly app: AppClient; readonly core: RawClient; readonly APIError: typeof APIError; constructor(config: CustomyAccessConfig); } declare function createAccessClient(config: CustomyAccessConfig): CustomyAccess; export { APIError, type AccessApplicationContract, type Application, type AuditEvent, type AuthorizeResult, type BatchAuthorizeResult, type BrandingConfig, type BruteForceConfig, type CommercialCatalogKind, type CommercialCatalogOwner, type CommercialCatalogScope, type Connection, type ConnectionStats, type ConnectionTestResult, type CreateAccessApplicationInput, CustomyAccess, type CustomyAccessConfig, type CustomyAccessHooks, type CustomyAccessRequestContext, type CustomyAccessResponseContext, type Delegation, type EntitlementAddOn, type EntitlementAddOnFeature, type EntitlementCatalogOverlay, type EntitlementCatalogSnapshot, type EntitlementFeature, type EntitlementMeter, type EntitlementPlan, type EntitlementPlanFeature, type EntitlementPrice, type Environment, type Group, type HierarchyTree, type ImpersonationSession, type LimitDefinition, type MFAConfig, type Organization, type PaginationOptions, type Permission, type Policy, type PricingCatalogResponse, type Project, type RegisterPricingCatalogInput, type RelationshipTuple, type Role, type Session, type SimulateResult, type UpdateAccessApplicationInput, type User, type Webhook, type WorkspaceEntitlementOverride, type WorkspacePriceOverride, type WorkspaceSubscription, createAccessClient };