@typedly/data-traits 1.0.0 → 1.1.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.
- package/README.md +13 -0
- package/package.json +1 -1
- package/types/typedly-data-traits.d.ts +20 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ A **TypeScript** type definitions package for configurable data traits, providin
|
|
|
51
51
|
- **Serializable**: Serialize and deserialize data values with async support
|
|
52
52
|
- **Timestamped**: Automatic tracking of creation, modification, and access times
|
|
53
53
|
- **Transformable**: Transform values with `map` and `flatMap` operations
|
|
54
|
+
- **Traversable**: Adds required iterable iterator, and optional async iterable iterator
|
|
54
55
|
- **Validatable**: Comprehensive validation system with custom validators and error reporting
|
|
55
56
|
- **Versionable**: Version control with history tracking, snapshots, and rollback support
|
|
56
57
|
|
|
@@ -85,6 +86,7 @@ A **TypeScript** type definitions package for configurable data traits, providin
|
|
|
85
86
|
- [`Serializable`](#serializable)
|
|
86
87
|
- [`Timestamped`](#timestamped)
|
|
87
88
|
- [`Transformable`](#transformable)
|
|
89
|
+
- [`Traversable`](#traversable)
|
|
88
90
|
- [`Validatable`](#validatable)
|
|
89
91
|
- [`Versionable`](#versionable)
|
|
90
92
|
- [Contributing](#contributing)
|
|
@@ -140,6 +142,7 @@ import {
|
|
|
140
142
|
Serializable,
|
|
141
143
|
Timestamped,
|
|
142
144
|
Transformable,
|
|
145
|
+
Traversable,
|
|
143
146
|
Validatable,
|
|
144
147
|
Versionable,
|
|
145
148
|
} from '@typedly/data-traits';
|
|
@@ -397,6 +400,16 @@ import { Transformable } from '@typedly/data-traits';
|
|
|
397
400
|
|
|
398
401
|
[Source](https://github.com/typedly/data-traits/blob/main/src/lib/transformable.trait.ts)
|
|
399
402
|
|
|
403
|
+
### `Traversable`
|
|
404
|
+
|
|
405
|
+
Capability for objects that can be traversed/iterated.
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
import { Traversable } from '@typedly/data-traits';
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
[Source](https://github.com/typedly/data-traits/blob/main/src/lib/traversable.trait.ts)
|
|
412
|
+
|
|
400
413
|
### `Validatable`
|
|
401
414
|
|
|
402
415
|
Interface for data types that can be validated with custom rules and track validation errors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typedly/data-traits",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": "wwwdev.io <dev@wwwdev.io>",
|
|
5
5
|
"description": "A TypeScript type definitions package for configurable data traits, providing various kinds of configurable data interfaces.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -689,6 +689,25 @@ interface Transformable<T, R extends boolean = false> {
|
|
|
689
689
|
map<U>(fn: (value: T) => U): AsyncReturn<R, U>;
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
/**
|
|
693
|
+
* @description Capability for objects that can be traversed/iterated.
|
|
694
|
+
* @export
|
|
695
|
+
* @interface Traversable
|
|
696
|
+
* @template E The element type
|
|
697
|
+
*/
|
|
698
|
+
interface Traversable<E> {
|
|
699
|
+
/**
|
|
700
|
+
* @description Synchronous iterator
|
|
701
|
+
* @returns {IterableIterator<E>}
|
|
702
|
+
*/
|
|
703
|
+
[Symbol.iterator](): IterableIterator<E>;
|
|
704
|
+
/**
|
|
705
|
+
* @description Asynchronous iterator
|
|
706
|
+
* @returns {AsyncIterableIterator<E>}
|
|
707
|
+
*/
|
|
708
|
+
[Symbol.asyncIterator]?(): AsyncIterableIterator<E>;
|
|
709
|
+
}
|
|
710
|
+
|
|
692
711
|
/**
|
|
693
712
|
* @description Interface for data types that can be validated with custom rules and track validation errors.
|
|
694
713
|
* @export
|
|
@@ -757,4 +776,4 @@ interface Versionable<T, V = unknown, R extends boolean = false> extends Reverti
|
|
|
757
776
|
snapshot(): AsyncReturn<R, T>;
|
|
758
777
|
}
|
|
759
778
|
|
|
760
|
-
export type { Adaptable, Cacheable, Cleanable, Cloneable, Collection, Comparable, Compressible, Configurable, Encryptable, Exportable, Freezable, Identifiable, Indexable, Measurable, Mergeable, Observable, Paginated, Persistable, Printable, Queryable, Resettable, Revertible, Serializable, Timestamped, Transformable, Validatable, Versionable };
|
|
779
|
+
export type { Adaptable, Cacheable, Cleanable, Cloneable, Collection, Comparable, Compressible, Configurable, Encryptable, Exportable, Freezable, Identifiable, Indexable, Measurable, Mergeable, Observable, Paginated, Persistable, Printable, Queryable, Resettable, Revertible, Serializable, Timestamped, Transformable, Traversable, Validatable, Versionable };
|