UNPKG

7.42 kBTypeScriptView Raw
1type maybe<T> = T | null | undefined;
2
3// From
4// https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm
5export interface DescribeSObjectResult {
6 activateable: boolean;
7 actionOverrides?: maybe<ActionOverride[]> | undefined;
8 childRelationships: ChildRelationship[];
9 compactLayoutable: boolean;
10 createable: boolean;
11 custom: boolean;
12 customSetting: boolean;
13 deletable: boolean;
14 deprecatedAndHidden: boolean;
15 feedEnabled: boolean;
16 fields: Field[];
17 keyPrefix?: maybe<string> | undefined;
18 label: string;
19 labelPlural: string;
20 layoutable: boolean;
21 listviewable?: maybe<boolean> | undefined;
22 lookupLayoutable?: maybe<boolean> | undefined;
23 mergeable: boolean;
24 mruEnabled: boolean;
25 name: string;
26 namedLayoutInfos: NamedLayoutInfo[];
27 networkScopeFieldName?: maybe<string> | undefined;
28 queryable: boolean;
29 recordTypeInfos: RecordTypeInfo[];
30 replicateable: boolean;
31 retrieveable: boolean;
32 searchable: boolean;
33 searchLayoutable: boolean;
34 supportedScopes: ScopeInfo[];
35 triggerable: boolean;
36 undeletable: boolean;
37 updateable: boolean;
38 urlDetail?: string | undefined;
39 urlEdit?: string | undefined;
40 urlNew?: string | undefined;
41 urls: Record<string, string>;
42}
43
44export interface ActionOverride {
45 formFactor: string;
46 isAvailableInTouch: boolean;
47 name: string;
48 pageId: string;
49 url?: maybe<string> | undefined;
50}
51
52export interface ChildRelationship {
53 cascadeDelete: boolean;
54 childSObject: string;
55 deprecatedAndHidden: boolean;
56 field: string;
57 junctionIdListNames: string[];
58 junctionReferenceTo: string[];
59 relationshipName?: maybe<string> | undefined;
60 restrictedDelete: boolean;
61}
62
63export interface Field {
64 aggregatable: boolean;
65 // Not in documentation, but exists in data
66 aiPredictionField?: maybe<boolean> | undefined;
67 // Salesforce documentation is wrong, they show `autonumber` but true data returned is `autoNumber`
68 autoNumber: boolean;
69 byteLength: number;
70 calculated: boolean;
71 calculatedFormula?: maybe<string> | undefined;
72 cascadeDelete: boolean;
73 caseSensitive: boolean;
74 compoundFieldName?: maybe<string> | undefined;
75 controllerName?: maybe<string> | undefined;
76 createable: boolean;
77 custom: boolean;
78 defaultValue?: maybe<string | boolean> | undefined;
79 defaultValueFormula?: maybe<string> | undefined;
80 defaultedOnCreate: boolean;
81 dependentPicklist: boolean;
82 deprecatedAndHidden: boolean;
83 digits?: maybe<number> | undefined;
84 displayLocationInDecimal?: maybe<boolean> | undefined;
85 encrypted?: maybe<boolean> | undefined;
86 externalId: boolean;
87 extraTypeInfo?: maybe<ExtraTypeInfo> | undefined;
88 filterable: boolean;
89 filteredLookupInfo?: maybe<FilteredLookupInfo> | undefined;
90 // Salesforce documentation is wrong, this field does not exist, calculatedFormula is correct
91 formula?: maybe<string> | undefined;
92 // Not in documentation, but exists in data
93 formulaTreatNullNumberAsZero?: maybe<boolean> | undefined;
94 groupable: boolean;
95 highScaleNumber?: maybe<boolean> | undefined;
96 htmlFormatted: boolean;
97 idLookup: boolean;
98 inlineHelpText?: maybe<string> | undefined;
99 label: string;
100 length: number;
101 mask?: maybe<string> | undefined;
102 maskType?: maybe<string> | undefined;
103 name: string;
104 nameField: boolean;
105 namePointing: boolean;
106 nillable: boolean;
107 permissionable: boolean;
108 picklistValues?: maybe<PicklistEntry[]> | undefined;
109 polymorphicForeignKey: boolean;
110 precision?: maybe<number> | undefined;
111 queryByDistance: boolean;
112 referenceTargetField?: maybe<string> | undefined;
113 referenceTo?: maybe<string[]> | undefined;
114 relationshipName?: maybe<string> | undefined;
115 relationshipOrder?: maybe<number> | undefined;
116 restrictedDelete?: maybe<boolean> | undefined;
117 restrictedPicklist: boolean;
118 scale: number;
119 searchPrefilterable: boolean;
120 soapType: SOAPType;
121 sortable: boolean;
122 type: FieldType;
123 unique: boolean;
124 updateable: boolean;
125 writeRequiresMasterRead?: maybe<boolean> | undefined;
126}
127
128export type ExtraTypeInfo =
129 | 'imageurl'
130 | 'personname'
131 | 'plaintextarea'
132 | 'richtextarea'
133 | 'switchablepersonname'
134 | 'externallookup'
135 | 'indirectlookup';
136
137export type FieldType =
138 | 'string'
139 | 'boolean'
140 | 'int'
141 | 'double'
142 | 'date'
143 | 'datetime'
144 | 'base64'
145 | 'id'
146 | 'reference'
147 | 'currency'
148 | 'textarea'
149 | 'percent'
150 | 'phone'
151 | 'url'
152 | 'email'
153 | 'combobox'
154 | 'picklist'
155 | 'multipicklist'
156 | 'anyType'
157 | 'location'
158 // the following are not found in official documentation, but still occur when describing an sobject
159 | 'time'
160 | 'encryptedstring'
161 | 'address'
162 | 'complexvalue';
163
164export interface FilteredLookupInfo {
165 controllingFields: string[];
166 dependent: boolean;
167 optionalFilter: boolean;
168}
169
170export type SOAPType =
171 | 'tns:ID'
172 | 'xsd:anyType'
173 | 'xsd:base64Binary'
174 | 'xsd:boolean'
175 | 'xsd:date'
176 | 'xsd:dateTime'
177 | 'xsd:double'
178 | 'xsd:int'
179 | 'xsd:string'
180 // the following are not found in official documentation, but still occur when describing an sobject
181 | 'xsd:time'
182 | 'urn:address'
183 | 'urn:JunctionIdListNames'
184 | 'urn:location'
185 | 'urn:RecordTypesSupported'
186 | 'urn:RelationshipReferenceTo'
187 | 'urn:SearchLayoutButtonsDisplayed'
188 | 'urn:SearchLayoutFieldsDisplayed';
189
190export interface PicklistEntry {
191 active: boolean;
192 validFor?: maybe<string> | undefined;
193 defaultValue: boolean;
194 label?: maybe<string> | undefined;
195 value: string;
196}
197
198export interface RecordTypeInfo {
199 available: boolean;
200 defaultRecordTypeMapping: boolean;
201 developerName?: maybe<string> | undefined;
202 master: boolean;
203 name: string;
204 recordTypeId: string;
205 urls: Record<string, string>;
206}
207
208export interface NamedLayoutInfo {
209 name: string;
210 urls: Record<string, string>;
211}
212
213export interface ScopeInfo {
214 label: string;
215 name: string;
216}
217
218// From
219// https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describeglobal_describeglobalresult.htm#!
220
221export interface DescribeGlobalSObjectResult {
222 activateable: boolean;
223 createable: boolean;
224 custom: boolean;
225 customSetting: boolean;
226 deletable: boolean;
227 deprecatedAndHidden: boolean;
228 feedEnabled: boolean;
229 hasSubtypes: boolean;
230 isSubtype: boolean;
231 keyPrefix: string | null;
232 label: string;
233 labelPlural: string;
234 layoutable: boolean;
235 mergeable: boolean;
236 mruEnabled: boolean;
237 name: string;
238 queryable: boolean;
239 replicateable: boolean;
240 retrieveable: boolean;
241 searchable: boolean;
242 triggerable: boolean;
243 undeletable: boolean;
244 updateable: boolean;
245 urls: Record<string, string>;
246}
247
248export interface DescribeSObjectOptions {
249 type: string;
250 ifModifiedSince?: string | undefined;
251}
252
253export interface BatchDescribeSObjectOptions {
254 types: string[];
255 autofetch?: boolean | undefined;
256 maxConcurrentRequests?: number | undefined;
257}
258
259export interface DescribeGlobalResult {
260 encoding: string;
261 maxBatchSize: number;
262 sobjects: DescribeGlobalSObjectResult[];
263}