@noggin/elastic-noggin-sdk
Version:
Elastic Noggin SDK
28 lines (27 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readSid = exports.read = void 0;
const operators_1 = require("rxjs/operators");
const pull_1 = require("./pull");
function read(tip, enSrvOptions, readOptions) {
return (0, pull_1.pull)([tip], enSrvOptions, readOptions).pipe((0, operators_1.map)((responseBatch) => {
for (let i = 0; i < responseBatch.length; i++) {
if (responseBatch[i].tip === tip) {
return responseBatch[i];
}
}
throw new Error("error/message/eno/not-found");
}));
}
exports.read = read;
function readSid(sid, enSrvOptions, readOptions) {
return (0, pull_1.pullSid)([sid], enSrvOptions, readOptions).pipe((0, operators_1.map)((responseBatch) => {
for (let i = 0; i < responseBatch.length; i++) {
if (responseBatch[i].sid === sid) {
return responseBatch[i];
}
}
throw new Error("error/message/eno/not-found");
}));
}
exports.readSid = readSid;