Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
const batchInfos: sf.BatchInfo[] = await job.list();
console.log('batchInfos:', batchInfos);
});
salesforceConnection.streaming.topic("InvoiceStatementUpdates").subscribe((message) => {
console.log('Event Type : ' + message.event.type);
console.log('Event Created : ' + message.event.createdDate);
console.log('Object Id : ' + message.sobject.Id);
});
const exitCallback = () => process.exit(1);
const channel = '/event/My_Event__e';
const replayId = -2;
const replayExt = new sf.StreamingExtension.Replay(channel, replayId);
const authFailureExt = new sf.StreamingExtension.AuthFailure(exitCallback);
const fayeClient = salesforceConnection.streaming.createClient([authFailureExt, replayExt]);
const subscription = fayeClient.subscribe(channel, (data: any) => {
console.log('topic received data', data);
});
subscription.cancel();
async function testDescribe() {
const global: sf.DescribeGlobalResult = await salesforceConnection.describeGlobal();
const globalCached: sf.DescribeGlobalResult = salesforceConnection.describeGlobal$();
const globalCachedCorrectly = global === globalCached;
salesforceConnection.describeGlobal$.clear();
globalCached.sobjects.forEach(async (sobject: sf.DescribeGlobalSObjectResult) => {
const object: sf.DescribeSObjectResult = await salesforceConnection.describe(sobject.name);
const cachedObject: sf.DescribeSObjectResult = salesforceConnection.describe$(sobject.name);
salesforceConnection.describe$.clear();
});
(async () => {
const batchInfos: sf.BatchInfo[] = await job.list();
console.log('batchInfos:', batchInfos);
});
salesforceConnection.streaming.topic("InvoiceStatementUpdates").subscribe((message) => {
console.log('Event Type : ' + message.event.type);
console.log('Event Created : ' + message.event.createdDate);
console.log('Object Id : ' + message.sobject.Id);
});
const exitCallback = () => process.exit(1);
const channel = '/event/My_Event__e';
const replayId = -2;
const replayExt = new sf.StreamingExtension.Replay(channel, replayId);
const authFailureExt = new sf.StreamingExtension.AuthFailure(exitCallback);
const fayeClient = salesforceConnection.streaming.createClient([authFailureExt, replayExt]);
const subscription = fayeClient.subscribe(channel, (data: any) => {
console.log('topic received data', data);
});
subscription.cancel();
async function testDescribe() {
const global: sf.DescribeGlobalResult = await salesforceConnection.describeGlobal();
const globalCached: sf.DescribeGlobalResult = salesforceConnection.describeGlobal$();
const globalCachedCorrectly = global === globalCached;
salesforceConnection.describeGlobal$.clear();
globalCached.sobjects.forEach(async (sobject: sf.DescribeGlobalSObjectResult) => {
const object: sf.DescribeSObjectResult = await salesforceConnection.describe(sobject.name);
const cachedObject: sf.DescribeSObjectResult = salesforceConnection.describe$(sobject.name);