import { StringKeys } from './util'; /** * */ export type DateString = string & { __DateBrand: never; }; export type BlobString = string & { __BlobBrand: never; }; export type Address = { city: string | null; country: string | null; geocodeAccuracy: string | null; latitude: number | null; longitude: number | null; postalCode: string | null; state: string | null; street: string | null; }; export type SObjectFieldType = number | boolean | DateString | BlobString | string | Address; export type SObjectDefinition = { Name: N; Fields: { [name: string]: SObjectFieldType | null; }; ParentReferences: { [name: string]: SObjectDefinition | null; }; ChildRelationships: { [name: string]: SObjectDefinition; }; }; export type Schema = { SObjects: { [name: string]: SObjectDefinition; }; }; /** * */ export type SObjectNames = StringKeys; export type SObjectFieldNames> = StringKeys; export type ParentReferenceNames> = StringKeys; type ParentReferenceSObjectName_, PRN extends ParentReferenceNames, PSO extends SObjectDefinition = NonNullable, SK extends keyof S['SObjects'] = keyof S['SObjects']> = Extract; export type ParentReferenceSObjectName, PRN extends ParentReferenceNames> = ParentReferenceSObjectName_; export type ChildRelationshipNames> = StringKeys; type ChildRelationshipSObjectName_, CRN extends ChildRelationshipNames, CSO extends SObjectDefinition = S['SObjects'][N]['ChildRelationships'][CRN], SK extends keyof S['SObjects'] = keyof S['SObjects']> = Extract; export type ChildRelationshipSObjectName, CRN extends ChildRelationshipNames> = ChildRelationshipSObjectName_; export {};