UNPKG

@kurrent/kurrentdb-client

Version:
29 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const projections_grpc_pb_1 = require("../../generated/projections_grpc_pb"); const projections_pb_1 = require("../../generated/projections_pb"); const Client_1 = require("../Client"); const utils_1 = require("../utils"); Client_1.Client.prototype.getProjectionState = async function (projectionName, { partition = "", ...baseOptions } = {}) { const req = new projections_pb_1.StateReq(); const options = new projections_pb_1.StateReq.Options(); options.setName(projectionName); options.setPartition(partition); req.setOptions(options); utils_1.debug.command("getProjectionState: %O", { projectionName, options: { partition, ...baseOptions, }, }); utils_1.debug.command_grpc("getProjectionState: %g", req); return this.execute(projections_grpc_pb_1.ProjectionsClient, "getProjectionState", (client) => new Promise((resolve, reject) => { client.state(req, ...this.callArguments(baseOptions), (error, response) => { if (error) return reject((0, utils_1.convertToCommandError)(error)); return resolve(response.getState()?.toJavaScript()); }); })); }; //# sourceMappingURL=getProjectionState.js.map