@bitblit/ratchet-misc
Version:
Ratchet miscellaneous tooling that requires smallish dependant libraries
88 lines • 4.53 kB
JavaScript
import { exists } from '../runtime.js';
import { RoleAccountableToFromJSON, RoleAccountableToToJSON } from './RoleAccountableTo.js';
import { RoleAssignmentsInnerFromJSON, RoleAssignmentsInnerToJSON } from './RoleAssignmentsInner.js';
import { RoleContributesToFromJSON, RoleContributesToToJSON } from './RoleContributesTo.js';
export var RoleTypeEnum;
(function (RoleTypeEnum) {
RoleTypeEnum["role"] = "role";
})(RoleTypeEnum || (RoleTypeEnum = {}));
export var RoleStatusEnum;
(function (RoleStatusEnum) {
RoleStatusEnum["draft"] = "draft";
RoleStatusEnum["active"] = "active";
RoleStatusEnum["archived"] = "archived";
})(RoleStatusEnum || (RoleStatusEnum = {}));
export function instanceOfRole(value) {
let isInstance = true;
isInstance = isInstance && '_id' in value;
isInstance = isInstance && '_rootId' in value;
isInstance = isInstance && '_createdBy' in value;
isInstance = isInstance && 'name' in value;
isInstance = isInstance && 'contributesTo' in value;
return isInstance;
}
export function RoleFromJSON(json) {
return RoleFromJSONTyped(json, false);
}
export function RoleFromJSONTyped(json, ignoreDiscriminator) {
if (json === undefined || json === null) {
return json;
}
return {
_id: json['_id'],
_type: !exists(json, '_type') ? undefined : json['_type'],
_rootId: json['_rootId'],
_createdOn: !exists(json, '_createdOn') ? undefined : new Date(json['_createdOn']),
_createdBy: json['_createdBy'],
_updatedOn: !exists(json, '_updatedOn') ? undefined : new Date(json['_updatedOn']),
_updatedBy: !exists(json, '_updatedBy') ? undefined : json['_updatedBy'],
_archivedOn: !exists(json, '_archivedOn') ? undefined : new Date(json['_archivedOn']),
_archivedBy: !exists(json, '_archivedBy') ? undefined : json['_archivedBy'],
_deletedOn: !exists(json, '_deletedOn') ? undefined : new Date(json['_deletedOn']),
_deletedBy: !exists(json, '_deletedBy') ? undefined : json['_deletedBy'],
_operationId: !exists(json, '_operationId') ? undefined : json['_operationId'],
_isPublic: !exists(json, '_isPublic') ? undefined : json['_isPublic'],
name: json['name'],
description: !exists(json, 'description') ? undefined : json['description'],
templateId: !exists(json, 'templateId') ? undefined : json['templateId'],
status: !exists(json, 'status') ? undefined : json['status'],
userAllocationPercent: !exists(json, 'userAllocationPercent') ? undefined : json['userAllocationPercent'],
contributesTo: RoleContributesToFromJSON(json['contributesTo']),
assignments: !exists(json, 'assignments') ? undefined : json['assignments'].map(RoleAssignmentsInnerFromJSON),
accountableTo: !exists(json, 'accountableTo') ? undefined : RoleAccountableToFromJSON(json['accountableTo']),
accountableFor: !exists(json, 'accountableFor') ? undefined : json['accountableFor'].map(RoleAccountableToFromJSON),
};
}
export function RoleToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
_id: value._id,
_type: value._type,
_rootId: value._rootId,
_createdOn: value._createdOn === undefined ? undefined : value._createdOn.toISOString(),
_createdBy: value._createdBy,
_updatedOn: value._updatedOn === undefined ? undefined : value._updatedOn.toISOString(),
_updatedBy: value._updatedBy,
_archivedOn: value._archivedOn === undefined ? undefined : value._archivedOn.toISOString(),
_archivedBy: value._archivedBy,
_deletedOn: value._deletedOn === undefined ? undefined : value._deletedOn.toISOString(),
_deletedBy: value._deletedBy,
_operationId: value._operationId,
_isPublic: value._isPublic,
name: value.name,
description: value.description,
templateId: value.templateId,
status: value.status,
userAllocationPercent: value.userAllocationPercent,
contributesTo: RoleContributesToToJSON(value.contributesTo),
assignments: value.assignments === undefined ? undefined : value.assignments.map(RoleAssignmentsInnerToJSON),
accountableTo: RoleAccountableToToJSON(value.accountableTo),
accountableFor: value.accountableFor === undefined ? undefined : value.accountableFor.map(RoleAccountableToToJSON),
};
}
//# sourceMappingURL=Role.js.map