@colyseus/schema 5.0.8 → 5.0.9

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/build/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { encode } from "./encoding/encode.js";
19
19
  export { decode, type Iterator } from "./encoding/decode.js";
20
20
  export { Reflection, ReflectionType, ReflectionField, } from "./Reflection.js";
21
21
  export { Metadata } from "./Metadata.js";
22
- export { type, deprecated, owned, unreliable, transient, view, schema, entity, type DefinitionType, type PrimitiveType, type Definition, type FieldsAndMethods, type SchemaWithExtendsConstructor, type SchemaWithExtends, type SchemaType, } from "./annotations.js";
22
+ export { type, deprecated, defineTypes, owned, unreliable, transient, view, schema, entity, type DefinitionType, type PrimitiveType, type Definition, type FieldsAndMethods, type SchemaWithExtendsConstructor, type SchemaWithExtends, type SchemaType, } from "./annotations.js";
23
23
  export { t, FieldBuilder, isBuilder, type BuilderDefinition, type ChildType } from "./types/builder.js";
24
24
  export { TypeContext } from "./types/TypeContext.js";
25
25
  export type { InferValueType, InferSchemaInstanceType, AssignableProps, BuilderInitProps, Data } from "./types/HelperTypes.js";
package/build/index.js CHANGED
@@ -6751,6 +6751,24 @@
6751
6751
  });
6752
6752
  };
6753
6753
  }
6754
+ let defineTypesWarned = false;
6755
+ /**
6756
+ * Adds synchronizable fields to an existing `Schema` subclass — the pre-5.0
6757
+ * helper for plain JavaScript users.
6758
+ *
6759
+ * @deprecated Use `schema()` with `t.*` field builders instead:
6760
+ * https://docs.colyseus.io/state/schema
6761
+ */
6762
+ function defineTypes(target, fields, options) {
6763
+ if (!defineTypesWarned) {
6764
+ defineTypesWarned = true;
6765
+ console.warn("@colyseus/schema: defineTypes() is deprecated and will be removed in a future release. Use schema() with t.* field builders instead → https://docs.colyseus.io/state/schema");
6766
+ }
6767
+ for (let field in fields) {
6768
+ type(fields[field], options)(target.prototype, field);
6769
+ }
6770
+ return target;
6771
+ }
6754
6772
  /**
6755
6773
  * Build a per-construction factory for a builder type's auto-instantiated
6756
6774
  * default (empty collection or zero-arg Schema ref), or `undefined` when the
@@ -10613,6 +10631,7 @@
10613
10631
  exports.decodeKeyValueOperation = decodeKeyValueOperation;
10614
10632
  exports.decodeSchemaOperation = decodeSchemaOperation;
10615
10633
  exports.defineCustomTypes = defineCustomTypes;
10634
+ exports.defineTypes = defineTypes;
10616
10635
  exports.deprecated = deprecated;
10617
10636
  exports.dumpChanges = dumpChanges;
10618
10637
  exports.encode = encode;
package/build/index.mjs CHANGED
@@ -6745,6 +6745,24 @@ function deprecated(throws = true) {
6745
6745
  });
6746
6746
  };
6747
6747
  }
6748
+ let defineTypesWarned = false;
6749
+ /**
6750
+ * Adds synchronizable fields to an existing `Schema` subclass — the pre-5.0
6751
+ * helper for plain JavaScript users.
6752
+ *
6753
+ * @deprecated Use `schema()` with `t.*` field builders instead:
6754
+ * https://docs.colyseus.io/state/schema
6755
+ */
6756
+ function defineTypes(target, fields, options) {
6757
+ if (!defineTypesWarned) {
6758
+ defineTypesWarned = true;
6759
+ console.warn("@colyseus/schema: defineTypes() is deprecated and will be removed in a future release. Use schema() with t.* field builders instead → https://docs.colyseus.io/state/schema");
6760
+ }
6761
+ for (let field in fields) {
6762
+ type(fields[field], options)(target.prototype, field);
6763
+ }
6764
+ return target;
6765
+ }
6748
6766
  /**
6749
6767
  * Build a per-construction factory for a builder type's auto-instantiated
6750
6768
  * default (empty collection or zero-arg Schema ref), or `undefined` when the
@@ -10572,5 +10590,5 @@ registerType("array", { constructor: ArraySchema });
10572
10590
  registerType("set", { constructor: SetSchema });
10573
10591
  registerType("collection", { constructor: CollectionSchema, });
10574
10592
 
10575
- export { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $numFields, $refId, $track, $values, ArraySchema, Callbacks, ChangeTree, CollectionSchema, Decoder, Encoder, FieldBuilder, MapSchema, Metadata, OPERATION, Reflection, ReflectionField, ReflectionType, Root, Schema, SetSchema, StateCallbackStrategy, StateView, StreamSchema, TypeContext, createPool, decode, decodeKeyValueOperation, decodeSchemaOperation, defineCustomTypes, deprecated, dumpChanges, encode, encodeArray, encodeIndexedEntry, encodeKeyValueOperation, encodeMapEntry, encodeSchemaOperation, entity, getDecoderStateCallbacks, getEncodeDescriptor, getRawChangesCallback, isBuilder, owned, registerType, schema, t, transient, type, unreliable, view };
10593
+ export { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $numFields, $refId, $track, $values, ArraySchema, Callbacks, ChangeTree, CollectionSchema, Decoder, Encoder, FieldBuilder, MapSchema, Metadata, OPERATION, Reflection, ReflectionField, ReflectionType, Root, Schema, SetSchema, StateCallbackStrategy, StateView, StreamSchema, TypeContext, createPool, decode, decodeKeyValueOperation, decodeSchemaOperation, defineCustomTypes, defineTypes, deprecated, dumpChanges, encode, encodeArray, encodeIndexedEntry, encodeKeyValueOperation, encodeMapEntry, encodeSchemaOperation, entity, getDecoderStateCallbacks, getEncodeDescriptor, getRawChangesCallback, isBuilder, owned, registerType, schema, t, transient, type, unreliable, view };
10576
10594
  //# sourceMappingURL=index.mjs.map