Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Commit a116718

Browse files
committed
Improve compatiblity of RemoteTK with ForceTK
Changes to allow RemoteTK to be used as a drop-in replacement for ForceTK: Add setSessionToken, setRefreshToken, and setUserAgentString noop functions. Return referenceTo attribute with describe responses. Return totalSize and done attributes with query responses.
1 parent 6f9efca commit a116718

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

RemoteTK.component

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ if (remotetk.Client === undefined) {
5757
*/
5858
remotetk.Client = function(){
5959
}
60+
61+
/** NOOP: for compatibility with forcetk
62+
*/
63+
remotetk.Client.prototype.setSessionToken = function() {}
64+
remotetk.Client.prototype.setRefreshToken = function() {}
65+
remotetk.Client.prototype.setUserAgentString = function() {}
6066

6167
/*
6268
* Completely describes the individual metadata at all levels for the

RemoteTKController.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ public class RemoteTKController {
4545
field.put('type', descField.getType().name().toLowerCase());
4646
field.put('name', descField.getName());
4747
field.put('label', descField.getLabel());
48+
List<String> references = new List<String>();
49+
for (Schema.sObjectType t: descField.getReferenceTo()) {
50+
references.add(t.getDescribe().getName());
51+
}
52+
if (!references.isEmpty()) {
53+
field.put('referenceTo', references);
54+
}
4855

4956
fields.add(field);
5057
}
@@ -224,6 +231,8 @@ public class RemoteTKController {
224231

225232
Map<String, Object> result = new Map<String, Object>();
226233
result.put('records', records);
234+
result.put('totalSize', records.size());
235+
result.put('done', true);
227236

228237
return JSON.serialize(result);
229238
}

0 commit comments

Comments
 (0)