mongodb-stitch
Version:
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
57 lines • 2.57 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "mongodb-stitch-core-sdk"], factory);
}
})(function (require, exports) {
"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