Skip to content

Commit d254ea6

Browse files
authored
feat: adding calls to client (#233)
1 parent ebe1687 commit d254ea6

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vesselapi/integrations",
3-
"version": "1.0.25",
3+
"version": "1.0.26",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/salesforce/actions/query-builder.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,31 @@ export const salesforceQueryBuilder = {
5353
cursor,
5454
limit = MAX_QUERY_PAGE_SIZE,
5555
relationalSelect,
56+
where,
5657
associations,
5758
}: {
5859
objectType: SalesforceSupportedObjectType;
5960
cursor?: string;
6061
limit?: number;
6162
relationalSelect?: Partial<Record<SalesforceSupportedObjectType, string>>;
63+
where?: string;
6264
associations?: SalesforceSupportedObjectType[];
6365
}) => {
6466
const selectClauses = sift([
6567
'SELECT FIELDS(ALL)',
6668
buildRelationalSelectClause(relationalSelect, associations),
6769
]);
68-
const getWhere = () => {
69-
if (!cursor) {
70-
return '';
71-
}
72-
return `WHERE Id < '${cursor}'`;
70+
const getWhereClause = () => {
71+
const cursorClause = cursor && `Id < '${cursor}'`;
72+
const clauses = sift([cursorClause, where]);
73+
if (clauses.length === 0) return '';
74+
return `WHERE ${clauses.join(' AND ')}`;
7375
};
74-
const where = getWhere();
76+
const whereClause = getWhereClause();
7577
return formatQuery(`
7678
${selectClauses.join(', ')}
7779
FROM ${objectType}
78-
${where}
80+
${whereClause}
7981
ORDER BY Id DESC
8082
LIMIT ${limit}
8183
`);

src/platforms/salesforce/client.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ const query = {
8888
schema,
8989
objectType,
9090
relationalSelect,
91+
where,
9192
}: {
9293
schema: T;
9394
objectType: SalesforceSupportedObjectType;
9495
relationalSelect?: Partial<Record<SalesforceSupportedObjectType, string>>;
96+
where?: string;
9597
}) =>
9698
request(
9799
({
@@ -108,6 +110,7 @@ const query = {
108110
cursor,
109111
limit,
110112
relationalSelect,
113+
where,
111114
associations,
112115
})}`,
113116
method: 'GET',
@@ -594,6 +597,14 @@ export const client = {
594597
schema: z.undefined(),
595598
})),
596599
},
600+
calls: {
601+
list: query.list<typeof salesforceTask>({
602+
objectType: 'Task',
603+
schema: salesforceTask,
604+
relationalSelect: salesforceTaskRelationalSelect,
605+
where: `TaskSubtype='Call'`,
606+
}),
607+
},
597608
events: {
598609
find: query.find<typeof salesforceEvent>({
599610
objectType: 'Event',

0 commit comments

Comments
 (0)