@typedly/data 5.0.0-beta.1 → 6.0.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 CHANGED
@@ -10,9 +10,19 @@
10
10
  ## @typedly/data
11
11
 
12
12
  <!-- npm badge -->
13
- [![npm version][typedly-npm-badge-svg]][typedly-npm-badge]
14
- [![GitHub issues][typedly-badge-issues]][typedly-issues]
15
- [![GitHub license][typedly-badge-license]][typedly-license]
13
+ [![npm version][package-npm-badge-svg]][package-npm-badge]
14
+ [![GitHub issues][package-badge-issues]][package-issues]
15
+ [![GitHub license][package-badge-license]][package-license]
16
+
17
+ <!-- GitHub badges -->
18
+ [![GitHub issues][package-badge-issues]][package-issues]
19
+ [![GitHub forks][package-badge-forks]][package-forks]
20
+ [![GitHub stars][package-badge-stars]][package-stars]
21
+ [![GitHub license][package-badge-license]][package-license]
22
+
23
+ <!-- Sponsors -->
24
+ [![GitHub Sponsors][github-badge-sponsor]][github-sponsor-link]
25
+ [![Patreon Sponsors][patreon-badge]][patreon-link]
16
26
 
17
27
  A **TypeScript** type definitions package for [**@typescript-package/data**](https://github.com/typescript-package/data).
18
28
 
@@ -20,7 +30,7 @@ A **TypeScript** type definitions package for [**@typescript-package/data**](htt
20
30
 
21
31
  - **Adapter**: Optional data adapter to customize managing underlying data available under the [`@typedly/adaptable-data`](https://github.com/typedly/data-adapter).
22
32
  - **Configurable**: Configurable data shape available under the [`@typedly/configurable-data`](https://github.com/typedly/configurable-data).
23
- - **Traits**: Extended customization by traits, such as `Configurable`, `Adaptable`, `Serializable`, and `Transformable` under the [`@typedly/data-traits`](https://github.com/typedly/data-traits) package.
33
+ - **Traits**: Extended customization via traits, such as `Configurable`, `Adaptable`, `Serializable`, and `Transformable` under the [`@typedly/data-traits`](https://github.com/typedly/data-traits) package.
24
34
  - **Shape**: The default shape for data of any `T` type with conditional async.
25
35
 
26
36
  ## Table of contents
@@ -28,13 +38,14 @@ A **TypeScript** type definitions package for [**@typescript-package/data**](htt
28
38
  - [Related packages](#related-packages)
29
39
  - [Installation](#installation)
30
40
  - [Api](#api)
41
+ - [Configuration](#configuration)
42
+ - [`DataConfig`](#dataconfig)
43
+ - [`DataSettings`](#datasettings)
31
44
  - [Data](#data)
32
45
  - [`AsyncReturn`](#asyncreturn)
33
- - [`DataConfig`](#dataconfig)
34
46
  - [`DataConstructorInput`](#dataconstructorinput)
35
47
  - [`DataConstructorTuple`](#dataconstructortuple)
36
48
  - [`DataConstructor`](#dataconstructor)
37
- - [`DataSettings`](#datasettings)
38
49
  - [`DataShape`](#datashape)
39
50
  - [Inference](#inference)
40
51
  - [`InferAsyncOf`](#inferasyncof)
@@ -83,7 +94,11 @@ npm install @typedly/data --save-peer
83
94
 
84
95
  ```typescript
85
96
  import {
86
- // Inference.
97
+ // Configuration
98
+ DataConfig,
99
+ DataSettings,
100
+
101
+ // Inference.
87
102
  InferAsync,
88
103
  InferAsyncOf,
89
104
  InferValue,
@@ -92,24 +107,44 @@ import {
92
107
  IterValue,
93
108
  IterableElement,
94
109
 
110
+ // Data.
111
+ DataConstructor,
112
+ DataShape,
113
+
95
114
  // Return types
96
115
  AsyncReturn,
97
- // Config
98
- DataConfig,
99
116
  // Input types
100
117
  DataConstructorInput,
101
118
  DataConstructorTuple,
102
119
 
103
- // Iterable
104
- IterValue,
105
- IterableElement,
106
-
107
120
  // Value.
108
121
  ValueConstructor,
109
122
  ValueShape,
110
123
  } from '@typedly/data';
111
124
  ```
112
125
 
126
+ ### Configuration
127
+
128
+ #### `DataConfig`
129
+
130
+ The type for the data configuration, which can be either a full configuration object of `C` or just an async flag.
131
+
132
+ ```typescript
133
+ import { DataConfig } from '@typedly/data';
134
+ ```
135
+
136
+ [Source](https://github.com/typedly/data/blob/main/src/configuration/lib/data.config.ts)
137
+
138
+ #### `DataSettings`
139
+
140
+ The settings for a data type.
141
+
142
+ ```typescript
143
+ import { DataSettings } from '@typedly/data';
144
+ ```
145
+
146
+ [Source](https://github.com/typedly/data/blob/main/src/configuration/lib/data.settings.ts)
147
+
113
148
  ### Inference
114
149
 
115
150
  #### `InferAsyncOf`
@@ -120,7 +155,7 @@ Infers the async flag from a tuple of arguments, returning true if any of the ar
120
155
  import { InferAsync } from '@typedly/data';
121
156
  ```
122
157
 
123
- [Source](https://github.com/typedly/data/blob/main/src/inference/infer-async-of.type.ts)
158
+ [Source](https://github.com/typedly/data/blob/main/src/inference/lib/infer-async-of.type.ts)
124
159
 
125
160
  #### `InferAsync`
126
161
 
@@ -130,7 +165,7 @@ Infers the async flag from the settings `DataSettings` or shape `DataShape`.
130
165
  import { InferAsync } from '@typedly/data';
131
166
  ```
132
167
 
133
- [Source](https://github.com/typedly/data/blob/main/src/inference/infer-async.type.ts)
168
+ [Source](https://github.com/typedly/data/blob/main/src/inference/lib/infer-async.type.ts)
134
169
 
135
170
  #### `InferValue`
136
171
 
@@ -140,7 +175,7 @@ Infers the value type from a data shape interface.
140
175
  import { InferAsync } from '@typedly/data';
141
176
  ```
142
177
 
143
- [Source](https://github.com/typedly/data/blob/main/src/inference/infer-value.type.ts)
178
+ [Source](https://github.com/typedly/data/blob/main/src/inference/lib/infer-value.type.ts)
144
179
 
145
180
  ### Iterable
146
181
 
@@ -152,7 +187,7 @@ The iterate element type.
152
187
  import { IterElement } from '@typedly/data';
153
188
  ```
154
189
 
155
- [Source](https://github.com/typedly/data/blob/main/src/iterable/iter-element.type.ts)
190
+ [Source](https://github.com/typedly/data/blob/main/src/iterable/lib/iterable-element.type.ts)
156
191
 
157
192
  #### `IterValue`
158
193
 
@@ -162,7 +197,7 @@ The iterated value type.
162
197
  import { IterValue } from '@typedly/data';
163
198
  ```
164
199
 
165
- [Source](https://github.com/typedly/data/blob/main/src/iterable/iter-value.type.ts)
200
+ [Source](http://github.com/typedly/data/blob/main/src/iterable/lib/iter-value.type.ts)
166
201
 
167
202
  ### Data
168
203
 
@@ -176,16 +211,6 @@ import { AsyncReturn } from '@typedly/data';
176
211
 
177
212
  [Source](https://github.com/typedly/data/blob/main/src/lib/type/async-return.type.ts)
178
213
 
179
- #### `DataConfig`
180
-
181
- The type for the data configuration, which can be either a full configuration object of `C` or just an async flag.
182
-
183
- ```typescript
184
- import { DataConfig } from '@typedly/data';
185
- ```
186
-
187
- [Source](https://github.com/typedly/data/blob/main/src/lib/type/data.config.ts)
188
-
189
214
  #### `DataConstructorInput`
190
215
 
191
216
  The input type for data constructors, with arguments support.
@@ -216,16 +241,6 @@ import { DataConstructor } from '@typedly/data';
216
241
 
217
242
  [Source](https://github.com/typedly/data/blob/main/src/lib/interface/lib/data.constructor.ts)
218
243
 
219
- #### `DataSettings`
220
-
221
- The settings for a data type.
222
-
223
- ```typescript
224
- import { DataSettings } from '@typedly/data';
225
- ```
226
-
227
- [Source](https://github.com/typedly/data/blob/main/src/lib/interface/lib/data.settings.ts)
228
-
229
244
  #### `DataShape`
230
245
 
231
246
  The shape of a `Data` type.
@@ -321,7 +336,7 @@ How do I know when to release 1.0.0?
321
336
 
322
337
  ## License
323
338
 
324
- MIT © typedly ([license][typedly-license])
339
+ MIT © typedly ([license][package-license])
325
340
 
326
341
  ## Packages
327
342
 
@@ -337,23 +352,41 @@ MIT © typedly ([license][typedly-license])
337
352
  - **[@typescript-package/wrapped-descriptor](https://github.com/typescript-package/wrapped-descriptor)**: A lightweight **TypeScript** library for wrapped property descriptor.
338
353
  - **[@xtypescript/property](https://github.com/xtypescript/property)** - A comprehensive, reactive **TypeScript** library for precise and extensible object property control.
339
354
 
355
+ <!-- Funding -->
356
+ [github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/angular-package
357
+ [github-sponsor-link]: https://github.com/sponsors/angular-package
358
+ [patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dangularpackage%26type%3Dpatrons&style=flat
359
+ [patreon-link]: https://www.patreon.com/join/angularpackage/checkout?fan_landing=true&rid=0
360
+
361
+ <!-- Discord -->
362
+ [discord-badge]: https://img.shields.io/discord/925168966098386944?style=social&logo=discord&label=Discord
363
+ [discord-channel]: https://discord.com/invite/rUCR2CW75G
364
+
365
+ <!-- Gitter -->
366
+ [gitter-badge]: https://img.shields.io/gitter/room/angular-package/ap-sass?style=social&logo=gitter
367
+ [gitter-chat]: https://app.gitter.im/#/room/#ap-sass:gitter.im
368
+
369
+ <!-- Twitter -->
370
+ [twitter-badge]: https://img.shields.io/twitter/follow/angularpackage?label=%40angularpackage&style=social
371
+ [twitter-follow]: https://twitter.com/angularpackage
372
+
340
373
  <!-- This package: typedly -->
341
374
  <!-- GitHub: badges -->
342
- [typedly-badge-issues]: https://img.shields.io/github/issues/typedly/data
343
- [typedly-badge-forks]: https://img.shields.io/github/forks/typedly/data
344
- [typedly-badge-stars]: https://img.shields.io/github/stars/typedly/data
345
- [typedly-badge-license]: https://img.shields.io/github/license/typedly/data
375
+ [package-badge-issues]: https://img.shields.io/github/issues/typedly/data
376
+ [package-badge-forks]: https://img.shields.io/github/forks/typedly/data
377
+ [package-badge-stars]: https://img.shields.io/github/stars/typedly/data
378
+ [package-badge-license]: https://img.shields.io/github/license/typedly/data
346
379
  <!-- GitHub: badges links -->
347
- [typedly-issues]: https://github.com/typedly/data/issues
348
- [typedly-forks]: https://github.com/typedly/data/network
349
- [typedly-license]: https://github.com/typedly/data/blob/master/LICENSE
350
- [typedly-stars]: https://github.com/typedly/data/stargazers
380
+ [package-issues]: https://github.com/typedly/data/issues
381
+ [package-forks]: https://github.com/typedly/data/network
382
+ [package-license]: https://github.com/typedly/data/blob/master/LICENSE
383
+ [package-stars]: https://github.com/typedly/data/stargazers
351
384
  <!-- This package -->
352
385
 
353
386
  <!-- Package: typedly -->
354
387
  <!-- npm -->
355
- [typedly-npm-badge-svg]: https://badge.fury.io/gh/typedly%2Fdata.svg
356
- [typedly-npm-badge]: https://badge.fury.io/js/@typedly%2Fdata
388
+ [package-npm-badge-svg]: https://badge.fury.io/gh/typedly%2Fdata.svg
389
+ [package-npm-badge]: https://badge.fury.io/js/@typedly%2Fdata
357
390
 
358
391
  <!-- GIT -->
359
392
  [git-semver]: http://semver.org/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typedly/data",
3
- "version": "5.0.0-beta.1",
3
+ "version": "6.0.0",
4
4
  "author": "wwwdev.io <dev@wwwdev.io>",
5
5
  "description": "A TypeScript type definitions package for @typescript-package/data.",
6
6
  "license": "MIT",
@@ -20,7 +20,9 @@
20
20
  },
21
21
  "keywords": [
22
22
  "@typedly",
23
- "@typedly/data"
23
+ "@typedly/data",
24
+ "configuration",
25
+ "settings"
24
26
  ],
25
27
  "funding": [
26
28
  {
@@ -15,16 +15,6 @@ interface DataSettings<R extends boolean = false> {
15
15
  async?: R;
16
16
  }
17
17
 
18
- /**
19
- * @description The type for the data configuration, which can be either a full configuration object of `C` or just an async flag.
20
- * @export
21
- * @template {DataSettings<R> | undefined} C The type of the settings for configuration.
22
- * @template {boolean} [R=InferAsync<C>] The type of the async flag.
23
- */
24
- type DataConfig<C extends DataSettings<R> | undefined, R extends boolean = InferAsync<C>> = C extends DataSettings<R> ? Required<C> : {
25
- async: R;
26
- };
27
-
28
18
  /**
29
19
  * @description The type to provide data constructor with arguments.
30
20
  * @export
@@ -54,20 +44,6 @@ type DataConstructorInput<I extends DataShape<T, R>, T = I extends DataShape<inf
54
44
  */
55
45
  type AsyncReturn<R extends boolean, T> = R extends true ? Promise<T> : T;
56
46
 
57
- /**
58
- * @description The iterate element type.
59
- * @export
60
- * @template T The type of the iterable.
61
- */
62
- type IterableElement<T> = T extends Iterable<infer U> ? U : T;
63
-
64
- /**
65
- * @description The iterated value type.
66
- * @export
67
- * @template T The type of iterated value constrained by the `Iterable` type.
68
- */
69
- type IterValue<T> = IterableElement<T>;
70
-
71
47
  /**
72
48
  * @description The shape of a data type.
73
49
  * @export
@@ -105,31 +81,15 @@ interface DataShape<T, R extends boolean = false> {
105
81
  getValue(): AsyncReturn<R, T>;
106
82
  /**
107
83
  * @description Locks the `Data` instance, preventing any further modifications to its value.
108
- * @returns {AsyncReturn<R, this>} The `Data` instance at the time of locking.
84
+ * @returns {this} The `Data` instance at the time of locking.
109
85
  */
110
- lock(): AsyncReturn<R, this>;
86
+ lock(): this;
111
87
  /**
112
88
  * @description Sets the value of the `Data` instance.
113
89
  * @param {T} value
114
90
  * @returns {AsyncReturn<R, this>}
115
91
  */
116
92
  setValue(value: T): AsyncReturn<R, this>;
117
- /**
118
- * @description The string tag of the `Data` instance.
119
- * @readonly
120
- * @type {?string}
121
- */
122
- readonly [Symbol.toStringTag]?: string;
123
- /**
124
- * @description The iterator method for the `Data` instance, allowing it to be iterable.
125
- * @returns {IterableIterator<IterValue<T>>}
126
- */
127
- [Symbol.iterator]?(): IterableIterator<IterValue<T>>;
128
- /**
129
- * @description The asynchronous iterator method for the `Data` instance, allowing it to be asynchronously iterable.
130
- * @returns {AsyncIterableIterator<IterValue<T>>}
131
- */
132
- [Symbol.asyncIterator]?(): AsyncIterableIterator<IterValue<T>>;
133
93
  }
134
94
 
135
95
  /**
@@ -177,6 +137,30 @@ type InferValue<I, F = any> = I extends DataShape<infer T> ? T : I extends {
177
137
  value?: infer V;
178
138
  } ? V : F;
179
139
 
140
+ /**
141
+ * @description The type for the data configuration, which can be either a full configuration object of `C` or just an async flag.
142
+ * @export
143
+ * @template {DataSettings<R> | undefined} C The type of the settings for configuration.
144
+ * @template {boolean} [R=InferAsync<C>] The type of the async flag.
145
+ */
146
+ type DataConfig<C extends DataSettings<R> | undefined, R extends boolean = InferAsync<C>> = C extends DataSettings<R> ? Required<C> : {
147
+ async: R;
148
+ };
149
+
150
+ /**
151
+ * @description The iterate element type.
152
+ * @export
153
+ * @template T The type of the iterable.
154
+ */
155
+ type IterableElement<T> = T extends Iterable<infer U> ? U : T;
156
+
157
+ /**
158
+ * @description The iterated value type.
159
+ * @export
160
+ * @template T The type of iterated value constrained by the `Iterable` type.
161
+ */
162
+ type IterValue<T> = IterableElement<T>;
163
+
180
164
  /**
181
165
  * @description The value shape.
182
166
  * @export