@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.cjs CHANGED
@@ -6747,6 +6747,24 @@ function deprecated(throws = true) {
6747
6747
  });
6748
6748
  };
6749
6749
  }
6750
+ let defineTypesWarned = false;
6751
+ /**
6752
+ * Adds synchronizable fields to an existing `Schema` subclass — the pre-5.0
6753
+ * helper for plain JavaScript users.
6754
+ *
6755
+ * @deprecated Use `schema()` with `t.*` field builders instead:
6756
+ * https://docs.colyseus.io/state/schema
6757
+ */
6758
+ function defineTypes(target, fields, options) {
6759
+ if (!defineTypesWarned) {
6760
+ defineTypesWarned = true;
6761
+ 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");
6762
+ }
6763
+ for (let field in fields) {
6764
+ type(fields[field], options)(target.prototype, field);
6765
+ }
6766
+ return target;
6767
+ }
6750
6768
  /**
6751
6769
  * Build a per-construction factory for a builder type's auto-instantiated
6752
6770
  * default (empty collection or zero-arg Schema ref), or `undefined` when the
@@ -10609,6 +10627,7 @@ exports.decode = decode;
10609
10627
  exports.decodeKeyValueOperation = decodeKeyValueOperation;
10610
10628
  exports.decodeSchemaOperation = decodeSchemaOperation;
10611
10629
  exports.defineCustomTypes = defineCustomTypes;
10630
+ exports.defineTypes = defineTypes;
10612
10631
  exports.deprecated = deprecated;
10613
10632
  exports.dumpChanges = dumpChanges;
10614
10633
  exports.encode = encode;