@typedly/adaptable-data 1.0.0-beta
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/LICENSE +21 -0
- package/README.md +246 -0
- package/package.json +70 -0
- package/types/typedly-adaptable-data.d.ts +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 typedly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<a href="https://github.com/typescript-package">
|
|
2
|
+
<img
|
|
3
|
+
src="https://avatars.githubusercontent.com/u/189665258?s=150&u=712e292bae048947d1f7d2020d7d38875c40e63a&v=4"
|
|
4
|
+
title="@typedly/adaptable-data - A TypeScript type definitions package for configurable, composable, trait-driven adaptable data models with adapter support."
|
|
5
|
+
/>
|
|
6
|
+
</a>
|
|
7
|
+
|
|
8
|
+
## @typedly/adaptable-data
|
|
9
|
+
|
|
10
|
+
<!-- npm badge -->
|
|
11
|
+
[![npm version][package-npm-badge-svg]][package-npm-badge]
|
|
12
|
+
[![GitHub issues][package-badge-issues]][package-issues]
|
|
13
|
+
[![GitHub license][package-badge-license]][package-license]
|
|
14
|
+
|
|
15
|
+
<!-- GitHub badges -->
|
|
16
|
+
[![GitHub issues][package-badge-issues]][package-issues]
|
|
17
|
+
[![GitHub forks][package-badge-forks]][package-forks]
|
|
18
|
+
[![GitHub stars][package-badge-stars]][package-stars]
|
|
19
|
+
[![GitHub license][package-badge-license]][package-license]
|
|
20
|
+
|
|
21
|
+
<!-- Sponsors -->
|
|
22
|
+
[![GitHub Sponsors][github-badge-sponsor]][github-sponsor-link]
|
|
23
|
+
[![Patreon Sponsors][patreon-badge]][patreon-link]
|
|
24
|
+
|
|
25
|
+
A **TypeScript** type definitions package for configurable, composable, trait-driven adaptable data models with adapter support.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Adaptable**: Create data models with configuration and adapter.
|
|
30
|
+
- **Trait-based**: Mix and match interfaces like `Adaptable`, `Queryable`, `Exportable`, and [more](https://github.com/typedly/data-traits).
|
|
31
|
+
- **Ecosystem**: Works seamlessly with other [`@typedly`](https://github.com/typedly) packages.
|
|
32
|
+
|
|
33
|
+
## Table of contents
|
|
34
|
+
|
|
35
|
+
- [Related packages](#related-packages)
|
|
36
|
+
- [Installation](#installation)
|
|
37
|
+
- [Api](#api)
|
|
38
|
+
- Interface
|
|
39
|
+
- [`AdaptableDataConstructor`](#adaptabledataconstructor)
|
|
40
|
+
- [`AdaptableDataShape`](#adaptabledatashape)
|
|
41
|
+
- Type
|
|
42
|
+
- [`InferAdaptableValue`](#inferadaptablevalue)
|
|
43
|
+
- [`InferSettings`](#infersettings)
|
|
44
|
+
- [Contributing](#contributing)
|
|
45
|
+
- [Support](#support)
|
|
46
|
+
- [Code of Conduct](#code-of-conduct)
|
|
47
|
+
- [Git](#git)
|
|
48
|
+
- [Commit](#commit)
|
|
49
|
+
- [Versioning](#versioning)
|
|
50
|
+
- [License](#license)
|
|
51
|
+
- [Packages](#packages)
|
|
52
|
+
|
|
53
|
+
## Related packages
|
|
54
|
+
|
|
55
|
+
### Peer dependencies
|
|
56
|
+
|
|
57
|
+
- **[@typedly/configurable-data](https://github.com/typedly/configurable-data)**: A **TypeScript** type definitions package for configurable, composable, trait-driven data models.
|
|
58
|
+
- **[@typedly/data-adapter](https://github.com/typedly/data-adapter)**: A **TypeScript** type definitions package for data adapters enabling configurable, composable, trait-driven adaptable data models.
|
|
59
|
+
- **[@typedly/data-traits](https://github.com/typedly/data-traits)**: A **TypeScript** type definitions package for configurable data traits, providing various kinds of configurable data interfaces.
|
|
60
|
+
- **[@typedly/data](https://github.com/typedly/data)**: A **TypeScript** type definitions for [`@typescript-package/data`](https://github.com/typedly/data).
|
|
61
|
+
|
|
62
|
+
### General
|
|
63
|
+
|
|
64
|
+
- **[@typedly/adaptable-data](https://github.com/typedly/adaptable-data)**: A **TypeScript** type definitions for data adapter.
|
|
65
|
+
- **[@typedly/collection](https://github.com/typedly/collection)**: A **TypeScript** type definitions package for data collections with customizable storage.
|
|
66
|
+
- **[@typescript-package/data](https://github.com/typescript-package/data)**: A lightweight **TypeScript** library for basic data management.
|
|
67
|
+
- **[@typescript-package/collection](https://github.com/typescript-package/collection)**: A lightweight **TypeScript** library for data collection.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
### 1. Install peer dependencies
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install
|
|
75
|
+
@typedly/data-adapter
|
|
76
|
+
@typedly/configurable-data
|
|
77
|
+
@typedly/data
|
|
78
|
+
@typedly/data-traits --save-peer
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Install package
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install @typedly/adaptable-data --save-peer
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Api
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import {
|
|
91
|
+
AdaptableDataConstructor,
|
|
92
|
+
AdaptableDataShape,
|
|
93
|
+
InferAdaptableValue,
|
|
94
|
+
InferSettings,
|
|
95
|
+
} from '@typedly/data-adapter';
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Interface
|
|
99
|
+
|
|
100
|
+
### `AdaptableDataConstructor`
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { AdaptableDataConstructor } from '@typedly/data-adapter';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
[Source](https://github.com/typedly/adaptable-data/blob/main/src/lib/adaptable.data.constructor.ts)
|
|
107
|
+
|
|
108
|
+
### `AdaptableDataShape`
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { AdaptableDataShape } from '@typedly/data-adapter';
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
[Source](https://github.com/typedly/adaptable-data/blob/main/src/lib/adaptable.data.shape.ts)
|
|
115
|
+
|
|
116
|
+
### Type
|
|
117
|
+
|
|
118
|
+
### `InferAdaptableValue`
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { InferAdaptableValue } from '@typedly/data-adapter';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
[Source](https://github.com/typedly/adaptable-data/blob/main/src/lib/infer-adaptable-value.type.ts)
|
|
125
|
+
|
|
126
|
+
### `InferSettings`
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { InferSettings } from '@typedly/data-adapter';
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
[Source](https://github.com/typedly/adaptable-data/blob/main/src/lib/infer-settings.type.ts)
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated.
|
|
137
|
+
|
|
138
|
+
## Support
|
|
139
|
+
|
|
140
|
+
If you find this package useful and would like to support its and general development, you can contribute through one of the following payment methods. Your support helps maintain the packages and continue adding new.
|
|
141
|
+
|
|
142
|
+
Support via:
|
|
143
|
+
|
|
144
|
+
- [4Fund](https://4fund.com/bruubs)
|
|
145
|
+
- [DonorBox](https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=o)
|
|
146
|
+
- [GitHub](https://github.com/sponsors/angular-package/sponsorships?sponsor=sciborrudnicki&tier_id=83618)
|
|
147
|
+
- [Ko-fi](https://ko-fi.com/sterblack)
|
|
148
|
+
- [OpenCollective](https://opencollective.com/sterblack)
|
|
149
|
+
- [Patreon](https://www.patreon.com/checkout/angularpackage?rid=0&fan_landing=true&view_as=public)
|
|
150
|
+
- [PayPal](https://paypal.me/sterblack)
|
|
151
|
+
- [Stripe](https://donate.stripe.com/dR614hfDZcJE3wAcMM)
|
|
152
|
+
- ~~[Revolut](https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29)~~
|
|
153
|
+
|
|
154
|
+
or via Trust Wallet
|
|
155
|
+
|
|
156
|
+
- [BNB](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
|
|
157
|
+
- [BTC](https://link.trustwallet.com/send?coin=0&address=bc1qnf709336tfl57ta5mfkf4t9fndhx7agxvv9svn)
|
|
158
|
+
- [ETH](https://link.trustwallet.com/send?coin=60&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
|
|
159
|
+
- [USDT (BEP20)](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94&token_id=0x55d398326f99059fF775485246999027B3197955)
|
|
160
|
+
- [XLM](https://link.trustwallet.com/send?coin=148&address=GAFFFB7H3LG42O6JA63FJDRK4PP4JCNEOPHLGLLFH625X2KFYQ4UYVM4)
|
|
161
|
+
|
|
162
|
+
Thanks for your support!
|
|
163
|
+
|
|
164
|
+
## Code of Conduct
|
|
165
|
+
|
|
166
|
+
By participating in this data-adapter, you agree to follow **[Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)**.
|
|
167
|
+
|
|
168
|
+
## GIT
|
|
169
|
+
|
|
170
|
+
### Commit
|
|
171
|
+
|
|
172
|
+
- [AngularJS Git Commit Message Conventions][git-commit-angular]
|
|
173
|
+
- [Karma Git Commit Msg][git-commit-karma]
|
|
174
|
+
- [Conventional Commits][git-commit-conventional]
|
|
175
|
+
|
|
176
|
+
### Versioning
|
|
177
|
+
|
|
178
|
+
[Semantic Versioning 2.0.0][git-semver]
|
|
179
|
+
|
|
180
|
+
**Given a version number MAJOR.MINOR.PATCH, increment the:**
|
|
181
|
+
|
|
182
|
+
- MAJOR version when you make incompatible API changes,
|
|
183
|
+
- MINOR version when you add functionality in a backwards-compatible manner, and
|
|
184
|
+
- PATCH version when you make backwards-compatible bug fixes.
|
|
185
|
+
|
|
186
|
+
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
|
|
187
|
+
|
|
188
|
+
**FAQ**
|
|
189
|
+
How should I deal with revisions in the 0.y.z initial development phase?
|
|
190
|
+
|
|
191
|
+
> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
|
|
192
|
+
|
|
193
|
+
How do I know when to release 1.0.0?
|
|
194
|
+
|
|
195
|
+
> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT © typedly ([license][package-license])
|
|
200
|
+
|
|
201
|
+
## Packages
|
|
202
|
+
|
|
203
|
+
- **[@typedly/array](https://github.com/typedly/array)**: A **TypeScript** type definitions package to handle array-related operations.
|
|
204
|
+
- **[@typedly/callback](https://github.com/typedly/callback)**: A **TypeScript** type definitions package for asynchronous and synchronous callback functions of various types.
|
|
205
|
+
- **[@typedly/character](https://github.com/typedly/character)**: A **TypeScript** type definitions package for various character types.
|
|
206
|
+
- **[@typedly/context](https://github.com/typedly/context)**: A **TypeScript** type definitions package for context data structures.
|
|
207
|
+
- **[@typedly/descriptor](https://github.com/typedly/descriptor)**: A **TypeScript** type definitions package for property descriptor.
|
|
208
|
+
- **[@typedly/digit](https://github.com/typedly/digit)**: A **TypeScript** type definitions package for digit types.
|
|
209
|
+
- **[@typedly/letter](https://github.com/typedly/letter)**: A **TypeScript** type definitions package for handling letter types.
|
|
210
|
+
- **[@typedly/object](https://github.com/typedly/object)**: A **TypeScript** type definitions package to handle object-related operations.
|
|
211
|
+
- **[@typedly/payload](https://github.com/typedly/payload)**: A **TypeScript** type definitions package for payload data structures.
|
|
212
|
+
- **[@typedly/property](https://github.com/typedly/property)**: A **TypeScript** type definitions package to handle object property-related operations.
|
|
213
|
+
- **[@typedly/regexp](https://github.com/typedly/regexp)**: A **TypeScript** type definitions package for `RegExp`.
|
|
214
|
+
- **[@typedly/symbol](https://github.com/typedly/symbol)**: A **TypeScript** type definitions package for various symbols.
|
|
215
|
+
|
|
216
|
+
<!-- Funding -->
|
|
217
|
+
[github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/angular-package
|
|
218
|
+
[github-sponsor-link]: https://github.com/sponsors/angular-package
|
|
219
|
+
[patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dangularpackage%26type%3Dpatrons&style=flat
|
|
220
|
+
[patreon-link]: https://www.patreon.com/join/angularpackage/checkout?fan_landing=true&rid=0
|
|
221
|
+
|
|
222
|
+
<!-- This package: typedly -->
|
|
223
|
+
<!-- GitHub: badges -->
|
|
224
|
+
[package-badge-issues]: https://img.shields.io/github/issues/typedly/adaptable-data
|
|
225
|
+
[package-badge-forks]: https://img.shields.io/github/forks/typedly/adaptable-data
|
|
226
|
+
[package-badge-stars]: https://img.shields.io/github/stars/typedly/adaptable-data
|
|
227
|
+
[package-badge-license]: https://img.shields.io/github/license/typedly/adaptable-data
|
|
228
|
+
<!-- GitHub: badges links -->
|
|
229
|
+
[package-issues]: https://github.com/typedly/adaptable-data/issues
|
|
230
|
+
[package-forks]: https://github.com/typedly/adaptable-data/network
|
|
231
|
+
[package-license]: https://github.com/typedly/adaptable-data/blob/master/LICENSE
|
|
232
|
+
[package-stars]: https://github.com/typedly/adaptable-data/stargazers
|
|
233
|
+
<!-- This package -->
|
|
234
|
+
|
|
235
|
+
<!-- Package: typedly -->
|
|
236
|
+
<!-- npm -->
|
|
237
|
+
[package-npm-badge-svg]: https://badge.fury.io/js/@typedly%2Fadaptable-data.svg
|
|
238
|
+
[package-npm-badge]: https://badge.fury.io/js/@typedly%2Fadaptable-data
|
|
239
|
+
|
|
240
|
+
<!-- GIT -->
|
|
241
|
+
[git-semver]: http://semver.org/
|
|
242
|
+
|
|
243
|
+
<!-- GIT: commit -->
|
|
244
|
+
[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
|
|
245
|
+
[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
|
|
246
|
+
[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@typedly/adaptable-data",
|
|
3
|
+
"version": "1.0.0-beta",
|
|
4
|
+
"author": "wwwdev.io <dev@wwwdev.io>",
|
|
5
|
+
"description": "A TypeScript type definitions package for configurable, composable, trait-driven adaptable data models with adapter support.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@typedly/configurable-data": "^1.0.0-beta.1",
|
|
13
|
+
"@typedly/data": "^5.0.0-beta.1",
|
|
14
|
+
"@typedly/data-adapter": "^1.0.0-beta",
|
|
15
|
+
"@typedly/data-traits": "^1.0.0"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/typedly/adaptable-data.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/typedly/adaptable-data/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"@typedly",
|
|
26
|
+
"@typedly/adaptable-data",
|
|
27
|
+
"adaptable"
|
|
28
|
+
],
|
|
29
|
+
"funding": [
|
|
30
|
+
{
|
|
31
|
+
"type": "stripe",
|
|
32
|
+
"url": "https://donate.stripe.com/dR614hfDZcJE3wAcMM"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "Donorbox",
|
|
36
|
+
"url": "https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=once&amount=1"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "Open Collective",
|
|
40
|
+
"url": "https://opencollective.com/sterblack"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "Ko-fi",
|
|
44
|
+
"url": "https://ko-fi.com/sterblack"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "4Fund",
|
|
48
|
+
"url": "https://4fund.com/bruubs"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "paypal",
|
|
52
|
+
"url": "https://paypal.me/sterblack"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "individual",
|
|
56
|
+
"url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"sideEffects": false,
|
|
60
|
+
"typings": "types/typedly-adaptable-data.d.ts",
|
|
61
|
+
"exports": {
|
|
62
|
+
"./package.json": {
|
|
63
|
+
"default": "./package.json"
|
|
64
|
+
},
|
|
65
|
+
".": {
|
|
66
|
+
"types": "./types/typedly-adaptable-data.d.ts",
|
|
67
|
+
"default": "./fesm2022/typedly-adaptable-data.mjs"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Adaptable } from '@typedly/data-traits';
|
|
2
|
+
import { InferConfigurableValue, ConfigurableDataShape } from '@typedly/configurable-data';
|
|
3
|
+
import { DataAdapterShape, DataAdapterConstructor } from '@typedly/data-adapter';
|
|
4
|
+
import { DataSettings, InferAsyncOf, InferValue } from '@typedly/data';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description Infers the value type from configurable, and data shape interface.
|
|
8
|
+
* @export
|
|
9
|
+
* @template I The data shape type.
|
|
10
|
+
* @template [F=any] The fallback type if inference fails.
|
|
11
|
+
*/
|
|
12
|
+
type InferAdaptableValue<I, F = any> = I extends AdaptableDataShape<any, any, infer T, any> ? T : InferConfigurableValue<I, F>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description Infers the settings type from a data adapter, or adaptable data shape.
|
|
16
|
+
* @export
|
|
17
|
+
* @template T
|
|
18
|
+
* @template [F=undefined]
|
|
19
|
+
*/
|
|
20
|
+
type InferSettings<T, F = undefined> = T extends DataAdapterShape<infer C, any, any> ? C : T extends AdaptableDataShape<any, infer C, any, any> ? C : F;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description The shape of a data type with optional adapter.
|
|
24
|
+
* @export
|
|
25
|
+
* @interface AdaptableDataShape
|
|
26
|
+
* @template {DataAdapterShape<C, T, R>} A The adapter type, which can be undefined for more flexible inference.
|
|
27
|
+
* @template {DataSettings<R> | undefined} [C=InferSettings<A>] The settings type, inferred from `A` if possible.
|
|
28
|
+
* @template [T=InferAdaptableValue<A>] The value type, inferred from `A` if possible.
|
|
29
|
+
* @template {boolean} [R=InferAsyncOf<[C, A]>] The async flag, inferred from C or `A` if possible.
|
|
30
|
+
* @extends {Adaptable<A>} The adaptable trait, which provides the adapter type `A`.
|
|
31
|
+
* @extends {ConfigurableDataShape<C, T, R>} The configurable data shape, which provides the settings type `C`, value type `T`, and async flag `R`.
|
|
32
|
+
*/
|
|
33
|
+
interface AdaptableDataShape<A extends DataAdapterShape<C, T, R>, C extends DataSettings<R> | undefined = InferSettings<A>, T = InferAdaptableValue<A>, R extends boolean = InferAsyncOf<[C, A]>> extends Adaptable<A>, ConfigurableDataShape<C, T, R> {
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @description The constructor interface for data types with adapter.
|
|
38
|
+
* @export
|
|
39
|
+
* @interface AdaptableDataConstructor
|
|
40
|
+
* @template {DataAdapterShape<T, C, R>} A The data adapter instance type.
|
|
41
|
+
* @template {AdaptableDataShape<A, T, C, R>} I The data instance type.
|
|
42
|
+
* @template {{ async?: boolean }} [C=A extends DataAdapterShape<any, infer V, any> ? V : any] The configuration type, inferred from A if possible.
|
|
43
|
+
* @template [T=A extends DataAdapterShape<infer U, any, any> ? U : any] The underlying value type, inferred from A if possible.
|
|
44
|
+
* @template {boolean} [R=A extends DataAdapterShape<T, C, infer U> ? U extends boolean ? U : false : false] The async flag, inferred from A if possible.
|
|
45
|
+
* @template {readonly any[]} [G=[]] The additional arguments type.
|
|
46
|
+
*/
|
|
47
|
+
interface AdaptableDataConstructor<A extends DataAdapterShape<C, T, R>, I extends AdaptableDataShape<A, C, T, R>, C extends DataSettings<R> = InferSettings<A>, T = InferValue<A>, R extends boolean = InferAsyncOf<[C, A, I]>, G extends readonly any[] = []> {
|
|
48
|
+
new (settings: C, value: T | undefined, adapter: DataAdapterConstructor<A, C, T, R, G>, ...args: G): I;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { AdaptableDataConstructor, AdaptableDataShape, InferAdaptableValue, InferSettings };
|