@dcl/ecs 7.1.2-4419392799.commit-7961b54 → 7.1.2-4426178080.commit-9504360
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/components/generated/index.gen.d.ts +31 -0
- package/dist/components/generated/index.gen.js +32 -0
- package/dist/composite/components.d.ts +18 -0
- package/dist/composite/components.js +18 -0
- package/dist/composite/index.d.ts +3 -0
- package/dist/composite/index.js +3 -0
- package/dist/composite/instance.d.ts +14 -0
- package/dist/composite/instance.js +121 -0
- package/dist/composite/serialization.d.ts +6 -0
- package/dist/composite/serialization.js +36 -0
- package/dist/composite/types.d.ts +21 -0
- package/dist/composite/types.js +1 -0
- package/dist/engine/index.js +8 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/index.js +7 -0
- package/package.json +3 -3
|
@@ -89,3 +89,34 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
|
|
|
89
89
|
/** @public */ export declare const UiTransform: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
|
|
90
90
|
/** @public */ export declare const VideoPlayer: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
|
|
91
91
|
/** @public */ export declare const VisibilityComponent: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
|
|
92
|
+
/** public */ export declare const componentDefinitionByName: {
|
|
93
|
+
"core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
|
|
94
|
+
"core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
|
|
95
|
+
"core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
|
|
96
|
+
"core::AvatarAttach": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarAttach>>;
|
|
97
|
+
"core::AvatarModifierArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>>;
|
|
98
|
+
"core::AvatarShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarShape>>;
|
|
99
|
+
"core::Billboard": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBBillboard>>;
|
|
100
|
+
"core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
|
|
101
|
+
"core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
|
|
102
|
+
"core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
|
|
103
|
+
"core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
|
|
104
|
+
"core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
|
|
105
|
+
"core::MeshRenderer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshRenderer>>;
|
|
106
|
+
"core::NftShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBNftShape>>;
|
|
107
|
+
"core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
|
|
108
|
+
"core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
|
|
109
|
+
"core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
|
|
110
|
+
"core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
|
|
111
|
+
"core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
|
|
112
|
+
"core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
|
|
113
|
+
"core::UiBackground": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiBackground>>;
|
|
114
|
+
"core::UiDropdown": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdown>>;
|
|
115
|
+
"core::UiDropdownResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>>;
|
|
116
|
+
"core::UiInput": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInput>>;
|
|
117
|
+
"core::UiInputResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
|
|
118
|
+
"core::UiText": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
|
|
119
|
+
"core::UiTransform": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
|
|
120
|
+
"core::VideoPlayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
|
|
121
|
+
"core::VisibilityComponent": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
|
|
122
|
+
};
|
|
@@ -88,3 +88,35 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
|
88
88
|
/** @public */ /*#__PURE__*/ export const UiTransform = engine => engine.defineComponentFromSchema("core::UiTransform", UiTransformSchema);
|
|
89
89
|
/** @public */ /*#__PURE__*/ export const VideoPlayer = engine => engine.defineComponentFromSchema("core::VideoPlayer", VideoPlayerSchema);
|
|
90
90
|
/** @public */ /*#__PURE__*/ export const VisibilityComponent = engine => engine.defineComponentFromSchema("core::VisibilityComponent", VisibilityComponentSchema);
|
|
91
|
+
/** public */ /*#__PURE__*/
|
|
92
|
+
export const componentDefinitionByName = {
|
|
93
|
+
"core::Animator": Animator,
|
|
94
|
+
"core::AudioSource": AudioSource,
|
|
95
|
+
"core::AudioStream": AudioStream,
|
|
96
|
+
"core::AvatarAttach": AvatarAttach,
|
|
97
|
+
"core::AvatarModifierArea": AvatarModifierArea,
|
|
98
|
+
"core::AvatarShape": AvatarShape,
|
|
99
|
+
"core::Billboard": Billboard,
|
|
100
|
+
"core::CameraMode": CameraMode,
|
|
101
|
+
"core::CameraModeArea": CameraModeArea,
|
|
102
|
+
"core::GltfContainer": GltfContainer,
|
|
103
|
+
"core::Material": Material,
|
|
104
|
+
"core::MeshCollider": MeshCollider,
|
|
105
|
+
"core::MeshRenderer": MeshRenderer,
|
|
106
|
+
"core::NftShape": NftShape,
|
|
107
|
+
"core::PointerEvents": PointerEvents,
|
|
108
|
+
"core::PointerEventsResult": PointerEventsResult,
|
|
109
|
+
"core::PointerLock": PointerLock,
|
|
110
|
+
"core::Raycast": Raycast,
|
|
111
|
+
"core::RaycastResult": RaycastResult,
|
|
112
|
+
"core::TextShape": TextShape,
|
|
113
|
+
"core::UiBackground": UiBackground,
|
|
114
|
+
"core::UiDropdown": UiDropdown,
|
|
115
|
+
"core::UiDropdownResult": UiDropdownResult,
|
|
116
|
+
"core::UiInput": UiInput,
|
|
117
|
+
"core::UiInputResult": UiInputResult,
|
|
118
|
+
"core::UiText": UiText,
|
|
119
|
+
"core::UiTransform": UiTransform,
|
|
120
|
+
"core::VideoPlayer": VideoPlayer,
|
|
121
|
+
"core::VisibilityComponent": VisibilityComponent,
|
|
122
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Entity } from '../engine';
|
|
2
|
+
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../engine/types';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
6
|
+
*/
|
|
7
|
+
export type CompositeRootType = {
|
|
8
|
+
id: string;
|
|
9
|
+
entities: {
|
|
10
|
+
src: Entity;
|
|
11
|
+
dest: Entity;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCompositeRootComponent(engine: IEngine): LastWriteWinElementSetComponentDefinition<CompositeRootType>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Schemas } from '../schemas';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
5
|
+
*/
|
|
6
|
+
export function getCompositeRootComponent(engine) {
|
|
7
|
+
const component = engine.getComponentOrNull('composite::root');
|
|
8
|
+
if (component) {
|
|
9
|
+
return component;
|
|
10
|
+
}
|
|
11
|
+
return engine.defineComponent('composite::root', {
|
|
12
|
+
id: Schemas.String,
|
|
13
|
+
entities: Schemas.Array(Schemas.Map({
|
|
14
|
+
src: Schemas.Entity,
|
|
15
|
+
dest: Schemas.Entity
|
|
16
|
+
}))
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Entity } from '../engine/entity';
|
|
2
|
+
import { IEngine } from '../engine/types';
|
|
3
|
+
import { Composite, CompositeProvider } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Instance a composite and returns its root entity
|
|
6
|
+
* @param compositeData state serialized by the CRDT protocol
|
|
7
|
+
* @param getNextAvailableEntity function that gives unused entities
|
|
8
|
+
* @param rootEntity (optional) suggested mapped rootEntity for the composite
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare function instanceComposite(engine: IEngine, compositeData: Composite, getNextAvailableEntity: () => Entity | null, compositeProvider: CompositeProvider, rootEntity?: Entity, alreadyRequestedId?: Set<string>): Entity;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { componentDefinitionByName } from '../components';
|
|
2
|
+
import { componentNumberFromName } from '../components/component-number';
|
|
3
|
+
import { Schemas } from '../schemas';
|
|
4
|
+
import { getCompositeRootComponent } from './components';
|
|
5
|
+
/**
|
|
6
|
+
* Return the entity mapping or fail if there is no more
|
|
7
|
+
*/
|
|
8
|
+
function getEntityMapping(compositeEntity, mappedEntities, getNextAvailableEntity) {
|
|
9
|
+
const existingEntity = mappedEntities.get(compositeEntity);
|
|
10
|
+
if (existingEntity) {
|
|
11
|
+
return existingEntity;
|
|
12
|
+
}
|
|
13
|
+
// This function in runtime can be just `engine.addEntity()`
|
|
14
|
+
const newEntity = getNextAvailableEntity();
|
|
15
|
+
if (newEntity === null) {
|
|
16
|
+
throw new Error('There is no more entities to allocate');
|
|
17
|
+
}
|
|
18
|
+
mappedEntities.set(compositeEntity, newEntity);
|
|
19
|
+
return newEntity;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Instance a composite and returns its root entity
|
|
23
|
+
* @param compositeData state serialized by the CRDT protocol
|
|
24
|
+
* @param getNextAvailableEntity function that gives unused entities
|
|
25
|
+
* @param rootEntity (optional) suggested mapped rootEntity for the composite
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
/*#__PURE__*/
|
|
32
|
+
export function instanceComposite(engine, compositeData, getNextAvailableEntity, compositeProvider, rootEntity, alreadyRequestedId = new Set()) {
|
|
33
|
+
const TransformComponentNumber = componentNumberFromName('core::Transform');
|
|
34
|
+
const CompositeRootComponent = getCompositeRootComponent(engine);
|
|
35
|
+
// Key => EntityNumber from the composite
|
|
36
|
+
// Value => EntityNumber in current engine
|
|
37
|
+
const mappedEntities = new Map();
|
|
38
|
+
const getCompositeEntity = (compositeEntity) => getEntityMapping(compositeEntity, mappedEntities, getNextAvailableEntity);
|
|
39
|
+
// ## 1 ##
|
|
40
|
+
// First entity that I want to map, the root entity from the composite to the target entity in the engine
|
|
41
|
+
// If there is no `rootEntity` passed, we assign one from `getNextAvailableEntity`
|
|
42
|
+
const compositeRootEntity = rootEntity ?? getCompositeEntity(0);
|
|
43
|
+
if (rootEntity) {
|
|
44
|
+
mappedEntities.set(0, rootEntity);
|
|
45
|
+
}
|
|
46
|
+
// ## 2 ##
|
|
47
|
+
// If there are more composite inside this one, we instance first.
|
|
48
|
+
// => This is not only a copy, we need to instance. Otherwise, we'd be missing that branches
|
|
49
|
+
// => TODO: in the future, the instanciation is first, then the overides (to parameterize Composite, e.g. house with different wall colors)
|
|
50
|
+
const childrenComposite = compositeData.components.find((item) => item.name === CompositeRootComponent.componentName);
|
|
51
|
+
if (childrenComposite) {
|
|
52
|
+
for (const [entity, childComposite] of childrenComposite.data) {
|
|
53
|
+
const compositeRoot = childComposite;
|
|
54
|
+
const composite = compositeProvider.getCompositeOrNull(compositeRoot.id);
|
|
55
|
+
if (composite) {
|
|
56
|
+
if (alreadyRequestedId.has(compositeRoot.id) || compositeRoot.id === compositeData.id) {
|
|
57
|
+
throw new Error(`Composite ${compositeRoot.id} has a recursive instanciation while try to instance ${compositeData.id}. Previous instances: ${alreadyRequestedId.toString()}`);
|
|
58
|
+
}
|
|
59
|
+
instanceComposite(engine, composite, getNextAvailableEntity, compositeProvider, entity, new Set(alreadyRequestedId).add(compositeData.id));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// ## 3 ##
|
|
64
|
+
// Then, we copy the all rest of the components (skipping the Composite ones)
|
|
65
|
+
for (const component of compositeData.components) {
|
|
66
|
+
// We already instanced the composite
|
|
67
|
+
if (component.name === CompositeRootComponent.componentName)
|
|
68
|
+
continue;
|
|
69
|
+
// ## 3a ##
|
|
70
|
+
// We find the component definition
|
|
71
|
+
let componentDefinition;
|
|
72
|
+
const existingComponentDefinition = engine.getComponentOrNull(component.name);
|
|
73
|
+
if (!existingComponentDefinition) {
|
|
74
|
+
if (component.schema) {
|
|
75
|
+
componentDefinition = engine.defineComponentFromSchema(component.name, Schemas.fromJson(component.schema));
|
|
76
|
+
}
|
|
77
|
+
else if (component.name.startsWith('core::')) {
|
|
78
|
+
if (component.name in componentDefinitionByName) {
|
|
79
|
+
componentDefinition = componentDefinitionByName[component.name](engine);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error(`The core component ${component.name} was not found.`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw new Error(`${component.name} is not defined and there is no schema to define it.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
componentDefinition = existingComponentDefinition;
|
|
91
|
+
}
|
|
92
|
+
// ## 3b ##
|
|
93
|
+
// Iterating over all the entities with this component and create the replica
|
|
94
|
+
for (const [entity, compositeComponentValue] of component.data) {
|
|
95
|
+
const targetEntity = getCompositeEntity(entity);
|
|
96
|
+
const componentValue = componentDefinition.create(targetEntity, compositeComponentValue);
|
|
97
|
+
// ## 3c ##
|
|
98
|
+
// All entities referenced in the composite probably has a different resolved EntityNumber
|
|
99
|
+
// We'll know with the mappedEntityes
|
|
100
|
+
if (componentDefinition.componentId === TransformComponentNumber) {
|
|
101
|
+
const transform = componentValue;
|
|
102
|
+
if (transform.parent) {
|
|
103
|
+
transform.parent = getCompositeEntity(transform.parent);
|
|
104
|
+
}
|
|
105
|
+
// TODO: is it going to be necessary to remap assets? e.g. src param from AudioSource and GltfContainer
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// TODO: with static reflection, look for `Schema.Entity` in custom components
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const composite = CompositeRootComponent.getMutableOrNull(compositeRootEntity) || CompositeRootComponent.create(compositeRootEntity);
|
|
113
|
+
for (const [entitySource, targetEntity] of mappedEntities) {
|
|
114
|
+
composite.entities.push({
|
|
115
|
+
src: entitySource,
|
|
116
|
+
dest: targetEntity
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
composite.id = compositeData.id;
|
|
120
|
+
return compositeRootEntity;
|
|
121
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
4
|
+
*/
|
|
5
|
+
export function compositeFromJson(jsonComposite) {
|
|
6
|
+
if (!jsonComposite)
|
|
7
|
+
throw new Error('Composite is not well defined');
|
|
8
|
+
if (!jsonComposite.id || typeof jsonComposite.id !== 'string')
|
|
9
|
+
throw new Error("Composite doesn't have a valid `id` field");
|
|
10
|
+
const compositeId = jsonComposite.id;
|
|
11
|
+
// TODO: Should be there a .version to identify the schema version?
|
|
12
|
+
if (!Array.isArray(jsonComposite.components))
|
|
13
|
+
throw new Error(`Composite '${compositeId}' fields 'components' is not an array`);
|
|
14
|
+
const composite = {
|
|
15
|
+
id: compositeId,
|
|
16
|
+
components: []
|
|
17
|
+
};
|
|
18
|
+
for (const component of jsonComposite.components) {
|
|
19
|
+
if (!component.name || typeof component.name !== 'string')
|
|
20
|
+
throw new Error(`Composite '${compositeId}': The component doesn't have a valid name`);
|
|
21
|
+
const componentName = component.name;
|
|
22
|
+
const componentData = new Map();
|
|
23
|
+
if (typeof component.data !== 'object' || Array.isArray(component.data))
|
|
24
|
+
throw new Error(`Composite '${compositeId}': Invalid data in component '${component.name}'`);
|
|
25
|
+
for (const [entityStr, data] of Object.entries(component.data)) {
|
|
26
|
+
const entity = parseInt(entityStr);
|
|
27
|
+
componentData.set(entity, data);
|
|
28
|
+
}
|
|
29
|
+
composite.components.push({
|
|
30
|
+
name: componentName,
|
|
31
|
+
data: componentData,
|
|
32
|
+
schema: component.schema
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return composite;
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Entity } from '../engine/entity';
|
|
2
|
+
import { JsonSchemaExtended } from '../schemas/ISchema';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
6
|
+
*/
|
|
7
|
+
export type Composite = {
|
|
8
|
+
id: string;
|
|
9
|
+
components: {
|
|
10
|
+
name: string;
|
|
11
|
+
schema?: JsonSchemaExtended;
|
|
12
|
+
data: Map<Entity, unknown>;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
* @deprecated composite is not being supported so far, please do not use this feature
|
|
18
|
+
*/
|
|
19
|
+
export type CompositeProvider = {
|
|
20
|
+
getCompositeOrNull: (id: string) => Composite | null;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/engine/index.js
CHANGED
|
@@ -102,16 +102,16 @@ function preEngine() {
|
|
|
102
102
|
componentsDefinition.set(componentId, newComponent);
|
|
103
103
|
return newComponent;
|
|
104
104
|
}
|
|
105
|
-
function getComponent(
|
|
106
|
-
const componentId = typeof
|
|
105
|
+
function getComponent(componentIdOrName) {
|
|
106
|
+
const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
|
|
107
107
|
const component = componentsDefinition.get(componentId);
|
|
108
108
|
if (!component) {
|
|
109
109
|
throw new Error(`Component ${componentId} not found. You need to declare the components at the beginnig of the engine declaration`);
|
|
110
110
|
}
|
|
111
111
|
return component;
|
|
112
112
|
}
|
|
113
|
-
function getComponentOrNull(
|
|
114
|
-
const componentId = typeof
|
|
113
|
+
function getComponentOrNull(componentIdOrName) {
|
|
114
|
+
const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
|
|
115
115
|
return (componentsDefinition.get(componentId) ??
|
|
116
116
|
/* istanbul ignore next */
|
|
117
117
|
null);
|
|
@@ -142,7 +142,10 @@ function preEngine() {
|
|
|
142
142
|
function componentsIter() {
|
|
143
143
|
return componentsDefinition.values();
|
|
144
144
|
}
|
|
145
|
-
function removeComponentDefinition(
|
|
145
|
+
function removeComponentDefinition(componentIdOrName) {
|
|
146
|
+
if (sealed)
|
|
147
|
+
throw new Error('Engine is already sealed. No components can be removed at this stage');
|
|
148
|
+
const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
|
|
146
149
|
componentsDefinition.delete(componentId);
|
|
147
150
|
}
|
|
148
151
|
const Transform = components.Transform({ defineComponentFromSchema });
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/schemas/index.d.ts
CHANGED
|
@@ -49,4 +49,10 @@ export declare namespace Schemas {
|
|
|
49
49
|
const Map: <T extends import("./Map").Spec>(spec: T, defaultValue?: Partial<import("./Map").MapResult<T>> | undefined) => ISchema<import("./Map").MapResult<T>>;
|
|
50
50
|
/** @public */
|
|
51
51
|
const Optional: <T>(spec: ISchema<T>) => ISchema<T | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* @public Create an ISchema object from the json-schema
|
|
54
|
+
* @param jsonSchema
|
|
55
|
+
* @returns a ISchema or fail for unsupported json-schema
|
|
56
|
+
*/
|
|
57
|
+
const fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
|
|
52
58
|
}
|
package/dist/schemas/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { QuaternionSchema } from './custom/Quaternion';
|
|
|
11
11
|
import { Vector3Schema } from './custom/Vector3';
|
|
12
12
|
import { IMap } from './Map';
|
|
13
13
|
import { IOptional } from './Optional';
|
|
14
|
+
import { jsonSchemaToSchema } from './buildSchema';
|
|
14
15
|
/**
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
@@ -54,4 +55,10 @@ export var Schemas;
|
|
|
54
55
|
Schemas.Map = IMap;
|
|
55
56
|
/** @public */
|
|
56
57
|
Schemas.Optional = IOptional;
|
|
58
|
+
/**
|
|
59
|
+
* @public Create an ISchema object from the json-schema
|
|
60
|
+
* @param jsonSchema
|
|
61
|
+
* @returns a ISchema or fail for unsupported json-schema
|
|
62
|
+
*/
|
|
63
|
+
Schemas.fromJson = jsonSchemaToSchema;
|
|
57
64
|
})(Schemas || (Schemas = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
|
-
"version": "7.1.2-
|
|
3
|
+
"version": "7.1.2-4426178080.commit-9504360",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ts-proto": "^1.112.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dcl/js-runtime": "7.1.2-
|
|
30
|
+
"@dcl/js-runtime": "7.1.2-4426178080.commit-9504360",
|
|
31
31
|
"@dcl/protocol": "1.0.0-4408137944.commit-a67c796"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"displayName": "ECS",
|
|
41
41
|
"tsconfig": "./tsconfig.json"
|
|
42
42
|
},
|
|
43
|
-
"commit": "
|
|
43
|
+
"commit": "950436017ab8c641b3200d13e39e696f901efe26"
|
|
44
44
|
}
|