uni-types 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +355 -1
  2. package/dist/index.d.cts +10773 -3925
  3. package/dist/index.d.mts +10773 -3925
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -18,7 +18,7 @@ A comprehensive collection of type helpers for TypeScript development
18
18
 
19
19
  ## Features
20
20
 
21
- - 🎯 **400+ Type Utilities** - Comprehensive type helpers for every use case
21
+ - 🎯 **600+ Type Utilities** - Comprehensive type helpers for every use case
22
22
  - 🔒 **Type Safe** - Full TypeScript support with strict type checking
23
23
  - 📦 **Zero Dependencies** - Lightweight and tree-shakeable
24
24
  - 🚀 **TypeScript 5.x** - Built with the latest TypeScript features
@@ -528,6 +528,360 @@ type Result = If<true, 'success', 'error'> // 'success'
528
528
  | `TypeInfo<T>` | Type information |
529
529
  | `InspectType<T>` | Inspect type details |
530
530
 
531
+ ### Authorization & Permissions *(v1.5.0)*
532
+
533
+ | Type | Description |
534
+ |------|-------------|
535
+ | `Permission<T>` | Permission definition |
536
+ | `PermissionSet<T>` | Set of permissions |
537
+ | `Role<T>` | Role definition |
538
+ | `RoleSet<T>` | Set of roles |
539
+ | `Policy` | Policy for ABAC |
540
+ | `PolicyRule<T>` | Policy rule |
541
+ | `PolicyEffect` | Allow or deny |
542
+ | `RBAC<R, P>` | Role-Based Access Control |
543
+ | `ABAC<T>` | Attribute-Based Access Control |
544
+ | `ACL` | Access Control List |
545
+ | `AccessControl<T>` | Access control interface |
546
+ | `Resource<T>` | Resource for authorization |
547
+ | `Action` | Action type (create, read, update, delete, etc.) |
548
+ | `AuthorizationProvider<T>` | Authorization provider |
549
+
550
+ ### Caching Strategies *(v1.5.0)*
551
+
552
+ | Type | Description |
553
+ |------|-------------|
554
+ | `Cache<T>` | Cache interface |
555
+ | `CacheEntry<T>` | Cache entry |
556
+ | `CacheOptions` | Cache options (TTL, tags) |
557
+ | `CacheStats` | Cache statistics |
558
+ | `LRUCache<T>` | LRU Cache |
559
+ | `LFUCache<T>` | LFU Cache |
560
+ | `TTLCache<T>` | TTL Cache |
561
+ | `FIFOCache<T>` | FIFO Cache |
562
+ | `ARCCache<T>` | Adaptive Replacement Cache |
563
+ | `DistributedCache<T>` | Distributed cache |
564
+ | `CacheAside<T>` | Cache-aside pattern |
565
+ | `ReadThroughCache<T>` | Read-through pattern |
566
+ | `WriteThroughCache<T>` | Write-through pattern |
567
+ | `WriteBehindCache<T>` | Write-behind pattern |
568
+
569
+ ### Configuration Management *(v1.5.0)*
570
+
571
+ | Type | Description |
572
+ |------|-------------|
573
+ | `Config<T>` | Configuration type |
574
+ | `ConfigField<T>` | Config field definition |
575
+ | `ConfigLoader<T>` | Config loader interface |
576
+ | `ConfigSchema<T>` | Config schema |
577
+ | `EnvConfig` | Environment config |
578
+ | `EnvMapping` | Env var mapping |
579
+ | `FeatureFlag` | Feature flag |
580
+ | `FeatureFlagConfig` | Feature flag config |
581
+ | `FeatureFlags<T>` | Feature flags collection |
582
+ | `RemoteConfigProvider<T>` | Remote config provider |
583
+ | `Secret` | Secret value |
584
+ | `SecretProvider` | Secret provider |
585
+
586
+ ### Event-Driven Architecture *(v1.5.0)*
587
+
588
+ | Type | Description |
589
+ |------|-------------|
590
+ | `EventBus<T>` | Event bus interface |
591
+ | `EventStream<T>` | Event stream |
592
+ | `Command<T>` | Command for CQRS |
593
+ | `CommandBus<T>` | Command bus |
594
+ | `CommandHandler<T, R>` | Command handler |
595
+ | `Query<T>` | Query for CQRS |
596
+ | `QueryBus<T>` | Query bus |
597
+ | `QueryHandler<T, R>` | Query handler |
598
+ | `Saga<T>` | Saga orchestrator |
599
+ | `SagaStep<T>` | Saga step |
600
+ | `MessageQueue<T>` | Message queue |
601
+ | `EventStore<T>` | Event store |
602
+ | `DeadLetterQueue<T>` | Dead letter queue |
603
+
604
+ ### GraphQL Integration *(v1.5.0)*
605
+
606
+ | Type | Description |
607
+ |------|-------------|
608
+ | `GraphQLSchema` | GraphQL schema |
609
+ | `GraphQLType` | GraphQL type wrapper |
610
+ | `GraphQLScalar<T>` | Scalar type |
611
+ | `GraphQLEnum<T>` | Enum type |
612
+ | `GraphQLInput<T>` | Input type |
613
+ | `GraphQLObject<T>` | Object type |
614
+ | `GraphQLField<T, A, R>` | Field type |
615
+ | `GraphQLResolver<T, A, R>` | Resolver type |
616
+ | `GraphQLContext<T>` | Context type |
617
+ | `GraphQLResult<T>` | Result wrapper |
618
+ | `GraphQLError` | Error type |
619
+
620
+ ### Logging & Observability *(v1.5.0)*
621
+
622
+ | Type | Description |
623
+ |------|-------------|
624
+ | `Logger<T>` | Logger interface |
625
+ | `LogLevel` | Log levels |
626
+ | `LogEntry<T>` | Log entry |
627
+ | `Metric<T>` | Metric type |
628
+ | `Counter<T>` | Counter metric |
629
+ | `Gauge<T>` | Gauge metric |
630
+ | `Histogram` | Histogram metric |
631
+ | `Tracer` | Tracer interface |
632
+ | `Span` | Tracing span |
633
+ | `Trace<T>` | Trace type |
634
+ | `Monitor` | Monitor type |
635
+ | `Alert<T>` | Alert type |
636
+ | `HealthIndicator<T>` | Health indicator |
637
+ | `HealthCheckResult<T>` | Health check result |
638
+
639
+ ### Microservices Architecture *(v1.5.0)*
640
+
641
+ | Type | Description |
642
+ |------|-------------|
643
+ | `Microservice<T>` | Microservice type |
644
+ | `ServiceConfig<T>` | Service config |
645
+ | `ServiceRegistry<T>` | Service registry |
646
+ | `ServiceInstance` | Service instance |
647
+ | `ServiceDiscovery<T>` | Service discovery |
648
+ | `CircuitBreaker<T>` | Circuit breaker |
649
+ | `RateLimit` | Rate limiting |
650
+ | `LoadBalancer<T>` | Load balancer |
651
+ | `APIGateway<T>` | API Gateway |
652
+ | `GatewayRoute` | Gateway route |
653
+ | `HealthReport` | Health report |
654
+
655
+ ### Validation Rules *(v1.5.0)*
656
+
657
+ | Type | Description |
658
+ |------|-------------|
659
+ | `ValidationRule<T>` | Validation rule |
660
+ | `Validator<T>` | Validator function |
661
+ | `ValidatorResult<T>` | Validator result |
662
+ | `ValidationError` | Validation error |
663
+ | `StringFieldValidator<T>` | String validator |
664
+ | `NumberFieldValidator<T>` | Number validator |
665
+ | `ArrayFieldValidator<T>` | Array validator |
666
+ | `ObjectFieldValidator<T>` | Object validator |
667
+ | `MinLength` | Min length constraint |
668
+ | `MaxLength` | Max length constraint |
669
+ | `MinValue` | Min value constraint |
670
+ | `MaxValue` | Max value constraint |
671
+ | `Pattern` | Regex pattern |
672
+ | `Sanitizer<T>` | Sanitizer function |
673
+
674
+ ### WebSocket & Real-Time *(v1.5.0)*
675
+
676
+ | Type | Description |
677
+ |------|-------------|
678
+ | `WebSocketConfig` | WebSocket config |
679
+ | `WebSocketMessage<T>` | WebSocket message |
680
+ | `EventEmitter<T>` | Event emitter |
681
+ | `PubSub<T>` | Pub/Sub interface |
682
+ | `Publisher<T>` | Publisher |
683
+ | `Subscriber<T>` | Subscriber |
684
+ | `RealTimeChannel<T>` | Real-time channel |
685
+ | `RealTimeClient<T>` | Real-time client |
686
+ | `Stream<T>` | Stream interface |
687
+ | `StreamReader<T>` | Stream reader |
688
+ | `StreamWriter<T>` | Stream writer |
689
+
690
+ ### Workflow Engine *(v1.5.0)*
691
+
692
+ | Type | Description |
693
+ |------|-------------|
694
+ | `Workflow<T>` | Workflow definition |
695
+ | `WorkflowInstance<T>` | Workflow instance |
696
+ | `WorkflowStep<T>` | Workflow step |
697
+ | `WorkflowTransition<T>` | Workflow transition |
698
+ | `WorkflowExecution<T>` | Workflow execution |
699
+ | `WorkflowHistory<T>` | Workflow history |
700
+ | `WorkflowEngine<T>` | Workflow engine |
701
+ | `RetryPolicy` | Retry policy |
702
+ | `BPMNProcess<T>` | BPMN process |
703
+ | `BPMNTask<T>` | BPMN task |
704
+ | `BPMNGateway<T>` | BPMN gateway |
705
+ | `BPMNEvent<T>` | BPMN event |
706
+
707
+ ### AI/ML Types *(v1.6.0)*
708
+
709
+ | Type | Description |
710
+ |------|-------------|
711
+ | `Tensor<Shape, DType>` | Tensor with shape and data type |
712
+ | `TensorShape` | Tensor shape type |
713
+ | `TensorDType` | Tensor data types (float32, int32, etc.) |
714
+ | `Model<Input, Output>` | Model type |
715
+ | `ModelConfig<T>` | Model configuration |
716
+ | `Layer<T>` | Neural network layer |
717
+ | `LayerType` | Layer types (dense, conv2d, lstm, etc.) |
718
+ | `Optimizer` | Optimizer types (adam, sgd, rmsprop) |
719
+ | `LossFunction` | Loss functions (mse, crossentropy) |
720
+ | `MLMetric` | ML metrics (accuracy, precision, recall) |
721
+ | `Dataset<T>` | Dataset type |
722
+ | `DataLoader<T>` | Data loader type |
723
+ | `Batch<T>` | Batch type |
724
+ | `InferenceResult<T>` | Inference result |
725
+ | `Prediction<T>` | Prediction result |
726
+
727
+ ### Functional Programming *(v1.6.0)*
728
+
729
+ | Type | Description |
730
+ |------|-------------|
731
+ | `Functor<T>` | Functor type |
732
+ | `Monad<T>` | Monad type |
733
+ | `Applicative<T>` | Applicative type |
734
+ | `Maybe<T>` | Maybe monad (Some/None) |
735
+ | `Either<L, R>` | Either monad (Left/Right) |
736
+ | `IO<T>` | IO monad |
737
+ | `Reader<R, T>` | Reader monad |
738
+ | `Writer<W, T>` | Writer monad |
739
+ | `State<S, T>` | State monad |
740
+ | `Result<T, E>` | Result type (Ok/Err) |
741
+ | `Lens<S, A>` | Lens for deep access |
742
+ | `Semigroup<T>` | Semigroup type |
743
+ | `Monoid<T>` | Monoid type |
744
+ | `Compose` | Function composition |
745
+ | `Pipe` | Pipeline composition |
746
+ | `Curry` | Curried function |
747
+
748
+ ### Type-Level Compiler *(v1.6.0)*
749
+
750
+ | Type | Description |
751
+ |------|-------------|
752
+ | `ASTNode<T>` | AST node type |
753
+ | `ASTNodeType` | AST node types |
754
+ | `Token<T>` | Token type |
755
+ | `TokenType` | Token types (keyword, identifier, etc.) |
756
+ | `Parser<T>` | Parser type |
757
+ | `ParserResult<T>` | Parser result |
758
+ | `CodeGenerator<T>` | Code generator |
759
+ | `GeneratedCode` | Generated code type |
760
+ | `Transformer<T>` | AST transformer |
761
+ | `Formatter` | Code formatter |
762
+
763
+ ### Distributed Systems *(v1.6.0)*
764
+
765
+ | Type | Description |
766
+ |------|-------------|
767
+ | `Consensus<T>` | Consensus protocol |
768
+ | `ConsensusState` | Consensus states (leader, follower, candidate) |
769
+ | `Replica<T>` | Replica type |
770
+ | `ReplicationStrategy` | Replication strategies (sync, async) |
771
+ | `Partition<T>` | Partition type |
772
+ | `PartitionStrategy` | Partition strategies (hash, range) |
773
+ | `ConsistencyLevel` | Consistency levels (strong, eventual) |
774
+ | `DistributedLock<T>` | Distributed lock |
775
+ | `TwoPhaseCommit<T>` | Two-phase commit protocol |
776
+ | `TransactionState` | Transaction states |
777
+ | `FailureDetector<T>` | Failure detector |
778
+ | `Heartbeat<T>` | Heartbeat type |
779
+
780
+ ### Security Types *(v1.6.0)*
781
+
782
+ | Type | Description |
783
+ |------|-------------|
784
+ | `Authentication<T>` | Authentication configuration |
785
+ | `AuthType` | Auth types (bearer, jwt, oauth2) |
786
+ | `AuthStatus` | Auth status (authenticated, failed) |
787
+ | `Session<T>` | Session type |
788
+ | `Encryption<T>` | Encryption configuration |
789
+ | `EncryptionAlgorithm` | Encryption algorithms |
790
+ | `Hash<T>` | Hash type |
791
+ | `HashAlgorithm` | Hash algorithms (sha256, blake3) |
792
+ | `Signature<T>` | Signature type |
793
+ | `SignatureAlgorithm` | Signature algorithms |
794
+ | `JWT<T>` | JWT token type |
795
+ | `OAuthToken` | OAuth token |
796
+ | `CSRFToken` | CSRF token |
797
+
798
+ ### Internationalization *(v1.6.0)*
799
+
800
+ | Type | Description |
801
+ |------|-------------|
802
+ | `Locale` | Locale configuration |
803
+ | `LocaleCode` | Locale codes (en-US, zh-CN, etc.) |
804
+ | `LanguageCode` | Language codes |
805
+ | `CountryCode` | Country codes |
806
+ | `Translation<T>` | Translation mapping |
807
+ | `PluralForm` | Plural forms (one, many, etc.) |
808
+ | `Currency` | Currency types (USD, EUR, CNY) |
809
+ | `TimeZone` | Time zone types |
810
+ | `DateFormat` | Date format configuration |
811
+ | `NumberFormat` | Number format configuration |
812
+ | `Direction` | Text direction (ltr, rtl) |
813
+
814
+ ### Testing Framework *(v1.6.0)*
815
+
816
+ | Type | Description |
817
+ |------|-------------|
818
+ | `TestSuite<T>` | Test suite type |
819
+ | `TestCase<T>` | Test case type |
820
+ | `TestResultType` | Test result (passed, failed, skipped) |
821
+ | `Assertion<T>` | Assertion type |
822
+ | `Mock<T>` | Mock type |
823
+ | `Spy<T>` | Spy type |
824
+ | `Fixture<T>` | Fixture type |
825
+ | `Coverage` | Coverage configuration |
826
+ | `CoverageReport<T>` | Coverage report |
827
+ | `Snapshot<T>` | Snapshot type |
828
+ | `Benchmark<T>` | Benchmark type |
829
+ | `BenchmarkResult<T>` | Benchmark result |
830
+
831
+ ### Plugin System *(v1.6.0)*
832
+
833
+ | Type | Description |
834
+ |------|-------------|
835
+ | `Plugin<T>` | Plugin type |
836
+ | `PluginLifecycle` | Plugin lifecycle events |
837
+ | `Hook<T>` | Hook type |
838
+ | `HookResult<T>` | Hook result |
839
+ | `Extension<T>` | Extension type |
840
+ | `ExtensionPoint<T>` | Extension point |
841
+ | `Middleware<T>` | Middleware type |
842
+ | `MiddlewarePipeline<T>` | Middleware pipeline |
843
+ | `Module<T>` | Module type |
844
+ | `Registry<T>` | Registry type |
845
+
846
+ ### Type Inference *(v1.6.0)*
847
+
848
+ | Type | Description |
849
+ |------|-------------|
850
+ | `Infer<T>` | Extract type from wrapper |
851
+ | `InferReturn<T>` | Extract return type |
852
+ | `InferArgs<T>` | Extract function arguments |
853
+ | `ExtractFunction<T>` | Extract function type |
854
+ | `ExtractClass<T>` | Extract class type |
855
+ | `Reconstruct<T>` | Reconstruct type |
856
+ | `Narrow<T>` | Narrow type with predicate |
857
+ | `Widen<T>` | Widen literal to primitive |
858
+ | `IsAny<T>` | Check if type is any |
859
+ | `IsNever<T>` | Check if type is never |
860
+ | `IsUnknown<T>` | Check if type is unknown |
861
+ | `IsFunction<T>` | Check if type is function |
862
+ | `IsArray<T>` | Check if type is array |
863
+ | `IsUnion<T>` | Check if type is union |
864
+ | `Equals<X, Y>` | Check type equality |
865
+ | `TypeName<T>` | Get type name |
866
+ | `TypeCategory` | Type category |
867
+
868
+ ### Performance Monitoring *(v1.6.0)*
869
+
870
+ | Type | Description |
871
+ |------|-------------|
872
+ | `Performance` | Performance monitoring |
873
+ | `PerformanceMetric<T>` | Performance metric |
874
+ | `Timing` | Timing operations |
875
+ | `TimingResult` | Timing result |
876
+ | `MemoryUsage` | Memory usage type |
877
+ | `MemoryMetric<T>` | Memory metric |
878
+ | `CPUUsage` | CPU usage type |
879
+ | `Profiler` | Profiler type |
880
+ | `ProfileResult<T>` | Profile result |
881
+ | `TraceSpan<T>` | Tracing span |
882
+ | `PerformanceTrace<T>` | Performance trace |
883
+ | `PerformanceAlert` | Performance alert |
884
+
531
885
  ## Examples
532
886
 
533
887
  ```typescript