import type { CompileTimeMetadata, InterfaceDefinition, ObjectMetadata, ObjectTypeDefinition, Osdk, OsdkObjectCreatePropertyType, PropertyKeys } from "@osdk/client"; export type ObjectLocator = { $apiName: Osdk.Instance["$apiName"] $primaryKey: Osdk.Instance["$primaryKey"] }; export type InterfaceLocator = { $apiName: Osdk.Instance["$apiName"] $objectType: Osdk.Instance["$objectType"] $primaryKey: Osdk.Instance["$primaryKey"] }; export declare namespace Edits { type Object = CreateObject | DeleteObject | UpdateObject; type Link< S extends ObjectTypeDefinition, L extends keyof CompileTimeMetadata["links"] > = AddLink | RemoveLink; type Interface = CreateObjectForInterface | UpdateObjectForInterface | DeleteObjectForInterface; } export interface AddLink< S extends ObjectTypeDefinition, L extends keyof CompileTimeMetadata["links"] > { type: "addLink"; apiName: L; source: ObjectLocator; target: CompileTimeMetadata["links"][L] extends ObjectMetadata.Link ? ObjectLocator : never; } export interface RemoveLink< S extends ObjectTypeDefinition, L extends keyof CompileTimeMetadata["links"] > { type: "removeLink"; apiName: L; source: ObjectLocator; target: CompileTimeMetadata["links"][L] extends ObjectMetadata.Link ? ObjectLocator : never; } type PartialForOptionalProperties = { [K in keyof T as undefined extends T[K] ? K : never]? : NonNullable } & { [K in keyof T as undefined extends T[K] ? never : K]-? : T[K] }; export interface CreateObject { type: "createObject"; obj: S; properties: PartialForOptionalProperties<{ [P in PropertyKeys] : OsdkObjectCreatePropertyType["properties"][P]> }>; } export interface DeleteObject { type: "deleteObject"; obj: ObjectLocator; } export interface DeleteObjectForInterface { type: "deleteObjectForInterface"; obj: InterfaceLocator; } export interface UpdateObject { type: "updateObject"; obj: ObjectLocator; properties: Partial<{ [P in Exclude, CompileTimeMetadata["primaryKeyApiName"]>] : OsdkObjectCreatePropertyType["properties"][P]> }>; } export interface CreateObjectForInterface { type: "createObjectForInterface"; int: S; properties: PartialForOptionalProperties<{ [P in PropertyKeys] : OsdkObjectCreatePropertyType["properties"][P]> } & { $objectType: string }>; } export interface UpdateObjectForInterface { type: "updateObjectForInterface"; obj: InterfaceLocator; properties: Partial<{ [P in PropertyKeys] : OsdkObjectCreatePropertyType["properties"][P]> }>; } export type AnyEdit = AddLink | RemoveLink | CreateObject | DeleteObject | UpdateObject | CreateObjectForInterface | UpdateObjectForInterface | DeleteObjectForInterface; export declare function isInterfaceLocator(obj: any): obj is InterfaceLocator; export {};