@typedly/configurable-data 1.0.0-beta.1

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 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,233 @@
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/configurable-data - A TypeScript type definitions package for configurable, composable, trait-driven data models."
5
+ />
6
+ </a>
7
+
8
+ ## @typedly/configurable-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 data models.
26
+
27
+ ## Features
28
+
29
+ - **Configurable**: Create data models with configuration.
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
+ - [`ConfigurableDataShape`](#configurabledatashape)
40
+ - Type
41
+ - [`InferConfigurableAsync`](#inferconfigurableasync)
42
+ - [`InferConfigurableValue`](#inferconfigurablevalue)
43
+ - [Contributing](#contributing)
44
+ - [Support](#support)
45
+ - [Code of Conduct](#code-of-conduct)
46
+ - [Git](#git)
47
+ - [Commit](#commit)
48
+ - [Versioning](#versioning)
49
+ - [License](#license)
50
+ - [Packages](#packages)
51
+
52
+ ## Related packages
53
+
54
+ ### Peer dependencies
55
+
56
+ - **[@typedly/data-traits](https://github.com/typedly/data-traits)**: A **TypeScript** type definitions for data traits.
57
+ - **[@typedly/data](https://github.com/typedly/data)**: A **TypeScript** type definitions for [`@typescript-package/data`](https://github.com/typedly/data).
58
+
59
+ ### General
60
+
61
+ - **[@typedly/adaptable-data](https://github.com/typedly/adaptable-data)**: A **TypeScript** type definitions for data adapter.
62
+ - **[@typedly/collection](https://github.com/typedly/collection)**: A **TypeScript** type definitions package for data collections with customizable storage.
63
+ - **[@typedly/data-adapter](https://github.com/typedly/data-adapter)**: A **TypeScript** type definitions for data adapter.
64
+ - **[@typescript-package/data](https://github.com/typescript-package/data)**: A lightweight **TypeScript** library for basic data management.
65
+ - **[@typescript-package/collection](https://github.com/typescript-package/collection)**: A lightweight **TypeScript** library for data collection.
66
+
67
+ ## Installation
68
+
69
+ ### 1. Install peer dependencies
70
+
71
+ ```bash
72
+ npm install @typedly/data @typedly/data-traits --save-peer
73
+ ```
74
+
75
+ ### 2. Install package
76
+
77
+ ```bash
78
+ npm install @typedly/configurable-data --save-peer
79
+ ```
80
+
81
+ ## Api
82
+
83
+ ```typescript
84
+ import {
85
+ // Configurable data
86
+ ConfigurableDataShape,
87
+ // Inference
88
+ InferConfigurableAsync,
89
+ InferConfigurableValue,
90
+ } from '@typedly/configurable-data';
91
+ ```
92
+
93
+ ### Interface
94
+
95
+ ### `ConfigurableDataShape`
96
+
97
+ ```typescript
98
+ import { ConfigurableDataShape } from '@typedly/configurable-data';
99
+ ```
100
+
101
+ [Source](https://github.com/typedly/configurable-data/blob/main/src/lib/configurable.data.shape.ts)
102
+
103
+ ### Type
104
+
105
+ ### `InferConfigurableAsync`
106
+
107
+ ```typescript
108
+ import { InferConfigurableAsync } from '@typedly/configurable-data';
109
+ ```
110
+
111
+ [Source](https://github.com/typedly/configurable-data/blob/main/src/inference/lib/infer-configurable-async.type.ts)
112
+
113
+ ### `InferConfigurableValue`
114
+
115
+ ```typescript
116
+ import { InferConfigurableValue } from '@typedly/configurable-data';
117
+ ```
118
+
119
+ [Source](https://github.com/typedly/configurable-data/blob/main/src/inference/lib/infer-configurable-value.type.ts)
120
+
121
+ ## Contributing
122
+
123
+ Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated.
124
+
125
+ ## Support
126
+
127
+ 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.
128
+
129
+ Support via:
130
+
131
+ - [4Fund](https://4fund.com/bruubs)
132
+ - [DonorBox](https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=o)
133
+ - [GitHub](https://github.com/sponsors/angular-package/sponsorships?sponsor=sciborrudnicki&tier_id=83618)
134
+ - [Ko-fi](https://ko-fi.com/sterblack)
135
+ - [OpenCollective](https://opencollective.com/sterblack)
136
+ - [Patreon](https://www.patreon.com/checkout/angularpackage?rid=0&fan_landing=true&view_as=public)
137
+ - [PayPal](https://paypal.me/sterblack)
138
+ - [Stripe](https://donate.stripe.com/dR614hfDZcJE3wAcMM)
139
+ - ~~[Revolut](https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29)~~
140
+
141
+ or via Trust Wallet
142
+
143
+ - [BNB](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
144
+ - [BTC](https://link.trustwallet.com/send?coin=0&address=bc1qnf709336tfl57ta5mfkf4t9fndhx7agxvv9svn)
145
+ - [ETH](https://link.trustwallet.com/send?coin=60&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
146
+ - [USDT (BEP20)](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94&token_id=0x55d398326f99059fF775485246999027B3197955)
147
+ - [XLM](https://link.trustwallet.com/send?coin=148&address=GAFFFB7H3LG42O6JA63FJDRK4PP4JCNEOPHLGLLFH625X2KFYQ4UYVM4)
148
+
149
+ Thanks for your support!
150
+
151
+ ## Code of Conduct
152
+
153
+ By participating in this configurable-data, you agree to follow **[Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)**.
154
+
155
+ ## GIT
156
+
157
+ ### Commit
158
+
159
+ - [AngularJS Git Commit Message Conventions][git-commit-angular]
160
+ - [Karma Git Commit Msg][git-commit-karma]
161
+ - [Conventional Commits][git-commit-conventional]
162
+
163
+ ### Versioning
164
+
165
+ [Semantic Versioning 2.0.0][git-semver]
166
+
167
+ **Given a version number MAJOR.MINOR.PATCH, increment the:**
168
+
169
+ - MAJOR version when you make incompatible API changes,
170
+ - MINOR version when you add functionality in a backwards-compatible manner, and
171
+ - PATCH version when you make backwards-compatible bug fixes.
172
+
173
+ Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
174
+
175
+ **FAQ**
176
+ How should I deal with revisions in the 0.y.z initial development phase?
177
+
178
+ > 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.
179
+
180
+ How do I know when to release 1.0.0?
181
+
182
+ > 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.
183
+
184
+ ## License
185
+
186
+ MIT © typedly ([license][package-license])
187
+
188
+ ## Packages
189
+
190
+ - **[@typedly/array](https://github.com/typedly/array)**: A **TypeScript** type definitions package to handle array-related operations.
191
+ - **[@typedly/callback](https://github.com/typedly/callback)**: A **TypeScript** type definitions package for asynchronous and synchronous callback functions of various types.
192
+ - **[@typedly/character](https://github.com/typedly/character)**: A **TypeScript** type definitions package for various character types.
193
+ - **[@typedly/context](https://github.com/typedly/context)**: A **TypeScript** type definitions package for context data structures.
194
+ - **[@typedly/descriptor](https://github.com/typedly/descriptor)**: A **TypeScript** type definitions package for property descriptor.
195
+ - **[@typedly/digit](https://github.com/typedly/digit)**: A **TypeScript** type definitions package for digit types.
196
+ - **[@typedly/letter](https://github.com/typedly/letter)**: A **TypeScript** type definitions package for handling letter types.
197
+ - **[@typedly/object](https://github.com/typedly/object)**: A **TypeScript** type definitions package to handle object-related operations.
198
+ - **[@typedly/payload](https://github.com/typedly/payload)**: A **TypeScript** type definitions package for payload data structures.
199
+ - **[@typedly/property](https://github.com/typedly/property)**: A **TypeScript** type definitions package to handle object property-related operations.
200
+ - **[@typedly/regexp](https://github.com/typedly/regexp)**: A **TypeScript** type definitions package for `RegExp`.
201
+ - **[@typedly/symbol](https://github.com/typedly/symbol)**: A **TypeScript** type definitions package for various symbols.
202
+
203
+ <!-- Funding -->
204
+ [github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/angular-package
205
+ [github-sponsor-link]: https://github.com/sponsors/angular-package
206
+ [patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dangularpackage%26type%3Dpatrons&style=flat
207
+ [patreon-link]: https://www.patreon.com/join/angularpackage/checkout?fan_landing=true&rid=0
208
+
209
+ <!-- This package: typedly -->
210
+ <!-- GitHub: badges -->
211
+ [package-badge-issues]: https://img.shields.io/github/issues/typedly/configurable-data
212
+ [package-badge-forks]: https://img.shields.io/github/forks/typedly/configurable-data
213
+ [package-badge-stars]: https://img.shields.io/github/stars/typedly/configurable-data
214
+ [package-badge-license]: https://img.shields.io/github/license/typedly/configurable-data
215
+ <!-- GitHub: badges links -->
216
+ [package-issues]: https://github.com/typedly/configurable-data/issues
217
+ [package-forks]: https://github.com/typedly/configurable-data/network
218
+ [package-license]: https://github.com/typedly/configurable-data/blob/master/LICENSE
219
+ [package-stars]: https://github.com/typedly/configurable-data/stargazers
220
+ <!-- This package -->
221
+
222
+ <!-- Package: typedly -->
223
+ <!-- npm -->
224
+ [package-npm-badge-svg]: https://badge.fury.io/js/@typedly%2Fconfigurable-data.svg
225
+ [package-npm-badge]: https://badge.fury.io/js/@typedly%2Fconfigurable-data
226
+
227
+ <!-- GIT -->
228
+ [git-semver]: http://semver.org/
229
+
230
+ <!-- GIT: commit -->
231
+ [git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
232
+ [git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
233
+ [git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@typedly/configurable-data",
3
+ "version": "1.0.0-beta.1",
4
+ "author": "wwwdev.io <dev@wwwdev.io>",
5
+ "description": "A TypeScript type definitions for configurable data.",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org"
10
+ },
11
+ "peerDependencies": {
12
+ "@typedly/data": "^5.0.0-beta.1",
13
+ "@typedly/data-traits": "^1.0.0"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/typedly/configurable-data.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/typedly/configurable-data/issues"
21
+ },
22
+ "keywords": [
23
+ "@typedly",
24
+ "@typedly/data",
25
+ "@typedly/configurable-data"
26
+ ],
27
+ "funding": [
28
+ {
29
+ "type": "stripe",
30
+ "url": "https://donate.stripe.com/dR614hfDZcJE3wAcMM"
31
+ },
32
+ {
33
+ "type": "Donorbox",
34
+ "url": "https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=once&amount=1"
35
+ },
36
+ {
37
+ "type": "Open Collective",
38
+ "url": "https://opencollective.com/sterblack"
39
+ },
40
+ {
41
+ "type": "Ko-fi",
42
+ "url": "https://ko-fi.com/sterblack"
43
+ },
44
+ {
45
+ "type": "4Fund",
46
+ "url": "https://4fund.com/bruubs"
47
+ },
48
+ {
49
+ "type": "paypal",
50
+ "url": "https://paypal.me/sterblack"
51
+ },
52
+ {
53
+ "type": "individual",
54
+ "url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29"
55
+ }
56
+ ],
57
+ "sideEffects": false,
58
+ "typings": "types/typedly-configurable-data.d.ts",
59
+ "exports": {
60
+ "./package.json": {
61
+ "default": "./package.json"
62
+ },
63
+ ".": {
64
+ "types": "./types/typedly-configurable-data.d.ts",
65
+ "default": "./fesm2022/typedly-configurable-data.mjs"
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,34 @@
1
+ import { DataSettings, DataShape, InferAsync } from '@typedly/data';
2
+ import { Configurable } from '@typedly/data-traits';
3
+
4
+ /**
5
+ * @description The shape of a data type with configuration.
6
+ * @export
7
+ * @interface ConfigurableDataShape
8
+ * @template {DataSettings<R> | undefined} C The settings to configure the data shape.
9
+ * @template {T} [T=any] The value type.
10
+ * @template {boolean} [R=InferAsync<C>] The async flag inferred from the settings.
11
+ * @extends {DataShape<T, R>} The base data shape with value type `T` and async flag `R`.
12
+ */
13
+ interface ConfigurableDataShape<C extends DataSettings<R> | undefined, T = any, R extends boolean = InferConfigurableAsync<C>> extends DataShape<T, R>, Configurable<C> {
14
+ }
15
+
16
+ /**
17
+ * @description Infers the async flag from the configuration or adapter.
18
+ * @export
19
+ * @template [T=undefined] The type of the configuration object.
20
+ * @template [F=false] The default async flag if it cannot be inferred from `T`.
21
+ */
22
+ type InferConfigurableAsync<T = undefined, F = false> = T extends ConfigurableDataShape<any, any, infer R extends boolean> ? R : InferAsync<T, F>;
23
+
24
+ /**
25
+ * @description Infers the value type from configurable, and data shape interface.
26
+ * @export
27
+ * @template I The data shape type.
28
+ * @template [F=any] The fallback type if inference fails.
29
+ */
30
+ type InferConfigurableValue<I, F = any> = I extends ConfigurableDataShape<any, infer T, any> ? T : I extends DataShape<infer T> ? T : I extends {
31
+ value?: infer V;
32
+ } ? V : F;
33
+
34
+ export type { ConfigurableDataShape, InferConfigurableAsync, InferConfigurableValue };