New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@colyseus/schema

Package Overview
Dependencies
Maintainers
1
Versions
340
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@colyseus/schema - npm Package Compare versions

Comparing version 2.0.12 to 2.0.13

8

lib/Schema.d.ts
import { OPERATION } from './spec';
import { ClientWithSessionId, Context, SchemaDefinition, DefinitionType } from "./annotations";
import type { Iterator } from "./encoding/decode";
import { ArraySchema } from "./types/ArraySchema";
import { MapSchema } from "./types/MapSchema";
import { ChangeTree, Ref } from "./changes/ChangeTree";
import { NonFunctionPropNames } from './types/HelperTypes';
import { NonFunctionPropNames, ToJSON } from './types/HelperTypes';
export interface DataChange<T = any, F = string> {

@@ -43,3 +45,3 @@ refId: number;

[prop in NonFunctionPropNames<this>]?: this[prop];
}): this;
} | ToJSON<this>): this;
protected get _definition(): SchemaDefinition;

@@ -65,3 +67,3 @@ /**

clone(): this;
toJSON(): {};
toJSON(): Partial<import("./types/HelperTypes").NonFunctionProps<{ [K in keyof this]: this[K] extends MapSchema<infer U, string> ? Record<string, U> : this[K] extends ArraySchema<infer U_1> ? U_1[] : this[K]; }>>;
discardAllChanges(): void;

@@ -68,0 +70,0 @@ protected getByIndex(index: number): any;

@@ -1,28 +0,11 @@

type Bool = 'true' | 'false';
type Key = string | number | symbol;
type Not<X extends Bool> = {
true: 'false';
false: 'true';
}[X];
type HaveIntersection<S1 extends string, S2 extends string> = ({
[K in S1]: 'true';
} & {
[key: string]: 'false';
})[S2];
type IsNeverWorker<S extends Key> = ({
[K in S]: 'false';
} & {
[key: string]: 'true';
})[S];
type IsNever<T extends Key> = Not<HaveIntersection<IsNeverWorker<T>, 'false'>>;
type IsFunction<T> = IsNever<keyof T>;
export type NonFunctionProps<T> = {
[K in keyof T]: {
'false': K;
'true': never;
}[IsFunction<T[K]>];
}[keyof T];
import { ArraySchema } from "./ArraySchema";
import { MapSchema } from "./MapSchema";
export type NonFunctionProps<T> = Omit<T, {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T]>;
export type NonFunctionPropNames<T> = {
[K in keyof T]: T[K] extends Function ? never : K;
}[keyof T];
export {};
export type ToJSON<T> = Partial<NonFunctionProps<{
[K in keyof T]: T[K] extends MapSchema<infer U> ? Record<string, U> : T[K] extends ArraySchema<infer U> ? U[] : T[K];
}>>;
{
"name": "@colyseus/schema",
"version": "2.0.12",
"version": "2.0.13",
"description": "Binary state serializer with delta encoding for games",

@@ -5,0 +5,0 @@ "bin": {

@@ -14,3 +14,3 @@ import { SWITCH_TO_STRUCTURE, TYPE_ID, OPERATION } from './spec';

import { ChangeTree, Ref, ChangeOperation } from "./changes/ChangeTree";
import { NonFunctionPropNames } from './types/HelperTypes';
import { NonFunctionPropNames, ToJSON } from './types/HelperTypes';
import { ClientState } from './filters';

@@ -188,3 +188,3 @@ import { getType } from './types/typeRegistry';

public assign(
props: { [prop in NonFunctionPropNames<this>]?: this[prop] }
props: { [prop in NonFunctionPropNames<this>]?: this[prop] } | ToJSON<this>,
) {

@@ -903,3 +903,3 @@ Object.assign(this, props);

const obj = {}
const obj: ToJSON<typeof this> = {};
for (let field in schema) {

@@ -906,0 +906,0 @@ if (!deprecated[field] && this[field] !== null && typeof (this[field]) !== "undefined") {

@@ -1,31 +0,8 @@

type Bool = 'true' | 'false'
type Key = string | number | symbol;
import { ArraySchema } from "./ArraySchema";
import { MapSchema } from "./MapSchema";
type Not<X extends Bool> = {
true: 'false',
false: 'true'
}[X]
export type NonFunctionProps<T> = Omit<T, {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T]>;
type HaveIntersection<S1 extends string, S2 extends string> = (
{ [K in S1]: 'true' } &
{ [key: string]: 'false' }
)[S2]
type IsNeverWorker<S extends Key> = (
{ [K in S]: 'false' } &
{ [key: string]: 'true' }
)[S]
// Worker needed because of https://github.com/Microsoft/TypeScript/issues/18118
type IsNever<T extends Key> = Not<HaveIntersection<IsNeverWorker<T>, 'false'>>
type IsFunction<T> = IsNever<keyof T>
export type NonFunctionProps<T> = {
[K in keyof T]: {
'false': K,
'true': never
}[IsFunction<T[K]>]
}[keyof T];
export type NonFunctionPropNames<T> = {

@@ -35,1 +12,8 @@ [K in keyof T]: T[K] extends Function ? never : K

export type ToJSON<T> = Partial<NonFunctionProps<{
[K in keyof T]: T[K] extends MapSchema<infer U>
? Record<string, U>
: T[K] extends ArraySchema<infer U>
? U[]
: T[K]
}>>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc