UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

42 lines 1.72 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); const ServiceEndpoint_1 = require("./ServiceEndpoint"); const cloneDeep = require('lodash/fp/cloneDeep'); const type = 'UserServiceEndpoint'; /** * Class to represent a host service endpoint. */ class UserServiceEndpoint extends ServiceEndpoint_1.default { constructor(context, instances) { super(context, type); this.instances = instances; } /** * Used to control the the properties that are * output by JSON.stringify. */ toJSON() { // Clone the current instance. Note the use of // a deep clone to ensure immutability of // the instance being cloned for serialization const clonedServiceReference = cloneDeep(this); clonedServiceReference['@context'] = this.context; delete clonedServiceReference.context; clonedServiceReference['@type'] = this.type; delete clonedServiceReference.type; return clonedServiceReference; } /** * Used to control the the properties that are * output by JSON.parse. */ static fromJSON(object) { return new UserServiceEndpoint(object['@context'], object['instances']); } } exports.default = UserServiceEndpoint; //# sourceMappingURL=UserServiceEndpoint.js.map