Skip to main content

Types and namespaces

WIP

Every exported namespace and member in @gentleduck/iam, with the exact flat and namespaced names and the import path each one comes from

duck-iam ships its types inside per-module namespaces and its runtime values as flat names. This page is the map for 5.10.0: every exported namespace, its members, and the flat runtime exports, one line each, with the import path each comes from. Use it as the type-import contract when you write adapters, wrappers, or your own tooling on top of the engine.

Naming convention

Three rules hold across the whole package.

  1. Interfaces carry the I prefix - IPolicy, IRule, IDecision, IAccessRequest, IConfig.
  2. Type aliases stay bare - Effect, Operator, Mode, PolicyCombine, CombiningAlgorithm, ValidationCode.
  3. Runtime values are flat and Iam-prefixed - IamEngine, IamMemoryAdapter, IamLRUCache, iamBuildPermissionKey. Free functions carry the prefix too (iamEvaluateFast, iamIndexPolicy, iamResolveValue), and constants use the screaming form (IAM_MAX_CONDITION_DEPTH). Namespaces are type-only; they add nothing to the bundle.
import type { AccessControl, IamRequest } from '@gentleduck/iam'

function decide(policy: AccessControl.IPolicy, req: IamRequest.IAccessRequest): AccessControl.IDecision {
  // ...
}

Namespaces exist so short member names can repeat without colliding. IConfig is a member of IamEngineTypes, IamHttp, IamRedis, IamDrizzle, IamRedisInvalidator, and IamMetrics; IResult is a member of both Explain and IamValidate. The namespace prefix is what disambiguates them at the call site.

Where each namespace lives

Namespaces are grouped by the exports entry that publishes them.

Loading diagram...

