UNPKG

@kurrent/kurrentdb-client

Version:
41 lines 1.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const streams_grpc_pb_1 = require("../../../generated/kurrentdb/protocols/v1/streams_grpc_pb"); const streams_grpc_pb_2 = require("../../../generated/kurrentdb/protocols/v2/streams/streams_grpc_pb"); const Client_1 = require("../../Client"); const constants_1 = require("../../constants"); const utils_1 = require("../../utils"); const append_1 = require("./append"); const batchAppend_1 = require("./batchAppend"); const multiStreamAppend_1 = require("./multiStreamAppend"); const appendRecords_1 = require("./appendRecords"); Client_1.Client.prototype.appendToStream = async function (streamName, event, { streamState = constants_1.ANY, batchAppendSize = 3 * 1024 * 1024, ...baseOptions } = {}) { const events = Array.isArray(event) ? event : [event]; if (!baseOptions.credentials && !this.credentialsProvider && (await this.supports(streams_grpc_pb_1.StreamsService.batchAppend))) { return batchAppend_1.batchAppend.call(this, streamName, events, { streamState: streamState, batchAppendSize, ...baseOptions, }); } return append_1.append.call(this, streamName, events, { streamState: streamState, batchAppendSize, ...baseOptions, }); }; Client_1.Client.prototype.multiStreamAppend = async function (requests) { if (!(await this.supports(streams_grpc_pb_2.StreamsServiceService.appendSession))) { throw new utils_1.UnsupportedError("multiStreamAppend", "25.1"); } return multiStreamAppend_1.multiStreamAppend.call(this, requests); }; Client_1.Client.prototype.appendRecords = async function (records, checks) { if (!(await this.supports(streams_grpc_pb_2.StreamsServiceService.appendRecords))) { throw new utils_1.UnsupportedError("appendRecords", "26.1"); } return appendRecords_1.appendRecords.call(this, records, checks); }; //# sourceMappingURL=index.js.map