11/**
22 * Client for the Salesforce Pub/Sub API
3- * @alias PubSubApiClient
4- * @global
53 */
64export default class PubSubApiClient {
75 /**
@@ -14,21 +12,18 @@ export default class PubSubApiClient {
1412 * Authenticates with Salesforce (if not using user-supplied authentication mode) then,
1513 * connects to the Pub/Sub API.
1614 * @returns {Promise<void> } Promise that resolves once the connection is established
17- * @memberof PubSubApiClient.prototype
1815 */
1916 connect ( ) : Promise < void > ;
2017 /**
2118 * Gets the gRPC connectivity state from the current channel.
2219 * @returns {Promise<connectivityState> } Promise that holds channel's connectivity information {@link connectivityState}
23- * @memberof PubSubApiClient.prototype
2420 */
2521 getConnectivityState ( ) : Promise < connectivityState > ;
2622 /**
2723 * Subscribes to a topic and retrieves all past events in retention window.
2824 * @param {string } topicName name of the topic that we're subscribing to
2925 * @param {SubscribeCallback } subscribeCallback callback function for handling subscription events
3026 * @param {number | null } [numRequested] optional number of events requested. If not supplied or null, the client keeps the subscription alive forever.
31- * @memberof PubSubApiClient.prototype
3227 */
3328 subscribeFromEarliestEvent ( topicName : string , subscribeCallback : SubscribeCallback , numRequested ?: number | null ) : void ;
3429 /**
@@ -37,15 +32,13 @@ export default class PubSubApiClient {
3732 * @param {SubscribeCallback } subscribeCallback callback function for handling subscription events
3833 * @param {number | null } numRequested number of events requested. If null, the client keeps the subscription alive forever.
3934 * @param {number } replayId replay ID
40- * @memberof PubSubApiClient.prototype
4135 */
4236 subscribeFromReplayId ( topicName : string , subscribeCallback : SubscribeCallback , numRequested : number | null , replayId : number ) : void ;
4337 /**
4438 * Subscribes to a topic.
4539 * @param {string } topicName name of the topic that we're subscribing to
4640 * @param {SubscribeCallback } subscribeCallback callback function for handling subscription events
4741 * @param {number | null } [numRequested] optional number of events requested. If not supplied or null, the client keeps the subscription alive forever.
48- * @memberof PubSubApiClient.prototype
4942 */
5043 subscribe ( topicName : string , subscribeCallback : SubscribeCallback , numRequested ?: number | null ) : void ;
5144 /**
@@ -54,7 +47,6 @@ export default class PubSubApiClient {
5447 * @param {SubscribeCallback } subscribeCallback callback function for handling subscription events
5548 * @param {number | null } [numRequested] optional number of events requested. If not supplied or null, the client keeps the subscription alive forever.
5649 * @throws Throws an error if the managed subscription does not exist or is not in the `RUN` state.
57- * @memberof PubSubApiClient.prototype
5850 */
5951 subscribeWithManagedSubscription ( subscriptionIdOrName : string , subscribeCallback : SubscribeCallback , numRequested ?: number | null ) : Promise < void > ;
6052 /**
@@ -77,27 +69,37 @@ export default class PubSubApiClient {
7769 */
7870 commitReplayId ( subscriptionId : string , replayId : number ) : string ;
7971 /**
80- * Publishes a payload to a topic using the gRPC client.
81- * @param {string } topicName name of the topic that we're subscribing to
82- * @param {Object } payload
72+ * Publishes a payload to a topic using the gRPC client. This is a synchronous operation, use `publishBatch` when publishing event batches.
73+ * @param {string } topicName name of the topic that we're publishing on
74+ * @param {Object } payload payload of the event that is being published
8375 * @param {string } [correlationKey] optional correlation key. If you don't provide one, we'll generate a random UUID for you.
8476 * @returns {Promise<PublishResult> } Promise holding a PublishResult object with replayId and correlationKey
85- * @memberof PubSubApiClient.prototype
8677 */
8778 publish ( topicName : string , payload : any , correlationKey ?: string ) : Promise < PublishResult > ;
79+ /**
80+ * Publishes a batch of events using the gRPC client's publish stream.
81+ * @param {string } topicName name of the topic that we're publishing on
82+ * @param {ProducerEvent[] } events events to be published
83+ * @param {PublishCallback } publishCallback callback function for handling publish responses
84+ */
85+ publishBatch ( topicName : string , events : ProducerEvent [ ] , publishCallback : PublishCallback ) : Promise < void > ;
8886 /**
8987 * Closes the gRPC connection. The client will no longer receive events for any topic.
90- * @memberof PubSubApiClient.prototype
9188 */
9289 close ( ) : void ;
9390 #private;
9491}
95- export type PublishResult = import ( "./utils/types.js" ) . PublishResult ;
96- export type Subscription = import ( "./utils/types.js" ) . Subscription ;
97- export type SubscriptionInfo = import ( "./utils/types.js" ) . SubscriptionInfo ;
9892export type Configuration = import ( "./utils/types.js" ) . Configuration ;
9993export type Logger = import ( "./utils/types.js" ) . Logger ;
94+ export type ProducerEvent = import ( "./utils/types.js" ) . ProducerEvent ;
95+ export type PublishCallback = import ( "./utils/types.js" ) . PublishCallback ;
96+ export type PublishStream = import ( "./utils/types.js" ) . PublishStream ;
97+ export type PublishStreamInfo = import ( "./utils/types.js" ) . PublishStreamInfo ;
98+ export type PublishResult = import ( "./utils/types.js" ) . PublishResult ;
99+ export type Schema = import ( "./utils/types.js" ) . Schema ;
100+ export type SubscribeCallback = import ( "./utils/types.js" ) . SubscribeCallback ;
100101export type SubscribeRequest = import ( "./utils/types.js" ) . SubscribeRequest ;
102+ export type Subscription = import ( "./utils/types.js" ) . Subscription ;
103+ export type SubscriptionInfo = import ( "./utils/types.js" ) . SubscriptionInfo ;
101104import { connectivityState } from '@grpc/grpc-js' ;
102- import Configuration from './utils/configuration.js' ;
103105//# sourceMappingURL=client.d.ts.map
0 commit comments