@typedly/data 1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -0
  3. package/index.d.ts +37 -0
  4. package/package.json +46 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 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,221 @@
1
+
2
+ <a href="https://www.typescriptlang.org/">
3
+ <img
4
+ src="https://avatars.githubusercontent.com/u/189665258?s=400&u=712e292bae048947d1f7d2020d7d38875c40e63a&v=4"
5
+ width="20%"
6
+ title="@typedly/data - A TypeScript type definitions package for @typescript-package/data."
7
+ />
8
+ </a>
9
+
10
+ ## @typedly/data
11
+
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]
16
+
17
+ A **TypeScript** type definitions package for [**@typescript-package/data**](https://github.com/typescript-package/data).
18
+
19
+ ## Table of contents
20
+
21
+ - [Installation](#installation)
22
+ - [Api](#api)
23
+ - [Interface](#interface)
24
+ - [`DataConstructor`](#dataconstructor)
25
+ - [`DataShape`](#datashape)
26
+ - [Type](#type)
27
+ - [`DataConstructorInput`](#dataconstructorinput)
28
+ - [Contributing](#contributing)
29
+ - [Support](#support)
30
+ - [Code of Conduct](#code-of-conduct)
31
+ - [Git](#git)
32
+ - [Commit](#commit)
33
+ - [Versioning](#versioning)
34
+ - [License](#license)
35
+ - [Related packages](#related-packages)
36
+
37
+ ## Installation
38
+
39
+ Peer dependencies
40
+
41
+ ```bash
42
+ npm install @typedly/constructor --save-peer
43
+ ```
44
+
45
+ The package
46
+
47
+ ```bash
48
+ npm install @typedly/data --save-peer
49
+ ```
50
+
51
+ ## Api
52
+
53
+ ```typescript
54
+ import {
55
+ // Interface.
56
+ DataConstructor,
57
+ DataShape,
58
+ // Type.
59
+ DataConstructorInput
60
+ } from '@typedly/data';
61
+ ```
62
+
63
+ ### Interface
64
+
65
+ #### `DataConstructor`
66
+
67
+ The constructor interface for data types.
68
+
69
+ ```typescript
70
+ import { DataConstructor } from '@typedly/data';
71
+
72
+ export const ctor: DataConstructor<number, DataShape<number>, any[]> = TestData;
73
+ ```
74
+
75
+ [Source](https://github.com/typedly/data/blob/main/src/lib/interface/data-constructor.interface.ts)
76
+
77
+ #### `DataShape`
78
+
79
+ The shape of a `Data` type.
80
+
81
+ ```typescript
82
+ import { DataShape } from '@typedly/data';
83
+
84
+ class TestData implements DataShape<number> {
85
+ get value(): number { return this.initialValue; }
86
+ constructor(private initialValue: number) {}
87
+ public clear(): this { return this; }
88
+ public destroy(): this { return this; }
89
+ public lock(): this { return this; }
90
+ public set(value: number): this { return this; }
91
+ }
92
+ ```
93
+
94
+ [Source](https://github.com/typedly/data/blob/main/src/lib/interface/data-shape.interface.ts)
95
+
96
+ ### Type
97
+
98
+ #### `DataConstructorInput`
99
+
100
+ The input type for data constructors, with arguments support.
101
+
102
+ ```typescript
103
+ import { DataConstructorInput, DataShape } from '@typedly/data';
104
+
105
+ function createData<Value, DataType extends DataShape<Value>>(
106
+ input: DataConstructorInput<Value, DataType>,
107
+ value: Value
108
+ ): DataType {
109
+ if (Array.isArray(input)) {
110
+ const [Ctor, ...args] = input;
111
+ return new Ctor(value, ...args);
112
+ } else {
113
+ return new input(value);
114
+ }
115
+ }
116
+ ```
117
+
118
+ [Source](https://github.com/typedly/data/blob/main/src/lib/type/data-constructor-input.type.ts)
119
+
120
+ ## Contributing
121
+
122
+ Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated.
123
+
124
+ ## Support
125
+
126
+ 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.
127
+
128
+ Support via:
129
+
130
+ - [Stripe](https://donate.stripe.com/dR614hfDZcJE3wAcMM)
131
+ - [Revolut](https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29)
132
+ - [GitHub](https://github.com/sponsors/angular-package/sponsorships?sponsor=sciborrudnicki&tier_id=83618)
133
+ - [DonorBox](https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=o)
134
+ - [Patreon](https://www.patreon.com/checkout/angularpackage?rid=0&fan_landing=true&view_as=public)
135
+
136
+ or via Trust Wallet
137
+
138
+ - [XLM](https://link.trustwallet.com/send?coin=148&address=GAFFFB7H3LG42O6JA63FJDRK4PP4JCNEOPHLGLLFH625X2KFYQ4UYVM4)
139
+ - [USDT (BEP20)](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94&token_id=0x55d398326f99059fF775485246999027B3197955)
140
+ - [ETH](https://link.trustwallet.com/send?coin=60&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
141
+ - [BTC](https://link.trustwallet.com/send?coin=0&address=bc1qnf709336tfl57ta5mfkf4t9fndhx7agxvv9svn)
142
+ - [BNB](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94)
143
+
144
+ Thanks for your support!
145
+
146
+ ## Code of Conduct
147
+
148
+ By participating in this project, you agree to follow **[Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)**.
149
+
150
+ ## GIT
151
+
152
+ ### Commit
153
+
154
+ - [AngularJS Git Commit Message Conventions][git-commit-angular]
155
+ - [Karma Git Commit Msg][git-commit-karma]
156
+ - [Conventional Commits][git-commit-conventional]
157
+
158
+ ### Versioning
159
+
160
+ [Semantic Versioning 2.0.0][git-semver]
161
+
162
+ **Given a version number MAJOR.MINOR.PATCH, increment the:**
163
+
164
+ - MAJOR version when you make incompatible API changes,
165
+ - MINOR version when you add functionality in a backwards-compatible manner, and
166
+ - PATCH version when you make backwards-compatible bug fixes.
167
+
168
+ Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
169
+
170
+ **FAQ**
171
+ How should I deal with revisions in the 0.y.z initial development phase?
172
+
173
+ > 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.
174
+
175
+ How do I know when to release 1.0.0?
176
+
177
+ > 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.
178
+
179
+ ## License
180
+
181
+ MIT © typedly ([license][typedly-license])
182
+
183
+ ## Related packages
184
+
185
+ - **[@typescript-package/chain-descriptor](https://github.com/typescript-package/chain-descriptor)**: A **TypeScript** library for chain property descriptor.
186
+ - **[@typescript-package/controlled-descriptor](https://github.com/typescript-package/controlled-descriptor)**: A **TypeScript** library for controlled property descriptor.
187
+ - **[@typescript-package/controller](https://github.com/typescript-package/controller)**: A **TypeScript** package with for various kind of controllers.
188
+ - **[@typescript-package/descriptor-chain](https://github.com/typescript-package/descriptor-chain)**: A **TypeScript** library for property descriptor chain.
189
+ - **[@typescript-package/descriptor](https://github.com/typescript-package/descriptor)**: A **TypeScript** library for property descriptor.
190
+ - **[@typescript-package/descriptors](https://github.com/typescript-package/descriptors)**: A **TypeScript** library for property descriptors.
191
+ - **[@typescript-package/property](https://github.com/typescript-package/property)**: A **TypeScript** package with features to handle object properties.
192
+ - **[@typescript-package/wrap-descriptor](https://github.com/typescript-package/wrap-descriptor)**: A **TypeScript** package for wrapping object descriptors.
193
+ - **[@typescript-package/wrap-property](https://github.com/typescript-package/wrap-property)**: A **TypeScript** package for wrapping object properties.
194
+ - **[@typescript-package/wrapped-descriptor](https://github.com/typescript-package/wrapped-descriptor)**: A lightweight **TypeScript** library for wrapped property descriptor.
195
+ - **[@xtypescript/property](https://github.com/xtypescript/property)** - A comprehensive, reactive **TypeScript** library for precise and extensible object property control.
196
+
197
+ <!-- This package: typedly -->
198
+ <!-- GitHub: badges -->
199
+ [typedly-badge-issues]: https://img.shields.io/github/issues/typedly/data
200
+ [typedly-badge-forks]: https://img.shields.io/github/forks/typedly/data
201
+ [typedly-badge-stars]: https://img.shields.io/github/stars/typedly/data
202
+ [typedly-badge-license]: https://img.shields.io/github/license/typedly/data
203
+ <!-- GitHub: badges links -->
204
+ [typedly-issues]: https://github.com/typedly/data/issues
205
+ [typedly-forks]: https://github.com/typedly/data/network
206
+ [typedly-license]: https://github.com/typedly/data/blob/master/LICENSE
207
+ [typedly-stars]: https://github.com/typedly/data/stargazers
208
+ <!-- This package -->
209
+
210
+ <!-- Package: typedly -->
211
+ <!-- npm -->
212
+ [typedly-npm-badge-svg]: https://badge.fury.io/js/@typedly%2Fdata.svg
213
+ [typedly-npm-badge]: https://badge.fury.io/js/@typedly%2Fdata
214
+
215
+ <!-- GIT -->
216
+ [git-semver]: http://semver.org/
217
+
218
+ <!-- GIT: commit -->
219
+ [git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
220
+ [git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
221
+ [git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/
package/index.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { DataConstructor as DataConstructor$1 } from '@typedly/constructor';
2
+
3
+ /**
4
+ * @description The shape of a `Data` type.
5
+ * @export
6
+ * @interface DataShape
7
+ * @template Value The value type.
8
+ */
9
+ interface DataShape<Value> {
10
+ get value(): Value;
11
+ clear(): this;
12
+ destroy(): this;
13
+ lock(): this;
14
+ set(value: Value): this;
15
+ }
16
+
17
+ /**
18
+ * @description The constructor interface for data types.
19
+ * @export
20
+ * @interface DataConstructor
21
+ * @template Value
22
+ * @template {DataShape<Value>} Instance The instance.
23
+ * @template {readonly any[]} [Args=any[]]
24
+ * @extends {BaseDataConstructor<Value, DataShape<Value>, Instance, [...Args]>}
25
+ */
26
+ interface DataConstructor<Value, Instance extends DataShape<Value>, Args extends readonly any[] = any[]> extends DataConstructor$1<Value, DataShape<Value>, Instance, [...Args]> {
27
+ }
28
+
29
+ /**
30
+ * @description The input type for data constructors, with arguments support.
31
+ * @export
32
+ * @template Value The value type.
33
+ * @template {DataShape<Value>} Instance The data instance type.
34
+ */
35
+ type DataConstructorInput<Value, Instance extends DataShape<Value>> = [DataConstructor<Value, Instance>, ...any[]] | DataConstructor<Value, Instance>;
36
+
37
+ export type { DataConstructor, DataConstructorInput, DataShape };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@typedly/data",
3
+ "version": "1.0.0",
4
+ "author": "wwwdev.io <dev@wwwdev.io>",
5
+ "description": "A TypeScript type definitions package for @typescript-package/data.",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org"
10
+ },
11
+ "peerDependencies": {
12
+ "@typedly/constructor": "^1.0.0"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/typedly/data.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/typedly/data/issues"
20
+ },
21
+ "keywords": [
22
+ "@typedly",
23
+ "@typedly/data"
24
+ ],
25
+ "funding": [
26
+ {
27
+ "type": "stripe",
28
+ "url": "https://donate.stripe.com/dR614hfDZcJE3wAcMM"
29
+ },
30
+ {
31
+ "type": "revolut",
32
+ "url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29"
33
+ }
34
+ ],
35
+ "sideEffects": false,
36
+ "typings": "index.d.ts",
37
+ "exports": {
38
+ "./package.json": {
39
+ "default": "./package.json"
40
+ },
41
+ ".": {
42
+ "types": "./index.d.ts",
43
+ "default": "./fesm2022/typedly-data.mjs"
44
+ }
45
+ }
46
+ }