@fluojs/serialization 1.0.0-beta.5 → 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.
- package/README.ko.md +2 -0
- package/README.md +2 -0
- package/dist/decorators/expose.d.ts.map +1 -1
- package/dist/decorators/expose.js +5 -3
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -109,6 +109,8 @@ fluo의 직렬화 엔진은 활성 순환 참조를 자동으로 감지하고 `u
|
|
|
109
109
|
|
|
110
110
|
기반 클래스에 선언한 직렬화 메타데이터는 파생 DTO에도 상속됩니다. 공통 필드에 적용한 `@Expose()`, `@Exclude()`, `@Transform()` 규칙은 서브클래스 인스턴스를 직렬화할 때도 그대로 반영됩니다.
|
|
111
111
|
|
|
112
|
+
Class-level `excludeExtraneous`도 일반 상속 규칙을 따릅니다. 파생 클래스에 option 없는 `@Expose()`를 붙여도 가장 가까운 상속 설정이 유지되므로, expose-only 기반 DTO는 subclass에서도 expose-only 상태를 유지합니다. 일반 enumerable field를 다시 포함하려는 의도가 있을 때만 파생 클래스에 `@Expose({ excludeExtraneous: false })`를 명시하세요. 이 경우에도 상속된 field-level `@Exclude()` metadata는 계속 적용됩니다.
|
|
113
|
+
|
|
112
114
|
Decorated metadata가 없는 class instance도 재귀적으로 순회하므로, parent object에 serialization metadata가 없어도 decorated nested descendant는 반영됩니다.
|
|
113
115
|
|
|
114
116
|
### 일반 객체 안전성
|
package/README.md
CHANGED
|
@@ -109,6 +109,8 @@ The serializer cuts active cyclic references safely instead of recursing forever
|
|
|
109
109
|
|
|
110
110
|
Serialization metadata declared on a base class is inherited by derived DTOs. `@Expose()`, `@Exclude()`, and `@Transform()` rules applied to shared base fields still take effect when you serialize subclass instances.
|
|
111
111
|
|
|
112
|
+
Class-level `excludeExtraneous` also follows normal inheritance. A derived class with `@Expose()` and no options keeps the nearest inherited setting, so an expose-only base DTO remains expose-only in subclasses. Use `@Expose({ excludeExtraneous: false })` on the derived class only when you intentionally want to re-enable ordinary enumerable fields while still honoring inherited field-level `@Exclude()` metadata.
|
|
113
|
+
|
|
112
114
|
Undecorated class instances are still traversed recursively, so decorated nested descendants are respected even when the parent object has no serialization metadata.
|
|
113
115
|
|
|
114
116
|
### Plain-object safety
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expose.d.ts","sourceRoot":"","sources":["../../src/decorators/expose.ts"],"names":[],"mappings":"AAIA,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAC1F,KAAK,wBAAwB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;AAG1H,KAAK,yBAAyB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,yBAAyB,
|
|
1
|
+
{"version":3,"file":"expose.d.ts","sourceRoot":"","sources":["../../src/decorators/expose.ts"],"names":[],"mappings":"AAIA,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAC1F,KAAK,wBAAwB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;AAG1H,KAAK,yBAAyB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,yBAAyB,CAqB9E"}
|
|
@@ -25,9 +25,11 @@ import { updateClassSerializationOptions, updateFieldSerializationMetadata } fro
|
|
|
25
25
|
export function Expose(options) {
|
|
26
26
|
const decorator = (_value, context) => {
|
|
27
27
|
if (context.kind === 'class') {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(options ?? {}, 'excludeExtraneous')) {
|
|
29
|
+
updateClassSerializationOptions(context.metadata, {
|
|
30
|
+
excludeExtraneous: options?.excludeExtraneous
|
|
31
|
+
});
|
|
32
|
+
}
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
updateFieldSerializationMetadata(context.metadata, context.name, current => ({
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"output",
|
|
10
10
|
"transform"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0
|
|
12
|
+
"version": "1.0.0",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.0
|
|
40
|
-
"@fluojs/http": "^1.0.0
|
|
39
|
+
"@fluojs/core": "^1.0.0",
|
|
40
|
+
"@fluojs/http": "^1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "^3.2.4"
|