infrastructure-components
Version:
Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.
24 lines • 915 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = __importDefault(require("../types"));
exports.ENTITY_INSTANCE_TYPE = "EntityComponent";
;
/**
* an entity is a field that can serve as primaryKey and/or as rangeKey
*/
exports.default = (props) => {
// the component must have the properties of IComponent
const componentProps = {
infrastructureType: types_1.default.INFRASTRUCTURE_TYPE_COMPONENT,
instanceType: exports.ENTITY_INSTANCE_TYPE,
instanceId: props.id
};
return Object.assign(componentProps, props);
};
exports.isEntity = (component) => {
return component !== undefined && component.instanceType === exports.ENTITY_INSTANCE_TYPE;
};
//# sourceMappingURL=entity-component.js.map