@axi-engine/fields 0.2.3 → 0.3.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/dist/index.d.ts CHANGED
@@ -139,7 +139,7 @@ interface StringField extends Field<string> {
139
139
  * @template T The type of the value this field holds.
140
140
  *
141
141
  */
142
- declare class DefaultField<T> implements Field<T> {
142
+ declare class CoreField<T> implements Field<T> {
143
143
  /** A type keyword of the field */
144
144
  static readonly typeName: string;
145
145
  readonly typeName: string;
@@ -180,21 +180,21 @@ declare class DefaultField<T> implements Field<T> {
180
180
  destroy(): void;
181
181
  }
182
182
 
183
- interface DefaultBooleanFieldOptions extends FieldOptions<boolean> {
183
+ interface CoreBooleanFieldOptions extends FieldOptions<boolean> {
184
184
  }
185
- declare class DefaultBooleanField extends DefaultField<boolean> implements BooleanField {
185
+ declare class CoreBooleanField extends CoreField<boolean> implements BooleanField {
186
186
  static readonly typeName: string;
187
187
  readonly typeName: string;
188
- constructor(name: string, initialVal: boolean, options?: DefaultBooleanFieldOptions);
188
+ constructor(name: string, initialVal: boolean, options?: CoreBooleanFieldOptions);
189
189
  toggle(): boolean;
190
190
  }
191
191
 
192
- interface DefaultStringFieldOptions extends FieldOptions<string> {
192
+ interface CoreStringFieldOptions extends FieldOptions<string> {
193
193
  }
194
- declare class DefaultStringField extends DefaultField<string> implements StringField {
194
+ declare class CoreStringField extends CoreField<string> implements StringField {
195
195
  static readonly typeName: string;
196
196
  readonly typeName: string;
197
- constructor(name: string, initialVal: string, options?: DefaultStringFieldOptions);
197
+ constructor(name: string, initialVal: string, options?: CoreStringFieldOptions);
198
198
  append(str: string | number): this;
199
199
  prepend(str: string | number): this;
200
200
  trim(): this;
@@ -202,16 +202,16 @@ declare class DefaultStringField extends DefaultField<string> implements StringF
202
202
  clear(): void;
203
203
  }
204
204
 
205
- interface DefaultNumericFieldOptions extends FieldOptions<number> {
205
+ interface CoreNumericFieldOptions extends FieldOptions<number> {
206
206
  min?: number;
207
207
  max?: number;
208
208
  }
209
- declare class DefaultNumericField extends DefaultField<number> implements NumericField {
209
+ declare class CoreNumericField extends CoreField<number> implements NumericField {
210
210
  static readonly typeName: string;
211
211
  readonly typeName: string;
212
212
  get min(): number | undefined;
213
213
  get max(): number | undefined;
214
- constructor(name: string, initialVal: number, options?: DefaultNumericFieldOptions);
214
+ constructor(name: string, initialVal: number, options?: CoreNumericFieldOptions);
215
215
  isMin(): boolean;
216
216
  isMax(): boolean;
217
217
  inc(amount?: number): void;
@@ -339,12 +339,12 @@ declare class Fields {
339
339
  upset<T extends Field<any>>(typeName: string, name: string, value: any, options?: any): T;
340
340
  /**
341
341
  * Retrieves a field by its name.
342
- * @template T - The expected `Field` type to be returned.
342
+ * @template TField - The expected `Field` type to be returned.
343
343
  * @param {string} name - The name of the field to retrieve.
344
- * @returns {T} The `Field` instance.
344
+ * @returns {TField} The `Field` instance.
345
345
  * @throws If the field does not exist.
346
346
  */
347
- get<T extends Field<any>>(name: string): T;
347
+ get<TField extends Field<any>>(name: string): TField;
348
348
  /**
349
349
  * Removes one or more fields from the collection.
350
350
  * This method ensures that the `destroy` method of each removed field is called to clean up its resources.
@@ -358,74 +358,18 @@ declare class Fields {
358
358
  destroy(): void;
359
359
  }
360
360
 
361
- declare const DefaultFields_base: _axi_engine_utils.Constructor<{
362
- createGeneric<T>(name: string, initialValue: T, options?: FieldOptions<T> | undefined): DefaultField<T>;
363
- upsetGeneric<T>(name: string, value: T, options?: FieldOptions<T> | undefined): DefaultField<T>;
364
- getGeneric<T>(name: string): DefaultField<T>;
365
- readonly typeName: "fields";
366
- readonly _fields: Map<string, Field<any>>;
367
- readonly _fieldRegistry: FieldRegistry;
368
- onAdd: _axi_engine_utils.Emitter<[event: {
369
- name: string;
370
- field: Field<any>;
371
- }]>;
372
- onRemove: _axi_engine_utils.Emitter<[event: {
373
- names: string[];
374
- }]>;
375
- get fields(): Map<string, Field<any>>;
376
- has(name: string): boolean;
377
- add<T extends Field<any>>(field: Field<any>): T;
378
- create<T extends Field<any>>(typeName: string, name: string, initialValue: any, options?: any): T;
379
- upset<T extends Field<any>>(typeName: string, name: string, value: any, options?: any): T;
380
- get<T extends Field<any>>(name: string): T;
381
- remove(names: string | string[]): void;
382
- clear(): void;
383
- destroy(): void;
384
- } & Fields & {
385
- createNumeric: (name: string, initialValue: number, options?: DefaultNumericFieldOptions | undefined) => DefaultNumericField;
386
- } & {
387
- upsetNumeric: (name: string, value: number, options?: DefaultNumericFieldOptions | undefined) => DefaultNumericField;
388
- } & {
389
- getNumeric: (name: string) => DefaultNumericField;
390
- } & {
391
- createString: (name: string, initialValue: string, options?: DefaultStringFieldOptions | undefined) => DefaultStringField;
392
- } & {
393
- upsetString: (name: string, value: string, options?: DefaultStringFieldOptions | undefined) => DefaultStringField;
394
- } & {
395
- getString: (name: string) => DefaultStringField;
396
- } & {
397
- createBoolean: (name: string, initialValue: boolean, options?: DefaultBooleanFieldOptions | undefined) => DefaultBooleanField;
398
- } & {
399
- upsetBoolean: (name: string, value: boolean, options?: DefaultBooleanFieldOptions | undefined) => DefaultBooleanField;
400
- } & {
401
- getBoolean: (name: string) => DefaultBooleanField;
402
- }>;
403
- declare class DefaultFields extends DefaultFields_base {
404
- }
405
-
406
361
  interface FieldsFactory<TFields extends Fields> {
407
362
  fields(): TFields;
408
363
  }
409
- declare class DefaultFieldsFactory implements FieldsFactory<DefaultFields> {
410
- private readonly fieldRegistry;
411
- constructor(fieldRegistry: FieldRegistry);
412
- fields(): DefaultFields;
413
- }
364
+
414
365
  /**
415
366
  * Defines the contract for a factory that creates nodes for a FieldTree.
416
367
  * This allows for custom implementations of Fields and FieldTree to be used.
417
368
  */
418
- interface TreeNodeFactory<TFields extends Fields> extends FieldsFactory<TFields> {
369
+ interface FieldTreeFactory<TFields extends Fields> extends FieldsFactory<TFields> {
419
370
  fields(): TFields;
420
371
  tree(): FieldTree<TFields>;
421
372
  }
422
- /**
423
- * The default factory implementation that creates standard DefaultFields and FieldTree instances.
424
- */
425
- declare class DefaultTreeNodeFactory extends DefaultFieldsFactory implements TreeNodeFactory<DefaultFields> {
426
- constructor(fieldRegistry: FieldRegistry);
427
- tree(): FieldTree<DefaultFields>;
428
- }
429
373
 
430
374
  /** A type alias for any container that can be a child node in a FieldTree */
431
375
  type TreeNode<F extends Fields> = FieldTree<F> | F;
@@ -479,9 +423,9 @@ declare class FieldTree<TFields extends Fields> {
479
423
  get nodes(): Map<string, TreeNode<TFields>>;
480
424
  /**
481
425
  * Creates an instance of FieldTree.
482
- * @param {TreeNodeFactory} factory - A factory responsible for creating new nodes within the tree.
426
+ * @param {FieldTreeFactory} factory - A factory responsible for creating new nodes within the tree.
483
427
  */
484
- constructor(factory: TreeNodeFactory<TFields>);
428
+ constructor(factory: FieldTreeFactory<TFields>);
485
429
  /**
486
430
  * Checks if a direct child node with the given name exists.
487
431
  * @param {string} name - The name of the direct child node.
@@ -561,7 +505,14 @@ declare class FieldTree<TFields extends Fields> {
561
505
  * @param {PathType} path - The path to the `Fields` container.
562
506
  * @returns {Fields} The existing or newly created `Fields` instance.
563
507
  */
564
- getOrCreateFields(path: PathType): Fields;
508
+ getOrCreateFields(path: PathType): TFields;
509
+ /**
510
+ * Finds the parent node for a given path.
511
+ * @param path The path to the target node.
512
+ * @returns The parent node (either a FieldTree or Fields).
513
+ * @throws An error if the path is invalid or any intermediate node is not a FieldTree.
514
+ */
515
+ findParentNode(path: PathType): FieldTree<TFields> | TFields;
565
516
  /**
566
517
  * Removes all child nodes from this tree branch.
567
518
  * This method ensures that `destroy()` is called on each child node, allowing for
@@ -588,6 +539,69 @@ declare class FieldTree<TFields extends Fields> {
588
539
  private traversePath;
589
540
  }
590
541
 
542
+ declare const CoreFields_base: _axi_engine_utils.Constructor<{
543
+ createGeneric<T>(name: string, initialValue: T, options?: FieldOptions<T> | undefined): CoreField<T>;
544
+ upsetGeneric<T>(name: string, value: T, options?: FieldOptions<T> | undefined): CoreField<T>;
545
+ getGeneric<T>(name: string): CoreField<T>;
546
+ readonly typeName: "fields";
547
+ readonly _fields: Map<string, Field<any>>;
548
+ readonly _fieldRegistry: FieldRegistry;
549
+ onAdd: _axi_engine_utils.Emitter<[event: {
550
+ name: string;
551
+ field: Field<any>;
552
+ }]>;
553
+ onRemove: _axi_engine_utils.Emitter<[event: {
554
+ names: string[];
555
+ }]>;
556
+ get fields(): Map<string, Field<any>>;
557
+ has(name: string): boolean;
558
+ add<T extends Field<any>>(field: Field<any>): T;
559
+ create<T extends Field<any>>(typeName: string, name: string, initialValue: any, options?: any): T;
560
+ upset<T extends Field<any>>(typeName: string, name: string, value: any, options?: any): T;
561
+ get<TField extends Field<any>>(name: string): TField;
562
+ remove(names: string | string[]): void;
563
+ clear(): void;
564
+ destroy(): void;
565
+ } & Fields & {
566
+ createNumeric: (name: string, initialValue: number, options?: CoreNumericFieldOptions | undefined) => CoreNumericField;
567
+ } & {
568
+ upsetNumeric: (name: string, value: number, options?: CoreNumericFieldOptions | undefined) => CoreNumericField;
569
+ } & {
570
+ getNumeric: (name: string) => CoreNumericField;
571
+ } & {
572
+ createString: (name: string, initialValue: string, options?: CoreStringFieldOptions | undefined) => CoreStringField;
573
+ } & {
574
+ upsetString: (name: string, value: string, options?: CoreStringFieldOptions | undefined) => CoreStringField;
575
+ } & {
576
+ getString: (name: string) => CoreStringField;
577
+ } & {
578
+ createBoolean: (name: string, initialValue: boolean, options?: CoreBooleanFieldOptions | undefined) => CoreBooleanField;
579
+ } & {
580
+ upsetBoolean: (name: string, value: boolean, options?: CoreBooleanFieldOptions | undefined) => CoreBooleanField;
581
+ } & {
582
+ getBoolean: (name: string) => CoreBooleanField;
583
+ }>;
584
+ declare class CoreFields extends CoreFields_base {
585
+ }
586
+
587
+ declare class CoreFieldsFactory implements FieldsFactory<CoreFields> {
588
+ protected readonly _fieldRegistry: FieldRegistry;
589
+ get fieldRegistry(): FieldRegistry;
590
+ constructor(fieldRegistry: FieldRegistry);
591
+ fields(): CoreFields;
592
+ }
593
+
594
+ declare class CoreFieldTree extends FieldTree<CoreFields> {
595
+ }
596
+
597
+ /**
598
+ * The default factory implementation that creates standard DefaultFields and FieldTree instances.
599
+ */
600
+ declare class CoreTreeNodeFactory extends CoreFieldsFactory implements FieldTreeFactory<CoreFields> {
601
+ constructor(fieldRegistry: FieldRegistry);
602
+ tree(): CoreFieldTree;
603
+ }
604
+
591
605
  /**
592
606
  * Defines the contract for a handler that can serialize and deserialize a specific type of Policy.
593
607
  * @template T - The specific Policy class this handler manages.
@@ -791,7 +805,7 @@ interface FieldTreeSnapshot {
791
805
  declare class FieldTreeSerializer<TFields extends Fields> {
792
806
  private readonly fieldTreeNodeFactory;
793
807
  private readonly fieldsSerializer;
794
- constructor(fieldTreeNodeFactory: TreeNodeFactory<TFields>, fieldsSerializer: FieldsSerializer<TFields>);
808
+ constructor(fieldTreeNodeFactory: FieldTreeFactory<TFields>, fieldsSerializer: FieldsSerializer<TFields>);
795
809
  /**
796
810
  * Creates a serializable snapshot of the entire tree and its contained fields.
797
811
  * @returns A plain JavaScript object representing the complete state managed by this tree.
@@ -805,4 +819,218 @@ declare class FieldTreeSerializer<TFields extends Fields> {
805
819
  hydrate(snapshot: FieldTreeSnapshot): FieldTree<TFields>;
806
820
  }
807
821
 
808
- export { type BooleanField, ClampMaxPolicy, ClampMaxPolicySerializerHandler, ClampMinPolicy, ClampMinPolicySerializerHandler, ClampPolicy, ClampPolicySerializerHandler, DefaultBooleanField, type DefaultBooleanFieldOptions, DefaultField, DefaultFields, DefaultFieldsFactory, DefaultNumericField, type DefaultNumericFieldOptions, DefaultStringField, type DefaultStringFieldOptions, DefaultTreeNodeFactory, type Field, type FieldOptions, FieldRegistry, FieldSerializer, type FieldSnapshot, FieldTree, FieldTreeSerializer, type FieldTreeSnapshot, Fields, type FieldsFactory, FieldsSerializer, type FieldsSnapshot, type NumericField, Policies, type Policy, PolicySerializer, type PolicySerializerHandler, type StringField, type TreeNode, type TreeNodeFactory, clampMaxPolicy, clampMinPolicy, clampPolicy, createTypedMethodsMixin };
822
+ interface StoreCreateFieldOptions {
823
+ /** Allows to explicitly specify the field type, overriding the automatic type detection. */
824
+ fieldType?: string;
825
+ }
826
+ /**
827
+ * Defines the primary high-level API for interacting with the state management system.
828
+ * It acts as a facade, simplifying access to the underlying FieldTree and providing
829
+ * both type-safe and dynamic methods for manipulating data.
830
+ */
831
+ interface Store {
832
+ /**
833
+ * Retrieves the raw value of a Field at a specific path.
834
+ * @template T The expected type of the value.
835
+ * @param path The path to the field (e.g., 'player.stats.hp').
836
+ * @returns {T} The raw value stored in the field.
837
+ * @throws An error if the path is invalid or no field exists at the path.
838
+ */
839
+ getValue<T>(path: PathType): T;
840
+ /**
841
+ * Strictly sets the value of an *existing* Field at a specific path.
842
+ * @template T The type of the value being set.
843
+ * @param path The path to the existing field.
844
+ * @param val The new value to set.
845
+ * @returns {T} The value that was set.
846
+ * @throws An error if no field exists at the specified path.
847
+ */
848
+ setValue<T>(path: PathType, val: T): T;
849
+ /**
850
+ * Creates a new Field at a specified path, inferring its type from the provided value.
851
+ * This is a strict operation and will fail if a node already exists at the target path.
852
+ * @template T The type of the initial value.
853
+ * @param path The full path where the new field will be created.
854
+ * @param val The initial value for the field.
855
+ * @param options Optional configuration, including policies and the ability to override field type.
856
+ * @returns {T} value of the newly created Field instance.
857
+ * @throws An error if a node already exists at the path or if the parent path is invalid.
858
+ */
859
+ createValue<T>(path: PathType, val: T, options?: FieldOptions<T> & StoreCreateFieldOptions): T;
860
+ /**
861
+ * Creates new or update a Field at a specified path, inferring its type from the provided value.
862
+ * @template T The type of the initial value.
863
+ * @param path The full path where the new field will be created.
864
+ * @param val The initial value for the field.
865
+ * @param options Optional configuration, including policies and the ability to override field type.
866
+ * @returns {T} value of the newly created Field instance.
867
+ * @throws An error if a node already exists at the path or if the parent path is invalid.
868
+ */
869
+ upsetValue<T>(path: PathType, val: T, options?: FieldOptions<T> & StoreCreateFieldOptions): T;
870
+ /**
871
+ * Creates a new, strongly-typed CoreBooleanField.
872
+ * @throws An error if a node already exists at the path.
873
+ */
874
+ createBoolean(path: PathType, initialValue: boolean, options?: CoreBooleanFieldOptions): CoreBooleanField;
875
+ /**
876
+ * Creates a new, strongly-typed CoreNumericField.
877
+ * @throws An error if a node already exists at the path.
878
+ */
879
+ createNumeric(path: PathType, initialValue: number, options?: CoreNumericFieldOptions): CoreNumericField;
880
+ /**
881
+ * Creates a new, strongly-typed CoreStringField.
882
+ * @throws An error if a node already exists at the path.
883
+ */
884
+ createString(path: PathType, initialValue: string, options?: CoreStringFieldOptions): CoreStringField;
885
+ /**
886
+ * Creates a new, generic CoreField instance for any data type.
887
+ * @throws An error if a node already exists at the path.
888
+ */
889
+ createGeneric<T>(path: PathType, initialValue: T, options?: FieldOptions<T>): CoreField<T>;
890
+ /**
891
+ * Retrieves a strongly-typed CoreBooleanField instance.
892
+ * @throws An error if the path is invalid or the field is not of the expected type.
893
+ */
894
+ getBoolean(path: PathType): CoreBooleanField;
895
+ /**
896
+ * Retrieves a strongly-typed CoreNumericField instance.
897
+ * @throws An error if the path is invalid or the field is not of the expected type.
898
+ */
899
+ getNumeric(path: PathType): CoreNumericField;
900
+ /**
901
+ * Retrieves a strongly-typed CoreStringField instance.
902
+ * @throws An error if the path is invalid or the field is not of the expected type.
903
+ */
904
+ getString(path: PathType): CoreStringField;
905
+ /**
906
+ * Retrieves a generic CoreField instance.
907
+ * @throws An error if the path is invalid.
908
+ */
909
+ getGeneric<T>(path: PathType): CoreField<T>;
910
+ /**
911
+ * A generic method to retrieve a Field instance with a specific asserted type.
912
+ * @template TField The expected Field class or interface.
913
+ * @throws An error if the path is invalid or the field cannot be cast to the specified type.
914
+ */
915
+ getField<TField extends Field<any>>(path: PathType): TField;
916
+ /**
917
+ * Strictly creates a new CoreFields container.
918
+ * Any missing parent nodes in the path will be created automatically.
919
+ * @param path The path where the new Fields container will be created.
920
+ * @returns {CoreFields} The newly created CoreFields instance.
921
+ * @throws An error if a node already exists at the target path.
922
+ */
923
+ createFields(path: PathType): CoreFields;
924
+ /**
925
+ * Strictly creates a new CoreFieldTree node.
926
+ * Any missing parent nodes in the path will be created automatically.
927
+ * @param path The path where the new FieldTree node will be created.
928
+ * @returns {CoreFieldTree} The newly created CoreFieldTree instance.
929
+ * @throws An error if a node already exists at the target path.
930
+ */
931
+ createTree(path: PathType): CoreFieldTree;
932
+ /**
933
+ * Retrieves an existing CoreFields container.
934
+ * @param path The path to the Fields container.
935
+ * @returns {CoreFields} The found CoreFields instance.
936
+ * @throws An error if the path is invalid or the node at the path is not a Fields container.
937
+ */
938
+ getFields(path: PathType): CoreFields;
939
+ /**
940
+ * Retrieves an existing CoreFieldTree node.
941
+ * @param path The path to the FieldTree node.
942
+ * @returns {CoreFieldTree} The found CoreFieldTree instance.
943
+ * @throws An error if the path is invalid or the node at the path is not a FieldTree.
944
+ */
945
+ getTree(path: PathType): CoreFieldTree;
946
+ /**
947
+ * Removes the node (Field, Fields, or FieldTree) at the end of the specified path.
948
+ * This method does not remove parent nodes if they become empty.
949
+ * @param path The path to the node to remove.
950
+ */
951
+ remove(path: PathType): void;
952
+ }
953
+
954
+ interface DataStoreFieldResolver {
955
+ /**
956
+ * The typeName this resolver corresponds to in the FieldRegistry.
957
+ * e.g., 'numeric', 'boolean', 'vector'
958
+ */
959
+ typeName: string;
960
+ /**
961
+ * Checks if this resolver can handle the given value.
962
+ * @param value The value to check.
963
+ * @returns {boolean} True if the value is supported, otherwise false.
964
+ */
965
+ supports(value: unknown): boolean;
966
+ }
967
+
968
+ declare class DataStore implements Store {
969
+ private readonly tree;
970
+ private readonly resolvers;
971
+ private readonly rootFieldsName;
972
+ private _rootFields;
973
+ private get rootFields();
974
+ constructor(tree: CoreFieldTree);
975
+ registerResolver(resolver: DataStoreFieldResolver): void;
976
+ clearResolvers(): void;
977
+ getValue<T>(path: PathType): T;
978
+ setValue<T>(path: PathType, val: T): T;
979
+ createValue<T>(path: PathType, val: T, options?: FieldOptions<T> & StoreCreateFieldOptions): T;
980
+ upsetValue<T>(path: PathType, val: T, options?: FieldOptions<T> & StoreCreateFieldOptions): T;
981
+ createBoolean(path: PathType, initialValue: boolean, options?: CoreBooleanFieldOptions): CoreBooleanField;
982
+ createNumeric(path: PathType, initialValue: number, options?: CoreNumericFieldOptions): CoreNumericField;
983
+ createString(path: PathType, initialValue: string, options?: CoreStringFieldOptions): CoreStringField;
984
+ createGeneric<T>(path: PathType, initialValue: T, options?: FieldOptions<T>): CoreField<T>;
985
+ getBoolean(path: PathType): CoreBooleanField;
986
+ getNumeric(path: PathType): CoreNumericField;
987
+ getString(path: PathType): CoreStringField;
988
+ getGeneric<T>(path: PathType): CoreField<T>;
989
+ getField<TField extends Field<any>>(path: PathType): TField;
990
+ createFields(path: PathType): CoreFields;
991
+ createTree(path: PathType): CoreFieldTree;
992
+ getFields(path: PathType): CoreFields;
993
+ getTree(path: PathType): CoreFieldTree;
994
+ remove(path: PathType): void;
995
+ private isPathToRootFields;
996
+ private getDestinationFields;
997
+ }
998
+
999
+ /**
1000
+ * Creates and configures a FieldRegistry with all the core field types.
1001
+ * @returns {FieldRegistry} A pre-configured FieldRegistry instance.
1002
+ */
1003
+ declare function createCoreFieldRegistry(): FieldRegistry;
1004
+ /**
1005
+ * Creates and configures a PolicySerializer with handlers for core policies.
1006
+ * @returns {PolicySerializer} A pre-configured PolicySerializer instance.
1007
+ */
1008
+ declare function createCorePolicySerializer(): PolicySerializer;
1009
+ /**
1010
+ * Creates a factory for CoreFieldTree and CoreFields nodes.
1011
+ * @param {FieldRegistry} fieldRegistry - The registry to be used by the factory.
1012
+ * @returns {CoreTreeNodeFactory} A new CoreTreeNodeFactory instance.
1013
+ */
1014
+ declare function createCoreTreeNodeFactory(fieldRegistry: FieldRegistry): CoreTreeNodeFactory;
1015
+ /**
1016
+ * Creates a fully configured serializer for a FieldTree.
1017
+ * This function composes all necessary serializers (FieldTree, Fields, Field) for a complete setup.
1018
+ * @param {CoreTreeNodeFactory} fieldTreeNodeFactory - The factory used to create new tree nodes during deserialization.
1019
+ * @param policySerializer
1020
+ * @returns {FieldTreeSerializer<CoreFields>} A top-level serializer for the entire field tree.
1021
+ */
1022
+ declare function createCoreTreeSerializer(fieldTreeNodeFactory: CoreTreeNodeFactory, policySerializer?: PolicySerializer): FieldTreeSerializer<CoreFields>;
1023
+ interface CoreFieldSystemConfig {
1024
+ registry?: FieldRegistry;
1025
+ policySerializer?: PolicySerializer;
1026
+ }
1027
+ /**
1028
+ * Creates a complete core setup for the field system.
1029
+ * @returns {{factory: CoreTreeNodeFactory, serializer: FieldTreeSerializer<CoreFields>}}
1030
+ */
1031
+ declare function createCoreFieldSystem(config?: CoreFieldSystemConfig): {
1032
+ factory: CoreTreeNodeFactory;
1033
+ serializer: FieldTreeSerializer<CoreFields>;
1034
+ };
1035
+
1036
+ export { type BooleanField, ClampMaxPolicy, ClampMaxPolicySerializerHandler, ClampMinPolicy, ClampMinPolicySerializerHandler, ClampPolicy, ClampPolicySerializerHandler, CoreBooleanField, type CoreBooleanFieldOptions, CoreField, type CoreFieldSystemConfig, CoreFieldTree, CoreFields, CoreFieldsFactory, CoreNumericField, type CoreNumericFieldOptions, CoreStringField, type CoreStringFieldOptions, CoreTreeNodeFactory, DataStore, type Field, type FieldOptions, FieldRegistry, FieldSerializer, type FieldSnapshot, FieldTree, type FieldTreeFactory, FieldTreeSerializer, type FieldTreeSnapshot, Fields, type FieldsFactory, FieldsSerializer, type FieldsSnapshot, type NumericField, Policies, type Policy, PolicySerializer, type PolicySerializerHandler, type Store, type StoreCreateFieldOptions, type StringField, type TreeNode, clampMaxPolicy, clampMinPolicy, clampPolicy, createCoreFieldRegistry, createCoreFieldSystem, createCorePolicySerializer, createCoreTreeNodeFactory, createCoreTreeSerializer, createTypedMethodsMixin };