The root entry re-exports everything in @gentleduck/iam/core, so AccessControl through Evaluate are reachable from either specifier. IamValidate is a special case: core/index.ts re-exports the namespace as a type only and deliberately does not re-export the validator functions, so importing validatePolicy requires the @gentleduck/iam/core/validate subpath. Everything under adapters/*, server/*, client/*, invalidators/*, and observability/* is only reachable through its own subpath.

Core namespaces

AccessControl

import type { AccessControl } from '@gentleduck/iam' - the policy and decision vocabulary.

Namespaced nameKindOne line
AccessControl.Effecttype'allow' | 'deny' - the outcome a matched rule produces
AccessControl.OperatortypeThe 19 comparison operators the condition engine accepts
AccessControl.IConditioninterfaceLeaf condition: field dot-path, operator, optional value
AccessControl.IConditionAllinterface{ all: [...] } group - every child must hold
AccessControl.IConditionAnyinterface{ any: [...] } group - at least one child must hold
AccessControl.IConditionNoneinterface{ none: [...] } group - no child may hold
AccessControl.IConditionGrouptypeUnion of the three named group arms; exactly one key present
AccessControl.IRuleinterfaceid, effect, priority, actions, resources, conditions, optional description / metadata
AccessControl.CombiningAlgorithmtypeIntra-policy conflict resolution: deny-overrides, allow-overrides, first-match, highest-priority
AccessControl.PolicyCombinetypeCross-policy strategy: and, allow-overrides, first-applicable
AccessControl.IPolicyinterfaceNamed rule set plus algorithm, optional version and targets
AccessControl.IPermissioninterfaceOne RBAC grant: action, resource, optional scope and conditions
AccessControl.IRoleinterfaceRBAC role: id, name, permissions, optional inherits, scope, metadata
AccessControl.IDecisioninterfaceallowed, effect, reason, duration, timestamp, optional rule, policy, applicable
AccessControl.Modetype'development' | 'production'
AccessControl.ModeResulttypeMode-conditional return: boolean in production, IDecision in development
AccessControl.ModePermissionMaptypeMode-conditional map: Record<string, boolean> in production, IamClient.PermissionMap in development
AccessControl.OpFntypeSignature of one operator implementation - (field, value) => boolean
AccessControl.PolicyErrorHandlertypeThe (error, policyId) => void callback a throwing policy is routed to

IamRequest

import type { IamRequest } from '@gentleduck/iam' - the request the engine evaluates.

Namespaced nameKindOne line
IamRequest.IScopedRoleinterfaceA role assignment restricted to a scope, with optional per-grant attributes
IamRequest.ISubjectinterfaceResolved subject: id, effective roles, optional scopedRoles, attributes
IamRequest.IResourceinterfaceTarget resource: type, optional id, attributes
IamRequest.IEnvironmentinterfaceRequest-level bag: ip, userAgent, timestamp, now, plus arbitrary keys
IamRequest.IAccessRequestinterfacesubject + action + resource + optional scope and environment

IamPrimitives

import type { IamPrimitives } from '@gentleduck/iam' - the leaves of the type system.

Namespaced nameKindOne line
IamPrimitives.Scalartypestring | number | boolean | null
IamPrimitives.AttributeValuetypeScalar | Scalar[] | Record<string, Scalar> - anything an attribute bag may hold
IamPrimitives.AttributestypeRecord<string, AttributeValue>

IamClient

import type { IamClient } from '@gentleduck/iam' - permission-map keys shared by server and client.

Namespaced nameKindOne line
IamClient.PermissionKeytypeThe four key shapes: action:resource, action:resource:id, scope:action:resource, scope:action:resource:id
IamClient.PermissionMaptypeRecord<PermissionKey, boolean> - the full (theoretical) map
IamClient.PartialPermissionMaptypePartial<PermissionMap> - what engine.permissions() actually returns
IamClient.IPermissionCheckinterfaceOne batch entry: action, resource, optional resourceId, optional scope

IamAdapter

import type { IamAdapter } from '@gentleduck/iam' - the storage contract.

Namespaced nameKindOne line
IamAdapter.IReadOptionsinterface{ signal?: AbortSignal } - read-time cancellation token from the engine
IamAdapter.IAssignOptionsinterfacestartsAt, expiresAt, attributes extras for assignRole
IamAdapter.IPolicyStoreinterfacelistPolicies, getPolicy, savePolicy, deletePolicy
IamAdapter.IRoleStoreinterfacelistRoles, getRole, saveRole, deleteRole
IamAdapter.ISubjectStoreinterfaceRole assignments and attributes; getSubjectScopedRoles and updateAssignmentScope are optional
IamAdapter.IAdapterinterfaceThe three stores combined - what IamEngineTypes.IConfig.adapter expects
IamAdapter.RowErrorHandlertypeCallback for a stored row that fails to parse, so one bad row does not sink a list read
IamAdapter.ITripleRowinterfaceThe (subjectId, roleId, scope) triple shared by the batch assignment shapes
IamAdapter.IAssignRow / IRevokeRowinterfaceOne row of a batch assignRoles / revokeRoles call
IamAdapter.IRevokeOptionsinterfaceRevoke-side counterpart of IAssignOptions
IamAdapter.IActorOptionsinterfaceWho performed the write, carried through to the onMutation audit event

DotPath

import type { DotPath } from '@gentleduck/iam' - the type machinery behind typed field paths, typed $-references, and typed attribute keys. See typed context for how these are wired into the builders.

Namespaced nameKindOne line
DotPath.DotPathstypeUnion of every reachable path through T; arrays and functions are leaves, index signatures produce never
DotPath.PathValuetypeValue type at a dot path in T, or never if the path does not exist
DotPath.FlexibleDotPathstypeDotPaths<T> when the context is closed; adds (string & {}) when any branch has an open index signature
DotPath.DollarPathstypeEvery member of DotPaths<TContext> with a $ prepended - the cross-reference union
DotPath.FlexibleDollarPathstypeDollarPaths<TContext> | (string & {}), used at method signatures so the IDE renders the literals
DotPath.ConditionValuetypeAdapts a value type for builder inputs, adding $-paths only to the string-capable half
DotPath.FieldValuetypeConditionValue applied at a context dot path; falls back to AttributeValue on mismatch
DotPath.SubjectAttrShapetypeExtracts TContext['subject']['attributes'], or never
DotPath.ResourceAttrShapetypeExtracts TContext['resource']['attributes'], or never
DotPath.EnvAttrShapetypeExtracts TContext['environment'], or never
DotPath.SubjectAttrstypeDot-path keys into the subject attribute bag - the key argument of When.attr()
DotPath.ResourceAttrstypeDot-path keys into the resource attribute bag
DotPath.EnvAttrstypeDot-path keys into the environment bag - the key argument of When.env()
DotPath.ResourceAttrMaptypeExtracts the optional TContext['resourceAttributes'] per-resource map, or never
DotPath.ResolvedResourceAttrstypeResource attribute shape narrowed to one resource; merged union for '*' and unknown resources
DotPath.ResolvedResourceAttrPathstypeDot-path keys into ResolvedResourceAttrs - the key argument of When.resourceAttr()
DotPath.AttrValueAttypeRaw value at a dot path inside an attribute bag; never on an invalid path
DotPath.AttrValuetypeAttrValueAt with undefined stripped, falling back to AttributeValue
DotPath.IAnyAttributesinterfaceOpen attribute bag - [key: string]: IamPrimitives.AttributeValue
DotPath.IDefaultContextinterfaceDefault context shape (action, subject, resource, environment, scope) with open bags

IamConfig

import type { IamConfig } from '@gentleduck/iam' - the shapes around createIam().

Namespaced nameKindOne line
IamConfig.IAccessConfigInputinterfaceInput to createIam(): actions, resources, optional scopes, roles, context
IamConfig.IAccessConfiginterfaceWhat createIam() returns - four readonly arrays and eight methods

IamEngineTypes

import type { IamEngineTypes } from '@gentleduck/iam' - engine configuration and lifecycle. The class itself is the flat IamEngine; the namespace is suffixed Types to avoid the clash. Documented in depth under engine.

Namespaced nameKindOne line
IamEngineTypes.IConfiginterfaceEngine options: adapter, defaultEffect, cacheTTL, maxCacheSize, hooks, mode, policyCombine, maxPolicies, maxRoles, allowFailOpen, adapterTimeoutMs, maxConcurrentSubjectLoads, invalidator, scopeMode, scopeCombine
IamEngineTypes.IHooksinterfacebeforeEvaluate, afterEvaluate, onDeny, onError, onPolicyError, onMetrics, onMutation
IamEngineTypes.IMetricsEventinterfacePrimitive-only event: subjectId, action, resource, allowed, durationMs, mode, failOpen
IamEngineTypes.IAdmininterfaceThe engine.admin surface - policy, role, assignment, attribute, export and import methods
IamEngineTypes.ISnapshotinterfaceSchema-versioned config snapshot: schemaVersion, exportedAt, policies, roles
IamEngineTypes.IImportOptionsinterface{ mode?: 'merge' | 'replace' }
IamEngineTypes.IImportResultinterfacepoliciesAdded, policiesDeleted, rolesAdded, rolesDeleted
IamEngineTypes.IInvalidatorinterfaceCross-instance invalidation contract - publish and subscribe
IamEngineTypes.IInvalidateAllinterface{ kind: 'all' }
IamEngineTypes.IInvalidatePoliciesinterface{ kind: 'policies' }
IamEngineTypes.IInvalidateRolesinterface{ kind: 'roles', roleId? }
IamEngineTypes.IInvalidateSubjectinterface{ kind: 'subject', subjectId }
IamEngineTypes.IInvalidateEventtypeDiscriminated union of the four invalidate events, keyed on kind
IamEngineTypes.IHealthinterfaceengine.healthCheck() output: ok, adapter, cacheHitRate, adapterLatencyMs, optional lastError and compiledTable (present only when the 32-role limit has been tripped)
IamEngineTypes.IMutationEventtypeUnion of the eight admin-write events, keyed on type: policy saved/deleted, role saved/deleted, role assigned/revoked, role scope changed, attributes set
IamEngineTypes.IMutationBaseinterfaceThe fields every IMutationEvent arm carries
IamEngineTypes.IAssignRow / IRevokeRow / IMoveRowtype / interfaceBatch rows for admin.assignRoles, revokeRoles, and scope moves
IamEngineTypes.IAssignOptions / IRevokeOptions / IActorOptionstype / interfacePer-write extras: validity window, attributes, and the acting principal

Evaluate

import type { Evaluate } from '@gentleduck/iam' - internals of the evaluation pass, exported so tooling can type against them.

Namespaced nameKindOne line
Evaluate.CombinertypeSignature of one combining-algorithm implementation
Evaluate.IIndexedRuleinterfaceA rule plus its pre-split actions / resources sets and wildcard flags
Evaluate.IPolicyRuleIndexinterfacePer-policy lookup index: literal buckets, two half-wildcard buckets, wildcardBoth, and precomputed

Explain

import type { Explain } from '@gentleduck/iam' (values from @gentleduck/iam/core/explain) - the explain trace. See explain.

Namespaced nameKindOne line
Explain.ILeafTraceinterfaceOne evaluated condition leaf with its resolved actual and expected values
Explain.IGroupTraceinterfaceOne all / any / none node with its children
Explain.TracetypeILeafTrace | IGroupTrace
Explain.IRuleTraceinterfaceOne rule: whether its target and conditions matched, plus the condition trace
Explain.IPolicyTraceinterfaceOne policy: applicability, algorithm, and its rule traces
Explain.IResultinterfaceWhole-request trace: subject info, policy traces, final decision, human summary
Explain.ISubjectInfointerfaceThe resolved subject as the trace saw it

IamValidate

import type { IamValidate } from '@gentleduck/iam'; the validator functions come from @gentleduck/iam/core/validate. See validation.

Namespaced nameKindOne line
IamValidate.ValidationCodetypeThe closed set of 24 machine-readable issue codes
IamValidate.IIssueinterfacetype ('error' | 'warning'), code, message, optional roleId, optional path
IamValidate.IResultinterfacevalid (false only when an error-level issue exists) and issues

IamError

import type { IamError } from '@gentleduck/iam' - the coded-error vocabulary every throw in the package uses instead of a raw Error.

Namespaced nameKindOne line
IamError.CodetypeUnion of every key in the IAM_ERRORS registry
IamError.Meta<C>typeThe metadata shape a given Code carries
IamError.ErrortypeDiscriminated union over every { code, ...meta } pair
IamError.Args<C>typeThe argument tuple throwIamError/rethrowIamError take for a given Code
IamError.Bare / IamError.Faults / IamError.HasRequired<T>typeSupporting shapes from the shared ErrorKit machinery

Batch

import type { Batch } from '@gentleduck/iam' - per-row results for engine.admin's batch writes (assignRoles, revokeRoles, and similar).

Namespaced nameKindOne line
Batch.Outcome<TRow, T>typeOne row's result: { row, ok: true, value }; outcomes are in input order, and a failure throws rather than reporting ok: false
Batch.Changetype{ changed?: boolean } - present only when the driver can say whether the row accounted for a write
Batch.Result<TRow, T>type{ outcomes, applied } for a whole batch call

Pending

import type { Pending } from '@gentleduck/iam' - cache invalidations and mutation events a transaction-bound engine holds until the caller's transaction commits.

Namespaced nameKindOne line
Pending.Invalidation<TRole>typeOne buffered invalidation: subject, policies, or roles
Pending.ICacheSink<TRole> / Pending.IMutationSink<TRole, TScope>interfaceStructural shapes a buffering sink implements in place of a real engine
Pending.Effects<TRole, TScope>interfacesize, mutationSize, flush(), discard(), peek(), peekMutations() - the object engine.withTransaction(client).pending returns

Bound

import type { Bound } from '@gentleduck/iam' - the transaction-bound view engine.withTransaction(client) returns. See engine methods.

Namespaced nameKindOne line
Bound.IamEngine<TAction, TResource, TRole, TScope, TMode>interfaceadmin, engine, pending, plus the read methods (can, check, authorize, explain, permissions, getEffectiveRoles) bound to the transaction

Integration namespaces

Each integration subpath publishes its own option-bag namespace. All are type-only.

NamespaceImport pathMembers
IamMemory@gentleduck/iam/adapters/memoryIInit - seed policies, roles, assignments, attributes
IamFile@gentleduck/iam/adapters/fileIFS (minimal node:fs/promises surface), IInit, IState (on-disk document shape)
IamPrisma@gentleduck/iam/adapters/prismaIPolicyRow, IRoleRow, IAssignmentRow, IAttrRow, ILike (structural Prisma client)
IamDrizzle@gentleduck/iam/adapters/drizzleIConfig, PolicyRow, RoleRow, AssignmentRow, AttrRow, DrizzleTable, AnyDrizzleDb
Pg@gentleduck/iam/adapters/drizzle/pgPolicyRow, RoleRow, AssignmentRow, AttrRow
Mysql@gentleduck/iam/adapters/drizzle/mysqlPolicyRow, RoleRow, AssignmentRow, AttrRow
Sqlite@gentleduck/iam/adapters/drizzle/sqlitePolicyRow, RoleRow, AssignmentRow, AttrRow
IamRedis@gentleduck/iam/adapters/redisILike (ioredis / node-redis common surface), IConfig
IamHttp@gentleduck/iam/adapters/httpIConfig - endpoint, fetch override, retry, circuit-breaker tuning
IamRedisInvalidator@gentleduck/iam/invalidators/redisIPubSubLike, IConfig
IamMetrics@gentleduck/iam/observability/metricsIAggregator, ISnapshot, IConfig
IamExpress@gentleduck/iam/server/expressIOptions, IAdminAuthorize, IAdminRouterOptions
IamHono@gentleduck/iam/server/honoIOptions, IAdminAuthorize, IAdminOptions, IRouterLike
IamNest@gentleduck/iam/server/nestIAuthorizeMeta, IGuardOptions, IAdminAuthorize, IAdminOptions
IamNext@gentleduck/iam/server/nextIWithAccessOptions, IMiddlewareOptions, IAdminAuthorize, IAdminOptions
IamAdminAudit@gentleduck/iam/server/genericAction, Target, IEvent, Hook, IOptions
IamReactClient@gentleduck/iam/client/reactPermissionMap, PermissionKey, PermissionCheck, IChecker, IContextValue

Flat exports

Everything below is exported under its own name, not through a namespace.

From @gentleduck/iam and @gentleduck/iam/core

Flat nameKindOne line
createIamfunctionThe typed-config factory - see createIam()
IamEngine / iamEngineclass / functionThe evaluation engine and its constructor-forwarding factory
iamFlushSharedCachesfunctionDrops the process-wide regex and path caches
PolicyBuilder / definePolicyclass / functionUntyped policy builder and its factory
RoleBuilder / defineRoleclass / functionUntyped role builder and its factory
RuleBuilder / defineRuleclass / functionUntyped standalone rule builder and its factory
When / whenclass / functionUntyped condition builder and its factory
iamChosenWhenfunctionResolves which builder a condition callback meant - the one it was given or the one it returned - and throws when both carry conditions
iamEvaluate / iamEvaluateFastfunctionFull and fast-path evaluation over a policy set
iamEvaluatePolicy / iamEvaluatePolicyFastfunctionFull and fast-path evaluation of a single policy
iamIndexPolicyfunctionBuilds the Evaluate.IPolicyRuleIndex for a policy
iamMatchesUnconditionallyfunctiontrue when a rule matches without evaluating conditions - the precompute test
iamEvalConditionGroupfunctionEvaluates a condition tree; fails closed past IAM_MAX_CONDITION_DEPTH
iamEvalConditionfunctionEvaluates one leaf condition
iamEvaluateOperatorfunctionApplies one operator to a (field, value) pair
iamResolveConditionValue / iamResolveValuefunctionResolve a $-prefixed condition value against a request
iamIsConditionfunctionType guard separating a leaf condition from a group
iamIsUserSourcedValuefunctiontrue when a value is a $-prefixed reference
iamGetCachedRegex / iamClearRegexCachefunctionCompile and memoise a matches pattern; drop the shared cache
iamDetectCatastrophicRegexfunctionReDoS heuristic, also re-exported by core/validate as detectCatastrophicRegex
VALID_POLICY_COMBINESconst['and', 'allow-overrides', 'first-applicable']
IAM_CRUD_ACTIONSconst['create', 'read', 'update', 'delete'] - what .grantCRUD() expands to
IAM_MAX_CONDITION_DEPTHconst10 - condition nesting cap
IAM_MAX_REGEX_LENGTHconst128 - longest accepted matches pattern
IAM_MAX_REGEX_INPUT_LENGTHconst2048 - longest string a matches pattern is run against
IAM_REGEX_CACHE_MAXconst256 - regex cache capacity
IAM_MAX_BOUNDED_QUANTIFIER / IAM_MAX_UNBOUNDED_QUANTIFIERSconst1000 and 4 - the ReDoS heuristic's two thresholds
IAM_RBAC_POLICY_ID / IAM_RBAC_CONDITION_DEPTHconst'__rbac__' and 1 - the id and condition depth of the policy rolesToPolicy generates
resolvefunctionResolves a dot-path against a request
clearPathCachefunctionDrops the process-wide path-segment cache
PATH_CACHE_MAXconst10_000 - path cache capacity
matchesAction / matchesResourcefunctionWildcard target matching
matchesResourceHierarchical / matchesScopefunctionHierarchical resource and scope matching
iamScopeAncestors / iamScopeCoversfunctionExpand a dotted scope to its ancestors; test whether one scope covers another
rolesToPolicyfunctionCompiles roles into a single ABAC policy
resolveEffectiveRolesfunctionExpands a role assignment list through inherits
MAX_INHERITANCE_DEPTHconst32 - inheritance expansion cap
POLICY_JSON_SCHEMAconstDraft 2020-12 schema for AccessControl.IPolicy
explainEvaluation / iamEscapeHtmlfunctionProduces an Explain.IResult; escapes trace strings before rendering them
iamCreateEvalCachesfunctionCreates a fresh IamEvalCaches - the per-engine regex and path cache pair
IamLRUCache / iamLRUCacheclass / functionTTL LRU used for policies, roles, and subjects
iamBuildPermissionKeyfunctionBuilds a permission-map key, escaping : and \ per segment
iamSplitPermissionKey / iamParsePermissionKeyfunctionSplit a key into unescaped segments; parse one into { scope, action, resource, resourceId }, or null if it is not a key
throwIamError / rethrowIamErrorfunctionThrow (or wrap and rethrow) a coded IamError.Error by IamError.Code
failfunctionBuilds a KitError for a Code without throwing it, for a caller that returns or wraps it manually
asIamError / hasIamErrorCode / metaOffunctionNarrow an unknown catch value to an IamError.Error; test its code; read its metadata
throwIamValidationFailedfunctionThrows the coded validation-failure error carrying an IamValidate.IResult
IAM_ERRORSconstThe registry every IamError.Code is a key of - status, message template, and metadata shape per code

The condition engine no longer throws its own error classes - a malformed condition group, a type-mismatched operand, a refused matches pattern, an oversized regex input, and a $-sourced pattern each throw the coded IamError with one of IAM_CONDITION_GROUP_INVALID, IAM_CONDITION_OPERAND_TYPE, IAM_CONDITION_PATTERN_REFUSED, IAM_CONDITION_REGEX_INPUT_TOO_LARGE, or IAM_CONDITION_USER_SOURCED_PATTERN. Catch with hasIamErrorCode(err, '<code>') and read the detail off metaOf(err, '<code>'), not off the message.

From @gentleduck/iam/core/validate

Flat nameKindOne line
validatePolicy / validateRole / validateRolesfunctionDeep shape and semantic validation, returning IamValidate.IResult
parsePolicyRow / parseRoleRowfunctionValidate-then-narrow helpers for adapter rows
detectCatastrophicRegexfunctionReDoS heuristic used by matches validation
VALID_ALGORITHMS / VALID_EFFECTS / VALID_OPERATORSconstAccepted enum sets
POLICY_LIMITSconstStructural caps: rulesPerPolicy 1000, actionsPerRule 100, resourcesPerRule 100, cartesianPerRule 1000
MAX_FIELD_LENGTH / MAX_CONDITION_VALUE_LENGTHconst256 and 1024 - per-field and per-value length caps
MAX_UNBOUNDED_QUANTIFIERS / MAX_BOUNDED_QUANTIFIERconst4 and 1000 - the ReDoS heuristic's thresholds

From the integration subpaths

Flat nameImport pathKind
IamMemoryAdapter / iamMemoryAdapteradapters/memoryclass / factory
IamFileAdapter / iamFileAdapteradapters/fileclass / factory
IamPrismaAdapter / iamPrismaAdapteradapters/prismaclass / factory
IamDrizzleAdapter / createIamDrizzleAdapter / iamDrizzleAdapteradapters/drizzleclass / factories
iamPolicies / iamRoles / iamAssignments / iamSubjectAttrsadapters/drizzle/{pg,mysql,sqlite}drizzle tables
combineAlgorithmadapters/drizzle/pgpg enum
IAM_COMBINE_ALGORITHMSadapters/drizzle/sqliteconst
IamRedisAdapter / iamRedisAdapteradapters/redisclass / factory
IamHttpAdapter / iamHttpAdapteradapters/httpclass / factory
createIamRedisInvalidatorinvalidators/redisfunction
iamCreateMetricsAggregatorobservability/metricsfunction
iamAccessMiddleware / iamGuard / iamAdminRouterserver/expressfunctions
iamAccessMiddleware / iamGuard / iamBindAdminRouterserver/honofunctions
IamAuthorize / iamNestAccessGuard / createIamEngineProvider / createIamAdminOperationsserver/nestdecorator, guard, providers
IAM_ACCESS_METADATA_KEY / IAM_ACCESS_ENGINE_TOKENserver/nestconsts
withIamAccess / checkIamAccess / getIamPermissionsserver/nextfunctions
createIamNextMiddleware / createIamAdminHandlersserver/nextfunctions
createIamSubjectCan / iamExtractEnvironment / iamFireAdminMutationserver/genericfunctions
iamDefaultCsrfCheck / iamNoticeCsrfDefaultIfNeeded / iamErrorToAuditStringserver/genericfunctions
IAM_METHOD_ACTION_MAPserver/genericconst
IamAdminAudit.IamIAdminAuthzResult and its four armsserver/generictypes in the IamAdminAudit namespace, not flat exports
iamRunAdminAuthz / iamWithAdminAudit / generateIamPermissionMapserver/genericfunctions
createIamAccessControl / createIamPermissionCheckerclient/reactfunctions
iamAllowedActions / iamHasAnyOnclient/{react,vue,vanilla}functions, re-exported by all three clients
createIamVueAccess / IAM_ACCESS_INJECTION_KEYclient/vuefunction / symbol
IamAccessClient / iamAccessClientclient/vanillaclass / factory
IamDevtools / IamDevtoolsInner and the panel componentsdtReact components
iamCreateFlowRecorderdtfunction

Gotchas

  • IamValidate is a type-only re-export from core. core/index.ts exports the namespace but not validatePolicy; the functions live behind @gentleduck/iam/core/validate so the validator chunk stays opt-in.
  • createIam() reaches the validator anyway. The object it returns closes over validatePolicy and validateRoles, so once you call createIam the validator code is retained even though you never imported the subpath. If bundle size is the priority, use the untyped builders and validate at an explicit boundary.
  • IResult and IConfig are ambiguous without their namespace. Never destructure them into a bare local alias in shared code.
  • The Types suffix appears once. IamEngineTypes is the only namespace named for its class rather than its domain, because IamEngine is a runtime class occupying the flat name.

See also

  • createIam() - the factory whose generics thread these types through every builder.
  • Typed context - how DotPath turns your context interface into autocomplete.
  • Engine methods - the IamEngineTypes.IConfig and IAdmin surfaces in use.
  • Adapters - implementing IamAdapter.IAdapter.