From f6a337a9f93f7738174df9448d5a735ebc9468a1 Mon Sep 17 00:00:00 2001 From: Nicolas Echezarreta Date: Fri, 14 Apr 2023 19:11:13 -0300 Subject: [PATCH] feat: add 'oneOf' schema (#523) --- packages/@dcl/ecs/src/schemas/ISchema.ts | 1 + packages/@dcl/ecs/src/schemas/OneOf.ts | 44 ++++++++++++ .../{buildSchema.ts => buildSchema/index.ts} | 68 +++++++++++-------- .../@dcl/ecs/src/schemas/buildSchema/types.ts | 3 + .../@dcl/ecs/src/schemas/buildSchema/utils.ts | 40 +++++++++++ packages/@dcl/ecs/src/schemas/index.ts | 3 + packages/@dcl/inspector/package.json | 8 +-- .../etc/playground-assets.api.md | 7 +- packages/@dcl/sdk-commands/package-lock.json | 4 ++ test/ecs/serialization.spec.ts | 39 +++++++++-- .../testing-fw.test.ts.crdt | 8 +-- .../two-way-crdt.test.ts.crdt | 8 +-- test/snapshots/package-lock.json | 2 +- .../append-value-crdt.ts.crdt | 8 +-- .../production-bundles/billboard.ts.crdt | 8 +-- .../production-bundles/composite.ts.crdt | 8 +-- .../production-bundles/cube-deleted.ts.crdt | 6 +- .../snapshots/production-bundles/cube.ts.crdt | 6 +- .../production-bundles/cubes.ts.crdt | 10 +-- .../production-bundles/pointer-events.ts.crdt | 8 +-- .../schema-components.ts.crdt | 8 +-- test/snapshots/production-bundles/ui.ts.crdt | 8 +-- 22 files changed, 222 insertions(+), 83 deletions(-) create mode 100644 packages/@dcl/ecs/src/schemas/OneOf.ts rename packages/@dcl/ecs/src/schemas/{buildSchema.ts => buildSchema/index.ts} (61%) create mode 100644 packages/@dcl/ecs/src/schemas/buildSchema/types.ts create mode 100644 packages/@dcl/ecs/src/schemas/buildSchema/utils.ts diff --git a/packages/@dcl/ecs/src/schemas/ISchema.ts b/packages/@dcl/ecs/src/schemas/ISchema.ts index 6c35175a7..ecbcb27c4 100644 --- a/packages/@dcl/ecs/src/schemas/ISchema.ts +++ b/packages/@dcl/ecs/src/schemas/ISchema.ts @@ -48,6 +48,7 @@ export type JsonSchemaExtended = { | 'utf8-string' | 'protocol-buffer' | 'transform' + | 'one-of' | 'unknown' } & JsonMap diff --git a/packages/@dcl/ecs/src/schemas/OneOf.ts b/packages/@dcl/ecs/src/schemas/OneOf.ts new file mode 100644 index 000000000..61bef0274 --- /dev/null +++ b/packages/@dcl/ecs/src/schemas/OneOf.ts @@ -0,0 +1,44 @@ +import { DeepReadonly } from '../engine/readonly' +import { ByteBuffer } from '../serialization/ByteBuffer' +import { ISchema } from './ISchema' +import { Spec } from './Map' + +type OneOfType = { + [K in keyof T]: { + readonly $case: K + readonly value: ReturnType + } +}[keyof T] + +export const IOneOf = (specs: T): ISchema> => { + const specKeys = Object.keys(specs) + const keyToIndex = specKeys.reduce((dict: Record, key, index) => { + dict[key] = index + return dict + }, {}) + const specReflection = specKeys.reduce((specReflection, currentKey) => { + specReflection[currentKey] = specs[currentKey].jsonSchema + return specReflection + }, {} as Record) + + return { + serialize({ $case, value }: DeepReadonly>, builder: ByteBuffer): void { + const _value = keyToIndex[$case.toString()] + 1 + builder.writeUint8(_value) + ;(specs as any)[$case].serialize(value, builder) + }, + deserialize(reader: ByteBuffer) { + const $case = specKeys[reader.readInt8() - 1] + const value = specs[$case].deserialize(reader) + return { $case, value } + }, + create() { + return {} as OneOfType + }, + jsonSchema: { + type: 'object', + properties: specReflection, + serializationType: 'one-of' + } + } +} diff --git a/packages/@dcl/ecs/src/schemas/buildSchema.ts b/packages/@dcl/ecs/src/schemas/buildSchema/index.ts similarity index 61% rename from packages/@dcl/ecs/src/schemas/buildSchema.ts rename to packages/@dcl/ecs/src/schemas/buildSchema/index.ts index 4d8fd46b9..785a5d93b 100644 --- a/packages/@dcl/ecs/src/schemas/buildSchema.ts +++ b/packages/@dcl/ecs/src/schemas/buildSchema/index.ts @@ -1,17 +1,19 @@ -import { IArray } from './Array' -import { Bool } from './basic/Boolean' -import { IntEnum, StringEnum } from './basic/Enum' -import { Float32, Float64 } from './basic/Float' -import { Int16, Int32, Int64, Int8 } from './basic/Integer' -import { EcsString } from './basic/String' -import { Color3Schema } from './custom/Color3' -import { Color4Schema } from './custom/Color4' -import { EntitySchema } from './custom/Entity' -import { QuaternionSchema } from './custom/Quaternion' -import { Vector3Schema } from './custom/Vector3' -import { ISchema, JsonSchemaExtended } from './ISchema' -import { IMap } from './Map' -import { IOptional } from './Optional' +import { IArray } from '../Array' +import { Bool } from '../basic/Boolean' +import { IntEnum, StringEnum } from '../basic/Enum' +import { Float32, Float64 } from '../basic/Float' +import { Int16, Int32, Int64, Int8 } from '../basic/Integer' +import { EcsString } from '../basic/String' +import { Color3Schema } from '../custom/Color3' +import { Color4Schema } from '../custom/Color4' +import { EntitySchema } from '../custom/Entity' +import { QuaternionSchema } from '../custom/Quaternion' +import { Vector3Schema } from '../custom/Vector3' +import { ISchema, JsonSchemaExtended } from '../ISchema' +import { IMap } from '../Map' +import { IOneOf } from '../OneOf' +import { IOptional } from '../Optional' +import { getTypeAndValue, isCompoundType } from './utils' const primitiveSchemas = { [Bool.jsonSchema.serializationType]: Bool, @@ -62,11 +64,21 @@ export function jsonSchemaToSchema(jsonSchema: JsonSchemaExtended): ISchema const enumJsonSchema = jsonSchema as JsonSchemaExtended & { enumObject: Record; default: number } return IntEnum(enumJsonSchema.enumObject, enumJsonSchema.default) } + if (jsonSchema.serializationType === 'enum-string') { const enumJsonSchema = jsonSchema as JsonSchemaExtended & { enumObject: Record; default: string } return StringEnum(enumJsonSchema.enumObject, enumJsonSchema.default) } + if (jsonSchema.serializationType === 'one-of') { + const oneOfJsonSchema = jsonSchema as JsonSchemaExtended & { properties: Record } + const spec: Record = {} + for (const key in oneOfJsonSchema.properties) { + spec[key] = jsonSchemaToSchema(oneOfJsonSchema.properties[key]) + } + return IOneOf(spec) + } + throw new Error(`${jsonSchema.serializationType} is not supported as reverse schema generation.`) } @@ -76,31 +88,31 @@ export function mutateValues( mutateFn: (value: unknown, valueType: JsonSchemaExtended) => { changed: boolean; value?: any } ): void { if (jsonSchema.serializationType === 'map') { - const mapJsonSchema = jsonSchema as JsonSchemaExtended & { properties: Record } - const mapValue = value as Record + const { properties } = jsonSchema as JsonSchemaExtended & { properties: Record } + const typedValue = value as Record - for (const key in mapJsonSchema.properties) { - const valueType = mapJsonSchema.properties[key] - if (valueType.serializationType === 'array' || valueType.serializationType === 'map') { - mutateValues(mapJsonSchema.properties[key], mapValue[key], mutateFn) + for (const key in properties) { + const { type, value: mapValue } = getTypeAndValue(properties, typedValue, key) + if (type.serializationType === 'unknown') continue + if (isCompoundType(type)) { + mutateValues(type, mapValue, mutateFn) } else { - const newValue = mutateFn(mapValue[key], valueType) + const newValue = mutateFn(mapValue, type) if (newValue.changed) { - mapValue[key] = newValue.value + typedValue[key] = newValue.value } } } } else if (jsonSchema.serializationType === 'array') { - const withItemsJsonSchema = jsonSchema as JsonSchemaExtended & { items: JsonSchemaExtended } + const { items } = jsonSchema as JsonSchemaExtended & { items: JsonSchemaExtended } const arrayValue = value as unknown[] - const nestedMutateValues = - withItemsJsonSchema.items.serializationType === 'array' || withItemsJsonSchema.items.serializationType === 'map' for (let i = 0, n = arrayValue.length; i < n; i++) { - if (nestedMutateValues) { - mutateValues(withItemsJsonSchema.items, arrayValue[i], mutateFn) + const { type, value } = getTypeAndValue({ items: items }, { items: arrayValue[i] }, 'items') + if (isCompoundType(type)) { + mutateValues(type, value, mutateFn) } else { - const newValue = mutateFn(arrayValue[i], withItemsJsonSchema.items) + const newValue = mutateFn(value, type) if (newValue.changed) { arrayValue[i] = newValue.value } diff --git a/packages/@dcl/ecs/src/schemas/buildSchema/types.ts b/packages/@dcl/ecs/src/schemas/buildSchema/types.ts new file mode 100644 index 000000000..c8759f178 --- /dev/null +++ b/packages/@dcl/ecs/src/schemas/buildSchema/types.ts @@ -0,0 +1,3 @@ +import { JsonSchemaExtended } from '../ISchema' + +export type UnknownSchema = { type: JsonSchemaExtended; value: unknown } diff --git a/packages/@dcl/ecs/src/schemas/buildSchema/utils.ts b/packages/@dcl/ecs/src/schemas/buildSchema/utils.ts new file mode 100644 index 000000000..699fab0af --- /dev/null +++ b/packages/@dcl/ecs/src/schemas/buildSchema/utils.ts @@ -0,0 +1,40 @@ +import { JsonSchemaExtended } from '../ISchema' +import { IOneOf } from '../OneOf' +import { UnknownSchema } from './types' + +export const isSchemaType = (value: JsonSchemaExtended, types: JsonSchemaExtended['serializationType'][]) => + types.includes(value.serializationType) + +export const isOneOfJsonSchema = ( + type: JsonSchemaExtended +): type is JsonSchemaExtended & { properties: Record } => isSchemaType(type, ['one-of']) + +export const getUnknownSchema = (): UnknownSchema => ({ + type: { type: 'object', serializationType: 'unknown' }, + value: undefined +}) + +export const isCompoundType = (type: JsonSchemaExtended): boolean => isSchemaType(type, ['array', 'map']) + +export const getTypeAndValue = ( + properties: Record, + value: Record, + key: string +): UnknownSchema => { + const type = properties[key] + const valueKey = value[key] + + if (isOneOfJsonSchema(type)) { + const typedMapValue = valueKey as ReturnType['deserialize']> + if (!typedMapValue.$case) return getUnknownSchema() + + const propType = type.properties[typedMapValue.$case] + + // transform { $case: string; value: unknown } => { [$case]: value } + if (isCompoundType(propType)) value[key] = { [typedMapValue.$case]: typedMapValue.value } + + return { type: propType, value: typedMapValue.value } + } + + return { type, value: valueKey } +} diff --git a/packages/@dcl/ecs/src/schemas/index.ts b/packages/@dcl/ecs/src/schemas/index.ts index ab6d7fff7..4ff81b909 100644 --- a/packages/@dcl/ecs/src/schemas/index.ts +++ b/packages/@dcl/ecs/src/schemas/index.ts @@ -13,6 +13,7 @@ import { Vector3Schema, Vector3Type } from './custom/Vector3' import { ISchema, JsonSchemaExtended, JsonArray, JsonMap, JsonPrimitive } from './ISchema' import { IMap } from './Map' import { IOptional } from './Optional' +import { IOneOf } from './OneOf' import { jsonSchemaToSchema, mutateValues } from './buildSchema' export { @@ -78,6 +79,8 @@ export namespace Schemas { export const Map = IMap /** @public */ export const Optional = IOptional + /** @public */ + export const OneOf = IOneOf /** * @public Create an ISchema object from the json-schema diff --git a/packages/@dcl/inspector/package.json b/packages/@dcl/inspector/package.json index 6f4d413e6..f45b7dd36 100644 --- a/packages/@dcl/inspector/package.json +++ b/packages/@dcl/inspector/package.json @@ -1,6 +1,9 @@ { "name": "@dcl/inspector", "version": "0.1.0", + "dependencies": { + "classnames": "^2.3.2" + }, "devDependencies": { "@babylonjs/core": "^5.48.0", "@babylonjs/gui": "^5.48.0", @@ -39,8 +42,5 @@ "start": "node ./build.js --watch" }, "types": "dist/tooling-entrypoint.d.ts", - "typings": "dist/tooling-entrypoint.d.ts", - "dependencies": { - "classnames": "^2.3.2" - } + "typings": "dist/tooling-entrypoint.d.ts" } diff --git a/packages/@dcl/playground-assets/etc/playground-assets.api.md b/packages/@dcl/playground-assets/etc/playground-assets.api.md index 463daa063..43edf68be 100644 --- a/packages/@dcl/playground-assets/etc/playground-assets.api.md +++ b/packages/@dcl/playground-assets/etc/playground-assets.api.md @@ -1238,7 +1238,7 @@ export type JsonPrimitive = string | number | boolean | null; // @public export type JsonSchemaExtended = { type: 'object' | 'number' | 'integer' | 'string' | 'array' | 'boolean'; - serializationType: 'boolean' | 'enum-int' | 'enum-string' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'vector3' | 'color3' | 'quaternion' | 'color4' | 'map' | 'optional' | 'entity' | 'array' | 'utf8-string' | 'protocol-buffer' | 'transform' | 'unknown'; + serializationType: 'boolean' | 'enum-int' | 'enum-string' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'vector3' | 'color3' | 'quaternion' | 'color4' | 'map' | 'optional' | 'entity' | 'array' | 'utf8-string' | 'protocol-buffer' | 'transform' | 'one-of' | 'unknown'; } & JsonMap; // Warning: (tsdoc-undefined-tag) The TSDoc tag "@hidden" is not defined in this configuration @@ -2606,6 +2606,11 @@ export namespace Schemas { Map: (spec: T, defaultValue?: Partial> | undefined) => ISchema>; const // (undocumented) Optional: (spec: ISchema) => ISchema; + const // (undocumented) + OneOf: (specs: T) => ISchema<{ [K in keyof T]: { + readonly $case: K; + readonly value: ReturnType; + }; }[keyof T]>; const // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen fromJson: (json: JsonSchemaExtended) => ISchema; const mutateNestedValues: (jsonSchema: JsonSchemaExtended, value: unknown, mutateFn: (value: unknown, valueType: JsonSchemaExtended) => { diff --git a/packages/@dcl/sdk-commands/package-lock.json b/packages/@dcl/sdk-commands/package-lock.json index e9694579c..3793c3ddb 100644 --- a/packages/@dcl/sdk-commands/package-lock.json +++ b/packages/@dcl/sdk-commands/package-lock.json @@ -48,6 +48,9 @@ }, "../inspector": { "version": "0.1.0", + "dependencies": { + "classnames": "^2.3.2" + }, "devDependencies": { "@babylonjs/core": "^5.48.0", "@babylonjs/gui": "^5.48.0", @@ -2396,6 +2399,7 @@ "@types/react-dom": "^18.0.10", "@vscode/webview-ui-toolkit": "^1.2.2", "@well-known-components/pushable-channel": "^1.0.3", + "classnames": "^2.3.2", "decentraland-ui": "^3.87.2", "esbuild": "^0.17.12", "fp-future": "^1.0.1", diff --git a/test/ecs/serialization.spec.ts b/test/ecs/serialization.spec.ts index d818f4382..704d679ba 100644 --- a/test/ecs/serialization.spec.ts +++ b/test/ecs/serialization.spec.ts @@ -109,7 +109,8 @@ describe('test schema serialization', () => { hp: Schemas.Float, position: Vector3, targets: Schemas.Array(Vector3), - items: Schemas.Array(ItemType) + items: Schemas.Array(ItemType), + pet: Schemas.OneOf({ cat: Schemas.Entity, dog: Schemas.Entity }) }) const defaultPlayer = { @@ -119,7 +120,8 @@ describe('test schema serialization', () => { hp: 0.0, position: { x: 1.0, y: 50.0, z: 50.0 }, targets: [], - items: [] + items: [], + pet: { $case: 'dog' as const, value: 3146 as Entity } } const myPlayer = PlayerComponent.create(myEntity, defaultPlayer) @@ -143,6 +145,7 @@ describe('test schema serialization', () => { itemAmount: 10, description: 'this is a description to an enchanting item.' }) + myPlayer.pet = { $case: 'cat', value: 2019 as Entity } const buffer = new ReadWriteByteBuffer() PlayerComponent.schema.serialize(PlayerComponent.get(myEntity), buffer) @@ -579,7 +582,8 @@ describe('test json-schema function', () => { const comp = engine.defineComponent('test', { arrayOf: Schemas.Array(Schemas.Map(mapWithAllPrimitives)), - mapOf: Schemas.Map(mapWithAllPrimitives) + mapOf: Schemas.Map(mapWithAllPrimitives), + oneOf: Schemas.OneOf(mapWithAllPrimitives) }) const jsonSchemaComponent = JSON.parse(JSON.stringify(comp.schema.jsonSchema)) @@ -609,12 +613,27 @@ describe('test json-schema function', () => { manyEntities: Schemas.Array(Schemas.Entity), valueWithoutChanges: Schemas.Int, manyPairOfEntities: Schemas.Array(Schemas.Array(Schemas.Entity)) - }) + }), + oneOrTheOther: Schemas.OneOf({ someEntity: Schemas.Entity, someBool: Schemas.Boolean }), + oneOrTheOtherMap: Schemas.OneOf({ + first: Schemas.Map({ anEntity: Schemas.Entity }), + second: Schemas.Map({ aNumber: Schemas.Number }) + }), + oneOrOtherArray: Schemas.Array(Schemas.OneOf({ someEntity: Schemas.Entity, someBool: Schemas.Boolean })), + oneOrTheOtherWithoutChanges: Schemas.OneOf({ someEntity: Schemas.Entity, someBool: Schemas.Boolean }), + nestedOneOrTheOtherWithoutChanges: Schemas.OneOf({ + first: Schemas.Map({ anEntity: Schemas.Entity }), + second: Schemas.Map({ aNumber: Schemas.Number }) + }), + arrayOfOneOrTheOtherWithoutChanges: Schemas.Array( + Schemas.OneOf({ someEntity: Schemas.Entity, someBool: Schemas.Boolean }) + ) } const MySchema = Schemas.Map(MySchemaDefinition) const someValue = MySchema.create() + someValue.someImportantEntity = 1 as Entity someValue.manyEntities = [2, 3, 4] as Entity[] someValue.manyPairOfEntities = [ @@ -630,6 +649,9 @@ describe('test json-schema function', () => { [22, 23, 24, 25] ] as Entity[][] someValue.nestedMap.valueWithoutChanges = 26 + someValue.oneOrTheOther = { $case: 'someEntity', value: 27 as Entity } + someValue.oneOrTheOtherMap = { $case: 'first', value: { anEntity: 28 as Entity } } + someValue.oneOrOtherArray = [{ $case: 'someEntity', value: 29 as Entity }] mutateValues(MySchema.jsonSchema, someValue, (currentValue, valueType) => { if (valueType.serializationType === 'entity') { @@ -646,7 +668,6 @@ describe('test json-schema function', () => { [1009, 1010, 1011, 1012] ] as Entity[][], valueWithoutChanges: 13, - nestedMap: { someImportantEntity: 1014 as Entity, manyEntities: [1015, 1016, 1017] as Entity[], @@ -655,7 +676,13 @@ describe('test json-schema function', () => { [1022, 1023, 1024, 1025] ] as Entity[][], valueWithoutChanges: 26 - } + }, + oneOrTheOther: 1027 as Entity, + oneOrTheOtherMap: { first: { anEntity: 1028 as Entity } }, + oneOrOtherArray: [1029], + oneOrTheOtherWithoutChanges: {}, + nestedOneOrTheOtherWithoutChanges: {}, + arrayOfOneOrTheOtherWithoutChanges: [] }) }) }) diff --git a/test/snapshots/development-bundles/testing-fw.test.ts.crdt b/test/snapshots/development-bundles/testing-fw.test.ts.crdt index 78eb4f856..1a31954ce 100644 --- a/test/snapshots/development-bundles/testing-fw.test.ts.crdt +++ b/test/snapshots/development-bundles/testing-fw.test.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=342.9k bytes +SCENE_COMPILED_JS_SIZE_PROD=344.9k bytes THE BUNDLE HAS SOURCEMAPS (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k @@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/testing-fw.test.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 29k - MALLOC_COUNT = 9565 - ALIVE_OBJS_DELTA ~= 1.78k + MALLOC_COUNT = 9626 + ALIVE_OBJS_DELTA ~= 1.79k CALL onStart() LOG: ["Adding one to position.y=0"] Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0} @@ -64,4 +64,4 @@ CALL onUpdate(0.1) OPCODES ~= 4k MALLOC_COUNT = -40 ALIVE_OBJS_DELTA ~= -0.01k - MEMORY_USAGE_COUNT ~= 940.35k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 945.82k bytes \ No newline at end of file diff --git a/test/snapshots/development-bundles/two-way-crdt.test.ts.crdt b/test/snapshots/development-bundles/two-way-crdt.test.ts.crdt index 320b37064..6ca4ed98f 100644 --- a/test/snapshots/development-bundles/two-way-crdt.test.ts.crdt +++ b/test/snapshots/development-bundles/two-way-crdt.test.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=342.9k bytes +SCENE_COMPILED_JS_SIZE_PROD=344.9k bytes THE BUNDLE HAS SOURCEMAPS (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k @@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/two-way-crdt.test.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 29k - MALLOC_COUNT = 9565 - ALIVE_OBJS_DELTA ~= 1.78k + MALLOC_COUNT = 9626 + ALIVE_OBJS_DELTA ~= 1.79k CALL onStart() LOG: ["Adding one to position.y=0"] Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0} @@ -64,4 +64,4 @@ CALL onUpdate(0.1) OPCODES ~= 4k MALLOC_COUNT = -40 ALIVE_OBJS_DELTA ~= -0.01k - MEMORY_USAGE_COUNT ~= 940.36k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 945.83k bytes \ No newline at end of file diff --git a/test/snapshots/package-lock.json b/test/snapshots/package-lock.json index 442c699b9..63d4cabad 100644 --- a/test/snapshots/package-lock.json +++ b/test/snapshots/package-lock.json @@ -156,7 +156,7 @@ "dependencies": { "@dcl/ecs": "file:../ecs", "@dcl/ecs-math": "2.0.1-20221129185242.commit-40495c1", - "@dcl/explorer": "1.0.99577-20230405135643.commit-4656050", + "@dcl/explorer": "1.0.102433-20230413154111.commit-3fba86c", "@dcl/js-runtime": "file:../js-runtime", "@dcl/react-ecs": "file:../react-ecs", "@dcl/sdk-commands": "file:../sdk-commands" diff --git a/test/snapshots/production-bundles/append-value-crdt.ts.crdt b/test/snapshots/production-bundles/append-value-crdt.ts.crdt index f245bb280..218258bb0 100644 --- a/test/snapshots/production-bundles/append-value-crdt.ts.crdt +++ b/test/snapshots/production-bundles/append-value-crdt.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=152.5k bytes +SCENE_COMPILED_JS_SIZE_PROD=153.3k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/append-value-crdt.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 30k - MALLOC_COUNT = 8424 - ALIVE_OBJS_DELTA ~= 1.79k + MALLOC_COUNT = 8466 + ALIVE_OBJS_DELTA ~= 1.80k CALL onStart() Renderer: APPEND_VALUE e=0x200 c=1063 t=0 data={"button":0,"hit":{"position":{"x":1,"y":2,"z":3},"globalOrigin":{"x":1,"y":2,"z":3},"direction":{"x":1,"y":2,"z":3},"normalHit":{"x":1,"y":2,"z":3},"length":10,"meshName":"mesh","entityId":512},"state":1,"timestamp":1,"analog":5} OPCODES ~= 8k @@ -55,4 +55,4 @@ CALL onUpdate(0.1) OPCODES ~= 12k MALLOC_COUNT = 31 ALIVE_OBJS_DELTA ~= 0.01k - MEMORY_USAGE_COUNT ~= 693.84k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 697.61k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/billboard.ts.crdt b/test/snapshots/production-bundles/billboard.ts.crdt index 0b62ee43c..b62c99f52 100644 --- a/test/snapshots/production-bundles/billboard.ts.crdt +++ b/test/snapshots/production-bundles/billboard.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=185.3k bytes +SCENE_COMPILED_JS_SIZE_PROD=186.1k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/billboard.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 40k - MALLOC_COUNT = 10716 - ALIVE_OBJS_DELTA ~= 2.24k + MALLOC_COUNT = 10758 + ALIVE_OBJS_DELTA ~= 2.25k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 4 @@ -77,4 +77,4 @@ CALL onUpdate(0.1) OPCODES ~= 8k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 844.59k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 848.37k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/composite.ts.crdt b/test/snapshots/production-bundles/composite.ts.crdt index fff4e30c1..4a15d5ca9 100644 --- a/test/snapshots/production-bundles/composite.ts.crdt +++ b/test/snapshots/production-bundles/composite.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=149.9k bytes +SCENE_COMPILED_JS_SIZE_PROD=150.7k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -10,8 +10,8 @@ EVAL test/snapshots/production-bundles/composite.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 29k - MALLOC_COUNT = 7979 - ALIVE_OBJS_DELTA ~= 1.67k + MALLOC_COUNT = 8021 + ALIVE_OBJS_DELTA ~= 1.68k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 14 @@ -34,4 +34,4 @@ CALL onUpdate(0.1) OPCODES ~= 1k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 669.24k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 673.02k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/cube-deleted.ts.crdt b/test/snapshots/production-bundles/cube-deleted.ts.crdt index 7eaf464aa..a13363196 100644 --- a/test/snapshots/production-bundles/cube-deleted.ts.crdt +++ b/test/snapshots/production-bundles/cube-deleted.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=149.3k bytes +SCENE_COMPILED_JS_SIZE_PROD=150.1k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,7 +9,7 @@ EVAL test/snapshots/production-bundles/cube-deleted.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 29k - MALLOC_COUNT = 7950 + MALLOC_COUNT = 7992 ALIVE_OBJS_DELTA ~= 1.67k CALL onStart() OPCODES ~= 0k @@ -42,4 +42,4 @@ CALL onUpdate(0.1) OPCODES ~= 3k MALLOC_COUNT = 1 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 667.11k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 670.88k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/cube.ts.crdt b/test/snapshots/production-bundles/cube.ts.crdt index 52c4af792..e0eb86b80 100644 --- a/test/snapshots/production-bundles/cube.ts.crdt +++ b/test/snapshots/production-bundles/cube.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=148.7k bytes +SCENE_COMPILED_JS_SIZE_PROD=149.5k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,7 +9,7 @@ EVAL test/snapshots/production-bundles/cube.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 29k - MALLOC_COUNT = 7789 + MALLOC_COUNT = 7831 ALIVE_OBJS_DELTA ~= 1.63k CALL onStart() OPCODES ~= 0k @@ -32,4 +32,4 @@ CALL onUpdate(0.1) OPCODES ~= 1k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 645.70k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 655.32k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/cubes.ts.crdt b/test/snapshots/production-bundles/cubes.ts.crdt index 261421ddf..5ea28b024 100644 --- a/test/snapshots/production-bundles/cubes.ts.crdt +++ b/test/snapshots/production-bundles/cubes.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=185.7k bytes +SCENE_COMPILED_JS_SIZE_PROD=186.5k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/cubes.js REQUIRE: long REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi - OPCODES ~= 79k - MALLOC_COUNT = 14166 - ALIVE_OBJS_DELTA ~= 3.55k + OPCODES ~= 80k + MALLOC_COUNT = 14208 + ALIVE_OBJS_DELTA ~= 3.56k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 6 @@ -1652,4 +1652,4 @@ CALL onUpdate(0.1) OPCODES ~= 636k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 982.74k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 986.52k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/pointer-events.ts.crdt b/test/snapshots/production-bundles/pointer-events.ts.crdt index 2cf69001a..c4f98d3a3 100644 --- a/test/snapshots/production-bundles/pointer-events.ts.crdt +++ b/test/snapshots/production-bundles/pointer-events.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=150.2k bytes +SCENE_COMPILED_JS_SIZE_PROD=151k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/pointer-events.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 30k - MALLOC_COUNT = 8291 - ALIVE_OBJS_DELTA ~= 1.76k + MALLOC_COUNT = 8333 + ALIVE_OBJS_DELTA ~= 1.77k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 6 @@ -43,4 +43,4 @@ CALL onUpdate(0.1) OPCODES ~= 1k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 676.08k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 679.86k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/schema-components.ts.crdt b/test/snapshots/production-bundles/schema-components.ts.crdt index 031c35be5..98a34a8d4 100644 --- a/test/snapshots/production-bundles/schema-components.ts.crdt +++ b/test/snapshots/production-bundles/schema-components.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=148.7k bytes +SCENE_COMPILED_JS_SIZE_PROD=149.5k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/schema-components.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 33k - MALLOC_COUNT = 7908 - ALIVE_OBJS_DELTA ~= 1.66k + MALLOC_COUNT = 7950 + ALIVE_OBJS_DELTA ~= 1.67k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 6 @@ -31,4 +31,4 @@ CALL onUpdate(0.1) OPCODES ~= 1k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 648.07k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 657.68k bytes \ No newline at end of file diff --git a/test/snapshots/production-bundles/ui.ts.crdt b/test/snapshots/production-bundles/ui.ts.crdt index b0d9651cf..0affc0a8b 100644 --- a/test/snapshots/production-bundles/ui.ts.crdt +++ b/test/snapshots/production-bundles/ui.ts.crdt @@ -1,4 +1,4 @@ -SCENE_COMPILED_JS_SIZE_PROD=304.2k bytes +SCENE_COMPILED_JS_SIZE_PROD=305k bytes (start empty vm 0.21.0-3680274614.commit-1808aa1) OPCODES ~= 0k MALLOC_COUNT = 1005 @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/ui.js REQUIRE: ~system/EngineApi REQUIRE: ~system/EngineApi OPCODES ~= 39k - MALLOC_COUNT = 15538 - ALIVE_OBJS_DELTA ~= 2.92k + MALLOC_COUNT = 15580 + ALIVE_OBJS_DELTA ~= 2.93k CALL onStart() OPCODES ~= 0k MALLOC_COUNT = 6 @@ -65,4 +65,4 @@ CALL onUpdate(0.1) OPCODES ~= 61k MALLOC_COUNT = 0 ALIVE_OBJS_DELTA ~= 0.00k - MEMORY_USAGE_COUNT ~= 1473.60k bytes \ No newline at end of file + MEMORY_USAGE_COUNT ~= 1477.37k bytes \ No newline at end of file