@macroforge/mcp-server 0.1.73 → 0.1.75
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/docs/builtin-macros/clone.md +14 -16
- package/docs/builtin-macros/debug.md +8 -9
- package/docs/builtin-macros/default.md +22 -23
- package/docs/builtin-macros/deserialize/cycleforward-reference-support.md +3 -2
- package/docs/builtin-macros/deserialize/example.md +2 -1
- package/docs/builtin-macros/deserialize/overview.md +10 -10
- package/docs/builtin-macros/deserialize/union-type-deserialization.md +15 -9
- package/docs/builtin-macros/deserialize/validation.md +5 -1
- package/docs/builtin-macros/deserialize.md +31 -19
- package/docs/builtin-macros/hash.md +29 -35
- package/docs/builtin-macros/ord.md +18 -20
- package/docs/builtin-macros/partial-eq.md +31 -39
- package/docs/builtin-macros/partial-ord.md +18 -18
- package/docs/builtin-macros/serialize.md +23 -22
- package/docs/sections.json +126 -126
- package/package.json +2 -2
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
# Clone
|
|
2
2
|
|
|
3
|
-
The `Clone` macro generates a `clone()` method for deep copying objects.
|
|
4
|
-
|
|
5
|
-
independent copies of values.
|
|
3
|
+
The `Clone` macro generates a `clone()` method for deep copying objects. This is analogous to Rust's
|
|
4
|
+
`Clone` trait, providing a way to create independent copies of values.
|
|
6
5
|
|
|
7
6
|
## Generated Output
|
|
8
7
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameClone(value: TypeName): TypeName`
|
|
15
|
-
|
|
8
|
+
| Type | Generated Code | Description |
|
|
9
|
+
| ---------- | --------------------------------------------------------- | --------------------------------------------------------------- |
|
|
10
|
+
| Class | `classNameClone(value)` + `static clone(value)` | Standalone function + static wrapper method |
|
|
11
|
+
| Enum | `enumNameClone(value: EnumName): EnumName` | Standalone function (enums are primitives, returns value as-is) |
|
|
12
|
+
| Interface | `interfaceNameClone(value: InterfaceName): InterfaceName` | Standalone function creating a new object literal |
|
|
13
|
+
| Type Alias | `typeNameClone(value: TypeName): TypeName` | Standalone function with spread copy for objects |
|
|
16
14
|
|
|
17
15
|
## Cloning Strategy
|
|
18
16
|
|
|
@@ -22,8 +20,8 @@ The generated clone performs a **shallow copy** of all fields:
|
|
|
22
20
|
- **Objects**: Reference is copied (not deep cloned)
|
|
23
21
|
- **Arrays**: Reference is copied (not deep cloned)
|
|
24
22
|
|
|
25
|
-
For deep cloning of nested objects, those objects should also derive `Clone`
|
|
26
|
-
|
|
23
|
+
For deep cloning of nested objects, those objects should also derive `Clone` and the caller should
|
|
24
|
+
clone them explicitly.
|
|
27
25
|
|
|
28
26
|
## Example
|
|
29
27
|
|
|
@@ -55,8 +53,8 @@ export function pointClone(value: Point): Point {
|
|
|
55
53
|
|
|
56
54
|
## Implementation Notes
|
|
57
55
|
|
|
58
|
-
- **Classes**: Uses `Object.create(Object.getPrototypeOf(value))` to preserve
|
|
59
|
-
|
|
56
|
+
- **Classes**: Uses `Object.create(Object.getPrototypeOf(value))` to preserve the prototype chain,
|
|
57
|
+
ensuring `instanceof` checks work correctly
|
|
60
58
|
- **Enums**: Simply returns the value (enums are primitives in TypeScript)
|
|
61
|
-
- **Interfaces/Type Aliases**: Creates new object literals with spread operator
|
|
62
|
-
|
|
59
|
+
- **Interfaces/Type Aliases**: Creates new object literals with spread operator for union/tuple
|
|
60
|
+
types, or field-by-field copy for object types
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
# Debug
|
|
2
2
|
|
|
3
|
-
The `Debug` macro generates a human-readable `toString()` method for
|
|
4
|
-
|
|
3
|
+
The `Debug` macro generates a human-readable `toString()` method for TypeScript classes, interfaces,
|
|
4
|
+
enums, and type aliases.
|
|
5
5
|
|
|
6
6
|
## Generated Output
|
|
7
7
|
|
|
8
|
-
**Classes**: Generates a standalone function `classNameToString(value)` and a static wrapper
|
|
9
|
-
|
|
8
|
+
**Classes**: Generates a standalone function `classNameToString(value)` and a static wrapper method
|
|
9
|
+
`static toString(value)` returning a string like `"ClassName { field1: value1, field2: value2 }"`.
|
|
10
10
|
|
|
11
|
-
**Enums**: Generates a standalone function `enumNameToString(value)` that performs
|
|
12
|
-
|
|
11
|
+
**Enums**: Generates a standalone function `enumNameToString(value)` that performs reverse lookup on
|
|
12
|
+
numeric enums.
|
|
13
13
|
|
|
14
14
|
**Interfaces**: Generates a standalone function `interfaceNameToString(value)`.
|
|
15
15
|
|
|
16
|
-
**Type Aliases**: Generates a standalone function using JSON.stringify for
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
**Type Aliases**: Generates a standalone function using JSON.stringify for complex types, or field
|
|
17
|
+
enumeration for object types.
|
|
19
18
|
|
|
20
19
|
## Field-Level Options
|
|
21
20
|
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
# Default
|
|
2
2
|
|
|
3
|
-
The `Default` macro generates a static `defaultValue()` factory method that creates
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Default` macro generates a static `defaultValue()` factory method that creates instances with
|
|
4
|
+
default values. This is analogous to Rust's `Default` trait, providing a standard way to create
|
|
5
|
+
"zero" or "empty" instances of types.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `defaultValueTypeName(): TypeName`
|
|
15
|
-
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | -------------------------------------------- | ------------------------------------------------- |
|
|
11
|
+
| Class | `static defaultValue(): ClassName` | Static factory method |
|
|
12
|
+
| Enum | `defaultValueEnumName(): EnumName` | Standalone function returning marked variant |
|
|
13
|
+
| Interface | `defaultValueInterfaceName(): InterfaceName` | Standalone function returning object literal |
|
|
14
|
+
| Type Alias | `defaultValueTypeName(): TypeName` | Standalone function with type-appropriate default |
|
|
16
15
|
|
|
17
16
|
## Default Values by Type
|
|
18
17
|
|
|
19
18
|
The macro uses Rust-like default semantics:
|
|
20
19
|
|
|
21
|
-
| Type
|
|
22
|
-
|
|
23
|
-
| `string`
|
|
24
|
-
| `number`
|
|
25
|
-
| `boolean`
|
|
26
|
-
| `bigint`
|
|
27
|
-
| `T[]`
|
|
28
|
-
| `Array<T>`
|
|
29
|
-
| `Map<K,V>`
|
|
30
|
-
| `Set<T>`
|
|
31
|
-
| `Date`
|
|
32
|
-
| `T \| null`
|
|
20
|
+
| Type | Default Value |
|
|
21
|
+
| ------------ | --------------------------------------- |
|
|
22
|
+
| `string` | `""` (empty string) |
|
|
23
|
+
| `number` | `0` |
|
|
24
|
+
| `boolean` | `false` |
|
|
25
|
+
| `bigint` | `0n` |
|
|
26
|
+
| `T[]` | `[]` (empty array) |
|
|
27
|
+
| `Array<T>` | `[]` (empty array) |
|
|
28
|
+
| `Map<K,V>` | `new Map()` |
|
|
29
|
+
| `Set<T>` | `new Set()` |
|
|
30
|
+
| `Date` | `new Date()` (current time) |
|
|
31
|
+
| `T \| null` | `null` |
|
|
33
32
|
| `CustomType` | `CustomType.defaultValue()` (recursive) |
|
|
34
33
|
|
|
35
34
|
## Field-Level Options
|
|
@@ -52,7 +51,7 @@ class UserSettings {
|
|
|
52
51
|
/** @default(10) */
|
|
53
52
|
pageSize: number;
|
|
54
53
|
|
|
55
|
-
notifications: boolean;
|
|
54
|
+
notifications: boolean; // Uses type default: false
|
|
56
55
|
}
|
|
57
56
|
```
|
|
58
57
|
|
|
@@ -7,5 +7,6 @@ Uses deferred patching to handle references:
|
|
|
7
7
|
3. After all objects are created, `ctx.applyPatches()` resolves all pending references
|
|
8
8
|
|
|
9
9
|
References only apply to object-shaped, serializable values. The generator avoids probing for
|
|
10
|
-
`__ref` on primitive-like fields (including literal unions and `T | null` where `T` is
|
|
11
|
-
and it parses `Date` / `Date | null` from ISO strings without treating them as
|
|
10
|
+
`__ref` on primitive-like fields (including literal unions and `T | null` where `T` is
|
|
11
|
+
primitive-like), and it parses `Date` / `Date | null` from ISO strings without treating them as
|
|
12
|
+
references.
|
|
@@ -214,4 +214,5 @@ if (Result.isOk(result)) {
|
|
|
214
214
|
## Required Imports
|
|
215
215
|
|
|
216
216
|
The generated code automatically imports:
|
|
217
|
-
|
|
217
|
+
|
|
218
|
+
- `DeserializeContext`, `DeserializeError`, `PendingRef` from `macroforge/serde`
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Deserialize
|
|
2
2
|
|
|
3
|
-
The `Deserialize` macro generates JSON deserialization methods with **cycle and
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Deserialize` macro generates JSON deserialization methods with **cycle and forward-reference
|
|
4
|
+
support**, plus comprehensive runtime validation. This enables safe parsing of complex JSON
|
|
5
|
+
structures including circular references.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameDeserialize(input)`, etc.
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ----------------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
11
|
+
| Class | `classNameDeserialize(input)` + `static deserialize(input)` | Standalone function + static factory method |
|
|
12
|
+
| Enum | `enumNameDeserialize(input)`, `enumNameDeserializeWithContext(data)`, `enumNameIs(value)` | Standalone functions |
|
|
13
|
+
| Interface | `interfaceNameDeserialize(input)`, etc. | Standalone functions |
|
|
14
|
+
| Type Alias | `typeNameDeserialize(input)`, etc. | Standalone functions |
|
|
15
15
|
|
|
16
16
|
## Return Type
|
|
17
17
|
|
|
18
18
|
All public deserialization methods return `Result<T, Array<{ field: string; message: string }>>`:
|
|
19
19
|
|
|
20
20
|
- `Result.ok(value)` - Successfully deserialized value
|
|
21
|
-
- `Result.err(errors)` - Array of validation errors with field names and messages
|
|
21
|
+
- `Result.err(errors)` - Array of validation errors with field names and messages
|
|
@@ -3,25 +3,31 @@
|
|
|
3
3
|
Union types are deserialized based on their member types:
|
|
4
4
|
|
|
5
5
|
### Literal Unions
|
|
6
|
-
|
|
7
|
-
the
|
|
6
|
+
|
|
7
|
+
For unions of literal values (`"A" | "B" | 123`), the value is validated against the allowed
|
|
8
|
+
literals directly.
|
|
8
9
|
|
|
9
10
|
### Primitive Unions
|
|
10
|
-
|
|
11
|
-
`
|
|
11
|
+
|
|
12
|
+
For unions containing primitive types (`string | number`), the deserializer uses `typeof` checks to
|
|
13
|
+
validate the value type. No `__type` discriminator is needed.
|
|
12
14
|
|
|
13
15
|
### Class/Interface Unions
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
For unions of serializable types (`User | Admin`), the deserializer requires a `__type` field in the
|
|
18
|
+
JSON to dispatch to the correct type's `deserializeWithContext` method.
|
|
16
19
|
|
|
17
20
|
### Generic Type Parameters
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
For generic unions like `type Result<T> = T | Error`, the generic type parameter `T` is passed
|
|
23
|
+
through as-is since its concrete type is only known at the call site.
|
|
20
24
|
|
|
21
25
|
### Mixed Unions
|
|
26
|
+
|
|
22
27
|
Mixed unions (e.g., `string | Date | User`) check in order:
|
|
28
|
+
|
|
23
29
|
1. Literal values
|
|
24
30
|
2. Primitives (via `typeof`)
|
|
25
31
|
3. Date (via `instanceof` or ISO string parsing)
|
|
26
32
|
4. Serializable types (via `__type` dispatch)
|
|
27
|
-
5. Generic type parameters (pass-through)
|
|
33
|
+
5. Generic type parameters (pass-through)
|
|
@@ -3,19 +3,23 @@
|
|
|
3
3
|
The macro supports 30+ validators via `@serde(validate(...))`:
|
|
4
4
|
|
|
5
5
|
### String Validators
|
|
6
|
+
|
|
6
7
|
- `email`, `url`, `uuid` - Format validation
|
|
7
8
|
- `minLength(n)`, `maxLength(n)`, `length(n)` - Length constraints
|
|
8
9
|
- `pattern("regex")` - Regular expression matching
|
|
9
10
|
- `nonEmpty`, `trimmed`, `lowercase`, `uppercase` - String properties
|
|
10
11
|
|
|
11
12
|
### Number Validators
|
|
13
|
+
|
|
12
14
|
- `gt(n)`, `gte(n)`, `lt(n)`, `lte(n)`, `between(min, max)` - Range checks
|
|
13
15
|
- `int`, `positive`, `nonNegative`, `finite` - Number properties
|
|
14
16
|
|
|
15
17
|
### Array Validators
|
|
18
|
+
|
|
16
19
|
- `minItems(n)`, `maxItems(n)`, `itemsCount(n)` - Collection size
|
|
17
20
|
|
|
18
21
|
### Date Validators
|
|
22
|
+
|
|
19
23
|
- `validDate`, `afterDate("ISO")`, `beforeDate("ISO")` - Date validation
|
|
20
24
|
|
|
21
25
|
## Field-Level Options
|
|
@@ -31,4 +35,4 @@ The `@serde` decorator supports:
|
|
|
31
35
|
## Container-Level Options
|
|
32
36
|
|
|
33
37
|
- `denyUnknownFields` - Error on unrecognized JSON properties
|
|
34
|
-
- `renameAll = "camelCase"` - Apply naming convention to all fields
|
|
38
|
+
- `renameAll = "camelCase"` - Apply naming convention to all fields
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# Deserialize
|
|
2
2
|
|
|
3
|
-
The `Deserialize` macro generates JSON deserialization methods with **cycle and
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Deserialize` macro generates JSON deserialization methods with **cycle and forward-reference
|
|
4
|
+
support**, plus comprehensive runtime validation. This enables safe parsing of complex JSON
|
|
5
|
+
structures including circular references.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameDeserialize(input)`, etc.
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ----------------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
11
|
+
| Class | `classNameDeserialize(input)` + `static deserialize(input)` | Standalone function + static factory method |
|
|
12
|
+
| Enum | `enumNameDeserialize(input)`, `enumNameDeserializeWithContext(data)`, `enumNameIs(value)` | Standalone functions |
|
|
13
|
+
| Interface | `interfaceNameDeserialize(input)`, etc. | Standalone functions |
|
|
14
|
+
| Type Alias | `typeNameDeserialize(input)`, etc. | Standalone functions |
|
|
15
15
|
|
|
16
16
|
## Return Type
|
|
17
17
|
|
|
@@ -29,27 +29,32 @@ Uses deferred patching to handle references:
|
|
|
29
29
|
3. After all objects are created, `ctx.applyPatches()` resolves all pending references
|
|
30
30
|
|
|
31
31
|
References only apply to object-shaped, serializable values. The generator avoids probing for
|
|
32
|
-
`__ref` on primitive-like fields (including literal unions and `T | null` where `T` is
|
|
33
|
-
and it parses `Date` / `Date | null` from ISO strings without treating them as
|
|
32
|
+
`__ref` on primitive-like fields (including literal unions and `T | null` where `T` is
|
|
33
|
+
primitive-like), and it parses `Date` / `Date | null` from ISO strings without treating them as
|
|
34
|
+
references.
|
|
34
35
|
|
|
35
36
|
## Validation
|
|
36
37
|
|
|
37
38
|
The macro supports 30+ validators via `@serde(validate(...))`:
|
|
38
39
|
|
|
39
40
|
### String Validators
|
|
41
|
+
|
|
40
42
|
- `email`, `url`, `uuid` - Format validation
|
|
41
43
|
- `minLength(n)`, `maxLength(n)`, `length(n)` - Length constraints
|
|
42
44
|
- `pattern("regex")` - Regular expression matching
|
|
43
45
|
- `nonEmpty`, `trimmed`, `lowercase`, `uppercase` - String properties
|
|
44
46
|
|
|
45
47
|
### Number Validators
|
|
48
|
+
|
|
46
49
|
- `gt(n)`, `gte(n)`, `lt(n)`, `lte(n)`, `between(min, max)` - Range checks
|
|
47
50
|
- `int`, `positive`, `nonNegative`, `finite` - Number properties
|
|
48
51
|
|
|
49
52
|
### Array Validators
|
|
53
|
+
|
|
50
54
|
- `minItems(n)`, `maxItems(n)`, `itemsCount(n)` - Collection size
|
|
51
55
|
|
|
52
56
|
### Date Validators
|
|
57
|
+
|
|
53
58
|
- `validDate`, `afterDate("ISO")`, `beforeDate("ISO")` - Date validation
|
|
54
59
|
|
|
55
60
|
## Field-Level Options
|
|
@@ -72,23 +77,29 @@ The `@serde` decorator supports:
|
|
|
72
77
|
Union types are deserialized based on their member types:
|
|
73
78
|
|
|
74
79
|
### Literal Unions
|
|
75
|
-
|
|
76
|
-
the
|
|
80
|
+
|
|
81
|
+
For unions of literal values (`"A" | "B" | 123`), the value is validated against the allowed
|
|
82
|
+
literals directly.
|
|
77
83
|
|
|
78
84
|
### Primitive Unions
|
|
79
|
-
|
|
80
|
-
`
|
|
85
|
+
|
|
86
|
+
For unions containing primitive types (`string | number`), the deserializer uses `typeof` checks to
|
|
87
|
+
validate the value type. No `__type` discriminator is needed.
|
|
81
88
|
|
|
82
89
|
### Class/Interface Unions
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
|
|
91
|
+
For unions of serializable types (`User | Admin`), the deserializer requires a `__type` field in the
|
|
92
|
+
JSON to dispatch to the correct type's `deserializeWithContext` method.
|
|
85
93
|
|
|
86
94
|
### Generic Type Parameters
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
|
|
96
|
+
For generic unions like `type Result<T> = T | Error`, the generic type parameter `T` is passed
|
|
97
|
+
through as-is since its concrete type is only known at the call site.
|
|
89
98
|
|
|
90
99
|
### Mixed Unions
|
|
100
|
+
|
|
91
101
|
Mixed unions (e.g., `string | Date | User`) check in order:
|
|
102
|
+
|
|
92
103
|
1. Literal values
|
|
93
104
|
2. Primitives (via `typeof`)
|
|
94
105
|
3. Date (via `instanceof` or ISO string parsing)
|
|
@@ -311,4 +322,5 @@ if (Result.isOk(result)) {
|
|
|
311
322
|
## Required Imports
|
|
312
323
|
|
|
313
324
|
The generated code automatically imports:
|
|
325
|
+
|
|
314
326
|
- `DeserializeContext`, `DeserializeError`, `PendingRef` from `macroforge/serde`
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# Hash
|
|
2
2
|
|
|
3
|
-
The `Hash` macro generates a `hashCode()` method for computing numeric hash codes.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Hash` macro generates a `hashCode()` method for computing numeric hash codes. This is analogous
|
|
4
|
+
to Rust's `Hash` trait and Java's `hashCode()` method, enabling objects to be used as keys in
|
|
5
|
+
hash-based collections.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameHashCode(value: TypeName): number`
|
|
15
|
-
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------- |
|
|
11
|
+
| Class | `classNameHashCode(value)` + `static hashCode(value)` | Standalone function + static wrapper method |
|
|
12
|
+
| Enum | `enumNameHashCode(value: EnumName): number` | Standalone function hashing by enum value |
|
|
13
|
+
| Interface | `interfaceNameHashCode(value: InterfaceName): number` | Standalone function computing hash |
|
|
14
|
+
| Type Alias | `typeNameHashCode(value: TypeName): number` | Standalone function computing hash |
|
|
16
15
|
|
|
17
16
|
## Hash Algorithm
|
|
18
17
|
|
|
@@ -28,17 +27,17 @@ This algorithm is consistent with Java's `Objects.hash()` implementation.
|
|
|
28
27
|
|
|
29
28
|
## Type-Specific Hashing
|
|
30
29
|
|
|
31
|
-
| Type
|
|
32
|
-
|
|
33
|
-
| `number`
|
|
34
|
-
| `bigint`
|
|
35
|
-
| `string`
|
|
36
|
-
| `boolean` | 1231 for true, 1237 for false (Java convention)
|
|
37
|
-
| `Date`
|
|
38
|
-
| Arrays
|
|
39
|
-
| `Map`
|
|
40
|
-
| `Set`
|
|
41
|
-
| Objects
|
|
30
|
+
| Type | Hash Strategy |
|
|
31
|
+
| --------- | ------------------------------------------------------ |
|
|
32
|
+
| `number` | Integer: direct value; Float: string hash of decimal |
|
|
33
|
+
| `bigint` | String hash of decimal representation |
|
|
34
|
+
| `string` | Character-by-character polynomial hash |
|
|
35
|
+
| `boolean` | 1231 for true, 1237 for false (Java convention) |
|
|
36
|
+
| `Date` | `getTime()` timestamp |
|
|
37
|
+
| Arrays | Element-by-element hash combination |
|
|
38
|
+
| `Map` | Entry-by-entry key+value hash |
|
|
39
|
+
| `Set` | Element-by-element hash |
|
|
40
|
+
| Objects | Calls `hashCode()` if available, else JSON string hash |
|
|
42
41
|
|
|
43
42
|
## Field-Level Options
|
|
44
43
|
|
|
@@ -77,18 +76,14 @@ class User {
|
|
|
77
76
|
|
|
78
77
|
export function userHashCode(value: User): number {
|
|
79
78
|
let hash = 17;
|
|
80
|
-
hash =
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.toString()
|
|
86
|
-
.split('')
|
|
87
|
-
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
79
|
+
hash = (hash * 31 +
|
|
80
|
+
(Number.isInteger(value.id) ? value.id | 0 : value.id
|
|
81
|
+
.toString()
|
|
82
|
+
.split('')
|
|
83
|
+
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
88
84
|
0;
|
|
89
|
-
hash =
|
|
90
|
-
(
|
|
91
|
-
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
85
|
+
hash = (hash * 31 +
|
|
86
|
+
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
92
87
|
0;
|
|
93
88
|
return hash;
|
|
94
89
|
}
|
|
@@ -101,6 +96,5 @@ export function userEquals(a: User, b: User): boolean {
|
|
|
101
96
|
|
|
102
97
|
## Hash Contract
|
|
103
98
|
|
|
104
|
-
Objects that are equal (`PartialEq`) should produce the same hash code.
|
|
105
|
-
|
|
106
|
-
`Hash` and `PartialEq` to maintain this contract.
|
|
99
|
+
Objects that are equal (`PartialEq`) should produce the same hash code. When using `@hash(skip)`,
|
|
100
|
+
ensure the same fields are skipped in both `Hash` and `PartialEq` to maintain this contract.
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
# Ord
|
|
2
2
|
|
|
3
|
-
The `Ord` macro generates a `compareTo()` method for **total ordering** comparison.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Ord` macro generates a `compareTo()` method for **total ordering** comparison. This is
|
|
4
|
+
analogous to Rust's `Ord` trait, enabling objects to be sorted and compared with a guaranteed
|
|
5
|
+
ordering relationship.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameCompare(a: TypeName, b: TypeName): number`
|
|
15
|
-
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ------------------------------------------------------------------ | ---------------------------------------------------- |
|
|
11
|
+
| Class | `classNameCompare(a, b)` + `static compareTo(a, b)` | Standalone function + static wrapper method |
|
|
12
|
+
| Enum | `enumNameCompare(a: EnumName, b: EnumName): number` | Standalone function comparing enum values |
|
|
13
|
+
| Interface | `interfaceNameCompare(a: InterfaceName, b: InterfaceName): number` | Standalone function comparing fields |
|
|
14
|
+
| Type Alias | `typeNameCompare(a: TypeName, b: TypeName): number` | Standalone function with type-appropriate comparison |
|
|
16
15
|
|
|
17
16
|
## Return Values
|
|
18
17
|
|
|
19
|
-
Unlike `PartialOrd`, `Ord` provides **total ordering** - every pair of values
|
|
20
|
-
can be compared:
|
|
18
|
+
Unlike `PartialOrd`, `Ord` provides **total ordering** - every pair of values can be compared:
|
|
21
19
|
|
|
22
20
|
- **-1**: `a` is less than `b`
|
|
23
21
|
- **0**: `a` is equal to `b`
|
|
@@ -36,14 +34,14 @@ Fields are compared **lexicographically** in declaration order:
|
|
|
36
34
|
|
|
37
35
|
## Type-Specific Comparisons
|
|
38
36
|
|
|
39
|
-
| Type
|
|
40
|
-
|
|
41
|
-
| `number`/`bigint` | Direct `<` and `>` comparison
|
|
42
|
-
| `string`
|
|
43
|
-
| `boolean`
|
|
44
|
-
| Arrays
|
|
45
|
-
| `Date`
|
|
46
|
-
| Objects
|
|
37
|
+
| Type | Comparison Method |
|
|
38
|
+
| ----------------- | ---------------------------------------- |
|
|
39
|
+
| `number`/`bigint` | Direct `<` and `>` comparison |
|
|
40
|
+
| `string` | `localeCompare()` (clamped to -1, 0, 1) |
|
|
41
|
+
| `boolean` | false < true |
|
|
42
|
+
| Arrays | Lexicographic element-by-element |
|
|
43
|
+
| `Date` | `getTime()` timestamp comparison |
|
|
44
|
+
| Objects | Calls `compareTo()` if available, else 0 |
|
|
47
45
|
|
|
48
46
|
## Field-Level Options
|
|
49
47
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# PartialEq
|
|
2
2
|
|
|
3
|
-
The `PartialEq` macro generates an `equals()` method for field-by-field
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `PartialEq` macro generates an `equals()` method for field-by-field structural equality
|
|
4
|
+
comparison. This is analogous to Rust's `PartialEq` trait, enabling value-based equality semantics
|
|
5
|
+
instead of reference equality.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameEquals(a: TypeName, b: TypeName): boolean`
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ------------------------------------------------------------------ | ---------------------------------------------------- |
|
|
11
|
+
| Class | `classNameEquals(a, b)` + `static equals(a, b)` | Standalone function + static wrapper method |
|
|
12
|
+
| Enum | `enumNameEquals(a: EnumName, b: EnumName): boolean` | Standalone function using strict equality |
|
|
13
|
+
| Interface | `interfaceNameEquals(a: InterfaceName, b: InterfaceName): boolean` | Standalone function comparing fields |
|
|
14
|
+
| Type Alias | `typeNameEquals(a: TypeName, b: TypeName): boolean` | Standalone function with type-appropriate comparison |
|
|
15
15
|
|
|
16
16
|
## Comparison Strategy
|
|
17
17
|
|
|
@@ -22,14 +22,14 @@ The generated equality check:
|
|
|
22
22
|
|
|
23
23
|
## Type-Specific Comparisons
|
|
24
24
|
|
|
25
|
-
| Type
|
|
26
|
-
|
|
27
|
-
| Primitives | Strict equality (`===`)
|
|
28
|
-
| Arrays
|
|
29
|
-
| `Date`
|
|
30
|
-
| `Map`
|
|
31
|
-
| `Set`
|
|
32
|
-
| Objects
|
|
25
|
+
| Type | Comparison Method |
|
|
26
|
+
| ---------- | ----------------------------------------- |
|
|
27
|
+
| Primitives | Strict equality (`===`) |
|
|
28
|
+
| Arrays | Length + element-by-element (recursive) |
|
|
29
|
+
| `Date` | `getTime()` comparison |
|
|
30
|
+
| `Map` | Size + entry-by-entry comparison |
|
|
31
|
+
| `Set` | Size + membership check |
|
|
32
|
+
| Objects | Calls `equals()` if available, else `===` |
|
|
33
33
|
|
|
34
34
|
## Field-Level Options
|
|
35
35
|
|
|
@@ -73,18 +73,14 @@ export function userEquals(a: User, b: User): boolean {
|
|
|
73
73
|
|
|
74
74
|
export function userHashCode(value: User): number {
|
|
75
75
|
let hash = 17;
|
|
76
|
-
hash =
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.toString()
|
|
82
|
-
.split('')
|
|
83
|
-
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
76
|
+
hash = (hash * 31 +
|
|
77
|
+
(Number.isInteger(value.id) ? value.id | 0 : value.id
|
|
78
|
+
.toString()
|
|
79
|
+
.split('')
|
|
80
|
+
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
84
81
|
0;
|
|
85
|
-
hash =
|
|
86
|
-
(
|
|
87
|
-
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
82
|
+
hash = (hash * 31 +
|
|
83
|
+
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
88
84
|
0;
|
|
89
85
|
return hash;
|
|
90
86
|
}
|
|
@@ -134,18 +130,14 @@ export function userEquals(a: User, b: User): boolean {
|
|
|
134
130
|
|
|
135
131
|
export function userHashCode(value: User): number {
|
|
136
132
|
let hash = 17;
|
|
137
|
-
hash =
|
|
138
|
-
(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.toString()
|
|
143
|
-
.split('')
|
|
144
|
-
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
133
|
+
hash = (hash * 31 +
|
|
134
|
+
(Number.isInteger(value.id) ? value.id | 0 : value.id
|
|
135
|
+
.toString()
|
|
136
|
+
.split('')
|
|
137
|
+
.reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
|
|
145
138
|
0;
|
|
146
|
-
hash =
|
|
147
|
-
(
|
|
148
|
-
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
139
|
+
hash = (hash * 31 +
|
|
140
|
+
(value.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
|
|
149
141
|
0;
|
|
150
142
|
return hash;
|
|
151
143
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# PartialOrd
|
|
2
2
|
|
|
3
|
-
The `PartialOrd` macro generates a `compareTo()` method for **partial ordering**
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `PartialOrd` macro generates a `compareTo()` method for **partial ordering** comparison. This is
|
|
4
|
+
analogous to Rust's `PartialOrd` trait, enabling comparison between values where some pairs may be
|
|
5
|
+
incomparable.
|
|
6
6
|
|
|
7
7
|
## Generated Output
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNamePartialCompare(a: TypeName, b: TypeName): Option<number>`
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | --------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
11
|
+
| Class | `classNamePartialCompare(a, b)` + `static compareTo(a, b)` | Standalone function + static wrapper method |
|
|
12
|
+
| Enum | `enumNamePartialCompare(a: EnumName, b: EnumName): Option<number>` | Standalone function returning Option |
|
|
13
|
+
| Interface | `interfaceNamePartialCompare(a: InterfaceName, b: InterfaceName): Option<number>` | Standalone function with Option |
|
|
14
|
+
| Type Alias | `typeNamePartialCompare(a: TypeName, b: TypeName): Option<number>` | Standalone function with Option |
|
|
15
15
|
|
|
16
16
|
## Return Values
|
|
17
17
|
|
|
@@ -43,15 +43,15 @@ Fields are compared **lexicographically** in declaration order:
|
|
|
43
43
|
|
|
44
44
|
## Type-Specific Comparisons
|
|
45
45
|
|
|
46
|
-
| Type
|
|
47
|
-
|
|
48
|
-
| `number`/`bigint` | Direct comparison, returns some()
|
|
49
|
-
| `string`
|
|
50
|
-
| `boolean`
|
|
51
|
-
| null/undefined
|
|
52
|
-
| Arrays
|
|
53
|
-
| `Date`
|
|
54
|
-
| Objects
|
|
46
|
+
| Type | Comparison Method |
|
|
47
|
+
| ----------------- | --------------------------------------------------------- |
|
|
48
|
+
| `number`/`bigint` | Direct comparison, returns some() |
|
|
49
|
+
| `string` | `localeCompare()` wrapped in some() |
|
|
50
|
+
| `boolean` | false < true, wrapped in some() |
|
|
51
|
+
| null/undefined | Returns none() for mismatched nullability |
|
|
52
|
+
| Arrays | Lexicographic, propagates none() on incomparable elements |
|
|
53
|
+
| `Date` | Timestamp comparison, none() if invalid |
|
|
54
|
+
| Objects | Unwraps nested Option from compareTo() |
|
|
55
55
|
|
|
56
56
|
## Field-Level Options
|
|
57
57
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# Serialize
|
|
2
2
|
|
|
3
|
-
The `Serialize` macro generates JSON serialization methods with **cycle detection**
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The `Serialize` macro generates JSON serialization methods with **cycle detection** and object
|
|
4
|
+
identity tracking. This enables serialization of complex object graphs including circular
|
|
5
|
+
references.
|
|
6
6
|
|
|
7
7
|
## Generated Methods
|
|
8
8
|
|
|
9
|
-
| Type
|
|
10
|
-
|
|
11
|
-
| Class
|
|
12
|
-
| Enum
|
|
13
|
-
| Interface
|
|
14
|
-
| Type Alias | `typeNameSerialize(value)`, etc.
|
|
9
|
+
| Type | Generated Code | Description |
|
|
10
|
+
| ---------- | ---------------------------------------------------------- | ------------------------------------------- |
|
|
11
|
+
| Class | `classNameSerialize(value)` + `static serialize(value)` | Standalone function + static wrapper method |
|
|
12
|
+
| Enum | `enumNameSerialize(value)`, `enumNameSerializeWithContext` | Standalone functions |
|
|
13
|
+
| Interface | `interfaceNameSerialize(value)`, etc. | Standalone functions |
|
|
14
|
+
| Type Alias | `typeNameSerialize(value)`, etc. | Standalone functions |
|
|
15
15
|
|
|
16
16
|
## Cycle Detection Protocol
|
|
17
17
|
|
|
@@ -22,29 +22,30 @@ The generated code handles circular references using `__id` and `__ref` markers:
|
|
|
22
22
|
"__type": "User",
|
|
23
23
|
"__id": 1,
|
|
24
24
|
"name": "Alice",
|
|
25
|
-
"friend": { "__ref": 2 }
|
|
25
|
+
"friend": { "__ref": 2 } // Reference to object with __id: 2
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
When an object is serialized:
|
|
30
|
+
|
|
30
31
|
1. Check if it's already been serialized (has an `__id`)
|
|
31
32
|
2. If so, return `{ "__ref": existingId }` instead
|
|
32
33
|
3. Otherwise, register the object and serialize its fields
|
|
33
34
|
|
|
34
35
|
## Type-Specific Serialization
|
|
35
36
|
|
|
36
|
-
| Type
|
|
37
|
-
|
|
38
|
-
| Primitives | Direct value
|
|
39
|
-
| `Date`
|
|
40
|
-
| Arrays
|
|
41
|
-
| `Map<K,V>` | For primitive-like values, `Object.fromEntries(map.entries())`; for `Date`/`Date
|
|
42
|
-
| `Set<T>`
|
|
43
|
-
| Nullable
|
|
44
|
-
| Objects
|
|
45
|
-
|
|
46
|
-
Note: the generator specializes some code paths based on the declared TypeScript type to
|
|
47
|
-
|
|
37
|
+
| Type | Serialization Strategy |
|
|
38
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| Primitives | Direct value |
|
|
40
|
+
| `Date` | `toISOString()` |
|
|
41
|
+
| Arrays | For primitive-like element types, pass through; for `Date`/`Date |
|
|
42
|
+
| `Map<K,V>` | For primitive-like values, `Object.fromEntries(map.entries())`; for `Date`/`Date |
|
|
43
|
+
| `Set<T>` | Convert to array; element handling matches `Array<T>` |
|
|
44
|
+
| Nullable | Include `null` explicitly; for primitive-like and `Date` unions the generator avoids runtime `SerializeWithContext` checks |
|
|
45
|
+
| Objects | Call `SerializeWithContext(ctx)` if available (to support user-defined implementations) |
|
|
46
|
+
|
|
47
|
+
Note: the generator specializes some code paths based on the declared TypeScript type to avoid
|
|
48
|
+
runtime feature detection on primitives and literal unions.
|
|
48
49
|
|
|
49
50
|
## Field-Level Options
|
|
50
51
|
|
package/docs/sections.json
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
1
|
[
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
]
|
|
2
|
+
{
|
|
3
|
+
"id": "debug",
|
|
4
|
+
"title": "Debug",
|
|
5
|
+
"category": "builtin-macros",
|
|
6
|
+
"category_title": "Built-in Macros",
|
|
7
|
+
"path": "builtin-macros/debug.md",
|
|
8
|
+
"use_cases": "toString, debugging, logging, output, print"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "clone",
|
|
12
|
+
"title": "Clone",
|
|
13
|
+
"category": "builtin-macros",
|
|
14
|
+
"category_title": "Built-in Macros",
|
|
15
|
+
"path": "builtin-macros/clone.md",
|
|
16
|
+
"use_cases": "copy, clone, duplicate, shallow copy, immutable"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "default",
|
|
20
|
+
"title": "Default",
|
|
21
|
+
"category": "builtin-macros",
|
|
22
|
+
"category_title": "Built-in Macros",
|
|
23
|
+
"path": "builtin-macros/default.md",
|
|
24
|
+
"use_cases": "default values, factory, initialization, constructor"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "hash",
|
|
28
|
+
"title": "Hash",
|
|
29
|
+
"category": "builtin-macros",
|
|
30
|
+
"category_title": "Built-in Macros",
|
|
31
|
+
"path": "builtin-macros/hash.md",
|
|
32
|
+
"use_cases": "hashCode, hashing, hash map, equality, hash function"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "ord",
|
|
36
|
+
"title": "Ord",
|
|
37
|
+
"category": "builtin-macros",
|
|
38
|
+
"category_title": "Built-in Macros",
|
|
39
|
+
"path": "builtin-macros/ord.md",
|
|
40
|
+
"use_cases": "compareTo, ordering, sorting, comparison, total order"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "partial-eq",
|
|
44
|
+
"title": "PartialEq",
|
|
45
|
+
"category": "builtin-macros",
|
|
46
|
+
"category_title": "Built-in Macros",
|
|
47
|
+
"path": "builtin-macros/partial-eq.md",
|
|
48
|
+
"use_cases": "equals, equality, comparison, value equality"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "partial-ord",
|
|
52
|
+
"title": "PartialOrd",
|
|
53
|
+
"category": "builtin-macros",
|
|
54
|
+
"category_title": "Built-in Macros",
|
|
55
|
+
"path": "builtin-macros/partial-ord.md",
|
|
56
|
+
"use_cases": "compareTo, partial ordering, sorting, nullable comparison"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "serialize",
|
|
60
|
+
"title": "Serialize",
|
|
61
|
+
"category": "builtin-macros",
|
|
62
|
+
"category_title": "Built-in Macros",
|
|
63
|
+
"path": "builtin-macros/serialize.md",
|
|
64
|
+
"use_cases": "toJSON, serialization, json, api, data transfer"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "deserialize/overview",
|
|
68
|
+
"title": "Deserialize: Overview",
|
|
69
|
+
"category": "builtin-macros",
|
|
70
|
+
"category_title": "Built-in Macros",
|
|
71
|
+
"path": "builtin-macros/deserialize/overview.md",
|
|
72
|
+
"use_cases": "fromJSON, deserialization, deserialize, classnamedeserialize(input), enumnamedeserialize(input)",
|
|
73
|
+
"parent_id": "deserialize"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "deserialize/cycleforward-reference-support",
|
|
77
|
+
"title": "Deserialize: Cycle/Forward-Reference Support",
|
|
78
|
+
"category": "builtin-macros",
|
|
79
|
+
"category_title": "Built-in Macros",
|
|
80
|
+
"path": "builtin-macros/deserialize/cycleforward-reference-support.md",
|
|
81
|
+
"use_cases": "fromJSON, deserialization, pendingref, ctx.applypatches(), __ref",
|
|
82
|
+
"parent_id": "deserialize"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "deserialize/validation",
|
|
86
|
+
"title": "Deserialize: Validation",
|
|
87
|
+
"category": "builtin-macros",
|
|
88
|
+
"category_title": "Built-in Macros",
|
|
89
|
+
"path": "builtin-macros/deserialize/validation.md",
|
|
90
|
+
"use_cases": "fromJSON, deserialization, @serde(validate(...)), email, url, uuid",
|
|
91
|
+
"parent_id": "deserialize"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "deserialize/union-type-deserialization",
|
|
95
|
+
"title": "Deserialize: Union Type Deserialization",
|
|
96
|
+
"category": "builtin-macros",
|
|
97
|
+
"category_title": "Built-in Macros",
|
|
98
|
+
"path": "builtin-macros/deserialize/union-type-deserialization.md",
|
|
99
|
+
"use_cases": "fromJSON, deserialization, typeof, __type",
|
|
100
|
+
"parent_id": "deserialize"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "deserialize/example",
|
|
104
|
+
"title": "Deserialize: Example",
|
|
105
|
+
"category": "builtin-macros",
|
|
106
|
+
"category_title": "Built-in Macros",
|
|
107
|
+
"path": "builtin-macros/deserialize/example.md",
|
|
108
|
+
"use_cases": "fromJSON, deserialization",
|
|
109
|
+
"parent_id": "deserialize"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "deserialize",
|
|
113
|
+
"title": "Deserialize",
|
|
114
|
+
"category": "builtin-macros",
|
|
115
|
+
"category_title": "Built-in Macros",
|
|
116
|
+
"path": "builtin-macros/deserialize.md",
|
|
117
|
+
"use_cases": "fromJSON, deserialization, parsing, validation, json",
|
|
118
|
+
"is_chunked": true,
|
|
119
|
+
"chunk_ids": [
|
|
120
|
+
"deserialize/overview",
|
|
121
|
+
"deserialize/cycleforward-reference-support",
|
|
122
|
+
"deserialize/validation",
|
|
123
|
+
"deserialize/union-type-deserialization",
|
|
124
|
+
"deserialize/example"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
]
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"main": "dist/index.js",
|
|
26
26
|
"name": "@macroforge/mcp-server",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"macroforge": "^0.1.
|
|
28
|
+
"macroforge": "^0.1.75"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"macroforge": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"test": "node --test tests/**/*.test.js"
|
|
47
47
|
},
|
|
48
48
|
"type": "module",
|
|
49
|
-
"version": "0.1.
|
|
49
|
+
"version": "0.1.75"
|
|
50
50
|
}
|