@fluojs/serialization 1.0.3 → 1.0.4

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 CHANGED
@@ -126,6 +126,7 @@ Decorated metadata가 없는 class instance도 재귀적으로 순회하므로,
126
126
  - **데코레이터**: `Expose`, `Exclude`, `Transform`
127
127
  - **엔진**: `serialize(value)`는 class instance, 배열, plain object, mixed graph를 재귀적으로 순회하며, 직접 transform하지 않은 opaque built-in 및 non-JSON leaf 값은 보존합니다.
128
128
  - **HTTP 통합**: `SerializerInterceptor`는 아직 commit되지 않은 handler 결과를 직렬화하고, response가 이미 commit된 뒤에는 handler 소유 값을 그대로 반환합니다.
129
+ - **타입**: `TransformFunction`은 `Transform(...)`에 전달하는 callback 타입으로 root entrypoint에서 export됩니다.
129
130
 
130
131
  `Expose`는 class와 field에 적용할 수 있습니다. `Exclude`와 `Transform`은 field에 적용합니다.
131
132
 
package/README.md CHANGED
@@ -126,6 +126,7 @@ Undecorated class instances are still traversed recursively, so decorated nested
126
126
  - **Decorators**: `Expose`, `Exclude`, `Transform`
127
127
  - **Engine**: `serialize(value)` recursively walks class instances, arrays, plain objects, and mixed graphs while preserving opaque built-ins and non-JSON leaf values unless you transform them
128
128
  - **HTTP integration**: `SerializerInterceptor` serializes uncommitted handler results and returns handler-owned values unchanged after the response has already been committed
129
+ - **Types**: `TransformFunction` is exported from the root entrypoint for callbacks passed to `Transform(...)`
129
130
 
130
131
  `Expose` can be applied to classes and fields. `Exclude` and `Transform` apply to fields.
131
132
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './decorators/exclude.js';
2
2
  export * from './decorators/expose.js';
3
3
  export * from './decorators/transform.js';
4
+ export type { TransformFunction } from './metadata.js';
4
5
  export * from './serialize.js';
5
6
  export * from './serializer-interceptor.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -2,4 +2,5 @@ export * from './decorators/exclude.js';
2
2
  export * from './decorators/expose.js';
3
3
  export * from './decorators/transform.js';
4
4
  export * from './serialize.js';
5
- export * from './serializer-interceptor.js';
5
+ export * from './serializer-interceptor.js';
6
+ export {};
@@ -1,4 +1,4 @@
1
- import { type MetadataPropertyKey } from '@fluojs/core';
1
+ import type { MetadataPropertyKey } from '@fluojs/core';
2
2
  /**
3
3
  * Defines the transform function type.
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKxD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAClC;AA8DD;;;;;GAKG;AACH,wBAAgB,+BAA+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BAAgB,4BAA4B,CAAC,WAAW,EAAE,QAAQ,GAAG,yBAAyB,CAQ7F;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,QAAQ,GAAG,GAAG,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAuBzH"}
package/dist/metadata.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ensureMetadataSymbol, getOwnStandardConstructorMetadataBag } from '@fluojs/core/internal';
1
+ import { getOwnStandardConstructorMetadataBag } from '@fluojs/core/internal';
2
2
 
3
3
  /**
4
4
  * Defines the transform function type.
@@ -14,7 +14,6 @@ import { ensureMetadataSymbol, getOwnStandardConstructorMetadataBag } from '@flu
14
14
 
15
15
  const standardSerializationClassMetadataKey = Symbol.for('fluo.standard.serialization.class');
16
16
  const standardSerializationFieldMetadataKey = Symbol.for('fluo.standard.serialization.field');
17
- ensureMetadataSymbol();
18
17
  function getStandardMetadataBag(metadata) {
19
18
  if (metadata === null || metadata === undefined) {
20
19
  throw new Error('Decorator metadata is not available. Ensure your environment supports TC39 decorator metadata (Stage 3).');
@@ -86,10 +85,11 @@ export function updateFieldSerializationMetadata(metadata, propertyKey, update)
86
85
  * @returns The get class serialization options result.
87
86
  */
88
87
  export function getClassSerializationOptions(constructor) {
89
- return getConstructorMetadataBags(constructor).reduce((options, bag) => ({
90
- ...options,
91
- ...bag[standardSerializationClassMetadataKey]
92
- }), {});
88
+ const options = {};
89
+ for (const bag of getConstructorMetadataBags(constructor)) {
90
+ Object.assign(options, bag[standardSerializationClassMetadataKey]);
91
+ }
92
+ return options;
93
93
  }
94
94
 
95
95
  /**
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "output",
10
10
  "transform"
11
11
  ],
12
- "version": "1.0.3",
12
+ "version": "1.0.4",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {