Skip to content

Commit

Permalink
Update utils.db() to handle without sharing case
Browse files Browse the repository at this point in the history
  • Loading branch information
brtheo authored Nov 20, 2024
1 parent b1ba49c commit 5089537
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions force-app/main/default/lwc/bolt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "./bolt";
import soqlQuery from '@salesforce/apex/Bolt.soqlQuery';
import soqlQueryWithoutCache from "@salesforce/apex/Bolt.soqlQueryWithoutCache";
import soqlQueryWithoutSharing from "@salesforce/apex/Bolt.soqlQueryWithoutSharing";
/**
* Useful method to pass as an input a custom label formated as an ES6 template literal
* like this : Hello ${name}
Expand Down Expand Up @@ -132,6 +133,7 @@ export const allMxnDone = (self, maybeSuspendedMixins) =>

const USER_MODE = 'WITH USER_MODE';
const UNCACHED = 'UNCACHED';
const WITHOUT_SHARING = 'WITHOUT_SHARING';
const ARRAY_TOKEN = '$ARRAY$'
/**
* @param {string[]} req
Expand Down Expand Up @@ -173,9 +175,12 @@ export const soql = async (req, ...args ) => {
else mode = null;
if(query.includes(UNCACHED)){
query = query.replace(UNCACHED, '');
console.log('DB',query, JSON.stringify(params))
return soqlQueryWithoutCache({query, params: JSON.stringify(params), mode});
}
else if(query.includes(WITHOUT_SHARING)){
query = query.replace(WITHOUT_SHARING, '');
return soqlQueryWithoutSharing({query, params: JSON.stringify(params), mode});
}
return soqlQuery({query, params: JSON.stringify(params), mode});
}
export const db = soql;
export const db = soql;

0 comments on commit 5089537

Please sign in to comment.