adaptive-extender 0.9.3 → 0.9.5
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/CHANGELOG.md +6 -1
- package/README.md +69 -104
- package/dist/core/portable.d.ts +11 -0
- package/dist/core/portable.js +75 -22
- package/dist/core/portable.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
## 0.9.
|
|
1
|
+
## 0.9.5 (27.01.2026)
|
|
2
|
+
- Added the ability to specify custom keys (via `DiscriminatorKey`) and values (via `Descendant`) for discriminators.
|
|
3
|
+
- Fixed an issue where static fields could be marked for porting.
|
|
4
|
+
- Improved descriptions for certain porting-related errors.
|
|
5
|
+
|
|
6
|
+
## 0.9.4 (23.01.2026)
|
|
2
7
|
- Ported models no longer automatically receive a discriminator unless they are polymorphic descendants.
|
|
3
8
|
- Improved typing for `Model.export` and its descendants in `Descendant`, ensuring that data is handled as at least an `object` type.
|
|
4
9
|
|
package/README.md
CHANGED
|
@@ -4,162 +4,127 @@
|
|
|
4
4
|
|
|
5
5
|
Adaptive library for JS/TS development environments.
|
|
6
6
|
|
|
7
|
-
**Adaptive Extender**
|
|
7
|
+
**Adaptive Extender** enables strict portability, structured time management, and LINQ-like collections by extending native prototypes. It provides a robust standard library layer for enterprise-grade architecture.
|
|
8
8
|
|
|
9
9
|
[Change log](./CHANGELOG.md)
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Core Systems
|
|
14
14
|
|
|
15
|
-
### 1.
|
|
16
|
-
|
|
17
|
-
Reading data from external sources (APIs, JSON files) usually results in `any` or untyped objects. Validating them requires verbose boilerplate repetitive mapping code. `JSON.parse` offers zero guarantees about shape or types.
|
|
18
|
-
|
|
19
|
-
**The Solution:**
|
|
20
|
-
The `Portable` system allows you to define strict schemas using decorators directly on your classes. It handles validation, type conversion, and polymorphic resolution automatically.
|
|
15
|
+
### 1. Strict Data Portability (`Portable`)
|
|
16
|
+
Integrates validation and serialization directly into domain models via decorators. The class definition serves as the authoritative schema, enabling automatic type checking and polymorphic resolution.
|
|
21
17
|
|
|
22
18
|
```typescript
|
|
23
|
-
import { Model, Field, ArrayOf
|
|
19
|
+
import { Model, Field, ArrayOf } from "adaptive-extender/core";
|
|
24
20
|
|
|
25
|
-
// Define a model
|
|
26
21
|
class User extends Model {
|
|
27
|
-
@Field(String)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@Field(Nullable(Number))
|
|
31
|
-
age: number | null = null;
|
|
32
|
-
|
|
33
|
-
@Field(ArrayOf(String))
|
|
34
|
-
tags: string[] = [];
|
|
22
|
+
@Field(String) name: string = "Guest";
|
|
23
|
+
@Field(ArrayOf(Number)) scores: number[] = [];
|
|
35
24
|
}
|
|
36
25
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Validates structure and types automatically. Throws informative errors if invalid.
|
|
42
|
-
const user = User.import(rawData, "api_response");
|
|
43
|
-
|
|
44
|
-
console.log(user instanceof User); // true
|
|
45
|
-
console.log(user.name); // "Alice"
|
|
26
|
+
// 1. Validates types at runtime
|
|
27
|
+
// 2. Instantiates actual 'User' class
|
|
28
|
+
// 3. Throws informative errors on failure
|
|
29
|
+
const user = User.import(json, "api.user");
|
|
46
30
|
```
|
|
47
31
|
|
|
48
|
-
### 2.
|
|
49
|
-
|
|
50
|
-
Calculating durations using raw milliseconds (e.g., `86400000` for a day) is prone to "magic number" errors and is hard to read. Converting back and forth between days, minutes, and milliseconds creates messy math in your business logic.
|
|
51
|
-
|
|
52
|
-
**The Solution:**
|
|
53
|
-
The `Timespan` class offers a structured, readable way to handle time intervals, inspired by robust systems like .NET.
|
|
32
|
+
### 2. Value-Object Time (`Timespan`)
|
|
33
|
+
A dedicated structural type for time intervals. It encapsulates duration logic, preventing logic errors associated with raw millisecond arithmetic.
|
|
54
34
|
|
|
55
35
|
```typescript
|
|
56
36
|
import { Timespan } from "adaptive-extender/core";
|
|
57
37
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// ✅ The Solution: Explicit Definition
|
|
62
|
-
const duration = Timespan.fromComponents(0, 2, 30, 0); // 0 days, 2 hours, 30 min
|
|
38
|
+
// Readable, safe arithmetic
|
|
39
|
+
const cacheDuration = Timespan.fromComponents(0, 0, 5, 0); // 5 minutes
|
|
40
|
+
const uptime = Timespan.fromValue(process.uptime() * 1000);
|
|
63
41
|
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
// Use valueOf() for precise millisecond comparison
|
|
43
|
+
if (uptime.valueOf() > cacheDuration.valueOf()) {
|
|
44
|
+
console.log("Cache expired");
|
|
45
|
+
}
|
|
66
46
|
|
|
67
|
-
//
|
|
68
|
-
|
|
47
|
+
// Structured formatting
|
|
48
|
+
console.log(uptime.toString()); // e.g. "0.00:12:45.123"
|
|
69
49
|
```
|
|
70
50
|
|
|
71
|
-
### 3.
|
|
72
|
-
|
|
73
|
-
JavaScript's standard library often lacks convenient utility methods found in other languages. Developers often write repetitive helper functions like `isEmpty(str)` or manual `for` loops to generate number ranges.
|
|
74
|
-
|
|
75
|
-
**The Solution:**
|
|
76
|
-
Adaptive Extender safely adds non-enumerable, standard-compliant extensions to native prototypes (`Array`, `String`, `Math`, etc.), making your code more expressive.
|
|
51
|
+
### 3. Native Prototype Extensions
|
|
52
|
+
Native prototypes (`Array`, `String`, `Math`) are augmented with missing standard utility methods. These extensions are non-enumerable and designed to be conflict-free.
|
|
77
53
|
|
|
78
|
-
#### String Utilities
|
|
79
54
|
```typescript
|
|
80
|
-
//
|
|
81
|
-
|
|
55
|
+
// Sequence generation
|
|
56
|
+
for (const i of Array.range(0, 5)) { ... }
|
|
82
57
|
|
|
83
|
-
//
|
|
84
|
-
|
|
58
|
+
// Parallel iteration
|
|
59
|
+
for (const [user, role] of Array.zip(users, roles)) { ... }
|
|
85
60
|
|
|
86
|
-
//
|
|
87
|
-
|
|
61
|
+
// Safe Swap
|
|
62
|
+
items.swap(0, items.length - 1);
|
|
88
63
|
```
|
|
89
64
|
|
|
90
|
-
|
|
65
|
+
### 4. Structured Primitives (`Vector`, `Controller`)
|
|
66
|
+
Provides abstract base classes for mathematical vectors and unified controller logic for complex execution flows.
|
|
67
|
+
|
|
91
68
|
```typescript
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Zipping arrays
|
|
100
|
-
const names = ["A", "B"];
|
|
101
|
-
const ages = [20, 30];
|
|
102
|
-
for (const [name, age] of Array.zip(names, ages)) {
|
|
103
|
-
console.log(`${name} is ${age}`);
|
|
69
|
+
import { Controller } from "adaptive-extender/core";
|
|
70
|
+
|
|
71
|
+
// Cancellable, error-handling async worker
|
|
72
|
+
class ImportTask extends Controller {
|
|
73
|
+
async run() { ... }
|
|
74
|
+
async catch(err) { ... }
|
|
104
75
|
}
|
|
105
76
|
```
|
|
106
77
|
|
|
107
|
-
|
|
108
|
-
**The Problem:**
|
|
109
|
-
Managing complex asynchronous states or checking if a promise has settled without awaiting it can be difficult.
|
|
78
|
+
---
|
|
110
79
|
|
|
111
|
-
|
|
112
|
-
Extensions to `Promise` and the `Promisable<T>` type simplify async workflows.
|
|
80
|
+
## Native Extensions
|
|
113
81
|
|
|
114
|
-
|
|
115
|
-
import { type Promisable } from "adaptive-extender/core";
|
|
82
|
+
A collection of high-performance utilities that eliminate common boilerplate.
|
|
116
83
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
84
|
+
| Feature | Native JavaScript | Adaptive Extender |
|
|
85
|
+
| :--- | :--- | :--- |
|
|
86
|
+
| **Math Clamping** | `Math.min(Math.max(val, 0), 100)` | `val.clamp(0, 100)` |
|
|
87
|
+
| **Math Remap** | `(val - a) * (d - c) / (b - a) + c` | `val.lerp(a, b, c, d)` |
|
|
88
|
+
| **Modulo** | `((val % n) + n) % n` | `val.mod(n)` |
|
|
89
|
+
| **Random** | `Math.floor(Math.random()...` | `Random.global.number(min, max)` |
|
|
90
|
+
| **String Empty** | `!str \|\| str.trim().length === 0` | `String.isWhitespace(str)` |
|
|
91
|
+
| **String Defaults** | `str \|\| "default"` | `str.insteadEmpty("default")` |
|
|
92
|
+
| **Async List** | *Manual loop with `Promise.all`* | `await Array.fromAsync(stream)` |
|
|
93
|
+
| **Promise State** | *n/a* | `await task.isSettled` |
|
|
127
94
|
|
|
128
95
|
---
|
|
129
96
|
|
|
130
|
-
##
|
|
97
|
+
## Architecture
|
|
131
98
|
|
|
132
|
-
|
|
99
|
+
- **`adaptive-extender/core`**:
|
|
100
|
+
Universal utilities. Works in Browser, Node, Deno.
|
|
101
|
+
*(Math, arrays, promises, portable system, time)*
|
|
133
102
|
|
|
134
|
-
- **`adaptive-extender/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- **`adaptive-extender/node`**:
|
|
138
|
-
Node.js specific extensions (Environment, File System processing).
|
|
139
|
-
|
|
140
|
-
- **`adaptive-extender/web`**:
|
|
141
|
-
Browser specific DOM extensions (Element, ParentNode hooks).
|
|
103
|
+
- **`adaptive-extender/node`**:
|
|
104
|
+
Backend-specific tools.
|
|
105
|
+
*(Enhanced `fs` operations, strict environment variable parsing)*
|
|
142
106
|
|
|
143
|
-
|
|
107
|
+
- **`adaptive-extender/web`**:
|
|
108
|
+
Frontend-specific tools.
|
|
109
|
+
*(DOM element wrappers, parent-node extensions)*
|
|
144
110
|
|
|
145
|
-
##
|
|
111
|
+
## Installation
|
|
146
112
|
|
|
147
113
|
```bash
|
|
148
114
|
npm install adaptive-extender
|
|
149
115
|
```
|
|
150
116
|
|
|
151
|
-
##
|
|
152
|
-
|
|
153
|
-
Simply import the module to activate the extensions.
|
|
117
|
+
## Usage
|
|
154
118
|
|
|
155
119
|
```typescript
|
|
156
|
-
// Import core to register global proto extensions
|
|
157
120
|
import "adaptive-extender/core";
|
|
158
121
|
|
|
159
|
-
//
|
|
160
|
-
|
|
122
|
+
// Extensions are now active
|
|
123
|
+
if (String.isEmpty(config.name)) {
|
|
124
|
+
// ...
|
|
125
|
+
}
|
|
161
126
|
```
|
|
162
127
|
|
|
163
|
-
##
|
|
128
|
+
## License
|
|
164
129
|
|
|
165
130
|
Apache-2.0
|
package/dist/core/portable.d.ts
CHANGED
|
@@ -76,6 +76,17 @@ export declare function Deferred<M, S>(resolver: (_: void) => PortableConstructo
|
|
|
76
76
|
* @param descendant The subclass constructor to register.
|
|
77
77
|
*/
|
|
78
78
|
export declare function Descendant<M extends typeof Model>(descendant: PortableConstructor<Model, object>): (target: M, context: ClassDecoratorContext) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Decorator to register a descendant class in the base class's polymorphic registry.
|
|
81
|
+
* @param descendant The subclass constructor to register.
|
|
82
|
+
* @param discriminator The custom discriminator value.
|
|
83
|
+
*/
|
|
84
|
+
export declare function Descendant<M extends typeof Model>(descendant: PortableConstructor<Model, object>, discriminator: string): (target: M, context: ClassDecoratorContext) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Decorator to register a custom discriminator key for the polymorphic model.
|
|
87
|
+
* @param key The property key to use for the discriminator.
|
|
88
|
+
*/
|
|
89
|
+
export declare function DiscriminatorKey<M extends typeof Model>(key: string): (target: M, context: ClassDecoratorContext) => void;
|
|
79
90
|
/**
|
|
80
91
|
* A portable adapter that facilitates the conversion between `Date` instances and millisecond timestamps.
|
|
81
92
|
*/
|
package/dist/core/portable.js
CHANGED
|
@@ -28,12 +28,29 @@ class FieldDescriptor {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
+
//#region Descendant descriptor
|
|
32
|
+
class DescendantDescriptor {
|
|
33
|
+
#type;
|
|
34
|
+
#discriminator;
|
|
35
|
+
constructor(type, discriminator) {
|
|
36
|
+
this.#type = type;
|
|
37
|
+
this.#discriminator = discriminator;
|
|
38
|
+
}
|
|
39
|
+
get type() {
|
|
40
|
+
return this.#type;
|
|
41
|
+
}
|
|
42
|
+
get discriminator() {
|
|
43
|
+
return this.#discriminator ?? this.#type.name;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
31
47
|
//#region Portability metadata
|
|
32
48
|
class PortabilityMetadata {
|
|
33
49
|
static #registry = new WeakMap();
|
|
34
50
|
#model;
|
|
35
51
|
#fields = new Map();
|
|
36
52
|
#descendants = [];
|
|
53
|
+
#discriminator = "$type";
|
|
37
54
|
constructor(model) {
|
|
38
55
|
this.#model = model;
|
|
39
56
|
}
|
|
@@ -55,6 +72,12 @@ class PortabilityMetadata {
|
|
|
55
72
|
get descendants() {
|
|
56
73
|
return this.#descendants;
|
|
57
74
|
}
|
|
75
|
+
get discriminator() {
|
|
76
|
+
return this.#discriminator;
|
|
77
|
+
}
|
|
78
|
+
set discriminator(value) {
|
|
79
|
+
this.#discriminator = value;
|
|
80
|
+
}
|
|
58
81
|
}
|
|
59
82
|
//#endregion
|
|
60
83
|
//#region Model
|
|
@@ -71,14 +94,17 @@ export class Model {
|
|
|
71
94
|
*/
|
|
72
95
|
static import(source, name) {
|
|
73
96
|
const model = this;
|
|
74
|
-
const { descendants } = PortabilityMetadata.read(model);
|
|
97
|
+
const { descendants, discriminator: key } = PortabilityMetadata.read(model);
|
|
75
98
|
if (descendants.length > 0) {
|
|
76
99
|
const object = Object.import(source, name);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
const value = Reflect.get(object, key);
|
|
101
|
+
if (value === undefined)
|
|
102
|
+
throw new TypeError(`Missing '${key}' discriminator in ${name}`);
|
|
103
|
+
const discriminator = String.import(value, `${name}.${key}`);
|
|
104
|
+
const descriptor = descendants.find(descriptor => descriptor.discriminator === discriminator);
|
|
105
|
+
if (descriptor === undefined)
|
|
106
|
+
throw new TypeError(`Unknown '${discriminator}' discriminator for ${name}`);
|
|
107
|
+
return descriptor.type.import(source, name);
|
|
82
108
|
}
|
|
83
109
|
const object = Object.import(source, name);
|
|
84
110
|
const instance = Reflect.construct(this, []);
|
|
@@ -96,13 +122,14 @@ export class Model {
|
|
|
96
122
|
*/
|
|
97
123
|
static export(source) {
|
|
98
124
|
const model = this;
|
|
99
|
-
const { descendants } = PortabilityMetadata.read(model);
|
|
125
|
+
const { descendants, discriminator: key } = PortabilityMetadata.read(model);
|
|
100
126
|
if (descendants.length > 0) {
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
127
|
+
const descriptor = descendants.find(descriptor => source instanceof descriptor.type);
|
|
128
|
+
if (descriptor === undefined)
|
|
103
129
|
throw new TypeError(`Invalid '${typename(source)}' type for source`);
|
|
130
|
+
const descendant = descriptor.type;
|
|
104
131
|
const exported = descendant.export(source);
|
|
105
|
-
Reflect.set(exported,
|
|
132
|
+
Reflect.set(exported, key, descriptor.discriminator);
|
|
106
133
|
return exported;
|
|
107
134
|
}
|
|
108
135
|
const object = new Object();
|
|
@@ -117,6 +144,8 @@ export class Model {
|
|
|
117
144
|
}
|
|
118
145
|
export function Field(type, name) {
|
|
119
146
|
return function (_, context) {
|
|
147
|
+
if (context.static)
|
|
148
|
+
throw new TypeError("Portable fields cannot be static");
|
|
120
149
|
const key = context.name;
|
|
121
150
|
if (typeof (key) === "symbol")
|
|
122
151
|
throw new TypeError("Symbols are not supported as portable keys");
|
|
@@ -135,7 +164,13 @@ export function Field(type, name) {
|
|
|
135
164
|
* @param type The portable type of the array elements.
|
|
136
165
|
*/
|
|
137
166
|
export function ArrayOf(type) {
|
|
138
|
-
return class {
|
|
167
|
+
return class ArrayWrapper {
|
|
168
|
+
static [Symbol.hasInstance](instance) {
|
|
169
|
+
return type[Symbol.hasInstance](instance);
|
|
170
|
+
}
|
|
171
|
+
static get name() {
|
|
172
|
+
return type.name;
|
|
173
|
+
}
|
|
139
174
|
static import(source, name) {
|
|
140
175
|
return Array.import(source, name).map((item, index) => type.import(item, `${name}[${index}]`));
|
|
141
176
|
}
|
|
@@ -149,7 +184,13 @@ export function ArrayOf(type) {
|
|
|
149
184
|
* @param type The inner portable type.
|
|
150
185
|
*/
|
|
151
186
|
export function Nullable(type) {
|
|
152
|
-
return class {
|
|
187
|
+
return class NullableWrapper {
|
|
188
|
+
static [Symbol.hasInstance](instance) {
|
|
189
|
+
return type[Symbol.hasInstance](instance);
|
|
190
|
+
}
|
|
191
|
+
static get name() {
|
|
192
|
+
return type.name;
|
|
193
|
+
}
|
|
153
194
|
static import(source, name) {
|
|
154
195
|
return Reflect.mapNull(source, source => type.import(source, name));
|
|
155
196
|
}
|
|
@@ -163,7 +204,13 @@ export function Nullable(type) {
|
|
|
163
204
|
* @param type The inner portable type.
|
|
164
205
|
*/
|
|
165
206
|
export function Optional(type) {
|
|
166
|
-
return class {
|
|
207
|
+
return class OptionalWrapper {
|
|
208
|
+
static [Symbol.hasInstance](instance) {
|
|
209
|
+
return type[Symbol.hasInstance](instance);
|
|
210
|
+
}
|
|
211
|
+
static get name() {
|
|
212
|
+
return type.name;
|
|
213
|
+
}
|
|
167
214
|
static import(source, name) {
|
|
168
215
|
return Reflect.mapUndefined(source, source => type.import(source, name));
|
|
169
216
|
}
|
|
@@ -177,9 +224,9 @@ export function Optional(type) {
|
|
|
177
224
|
* @param resolver Function that returns the actual type constructor.
|
|
178
225
|
*/
|
|
179
226
|
export function Deferred(resolver) {
|
|
180
|
-
return class {
|
|
227
|
+
return class DeferredWrapper {
|
|
181
228
|
static [Symbol.hasInstance](instance) {
|
|
182
|
-
return
|
|
229
|
+
return resolver()[Symbol.hasInstance](instance);
|
|
183
230
|
}
|
|
184
231
|
static get name() {
|
|
185
232
|
return resolver().name;
|
|
@@ -192,14 +239,20 @@ export function Deferred(resolver) {
|
|
|
192
239
|
}
|
|
193
240
|
};
|
|
194
241
|
}
|
|
242
|
+
export function Descendant(descendant, discriminator) {
|
|
243
|
+
return function (model) {
|
|
244
|
+
const { descendants } = PortabilityMetadata.read(model);
|
|
245
|
+
descendants.push(new DescendantDescriptor(descendant, discriminator));
|
|
246
|
+
};
|
|
247
|
+
}
|
|
195
248
|
/**
|
|
196
|
-
* Decorator to register a
|
|
197
|
-
* @param
|
|
249
|
+
* Decorator to register a custom discriminator key for the polymorphic model.
|
|
250
|
+
* @param key The property key to use for the discriminator.
|
|
198
251
|
*/
|
|
199
|
-
export function
|
|
252
|
+
export function DiscriminatorKey(key) {
|
|
200
253
|
return function (model) {
|
|
201
|
-
const
|
|
202
|
-
|
|
254
|
+
const metadata = PortabilityMetadata.read(model);
|
|
255
|
+
metadata.discriminator = key;
|
|
203
256
|
};
|
|
204
257
|
}
|
|
205
258
|
//#endregion
|
|
@@ -209,7 +262,7 @@ export function Descendant(descendant) {
|
|
|
209
262
|
*/
|
|
210
263
|
export const Timestamp = {
|
|
211
264
|
[Symbol.hasInstance](instance) {
|
|
212
|
-
return instance
|
|
265
|
+
return Date[Symbol.hasInstance](instance);
|
|
213
266
|
},
|
|
214
267
|
get name() {
|
|
215
268
|
return "Timestamp";
|
|
@@ -228,7 +281,7 @@ export const Timestamp = {
|
|
|
228
281
|
*/
|
|
229
282
|
export const UnixSeconds = {
|
|
230
283
|
[Symbol.hasInstance](instance) {
|
|
231
|
-
return instance
|
|
284
|
+
return Date[Symbol.hasInstance](instance);
|
|
232
285
|
},
|
|
233
286
|
get name() {
|
|
234
287
|
return "UnixSeconds";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portable.js","sourceRoot":"","sources":["../../src/core/portable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CAAC;AACtB,OAAO,YAAY,CAAC;AACpB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CAAC;AACtB,OAAO,EAAoB,MAAM,aAAa,CAAC;AAoB/C,YAAY;AACZ,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