UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

47 lines 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var mongodb_stitch_core_sdk_1 = require("mongodb-stitch-core-sdk"); var StitchAdminUserProfileFields; (function (StitchAdminUserProfileFields) { StitchAdminUserProfileFields["UserType"] = "type"; StitchAdminUserProfileFields["Identities"] = "identities"; StitchAdminUserProfileFields["Data"] = "data"; StitchAdminUserProfileFields["Roles"] = "roles"; })(StitchAdminUserProfileFields || (StitchAdminUserProfileFields = {})); var StitchAdminUserProfileCodec = (function () { function StitchAdminUserProfileCodec() { } StitchAdminUserProfileCodec.prototype.decode = function (from) { var roleCodec = new StitchAdminRoleCodec(); return { data: from[StitchAdminUserProfileFields.Data], identities: from[StitchAdminUserProfileFields.Identities].map(function (identity) { return mongodb_stitch_core_sdk_1.ApiStitchUserIdentity.fromJSON(identity); }), roles: from[StitchAdminUserProfileFields.Roles].map(function (role) { return roleCodec.decode(role); }), userType: from[StitchAdminUserProfileFields.UserType] }; }; return StitchAdminUserProfileCodec; }()); exports.StitchAdminUserProfileCodec = StitchAdminUserProfileCodec; var StitchAdminRoleFields; (function (StitchAdminRoleFields) { StitchAdminRoleFields["Name"] = "role_name"; StitchAdminRoleFields["GroupId"] = "group_id"; })(StitchAdminRoleFields || (StitchAdminRoleFields = {})); var StitchAdminRoleCodec = (function () { function StitchAdminRoleCodec() { } StitchAdminRoleCodec.prototype.decode = function (from) { return { groupId: from[StitchAdminRoleFields.GroupId], name: from[StitchAdminRoleFields.Name] }; }; return StitchAdminRoleCodec; }()); exports.StitchAdminRoleCodec = StitchAdminRoleCodec; //# sourceMappingURL=StitchAdminUserProfile.js.map