@copado/copado-cli
Version:
Copado Developer CLI
26 lines • 880 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const restConnections_1 = require("../service/restConnections");
class SObjectSelector {
constructor() {
this.orderby = 'Name';
}
byId(recordId) {
return this.getRecords(`Id = '${recordId}'`);
}
all() {
return this.getRecords();
}
async getRecords(condition) {
const result = await restConnections_1.RestConnections.query(this.queryString(condition));
return result.records;
}
queryString(condition) {
return `SELECT ${this.fields.join(', ')} FROM ${this.sObject} ${this.addFilter(condition)} ${this.orderby ? 'ORDER By ' + this.orderby : ''}`;
}
addFilter(condition) {
return condition ? ` WHERE ${condition}` : '';
}
}
exports.default = SObjectSelector;
//# sourceMappingURL=sObjectSelector.js.map