This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git


The following commit(s) were added to refs/heads/main by this push:
     new 39700abe2 chore(javascript): rename ref tracking to ref (#3559)
39700abe2 is described below

commit 39700abe2b03046e652d725487a21a2191949296
Author: Shawn Yang <[email protected]>
AuthorDate: Mon Apr 13 15:56:43 2026 +0800

    chore(javascript): rename ref tracking to ref (#3559)
    
    ## Why?
    
    
    
    ## What does this PR do?
    
    
    
    ## Related issues
    
    
    
    ## AI Contribution Checklist
    
    
    
    - [ ] Substantial AI assistance was used in this PR: `yes` / `no`
    - [ ] If `yes`, I included a completed [AI Contribution
    
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
    in this PR description and the required `AI Usage Disclosure`.
    - [ ] If `yes`, my PR description includes the required `ai_review`
    summary and screenshot evidence of the final clean AI review results
    from both fresh reviewers on the current PR diff or current HEAD after
    the latest code changes.
    
    
    
    ## Does this PR introduce any user-facing change?
    
    
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
---
 javascript/benchmark/index.js                  |  2 +-
 javascript/benchmark/map.js                    |  2 +-
 javascript/packages/core/lib/context.ts        |  3 +-
 javascript/packages/core/lib/fory.ts           |  2 +-
 javascript/packages/core/lib/gen/serializer.ts |  2 +-
 javascript/packages/core/lib/type.ts           |  2 +-
 javascript/packages/core/lib/typeResolver.ts   |  2 ++
 javascript/test/array.test.ts                  | 13 ++++----
 javascript/test/binary.test.ts                 |  3 +-
 javascript/test/bool.test.ts                   |  5 ++-
 javascript/test/crossLanguage.test.ts          | 10 +++---
 javascript/test/datetime.test.ts               |  5 ++-
 javascript/test/depthLimit.test.ts             |  6 ++--
 javascript/test/enum.test.ts                   |  9 +++---
 javascript/test/map.test.ts                    |  5 ++-
 javascript/test/number.test.ts                 | 43 +++++++++++++-------------
 javascript/test/object.test.ts                 | 20 ++++++------
 javascript/test/protocol/struct.test.ts        |  3 +-
 javascript/test/set.test.ts                    |  5 ++-
 javascript/test/sizeLimit.test.ts              | 30 +++++++++---------
 20 files changed, 83 insertions(+), 89 deletions(-)

diff --git a/javascript/benchmark/index.js b/javascript/benchmark/index.js
index 1e60705f6..ddbe45bf3 100644
--- a/javascript/benchmark/index.js
+++ b/javascript/benchmark/index.js
@@ -20,7 +20,7 @@
 const Fory = require("@apache-fory/core");
 const utils = require("@apache-fory/core/dist/lib/util");
 const hps = require('@apache-fory/hps').default;
-const fory = new Fory.default({ hps, refTracking: false, useSliceString: true 
});
+const fory = new Fory.default({ hps, ref: false, useSliceString: true });
 const Benchmark = require("benchmark");
 const protobuf = require("protobufjs");
 const path = require('path');
diff --git a/javascript/benchmark/map.js b/javascript/benchmark/map.js
index e0245c9e3..3d3fd4bcb 100644
--- a/javascript/benchmark/map.js
+++ b/javascript/benchmark/map.js
@@ -21,7 +21,7 @@ const Fory = require("@apache-fory/core");
 const beautify = require("js-beautify");
 const hps = require('@apache-fory/hps');
 const fory = new Fory.default({
-  hps, refTracking: false, useSliceString: true, hooks: {
+  hps, ref: false, useSliceString: true, hooks: {
     afterCodeGenerated: (code) => {
       return beautify.js(code, { indent_size: 2, space_in_empty_paren: true, 
indent_empty_lines: true });
     }
diff --git a/javascript/packages/core/lib/context.ts 
b/javascript/packages/core/lib/context.ts
index 362eccf6e..6a7db8292 100644
--- a/javascript/packages/core/lib/context.ts
+++ b/javascript/packages/core/lib/context.ts
@@ -26,6 +26,7 @@ import { Config, RefFlags, Serializer, TypeId } from "./type";
 
 type TypeResolverLike = {
   config: Config;
+  trackingRef: boolean;
   computeTypeId(typeInfo: TypeInfo): number;
   getSerializerById(id: number, userTypeId?: number): Serializer | undefined;
   getSerializerByName(name: string): Serializer | undefined;
@@ -227,7 +228,7 @@ export class WriteContext {
       this.writer.writeInt8(RefFlags.NullFlag);
       return true;
     }
-    if (this.typeResolver.config.refTracking === true) {
+    if (this.typeResolver.trackingRef) {
       const refId = this.refWriter.getWrittenRefId(object);
       if (typeof refId === "number") {
         this.writer.writeInt8(RefFlags.RefFlag);
diff --git a/javascript/packages/core/lib/fory.ts 
b/javascript/packages/core/lib/fory.ts
index 468796f8a..8066698c7 100644
--- a/javascript/packages/core/lib/fory.ts
+++ b/javascript/packages/core/lib/fory.ts
@@ -61,7 +61,7 @@ export default class Fory {
 
   private initConfig(config: Partial<Config> | undefined) {
     return {
-      refTracking: config?.refTracking !== null ? Boolean(config?.refTracking) 
: null,
+      ref: Boolean(config?.ref),
       useSliceString: Boolean(config?.useSliceString),
       maxDepth: config?.maxDepth,
       maxBinarySize: config?.maxBinarySize,
diff --git a/javascript/packages/core/lib/gen/serializer.ts 
b/javascript/packages/core/lib/gen/serializer.ts
index 761670f48..b2a545a7c 100644
--- a/javascript/packages/core/lib/gen/serializer.ts
+++ b/javascript/packages/core/lib/gen/serializer.ts
@@ -77,7 +77,7 @@ export abstract class BaseSerializerGenerator implements 
SerializerGenerator {
     if (refTrackingUnableTypeId(this.getTypeId())) {
       return false;
     }
-    if (this.builder.resolver.config.refTracking !== true) {
+    if (!this.builder.resolver.trackingRef) {
       return false;
     }
     if (typeof this.typeInfo.trackingRef === "boolean") {
diff --git a/javascript/packages/core/lib/type.ts 
b/javascript/packages/core/lib/type.ts
index 53fe26f11..fb9f22ab1 100644
--- a/javascript/packages/core/lib/type.ts
+++ b/javascript/packages/core/lib/type.ts
@@ -260,7 +260,7 @@ export enum Mode {
 
 export interface Config {
   hps?: Hps;
-  refTracking: boolean | null;
+  ref: boolean;
   useSliceString: boolean;
   maxDepth?: number;
   maxBinarySize?: number;
diff --git a/javascript/packages/core/lib/typeResolver.ts 
b/javascript/packages/core/lib/typeResolver.ts
index 1c0c5a336..f0b698032 100644
--- a/javascript/packages/core/lib/typeResolver.ts
+++ b/javascript/packages/core/lib/typeResolver.ts
@@ -79,6 +79,7 @@ const uninitSerialize = {
 };
 
 export default class TypeResolver {
+  readonly trackingRef: boolean;
   private internalSerializer: Serializer[] = new Array(300);
   private customSerializer: Map<number | string, Serializer> = new Map();
 
@@ -108,6 +109,7 @@ export default class TypeResolver {
   private float64ArraySerializer: null | Serializer = null;
 
   constructor(readonly config: Config) {
+    this.trackingRef = config.ref;
   }
 
   bindContexts(writeContext: WriteContext, readContext: ReadContext) {
diff --git a/javascript/test/array.test.ts b/javascript/test/array.test.ts
index 20944b491..7381d230b 100644
--- a/javascript/test/array.test.ts
+++ b/javascript/test/array.test.ts
@@ -34,7 +34,7 @@ describe('array', () => {
         a: Type.string()
       }))
     });
-    const fory = new Fory({ refTracking: true, hooks: {
+    const fory = new Fory({ ref: true, hooks: {
         afterCodeGenerated: (code: string) => {
           return beautify.js(code, { indent_size: 2, space_in_empty_paren: 
true, indent_empty_lines: true });
         }
@@ -54,7 +54,7 @@ describe('array', () => {
       a6: Type.float64Array()
     });
 
-    const fory = new Fory({ refTracking: true }); 
+    const fory = new Fory({ ref: true }); 
     const serializer = fory.register(typeinfo).serializer;
     const input = fory.serialize({
       a: [true, false],
@@ -83,7 +83,7 @@ describe('array', () => {
       a5: Type.float32Array(),
     })
 
-    const fory = new Fory({ refTracking: true }); const serialize = 
fory.register(typeinfo).serializer;
+    const fory = new Fory({ ref: true }); const serialize = 
fory.register(typeinfo).serializer;
     const input = fory.serialize({
       a5: new Float32Array([2.43, 654.4, 55]),
     }, serialize);
@@ -102,7 +102,7 @@ describe('array', () => {
       a6: Type.float16Array(),
     })
 
-    const fory = new Fory({ refTracking: true }); const serialize = 
fory.register(typeinfo).serializer;
+    const fory = new Fory({ ref: true }); const serialize = 
fory.register(typeinfo).serializer;
     const input = fory.serialize({
       a6: [1.5, 2.5, -4.5],
     }, serialize);
@@ -120,7 +120,7 @@ describe('array', () => {
     }, {
       a7: Type.bfloat16Array(),
     });
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serialize = fory.register(typeinfo).serializer;
     const input = fory.serialize({
       a7: [1.5, 2.5, -4.5],
@@ -138,7 +138,7 @@ describe('array', () => {
     }, {
       a7: Type.bfloat16Array(),
     });
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serialize = fory.register(typeinfo).serializer;
     const arr = new BFloat16Array([1.25, -2.5, 0]);
     const input = fory.serialize({ a7: arr }, serialize);
@@ -150,4 +150,3 @@ describe('array', () => {
   });
 });
 
-
diff --git a/javascript/test/binary.test.ts b/javascript/test/binary.test.ts
index c82015474..7c94fbc34 100644
--- a/javascript/test/binary.test.ts
+++ b/javascript/test/binary.test.ts
@@ -27,7 +27,7 @@ describe('binary', () => {
             a: Type.binary()
         })
 
-        const fory = new Fory({ refTracking: true });    
+        const fory = new Fory({ ref: true });    
         const serializer = fory.register(typeinfo).serializer;
         const input = fory.serialize({ a: new Uint8Array([1, 2, 3]) }, 
serializer);
         const result = fory.deserialize(
@@ -40,4 +40,3 @@ describe('binary', () => {
     });
 });
 
-
diff --git a/javascript/test/bool.test.ts b/javascript/test/bool.test.ts
index 69db08e4f..ddd6df415 100644
--- a/javascript/test/bool.test.ts
+++ b/javascript/test/bool.test.ts
@@ -23,7 +23,7 @@ import {describe, expect, test} from '@jest/globals';
 describe('bool', () => {
   test('should false work', () => {
     
-    const fory = new Fory({ refTracking: true });    
+    const fory = new Fory({ ref: true });    
     const input = fory.serialize(false);
     const result = fory.deserialize(
         input
@@ -32,7 +32,7 @@ describe('bool', () => {
   });
   test('should true work', () => {
     
-    const fory = new Fory({ refTracking: true });    
+    const fory = new Fory({ ref: true });    
     const input = fory.serialize(true);
     const result = fory.deserialize(
         input
@@ -41,4 +41,3 @@ describe('bool', () => {
   });
 });
 
-
diff --git a/javascript/test/crossLanguage.test.ts 
b/javascript/test/crossLanguage.test.ts
index 66f06cc52..b58534ab4 100644
--- a/javascript/test/crossLanguage.test.ts
+++ b/javascript/test/crossLanguage.test.ts
@@ -680,7 +680,7 @@ describe("bool", () => {
   test("test_collection_element_ref_override", () => {
     const fory = new Fory({
       compatible: false,
-      refTracking: true,
+      ref: true,
       hooks: {
         afterCodeGenerated: (code) => {
           return beautify.js(code, { indent_size: 2, space_in_empty_paren: 
true, indent_empty_lines: true });
@@ -1596,7 +1596,7 @@ describe("bool", () => {
   test("test_ref_schema_consistent", () => {
     const fory = new Fory({
       compatible: false,
-      refTracking: true,
+      ref: true,
     });
 
     @Type.struct(501, {
@@ -1633,7 +1633,7 @@ describe("bool", () => {
   test("test_ref_compatible", () => {
     const fory = new Fory({
       compatible: true,
-      refTracking: true,
+      ref: true,
     });
 
     @Type.struct(503, {
@@ -1670,7 +1670,7 @@ describe("bool", () => {
   test("test_circular_ref_schema_consistent", () => {
     const fory = new Fory({
       compatible: false,
-      refTracking: true,
+      ref: true,
     });
 
     @Type.struct(601, {
@@ -1699,7 +1699,7 @@ describe("bool", () => {
   test("test_circular_ref_compatible", () => {
     const fory = new Fory({
       compatible: true,
-      refTracking: true,
+      ref: true,
     });
 
     @Type.struct(602, {
diff --git a/javascript/test/datetime.test.ts b/javascript/test/datetime.test.ts
index 9c074560b..8bbbfdc58 100644
--- a/javascript/test/datetime.test.ts
+++ b/javascript/test/datetime.test.ts
@@ -23,7 +23,7 @@ import {describe, expect, test} from '@jest/globals';
 describe('datetime', () => {
   test('should date work', () => {
     
-    const fory = new Fory({ refTracking: true });    
+    const fory = new Fory({ ref: true });    
     const now = new Date();
     const input = fory.serialize(now);
     const result: Date | null = fory.deserialize(
@@ -37,7 +37,7 @@ describe('datetime', () => {
       a: Type.timestamp(),
       b: Type.duration(),
     })
-    const fory = new Fory({ refTracking: true });    
+    const fory = new Fory({ ref: true });    
     const serializer = fory.register(typeinfo).serializer;
     const d = new Date('2021/10/20 09:13');
     const input = fory.serialize({ a:  d, b: d}, serializer);
@@ -48,4 +48,3 @@ describe('datetime', () => {
   });
 });
 
-
diff --git a/javascript/test/depthLimit.test.ts 
b/javascript/test/depthLimit.test.ts
index f9ce85d05..da69ac237 100644
--- a/javascript/test/depthLimit.test.ts
+++ b/javascript/test/depthLimit.test.ts
@@ -363,10 +363,10 @@ describe('depth-limit', () => {
   });
 
   describe('configuration with other options', () => {
-    test('should work with refTracking enabled', () => {
+    test('should work with ref enabled', () => {
       const fory = new Fory({
         maxDepth: 50,
-        refTracking: true,
+        ref: true,
       });
       expect(fory.readContext.maxDepth).toBe(50);
     });
@@ -390,7 +390,7 @@ describe('depth-limit', () => {
     test('should work with all options combined', () => {
       const fory = new Fory({
         maxDepth: 100,
-        refTracking: true,
+        ref: true,
         compatible: true,
         useSliceString: true,
       });
diff --git a/javascript/test/enum.test.ts b/javascript/test/enum.test.ts
index 82cdf439b..4d5f72cb4 100644
--- a/javascript/test/enum.test.ts
+++ b/javascript/test/enum.test.ts
@@ -26,7 +26,7 @@ describe('enum', () => {
             f1: 1,
             f2: 2
         }
-        const fory = new Fory({ refTracking: true });   
+        const fory = new Fory({ ref: true });   
         const {serialize, deserialize} = 
fory.register(Type.enum("example.foo", Foo)) 
         const input = serialize(Foo.f1);
         const result = deserialize(
@@ -40,7 +40,7 @@ describe('enum', () => {
             f1: "hello",
             f2: "world"
         }
-        const fory = new Fory({ refTracking: true });   
+        const fory = new Fory({ ref: true });   
         fory.register(Type.enum("example.foo", Foo)) 
         const input = fory.serialize(Foo.f1);
         const result = fory.deserialize(
@@ -53,7 +53,7 @@ describe('enum', () => {
         f1 = 1,
         f2 = 2
     }
-    const fory = new Fory({ refTracking: true });   
+    const fory = new Fory({ ref: true });   
     const {serialize, deserialize} = fory.register(Type.enum("example.foo", 
Foo)) 
     const input = serialize(Foo.f1);
     const result = deserialize(
@@ -67,7 +67,7 @@ describe('enum', () => {
         f1 = "hello",
         f2 = "world"
     }
-    const fory = new Fory({ refTracking: true });   
+    const fory = new Fory({ ref: true });   
     fory.register(Type.enum("example.foo", Foo)) 
     const input = fory.serialize(Foo.f1);
     const result = fory.deserialize(
@@ -77,4 +77,3 @@ describe('enum', () => {
   });
 });
 
-
diff --git a/javascript/test/map.test.ts b/javascript/test/map.test.ts
index 98fc5ff69..b60cca8dc 100644
--- a/javascript/test/map.test.ts
+++ b/javascript/test/map.test.ts
@@ -23,7 +23,7 @@ import {describe, expect, test} from '@jest/globals';
 describe('map', () => {
   test('should map work', () => {
     
-    const fory = new Fory({ refTracking: true });    
+    const fory = new Fory({ ref: true });    
     const input = fory.serialize(new Map([["foo", "bar"], ["foo2", "bar2"]]));
     const result = fory.deserialize(
         input
@@ -33,7 +33,7 @@ describe('map', () => {
   
   test('should map specific type work', () => {
     
-    const fory = new Fory({ refTracking: true });  
+    const fory = new Fory({ ref: true });  
     const { serialize, deserialize } = fory.register(Type.struct("class.foo", {
       f1: Type.map(Type.string(), Type.varInt32())
     }))  
@@ -45,4 +45,3 @@ describe('map', () => {
   });
 });
 
-
diff --git a/javascript/test/number.test.ts b/javascript/test/number.test.ts
index 3b52003f7..9cd81b2c6 100644
--- a/javascript/test/number.test.ts
+++ b/javascript/test/number.test.ts
@@ -23,7 +23,7 @@ import { describe, expect, test } from '@jest/globals';
 describe('number', () => {
   test('should i8 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serialize = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -37,7 +37,7 @@ describe('number', () => {
   });
   test('should i16 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serialize = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -51,7 +51,7 @@ describe('number', () => {
   });
   test('should i32 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -65,7 +65,7 @@ describe('number', () => {
   });
   test('should i64 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -81,7 +81,7 @@ describe('number', () => {
 
   test('should float32 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -95,7 +95,7 @@ describe('number', () => {
   });
   test('should float64 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -110,7 +110,7 @@ describe('number', () => {
 
   test('should float16 work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -125,7 +125,7 @@ describe('number', () => {
 
   test('should float16 NAN work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -140,7 +140,7 @@ describe('number', () => {
 
   test('should float16 Infinity work', () => {
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -154,7 +154,7 @@ describe('number', () => {
   });
 
   test('should bfloat16 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -167,7 +167,7 @@ describe('number', () => {
   });
 
   test('should bfloat16 accept number', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -180,7 +180,7 @@ describe('number', () => {
   });
 
   test('should bfloat16 NaN work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -193,7 +193,7 @@ describe('number', () => {
   });
 
   test('should bfloat16 Infinity work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -206,7 +206,7 @@ describe('number', () => {
   });
 
   test('should bfloat16 zero and neg zero round-trip', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -222,7 +222,7 @@ describe('number', () => {
   });
 
   test('should uint8 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -234,7 +234,7 @@ describe('number', () => {
   });
 
   test('should uint16 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -246,7 +246,7 @@ describe('number', () => {
   });
 
   test('should uint32 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -258,7 +258,7 @@ describe('number', () => {
   });
 
   test('should varUInt32 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -270,7 +270,7 @@ describe('number', () => {
   });
 
   test('should uint64 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -282,7 +282,7 @@ describe('number', () => {
   });
 
   test('should varUInt64 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -294,7 +294,7 @@ describe('number', () => {
   });
 
   test('should taggedUInt64 work', () => {
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(Type.struct({
       typeName: "example.foo"
     }, {
@@ -306,4 +306,3 @@ describe('number', () => {
   });
 });
 
-
diff --git a/javascript/test/object.test.ts b/javascript/test/object.test.ts
index eb51c0c82..3319a97b8 100644
--- a/javascript/test/object.test.ts
+++ b/javascript/test/object.test.ts
@@ -30,7 +30,7 @@ describe('object', () => {
       @Type.int32()
       a: number;
     }
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(Foo);
     const foo = new Foo();
     foo.a = 123;
@@ -50,7 +50,7 @@ describe('object', () => {
       @Type.int32()
       a: number;
     }
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     fory.register(Foo);
 
     const foo = new Foo();
@@ -68,7 +68,7 @@ describe('object', () => {
       })
     })
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(typeInfo);
     const input = serialize({ a: { b: "hel" } });
     const result = deserialize(
@@ -84,7 +84,7 @@ describe('object', () => {
         b: Type.string()
       }).setNullable(true)
     })
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(typeInfo);
     const input = serialize({ a: null });
     const result = deserialize(
@@ -104,7 +104,7 @@ describe('object', () => {
       }))
     })
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(typeInfo).serializer;
     const input = fory.serialize({ a: [{ b: "hel", c: true, d: 123, e: 123, f: 
new Uint8Array([1, 2, 3]) }] }, serializer);
     const result = fory.deserialize(
@@ -121,7 +121,7 @@ describe('object', () => {
       }),
       a2: Type.struct("example.bar")
     });
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const serializer = fory.register(typeInfo).serializer;
     const input = fory.serialize({ a: { b: "hel" }, a2: { b: "hel2" } }, 
serializer);
     const result = fory.deserialize(
@@ -139,7 +139,7 @@ describe('object', () => {
     })
 
     const fory = new Fory({
-      refTracking: true, 
+      ref: true, 
       hooks: {
         afterCodeGenerated: (code) => {
           return beautify.js(code, { indent_size: 2, space_in_empty_paren: 
true, indent_empty_lines: true });
@@ -168,7 +168,7 @@ describe('object', () => {
       }),
     })
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(typeInfo);
     const input = serialize({ "+a": { "delete": "hel", c: [{ d: "hello" }] } 
});
     const result = deserialize(
@@ -188,7 +188,7 @@ describe('object', () => {
       }),
     })
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(typeInfo);
     const input = serialize({ a: { b: "hel", c: [{ d: "hello" }] } });
     const result = deserialize(
@@ -218,7 +218,7 @@ describe('object', () => {
       a: Type.string()
     });
 
-    const fory = new Fory({ refTracking: true });
+    const fory = new Fory({ ref: true });
     const { serialize, deserialize } = fory.register(typeInfo);
     const input = serialize({ a: "Hello, world! 🌍😊" });
     const result = deserialize(input);
diff --git a/javascript/test/protocol/struct.test.ts 
b/javascript/test/protocol/struct.test.ts
index 0e4f29e08..0ff71d3c0 100644
--- a/javascript/test/protocol/struct.test.ts
+++ b/javascript/test/protocol/struct.test.ts
@@ -24,7 +24,7 @@ import { describe, expect, test } from '@jest/globals';
 describe('protocol', () => {
     test('should polymorphic work', () => {
 
-        const fory = new Fory({ refTracking: true });
+        const fory = new Fory({ ref: true });
         const { serialize, deserialize } = fory.register(Type.struct({
             typeName: "example.foo"
         }, {
@@ -91,4 +91,3 @@ describe('protocol', () => {
 
 
 
-
diff --git a/javascript/test/set.test.ts b/javascript/test/set.test.ts
index fddfae3f8..fbf275c4b 100644
--- a/javascript/test/set.test.ts
+++ b/javascript/test/set.test.ts
@@ -23,7 +23,7 @@ import { describe, expect, test } from '@jest/globals';
 describe('set', () => {
     test('should set work', () => {
         
-        const fory = new Fory({ refTracking: true });    
+        const fory = new Fory({ ref: true });    
         const input = fory.serialize(new Set(["foo1", "bar1", "cc2"]));
         const result = fory.deserialize(
             input
@@ -37,7 +37,7 @@ describe('set', () => {
             a: Type.set(Type.string())
         });
         
-        const fory = new Fory({ refTracking: true });    
+        const fory = new Fory({ ref: true });    
         const { serialize, deserialize } = fory.register(typeinfo);
         const input = serialize({ a: new Set(["foo1", "bar2"]) });
         const result = deserialize(
@@ -47,4 +47,3 @@ describe('set', () => {
     });
 });
 
-
diff --git a/javascript/test/sizeLimit.test.ts 
b/javascript/test/sizeLimit.test.ts
index 5bd94ba5f..877d988f4 100644
--- a/javascript/test/sizeLimit.test.ts
+++ b/javascript/test/sizeLimit.test.ts
@@ -79,7 +79,7 @@ describe('size-limit guardrails', () => {
         maxDepth: 100,
         maxBinarySize: 1024,
         maxCollectionSize: 500,
-        refTracking: true,
+        ref: true,
         compatible: true,
       });
       expect(fory.readContext.maxDepth).toBe(100);
@@ -165,7 +165,7 @@ describe('size-limit guardrails', () => {
 
   describe('set deserialization with maxCollectionSize', () => {
     test('should deserialize set within limit', () => {
-      const fory = new Fory({ maxCollectionSize: 10, refTracking: true });
+      const fory = new Fory({ maxCollectionSize: 10, ref: true });
       const { serialize, deserialize } = fory.register(Type.set(Type.int32()));
       const data = new Set([1, 2, 3]);
       const result = deserialize(serialize(data));
@@ -173,11 +173,11 @@ describe('size-limit guardrails', () => {
     });
 
     test('should throw when set exceeds maxCollectionSize', () => {
-      const serializeFory = new Fory({ refTracking: true });
+      const serializeFory = new Fory({ ref: true });
       const { serialize } = serializeFory.register(Type.set(Type.int32()));
       const bytes = serialize(new Set([1, 2, 3, 4, 5]));
 
-      const deserializeFory = new Fory({ maxCollectionSize: 3, refTracking: 
true });
+      const deserializeFory = new Fory({ maxCollectionSize: 3, ref: true });
       const { deserialize } = deserializeFory.register(Type.set(Type.int32()));
       expect(() => deserialize(bytes)).toThrow('exceeds maxCollectionSize');
     });
@@ -185,7 +185,7 @@ describe('size-limit guardrails', () => {
 
   describe('map deserialization with maxCollectionSize', () => {
     test('should deserialize map within limit', () => {
-      const fory = new Fory({ maxCollectionSize: 10, refTracking: true });
+      const fory = new Fory({ maxCollectionSize: 10, ref: true });
       const { serialize, deserialize } = fory.register(
         Type.map(Type.string(), Type.int32())
       );
@@ -195,13 +195,13 @@ describe('size-limit guardrails', () => {
     });
 
     test('should throw when map exceeds maxCollectionSize', () => {
-      const serializeFory = new Fory({ refTracking: true });
+      const serializeFory = new Fory({ ref: true });
       const { serialize } = serializeFory.register(
         Type.map(Type.string(), Type.int32())
       );
       const bytes = serialize(new Map([['a', 1], ['b', 2], ['c', 3], ['d', 
4]]));
 
-      const deserializeFory = new Fory({ maxCollectionSize: 2, refTracking: 
true });
+      const deserializeFory = new Fory({ maxCollectionSize: 2, ref: true });
       const { deserialize } = deserializeFory.register(
         Type.map(Type.string(), Type.int32())
       );
@@ -211,7 +211,7 @@ describe('size-limit guardrails', () => {
 
   describe('binary deserialization with maxBinarySize', () => {
     test('should deserialize binary within limit', () => {
-      const fory = new Fory({ maxBinarySize: 1024, refTracking: true });
+      const fory = new Fory({ maxBinarySize: 1024, ref: true });
       const { serialize, deserialize } = 
fory.register(Type.struct("test.binary", {
         data: Type.binary(),
       }));
@@ -223,13 +223,13 @@ describe('size-limit guardrails', () => {
     });
 
     test('should throw when binary exceeds maxBinarySize', () => {
-      const serializeFory = new Fory({ refTracking: true });
+      const serializeFory = new Fory({ ref: true });
       const { serialize } = serializeFory.register(Type.struct("test.binary2", 
{
         data: Type.binary(),
       }));
       const bytes = serialize({ data: new Uint8Array(100) });
 
-      const deserializeFory = new Fory({ maxBinarySize: 50, refTracking: true 
});
+      const deserializeFory = new Fory({ maxBinarySize: 50, ref: true });
       const { deserialize } = 
deserializeFory.register(Type.struct("test.binary2", {
         data: Type.binary(),
       }));
@@ -239,7 +239,7 @@ describe('size-limit guardrails', () => {
 
   describe('default limits allow normal payloads', () => {
     test('should allow large collections within default limit', () => {
-      const fory = new Fory({ refTracking: true });
+      const fory = new Fory({ ref: true });
       const { serialize, deserialize } = 
fory.register(Type.array(Type.int32()));
       const bigArray = Array.from({ length: 1000 }, (_, i) => i);
       const result = deserialize(serialize(bigArray));
@@ -249,18 +249,18 @@ describe('size-limit guardrails', () => {
 
   describe('polymorphic (any-typed) collection paths', () => {
     test('should enforce maxCollectionSize on untyped list', () => {
-      const serializeFory = new Fory({ refTracking: true });
+      const serializeFory = new Fory({ ref: true });
       const bytes = serializeFory.serialize([1, "two", 3.0]);
 
-      const deserializeFory = new Fory({ maxCollectionSize: 2, refTracking: 
true });
+      const deserializeFory = new Fory({ maxCollectionSize: 2, ref: true });
       expect(() => deserializeFory.deserialize(bytes)).toThrow('exceeds 
maxCollectionSize');
     });
 
     test('should enforce maxCollectionSize on untyped map', () => {
-      const serializeFory = new Fory({ refTracking: true });
+      const serializeFory = new Fory({ ref: true });
       const bytes = serializeFory.serialize(new Map([["a", 1], ["b", 2], ["c", 
3]]));
 
-      const deserializeFory = new Fory({ maxCollectionSize: 2, refTracking: 
true });
+      const deserializeFory = new Fory({ maxCollectionSize: 2, ref: true });
       expect(() => deserializeFory.deserialize(bytes)).toThrow('exceeds 
maxCollectionSize');
     });
   });


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to