xiot-core-spec-ts
Version:
XIOT Specification Codec
35 lines (34 loc) • 899 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoleCodec = void 0;
const Role_1 = require("../../typedef/rbac/Role");
class RoleCodec {
static decodeArray(array) {
if (array != null) {
if (array.length > 0) {
return array.map(x => RoleCodec.decode(x));
}
}
return [];
}
static decode(x) {
return new Role_1.Role(x.id, x.parent_id, x.text, x.permission);
}
static encode(x) {
return {
id: x.id,
parent_id: x.parent_id,
text: x.text,
permission: x.permission
};
}
static encodeArray(roles) {
if (roles != null) {
if (roles.length > 0) {
return roles.map(x => RoleCodec.encode(x));
}
}
return [];
}
}
exports.RoleCodec = RoleCodec;