Complete list of all SDK exports (v0.10.0).
Import from @z0-app/sdk.
| Export | Type | Description |
|---|
Entity | Type | Identity and state container |
Fact | Type | Immutable event record |
Config | Type | Versioned configuration |
InvariantSettings | Type | Runtime assertion config |
EntityLifecycleState | Type | Lifecycle state enum |
EntityMigrationState | Type | Migration state enum |
AnonymizationReason | Type | GDPR anonymization reasons |
BudgetMode | Type | Budget enforcement mode |
| Export | Type | Description |
|---|
SYSTEM_TENANT_ID | string | Reserved tenant for platform |
CONFIG_TYPES | object | Config type constants |
SYSTEM_FACT_TYPES | object | System fact type constants |
SCOPE_PRIORITY | object | Config scope priority order |
LIFECYCLE_STATES | array | Valid lifecycle states |
MIGRATION_STATES | array | Valid migration states |
| Export | Type | Description |
|---|
ParentEvent | Type | Base parent event |
ParentEventType | Type | Event type enum |
ChildRegisteredEvent | Type | Child registration notification |
ChildRetiringEvent | Type | Child retiring notification |
ChildRetiredEvent | Type | Child retired notification |
ChildDeletedEvent | Type | Child deletion notification |
StatsUpdateEvent | Type | Stats aggregation update |
AggregationConfig | Type | Fact aggregation config |
FactAggregationRule | Type | Single aggregation rule |
| Export | Type | Description |
|---|
createChildRegisteredEvent | Function | Create child registered event |
createChildRetiringEvent | Function | Create child retiring event |
createChildRetiredEvent | Function | Create child retired event |
createChildDeletedEvent | Function | Create child deleted event |
createStatsUpdateEvent | Function | Create stats update event |
isValidParentEvent | Function | Validate parent event structure |
validateTenantMatch | Function | Verify tenant ID match |
PARENT_CACHE_KEYS | object | Cache key constants |
| Export | Type | Description |
|---|
FactSummary | Type | Fact metadata summary |
LedgerSnapshot | Type | Point-in-time ledger state |
HookConfig | Type | Hook configuration |
HookAction | Type | Hook action type |
FactQueryOptions | Type | Fact query filters |
FactInput | Type | Fact creation input |
EntityInput | Type | Entity creation input |
ConfigInput | Type | Config creation input |
ConfigUpdateInput | Type | Config update input |
LifecycleTransitionInput | Type | Lifecycle transition params |
DeadLetterFact | Type | Rejected fact record |
InFlightStatus | Type | In-flight fact status |
LifecycleStatus | Type | Entity lifecycle status |
DrainingStatus | Type | Draining progress status |
DrainingOptions | Type | Draining configuration |
AnonymizeOptions | Type | GDPR anonymization params |
AnonymizeResult | Type | Anonymization result |
GdprDeletionRequest | Type | GDPR deletion request |
GdprDeletionResult | Type | GDPR deletion result |
ExtendReservationRequest | Type | Reservation extension params |
ExtendReservationResult | Type | Reservation extension result |
ForceChargeRequest | Type | Force charge params |
ForceChargeResult | Type | Force charge result |
SharedBudgetConfig | Type | Shared budget configuration |
SharedBudgetCheckRequest | Type | Budget check params |
SharedBudgetCheckResult | Type | Budget check result |
MigrationStatus | Type | Migration status response |
MigrationStartInput | Type | Start migration params |
MigrationVerifyInput | Type | Verify migration params |
WebhookOwnershipResult | Type | Webhook ownership check |
ExternalProviderConfig | Type | External provider config |
WebhookRoutingAudit | Type | Webhook routing audit log |
| Export | Type | Description |
|---|
EntityLedger | Class | Base ledger class to extend |
SystemLedger | Class | Platform-level system ledger |
TenantSystemLedger | Class | Tenant-level system ledger |
DEFAULT_BOOTSTRAP_CONFIG | object | Default bootstrap options |
DEFAULT_QUERY_LIMIT | number | Default fact query limit (1000) |
| Export | Type | Description |
|---|
EntityLedgerEnv | Type | Required Durable Object env bindings |
FactRow | Type | SQLite fact row structure |
FactContext | Type | Fact processing context |
BootstrapConfig | Type | Bootstrap configuration |
LedgerOptions | Type | Ledger initialization options |
| Export | Type | Description |
|---|
SdkObservabilityFact | Type | SDK observability fact |
SdkObservabilitySubtype | Type | Observability event subtype |
SdkObservabilityData | Type | Observability event data |
CacheStatsData | Type | Cache statistics payload |
FactAppendedData | Type | Fact append event payload |
SchemaInitData | Type | Schema init event payload |
HydrationDoneData | Type | Hydration complete payload |
TenantStatsPayload | Type | Tenant stats payload |
| Export | Type | Description |
|---|
TenantSystemLedgerEnv | Type | Tenant system ledger env |
TenantSystemLedgerOptions | Type | Tenant system ledger options |
| Export | Type | Description |
|---|
SubscriptionManager | Class | WebSocket/SSE subscription manager |
| Export | Type | Description |
|---|
SubscriptionRow | Type | SQLite subscription row |
ConnectionRow | Type | SQLite connection row |
| Export | Type | Description |
|---|
createMockDOContext | Function | Create mock Durable Object context |
createMockDOStub | Function | Create mock DO stub |
createMockQueue | Function | Create mock queue |
MockDOContext | Type | Mock DO context type |
MockSqlStorage | Type | Mock SQLite storage type |
| Export | Type | Description |
|---|
LedgerRegistry | Class | Domain manifest registry |
| Export | Type | Description |
|---|
LedgerConstructor | Type | Ledger class constructor |
EntityDefinition | Type | Entity definition |
DomainManifest | Type | Domain manifest structure |
FactEventHandler | Type | Fact event handler function |
| Export | Type | Description |
|---|
generateId | Function | Generate prefixed ID |
PLATFORM_ID_PREFIXES | object | ID prefix constants |
| Export | Type | Description |
|---|
ApiError | Class | RFC 7807 API error |
EntityLedgerErrors | object | Pre-built error factories |
FieldError | Type | Field validation error |
ProblemDetails | Type | RFC 7807 problem details |
| Export | Type | Description |
|---|
authenticateRequest | Function | Authenticate API request |
parseApiKey | Function | Parse API key structure |
ApiKeyMode | Type | API key mode enum |
AuthContext | Type | Authentication context |
AuthResult | Type | Authentication result |
| Export | Type | Description |
|---|
CreateEntitySchema | ZodSchema | Entity creation validator |
CreateFactSchema | ZodSchema | Fact creation validator |
CreateConfigSchema | ZodSchema | Config creation validator |
| Export | Type | Description |
|---|
Router | Class | Simple request router |
| Export | Type | Description |
|---|
LedgerClient | Class | Type-safe ledger client |
LedgerStub | Class | Single entity stub |
| Export | Type | Description |
|---|
CircuitBreaker | Class | Circuit breaker for DO calls |
CircuitOpenError | Class | Circuit open error |
CircuitBreakerOptions | Type | Circuit breaker config |
CircuitBreakerState | Type | Circuit state enum |
| Export | Type | Description |
|---|
ParentDOClient | Class | Parent DO client with circuit breaker |
ParentClientOptions | Type | Parent client config |
CachedResponse | Type | Cached response structure |
| Export | Type | Description |
|---|
ParentEventsConsumer | Class | Queue consumer for parent events |
createParentEventsConsumer | Function | Create consumer instance |
ParentEventMessage | Type | Queue message wrapper |
DONamespace | Type | Durable Object namespace |
DurableObjectId | Type | DO ID type |
DurableObjectStub | Type | DO stub type |
BatchProcessResult | Type | Batch processing result |
ParentEventsConsumerOptions | Type | Consumer config |
MessageBatch | Type | Queue message batch |
Message | Type | Queue message |
| Export | Type | Description |
|---|
compareStates | Function | Compare entity states |
createNumericCheck | Function | Create numeric tolerance check |
createExactMatchCheck | Function | Create exact match check |
HealthCheckResult | Type | Health check result |
HealthCheck | Type | Health check function |
HealthCheckOptions | Type | Health check config |
DivergenceReport | Type | State divergence report |
HealthCheckable | Type | Health checkable interface |
| Export | Type | Description |
|---|
signPayload | Function | Sign webhook payload |
constantTimeCompare | Function | Constant-time string compare |
buildWebhookPayload | Function | Build webhook payload |
generateDeliveryId | Function | Generate delivery ID |
generateWebhookId | Function | Generate webhook ID |
matchWebhookTrigger | Function | Match fact to webhook trigger |
findMatchingWebhooks | Function | Find matching webhooks |
isRetryableError | Function | Check if HTTP error is retryable |
calculateBackoff | Function | Calculate exponential backoff |
validateWebhookConfig | Function | Validate webhook config |
buildWebhookHeaders | Function | Build webhook headers |
filterPii | Function | Filter PII from payload |
detectPotentialPii | Function | Detect PII in data |
DEFAULT_RETRY_CONFIG | object | Default retry config |
DEFAULT_PII_FIELDS | array | Default PII field names |
| Export | Type | Description |
|---|
WebhookConfigSettings | Type | Webhook configuration |
WebhookDeliveryMessage | Type | Webhook delivery queue message |
WebhookPayload | Type | Webhook payload structure |
WebhookTriggeredData | Type | Webhook triggered event data |
WebhookSentData | Type | Webhook sent event data |
PiiFilterConfig | Type | PII filter configuration |
| Export | Type | Description |
|---|
validateWebhookOwnership | Function | Validate tenant ownership |
findTenantByExternalId | Function | Find tenant by external ID |
createRoutingAudit | Function | Create routing audit log |
extractRequestMetadata | Function | Extract request metadata |
createDefaultProviderRegistry | Function | Create default provider registry |
registerProvider | Function | Register webhook provider |
twilioParser | Function | Twilio webhook parser |
stripeParser | Function | Stripe webhook parser |
sendgridParser | Function | SendGrid webhook parser |
| Export | Type | Description |
|---|
WebhookProviderParser | Type | Provider parser function |
ProviderRegistry | Type | Provider registry map |
| Export | Type | Description |
|---|
assertInvariant | Function | Assert runtime invariant |
InvariantChecker | Class | Invariant evaluation engine |
InvariantViolation | Class | Invariant violation error |
| Export | Type | Description |
|---|
resolveBindingAsOf | Function | Resolve binding at timestamp |
canAssignResource | Function | Check if resource can be assigned |
buildAssignmentFact | Function | Build resource assignment fact |
buildReleaseFact | Function | Build resource release fact |
getActiveBinding | Function | Get active binding |
getEntityBindings | Function | Get all entity bindings |
getAvailableAt | Function | Get resource availability time |
bindingFromFact | Function | Extract binding from fact |
applyRelease | Function | Apply release to binding |
isBindingValidAt | Function | Check binding validity |
resolveBindingAt | Function | Resolve binding at time |
getBindingHistoryAt | Function | Get binding history |
willBindingBeValidAt | Function | Check future validity |
DEFAULT_QUARANTINE_MS | number | Default quarantine duration |
PHONE_NUMBER_CONFIG | object | Phone number resource config |
EMAIL_CONFIG | object | Email resource config |
| Export | Type | Description |
|---|
ResourceBinding | Type | Resource binding record |
BindingResolution | Type | Binding resolution result |
AssignResourceOptions | Type | Resource assignment options |
ReleaseResourceOptions | Type | Resource release options |
ResourceTypeConfig | Type | Resource type config |
ResourceAssignedData | Type | Resource assigned fact data |
ResourceReleasedData | Type | Resource released fact data |
| Export | Type | Description |
|---|
validateHierarchyDepth | Function | Validate depth limit |
calculateDepth | Function | Calculate current depth |
buildHierarchyPath | Function | Build ancestor path |
cacheParentData | Function | Cache parent entity data |
isCacheValid | Function | Check cache validity |
ParentCache | Class | Parent data cache |
buildAncestorIds | Function | Build ancestor ID list |
DEFAULT_HIERARCHY_CONFIG | object | Default hierarchy config |
| Export | Type | Description |
|---|
HierarchyConfig | Type | Hierarchy configuration |
HierarchyPosition | Type | Entity position in hierarchy |
HierarchyValidation | Type | Depth validation result |
CachedParentData | Type | Cached parent entity data |
FlattenedEntity | Type | Flattened entity with ancestors |
HierarchyPathResult | Type | Hierarchy path result |
AncestorIdsResult | Type | Ancestor IDs result |
| Export | Type | Description |
|---|
BatchExecutor | Class | Batch processor with resumability |
createBatchProgress | Function | Create batch progress tracker |
progressToOptions | Function | Convert progress to options |
| Export | Type | Description |
|---|
BatchResult | Type | Batch execution result |
BatchOptions | Type | Batch execution options |
BatchProcessor | Type | Batch processor function |
BatchProgress | Type | Batch progress state |
| Export | Type | Description |
|---|
detectCycle | Function | Detect cycle in chain |
canMerge | Function | Check if merge creates cycle |
getChain | Function | Get entity chain |
getCanonicalId | Function | Get canonical entity ID |
| Export | Type | Description |
|---|
CycleResult | Type | Cycle detection result |
MergeCheck | Type | Merge validation result |
GetNextFn | Type | Get next entity function |
| Export | Type | Description |
|---|
getBillingDay | Function | Get billing day for timestamp |
isSameBillingDay | Function | Check if same billing day |
getBillingDayStart | Function | Get billing day start time |
getBillingDayEnd | Function | Get billing day end time |
getCurrentBillingDay | Function | Get current billing day |
getDaysSince | Function | Get days since timestamp |
| Export | Type | Description |
|---|
BillingDay | Type | Billing day representation |
| Export | Type | Description |
|---|
calculateTieredCharge | Function | Calculate graduated tier pricing |
| Export | Type | Description |
|---|
Tier | Type | Price tier definition |
TierBreakdownItem | Type | Tier calculation breakdown |
TieredChargeResult | Type | Tier calculation result |
| Export | Type | Description |
|---|
ThresholdMonitor | Class | Threshold crossing detector |
| Export | Type | Description |
|---|
ThresholdCheckResult | Type | Threshold check result |
| Export | Type | Description |
|---|
cascade | Function | Execute multi-DO operation with rollback |
CascadeError | Class | Cascade execution error |
| Export | Type | Description |
|---|
CascadeOperation | Type | Single cascade operation |
CascadeResult | Type | Cascade execution result |
PartialRollback | Type | Partial rollback state |
| Export | Type | Description |
|---|
registerSchema | Function | Register fact schema version |
validateFact | Function | Validate fact against schema |
migrateFact | Function | Migrate fact to latest version |
getLatestVersion | Function | Get latest schema version |
hasSchema | Function | Check if schema exists |
clearSchemas | Function | Clear schema registry |
z | object | Re-exported Zod |
| Export | Type | Description |
|---|
ValidationResult | Type | Schema validation result |
SchemaOptions | Type | Schema registration options |
| Export | Type | Description |
|---|
RateLimiter | Class | Rate limiter with backpressure |
RateLimitError | Class | Rate limit exceeded error |
ValidationError | Class | Request validation error |
processInOrder | Function | Process requests in order |
createPendingRequest | Function | Create pending request |
isPendingRequestValid | Function | Check request validity |
DEFAULT_RATE_LIMIT_CONFIG | object | Default rate limit config |
AGGRESSIVE_RATE_LIMIT_CONFIG | object | Aggressive rate limit config |
RELAXED_RATE_LIMIT_CONFIG | object | Relaxed rate limit config |
DEFAULT_PENDING_TTL_MS | number | Default pending request TTL |
| Export | Type | Description |
|---|
RateLimitConfig | Type | Rate limit configuration |
RateLimitState | Type | Rate limit state |
RateLimitResult | Type | Rate limit check result |
BackpressureSignal | Type | Backpressure signal |
PendingRequest | Type | Pending request state |
LimitNotification | Type | Limit notification |
RequestProcessingOrder | Type | Request processing order |
| Export | Type | Description |
|---|
mean | Function | Calculate mean |
stddev | Function | Calculate standard deviation |
median | Function | Calculate median |
percentile | Function | Calculate percentile |
zScore | Function | Calculate z-score |
mad | Function | Calculate median absolute deviation |
iqr | Function | Calculate interquartile range |
aggregateMetrics | Function | Aggregate metrics |
isOutlier | Function | Check if value is outlier |
excludeOutliers | Function | Exclude outliers from dataset |
assignToCohorts | Function | Assign tenants to cohorts |
matchesCohortCriteria | Function | Check cohort match |
detectAnomaly | Function | Detect anomaly in metrics |
DEFAULT_OUTLIER_CONFIG | object | Default outlier config |
DEFAULT_COHORTS | array | Default tenant cohorts |
| Export | Type | Description |
|---|
MetricPoint | Type | Single metric data point |
AggregatedMetric | Type | Aggregated metric |
TenantMetricSummary | Type | Tenant metric summary |
PlatformMetric | Type | Platform-wide metric |
TenantCohort | Type | Tenant cohort definition |
CohortCriteria | Type | Cohort matching criteria |
TenantProfile | Type | Tenant profile |
AnomalyResult | Type | Anomaly detection result |
OutlierConfig | Type | Outlier detection config |
| Export | Type | Description |
|---|
ProjectionEngine | Class | Fact aggregation engine (YAML) |
parseProjectionConfig | Function | Parse projection YAML |
ConfigParseError | Class | Config parsing error |
ConfigValidationError | Class | Config validation error |
| Export | Type | Description |
|---|
ProjectionConfig | Type | Projection configuration |
Aggregation | Type | Aggregation definition |
AggregationFunction | Type | Aggregation function type |
TimeWindow | Type | Time window config |
ProjectionProcessOptions | Type | Processing options |
| Export | Type | Description |
|---|
MeterEngine | Class | Usage tracking and budget enforcement |
parseMeterConfig | Function | Parse meter YAML |
MeterNotFoundError | Class | Meter not found error |
| Export | Type | Description |
|---|
MeterConfig | Type | Meter configuration |
MeterWindow | Type | Meter time window |
MeterAggregation | Type | Meter aggregation function |
BudgetCheckConfig | Type | Budget check config |
OverageConfig | Type | Overage handling config |
BudgetCheckResult | Type | Budget check result (union) |
BudgetCheckAllowed | Type | Budget check allowed |
BudgetCheckRejected | Type | Budget check rejected |
OverageDetails | Type | Overage details |
| Export | Type | Description |
|---|
z0 | object | Platform instance |
boot | Function | Bootstrap platform |
PLATFORM_MANIFEST | object | Platform manifest |
| Export | Type | Description |
|---|
Platform | Type | Platform interface |
EntityClient | Type | Entity client interface |
EntityStats | Type | Entity statistics |
BootOptions | Type | Boot options |
PlatformManifest | Type | Platform manifest |
| Export | Type | Description |
|---|
schemaBuilders | object | TypeScript schema builders |
registerEntity | Function | Register entity definition |
freezeSchemas | Function | Freeze schema registry |
isSchemaFrozen | Function | Check if schemas frozen |
getRegisteredEntity | Function | Get registered entity |
getRegisteredEntityNames | Function | Get all entity names |
clearSchemaRegistry | Function | Clear schema registry |
resetIndexCounters | Function | Reset index counters |
entityToDefinition | Function | Convert entity to definition |
buildManifest | Function | Build domain manifest |
entityToManifest | Function | Convert entity to manifest |
fieldToZod | Function | Convert field to Zod schema |
entityFieldsToZod | Function | Convert entity fields to Zod |
factDataToZod | Function | Convert fact data to Zod |
entityFactsToZod | Function | Convert entity facts to Zod |
entityToValidators | Function | Generate entity validators |
sanitizeValidationError | Function | Sanitize Zod error |
| Export | Type | Description |
|---|
parseManifest | Function | Parse YAML manifest |
manifestToBuilders | Function | Convert manifest to builders |
parseManifestToBuilders | Function | Parse YAML to builders |
validateManifest | Function | Validate manifest structure |
ManifestParseError | Class | Manifest parse error |
YamlManifestSchema | ZodSchema | YAML manifest validator |
| Export | Type | Description |
|---|
FieldBuilder | Type | Field builder interface |
FieldConfig | Type | Field configuration |
FieldType | Type | Field type enum |
EntityBuilder | Type | Entity builder interface |
EntityConfig | Type | Entity configuration |
FactDefinition | Type | Fact definition |
SchemaNamespace | Type | Schema namespace |
InferField | Type | Infer field type |
InferEntityFields | Type | Infer entity fields type |
InferEntityFacts | Type | Infer entity facts type |
InferFactData | Type | Infer fact data type |
BuildManifestOptions | Type | Manifest build options |
EntityValidators | Type | Entity validators |
| Export | Type | Description |
|---|
YamlManifest | Type | YAML manifest structure |
YamlEntity | Type | YAML entity definition |
YamlField | Type | YAML field definition |
YamlConfig | Type | YAML config definition |
YamlRoute | Type | YAML route definition |
ManifestParseResult | Type | Manifest parse result |
ManifestBuilders | Type | Manifest builders |
| Export | Type | Description |
|---|
gatewayContract | oRPC Router | Gateway contract definitions for all actions |
| Export | Type | Description |
|---|
EntitySchema | ZodSchema | Entity structure schema |
FactSchema | ZodSchema | Fact structure schema |
FieldErrorSchema | ZodSchema | Field validation error schema |
ProblemDetailsSchema | ZodSchema | RFC 7807 problem details schema |
EmitInputSchema | ZodSchema | Emit action input schema |
EmitOutputSchema | ZodSchema | Emit action output schema |
GetInputSchema | ZodSchema | Get action input schema |
GetOutputSchema | ZodSchema | Get action output schema |
CreateInputSchema | ZodSchema | Create action input schema |
CreateOutputSchema | ZodSchema | Create action output schema |
ListInputSchema | ZodSchema | List action input schema |
ListOutputSchema | ZodSchema | List action output schema |
QueryInputSchema | ZodSchema | Query action input schema |
QueryOutputSchema | ZodSchema | Query action output schema |
| Export | Type | Description |
|---|
GatewayWorker | Class | Base class for API Gateway Workers |
GatewayWorkerEnv | Type | Required environment bindings |
| Export | Type | Description |
|---|
createAuthMiddleware | Function | Create authentication middleware |
createRateLimitMiddleware | Function | Create rate limiting middleware |
createValidationMiddleware | Function | Create request validation middleware |
zodErrorsToFieldErrors | Function | Convert Zod errors to field errors |
shapeSuccessResponse | Function | Shape success response envelope |
shapeErrorResponse | Function | Shape error response (RFC 7807) |
| Export | Type | Description |
|---|
AuthMode | Type | Auth mode: api_key, public |
Middleware | Type | Middleware function signature |
RateLimitScope | Type | Rate limit scope: tenant, global |
RouteRateLimitConfig | Type | Route rate limit configuration |
ResponseMeta | Type | Response metadata structure |
SuccessEnvelope | Type | Success response envelope type |
| Export | Type | Description |
|---|
EmitRequest | Type | Emit action request type |
EmitResponse | Type | Emit action response type |
GetRequest | Type | Get action request type |
GetResponse | Type | Get action response type |
CreateRequest | Type | Create action request type |
CreateResponse | Type | Create action response type |
ListRequest | Type | List action request type |
ListResponse | Type | List action response type |
QueryRequest | Type | Query action request type |
QueryResponse | Type | Query action response type |
| Export | Type | Description |
|---|
generateGatewayWorker | Function | Generate Worker code from manifest |
generateOpenAPISpec | Function | Generate OpenAPI 3.0 spec from contracts |
| Export | Type | Description |
|---|
GeneratorOptions | Type | Gateway code generator options |
OpenAPISpec | Type | OpenAPI 3.0 specification structure |
OpenAPIGeneratorOptions | Type | OpenAPI generator options |
PathItem | Type | OpenAPI path item |
Operation | Type | OpenAPI operation |
Parameter | Type | OpenAPI parameter |
RequestBody | Type | OpenAPI request body |
Response | Type | OpenAPI response |
JSONSchema | Type | JSON Schema definition |
SecurityScheme | Type | OpenAPI security scheme |
| Export | Type | Description |
|---|
VERSION | string | SDK version (0.10.0) |
| Category | Exports |
|---|
| Core Primitives | 8 types + 6 constants |
| Parent Events | 9 types + 8 functions |
| Ledger Types | 30+ types |
| Base Classes | 3 classes + 12 types |
| Managers | 1 class + 2 types |
| Test Utilities | 3 functions + 2 types |
| Registry | 1 class + 4 types |
| Utilities (15 modules) | 100+ functions/classes |
| Engines | 2 engines + 20+ types |
| Platform | 2 functions + 5 types |
| Schema Builder | 20+ functions + 25+ types |
| Gateway (NEW) | 3 classes + 40+ types + 10+ functions |
| Total | 350+ exports |