import { CustomObject, type CustomObjectStandardFieldIdentifier } from "../custom-object.mjs"; import { Field } from "../field.mjs"; import { CustomObjectFieldSection } from "../custom-object-field-section.mjs"; import type { RipplingSDK } from "../../../client.mjs"; import { extendCustomObject as extendObject } from "../../../core/platform/custom-objects/definition.mjs"; import type { CustomObjectCategoryDefinition } from "../../../core/platform/custom-objects/category.mjs"; import type { CustomObjectRecordsClient, TypedBatchWriteOptions, TypedRecordPageOptions, TypedRecordQueryOptions, TypedRecordPage, TypedRecordWriteResult } from "../../../core/platform/custom-objects/manager.mjs"; import { type RqlFieldToken, type RqlComparableValue, type RqlFragment } from "../../../core/platform/custom-objects/rql.mjs"; import type { AnyCustomObjectDefinition, CustomObjectDefinition, FieldDefinitions, SectionDefinitions, NameFieldDefinition, RecordShape, LogicalCustomObjectName, LogicalCategoryName } from "../../../core/platform/custom-objects/types.mjs"; import type { RequestOptions } from "../../../internal/request-options.mjs"; import type { FieldListParams, CustomObjectField, CustomObjectFieldsPageCursorURL } from "../../../resources/custom-objects/fields.mjs"; import type { CustomObject as DeployedCustomObject } from "../../../resources/custom-objects/custom-objects.mjs"; import type { APIPromise } from "../../../core/api-promise.mjs"; import type { PagePromise } from "../../../core/pagination.mjs"; import type { ValueParser } from "./function.mjs"; import { type ObjectCreateInput, type ObjectUpdateInput, type ObjectBulkUpdateInput } from "./_object-records.mjs"; export type { ObjectCreateInput, ObjectUpdateInput, ObjectBulkUpdateInput } from "./_object-records.mjs"; export type DefineCustomObjectProps}_category`, S extends SectionDefinitions = {}, N extends NameFieldDefinition = { kind: 'text'; }> = Omit, 'pluralLabel'> & { apiName: A; name: string; pluralName?: string; category?: CategoryInput; }; export type DefinedCustomObject = Omit & { readonly fields: { readonly [K in keyof D['fields']]: Omit & { readonly apiName: `${Unsuffixed>}__c`; readonly objectApiName: D['apiName']; }; }; readonly records: D extends AnyCustomObjectDefinition ? Readonly> : never; readonly schema: D extends AnyCustomObjectDefinition ? Readonly : never; readonly inputs: D extends AnyCustomObjectDefinition ? { readonly create: ValueParser>; readonly update: ValueParser>; } : never; }; /** Authenticated records transport supplied at the operation's call site. */ export interface ObjectRecordsContext { readonly customObjects: { readonly records: CustomObjectRecordsClient; }; } /** Schema resources supplied at the operation's call site. */ export interface ObjectSchemaContext { readonly customObjects: Pick; } export type ObjectRecordListOptions = TypedRecordPageOptions & { where?: ObjectFilter; }; /** Typed record operations; writes return readable records or ID-only receipts. Supply an authenticated client at each call. */ export interface ObjectRecords { create(ctx: ObjectRecordsContext, input: ObjectCreateInput): Promise>; createMany(ctx: ObjectRecordsContext, rows: readonly ObjectCreateInput[], options?: TypedBatchWriteOptions): Promise[]>; get(ctx: ObjectRecordsContext, recordID: string): Promise>; getByExternalID(ctx: ObjectRecordsContext, externalID: string): Promise>; update(ctx: ObjectRecordsContext, recordID: string, patch: ObjectUpdateInput): Promise>; updateMany(ctx: ObjectRecordsContext, rows: readonly ObjectBulkUpdateInput[], options?: TypedBatchWriteOptions): Promise[]>; delete(ctx: ObjectRecordsContext, recordID: string): Promise; deleteMany(ctx: ObjectRecordsContext, recordIDs: readonly string[], options?: TypedBatchWriteOptions): Promise; /** List records with optional typed filters and cursor pagination. */ list(ctx: ObjectRecordsContext, options?: ObjectRecordListOptions): Promise>; /** Run a raw RQL filter with cursor pagination. */ query(ctx: ObjectRecordsContext, options?: TypedRecordQueryOptions): Promise>; } /** Deployed object metadata, separate from the local field definitions. */ export interface ObjectSchema { retrieve(ctx: ObjectSchemaContext, options?: RequestOptions): APIPromise; readonly fields: Readonly; } export interface ObjectSchemaFields { list(ctx: ObjectSchemaContext, params?: FieldListParams, options?: RequestOptions): PagePromise; } export interface CustomObjectOperations { readonly records: Readonly>; readonly schema: Readonly; } /** The same operations with the authenticated client supplied by client.objects(definition). */ export interface ObjectClient { create(input: ObjectCreateInput): Promise>; createMany(rows: readonly ObjectCreateInput[], options?: TypedBatchWriteOptions): Promise[]>; get(recordID: string): Promise>; getByExternalID(externalID: string): Promise>; update(recordID: string, patch: ObjectUpdateInput): Promise>; updateMany(rows: readonly ObjectBulkUpdateInput[], options?: TypedBatchWriteOptions): Promise[]>; delete(recordID: string): Promise; deleteMany(recordIDs: readonly string[], options?: TypedBatchWriteOptions): Promise; list(options?: ObjectRecordListOptions): Promise>; query(options?: TypedRecordQueryOptions): Promise>; schema: { retrieve(options?: RequestOptions): APIPromise; }; fields: { list(params?: FieldListParams, options?: RequestOptions): PagePromise; }; } export type ObjectFilter = RqlFragment & { readonly [filterOwner]: A; }; export declare function defineCustomObject}_category`, S extends SectionDefinitions = {}, N extends NameFieldDefinition = { kind: 'text'; }>(props: DefineCustomObjectProps): DefinedCustomObject>, LogicalCategoryName, S, F, N>>; /** Existing extension semantics, with the same additive field tokens and parsers. */ export declare function extendCustomObject(base: B, extension: Omit>[1], 'fields'> & { fields?: Extract extends never ? F & ApiNamedMap : never; sections?: ApiNamedMap; }): DefinedCustomObject>>; export declare const eq: (field: FieldToken, value: RqlComparableValue> | null) => ObjectFilter; export declare const ne: (field: FieldToken, value: RqlComparableValue> | null) => ObjectFilter; export declare const lt: (field: FieldToken, value: NoInfer) => ObjectFilter; export declare const lte: (field: FieldToken, value: NoInfer) => ObjectFilter; export declare const gt: (field: FieldToken, value: NoInfer) => ObjectFilter; export declare const gte: (field: FieldToken, value: NoInfer) => ObjectFilter; export declare const inArray: (field: FieldToken, values: readonly RqlComparableValue>[]) => ObjectFilter; export declare const notInArray: (field: FieldToken, values: readonly RqlComparableValue>[]) => ObjectFilter; export declare const isNull: (field: FieldToken) => ObjectFilter; export declare const isNotNull: (field: FieldToken) => ObjectFilter; export declare const and: (first: ObjectFilter, ...rest: ObjectFilter>[]) => ObjectFilter; export declare const or: (first: ObjectFilter, ...rest: ObjectFilter>[]) => ObjectFilter; export declare const not: (filter: ObjectFilter) => ObjectFilter; type Unsuffixed = N extends `${infer Name}__c` ? Name : N; type ApiNamedMap = { [K in keyof T]: string extends K ? T[K] : K extends `${string}__c` ? T[K] : never; }; type CategoryInput = `${N}__c` | CustomObjectCategoryDefinition>; type ObjectOptions = Pick & { sections?: S & ApiNamedMap; fields: F & ApiNamedMap & { [K in keyof F]: string extends Exclude ? F[K] : Exclude extends keyof NoInfer ? F[K] : never; }; nameField?: N; }; /** @internal Forward client helpers to the definition operations. */ export declare function createObjectClient(ctx: ObjectRecordsContext & ObjectSchemaContext, definition: D): ObjectClient; declare const filterOwner: unique symbol; type FieldToken = Pick, 'apiName' | '__valueType__'> & { readonly objectApiName: A; }; declare const objectScope: unique symbol; /** Carry parent identity through helpers while still accepting existing constructor instances. */ export type ObjectScoped = TDefinition & { readonly [objectScope]: TObject['apiName']; }; export declare function scopedDefinition(_object: TObject, definition: TDefinition): ObjectScoped; export declare function fieldReferences(owner: TObject, field: DefinitionFieldReference): object[]; /** Keep dependency collection in sync with layout-driven field moves. */ export declare function trackFieldSection(field: T, section: CustomObjectFieldSection): T; export declare function fieldSectionReferences(field: Field): object[]; export type ObjectReference = AnyCustomObjectDefinition; export type DefinitionFieldReference = TObject['fields'][keyof TObject['fields']] | ObjectScoped | CustomObjectStandardFieldIdentifier; export type SectionReference = ObjectScoped | Extract | 'general'; export declare function manifestSection(object: TObject, reference: SectionReference): CustomObjectFieldSection; /** References and compilation reuse one materialized schema; authored children remain explicit roots. */ export declare function manifestObject(reference: ObjectReference): CustomObject; /** Adapts a typed schema field to the existing layout, view, and rule component APIs. */ export declare function manifestField(object: TObject, field: NoInfer>): Field; //# sourceMappingURL=custom-object.d.mts.map