@dcl/ecs 7.1.2-4415683908.commit-0a210fd → 7.1.2-4419392799.commit-7961b54

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.
@@ -102,14 +102,16 @@ function preEngine() {
102
102
  componentsDefinition.set(componentId, newComponent);
103
103
  return newComponent;
104
104
  }
105
- function getComponent(componentId) {
105
+ function getComponent(value) {
106
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
106
107
  const component = componentsDefinition.get(componentId);
107
108
  if (!component) {
108
109
  throw new Error(`Component ${componentId} not found. You need to declare the components at the beginnig of the engine declaration`);
109
110
  }
110
111
  return component;
111
112
  }
112
- function getComponentOrNull(componentId) {
113
+ function getComponentOrNull(value) {
114
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
113
115
  return (componentsDefinition.get(componentId) ??
114
116
  /* istanbul ignore next */
115
117
  null);
@@ -157,7 +157,7 @@ export interface IEngine {
157
157
  * const StateComponent = engine.getComponent(StateComponentId)
158
158
  * ```
159
159
  */
160
- getComponent<T>(componentId: number): ComponentDefinition<T>;
160
+ getComponent<T>(componentId: number | string): ComponentDefinition<T>;
161
161
  /**
162
162
  * Get the component definition from the component id.
163
163
  * @param componentId - component number or name used to identify the component descriptor
@@ -167,7 +167,7 @@ export interface IEngine {
167
167
  * const StateComponent = engine.getComponent(StateComponentId)
168
168
  * ```
169
169
  */
170
- getComponentOrNull<T>(componentId: number): ComponentDefinition<T> | null;
170
+ getComponentOrNull<T>(componentId: number | string): ComponentDefinition<T> | null;
171
171
  /**
172
172
  * @public
173
173
  * Get a iterator of entities that has all the component requested.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
- "version": "7.1.2-4415683908.commit-0a210fd",
3
+ "version": "7.1.2-4419392799.commit-7961b54",
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-4415683908.commit-0a210fd",
30
+ "@dcl/js-runtime": "7.1.2-4419392799.commit-7961b54",
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": "0a210fde7524e27f44b8cc35d8fabf39705c57b6"
43
+ "commit": "7961b54813d767254a533472157b7c07665aeb13"
44
44
  }