UNPKG

915 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const types_1 = __importDefault(require("../types"));
7exports.ENTITY_INSTANCE_TYPE = "EntityComponent";
8;
9/**
10 * an entity is a field that can serve as primaryKey and/or as rangeKey
11 */
12exports.default = (props) => {
13 // the component must have the properties of IComponent
14 const componentProps = {
15 infrastructureType: types_1.default.INFRASTRUCTURE_TYPE_COMPONENT,
16 instanceType: exports.ENTITY_INSTANCE_TYPE,
17 instanceId: props.id
18 };
19 return Object.assign(componentProps, props);
20};
21exports.isEntity = (component) => {
22 return component !== undefined && component.instanceType === exports.ENTITY_INSTANCE_TYPE;
23};
24//# sourceMappingURL=entity-component.js.map
\No newline at end of file