UNPKG

@rcsb/rcsb-saguaro-app

Version:
36 lines (35 loc) 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AssemblyInterfacesCollector = void 0; const tslib_1 = require("tslib"); const RcsbClient_1 = require("../../RcsbGraphQL/RcsbClient"); const Assertions_1 = require("../../RcsbUtils/Helpers/Assertions"); var assertDefined = Assertions_1.Assertions.assertDefined; class AssemblyInterfacesCollector { constructor() { this.rcsbFvQuery = RcsbClient_1.rcsbClient; } collect(requestConfig) { return tslib_1.__awaiter(this, void 0, void 0, function* () { try { const result = yield this.rcsbFvQuery.requestAssemblyInterfaces(requestConfig); return result.map(r => parseAssemblyInterfaces(r)); } catch (error) { console.log(error); throw error; } }); } } exports.AssemblyInterfacesCollector = AssemblyInterfacesCollector; function parseAssemblyInterfaces(assemblyInterfaces) { var _a, _b; return { rcsbId: assemblyInterfaces.rcsb_id, interfaceIds: (_b = (_a = assemblyInterfaces.interfaces) === null || _a === void 0 ? void 0 : _a.map(i => { assertDefined(i === null || i === void 0 ? void 0 : i.rcsb_id); return i.rcsb_id; })) !== null && _b !== void 0 ? _b : [] }; }