@salesforce/sobject-metadata
Version:
Retrieve Salesforce object metadata from connected org
195 lines (194 loc) • 5.29 kB
TypeScript
import { Connection } from '@salesforce/core';
import { RequestInfo } from 'jsforce';
export interface SObject {
actionOverrides: any[];
activateable: boolean;
childRelationships: ChildRelationship[];
compactLayoutable: boolean;
createable: boolean;
custom: boolean;
customSetting: boolean;
deletable: boolean;
deprecatedAndHidden: boolean;
feedEnabled: boolean;
fields: Field[];
hasSubtypes: boolean;
isSubtype: boolean;
keyPrefix: string;
label: string;
labelPlural: string;
layoutable: boolean;
listviewable?: any;
lookupLayoutable?: any;
mergeable: boolean;
mruEnabled: boolean;
name: string;
namedLayoutInfos: any[];
networkScopeFieldName?: any;
queryable: boolean;
recordTypeInfos: RecordTypeInfo[];
replicateable: boolean;
retrieveable: boolean;
searchLayoutable: boolean;
searchable: boolean;
supportedScopes: SupportedScope[];
triggerable: boolean;
undeletable: boolean;
updateable: boolean;
urls: Urls2;
}
export interface ChildRelationship {
cascadeDelete: boolean;
childSObject: string;
deprecatedAndHidden: boolean;
field: string;
junctionIdListNames: any[];
junctionReferenceTo: any[];
relationshipName: string;
restrictedDelete: boolean;
}
export interface Field {
aggregatable: boolean;
autoNumber: boolean;
byteLength: number;
calculated: boolean;
calculatedFormula?: any;
cascadeDelete: boolean;
caseSensitive: boolean;
compoundFieldName?: any;
controllerName?: any;
createable: boolean;
custom: boolean;
defaultValue?: boolean;
defaultValueFormula?: any;
defaultedOnCreate: boolean;
dependentPicklist: boolean;
deprecatedAndHidden: boolean;
digits: number;
displayLocationInDecimal: boolean;
encrypted: boolean;
externalId: boolean;
extraTypeInfo?: any;
filterable: boolean;
filteredLookupInfo?: any;
groupable: boolean;
highScaleNumber: boolean;
htmlFormatted: boolean;
idLookup: boolean;
inlineHelpText?: any;
label: string;
length: number;
mask?: any;
maskType?: any;
name: string;
nameField: boolean;
namePointing: boolean;
nillable: boolean;
permissionable: boolean;
picklistValues: any[];
polymorphicForeignKey: boolean;
precision: number;
queryByDistance: boolean;
referenceTargetField?: any;
referenceTo: string[];
relationshipName: string;
relationshipOrder?: any;
restrictedDelete: boolean;
restrictedPicklist: boolean;
scale: number;
searchPrefilterable: boolean;
soapType: string;
sortable: boolean;
type: string;
unique: boolean;
updateable: boolean;
writeRequiresMasterRead: boolean;
}
export interface Urls {
layout: string;
}
export interface RecordTypeInfo {
active: boolean;
available: boolean;
defaultRecordTypeMapping: boolean;
master: boolean;
name: string;
recordTypeId: string;
urls: Urls;
}
export interface SupportedScope {
label: string;
name: string;
}
export interface Urls2 {
compactLayouts: string;
rowTemplate: string;
approvalLayouts: string;
uiDetailTemplate: string;
uiEditTemplate: string;
defaultValues: string;
describe: string;
uiNewRecord: string;
quickActions: string;
layouts: string;
sobject: string;
}
export interface DescribeSObjectResult {
sObjectName: string;
result?: SObject;
timestamp?: string;
}
export declare enum SObjectCategory {
ALL = "ALL",
STANDARD = "STANDARD",
CUSTOM = "CUSTOM"
}
export declare type SubRequest = {
method: string;
url: string;
};
export declare type BatchRequest = {
batchRequests: SubRequest[];
};
export declare type DescribeResponse = {
statusCode: number;
headers: {
[key: string]: string;
};
body: string;
};
export declare type SubResponse = {
statusCode: number;
result: SObject;
};
export declare type BatchRawResponse = {
statusCode: number;
headers: {
[key: string]: string;
};
body: string;
};
export declare type BatchResponse = {
hasErrors: boolean;
results: SubResponse[];
};
export declare class SObjectDescribeAPI {
private readonly connection;
private readonly SERVICESPATH;
private readonly TARGETVERSION;
private readonly VERSIONPREFIX;
private readonly SOBJECTS;
private readonly BATCH;
private readonly DESCRIBE;
private readonly CLIENT_ID;
private readonly commonHeaders;
constructor(connection: Connection);
describeSObject(sObjectName: string, lastRefreshDate?: string): Promise<DescribeSObjectResult>;
describeSObjectBatch(types: string[], nextToProcess: number): Promise<DescribeSObjectResult[]>;
protected buildSObjectDescribeURL(sObjectName: string, fullUrl?: boolean): string;
protected buildBatchRequestURL(): string;
protected buildBatchRequestBody(types: string[], nextToProcess: number): BatchRequest;
protected buildSingleXHROptions(sObjectName: string, lastRefreshDate?: string): RequestInfo;
protected buildBatchXHROptions(types: string[], nextToProcess: number): RequestInfo;
protected getVersion(): string;
}