import { type FieldType, type FormulaFieldType, type SummaryAggregation, type SummaryFilterOperator } from "./_helpers.js"; import type { CustomObject } from "./custom-object.js"; import { CustomObjectFieldSection } from "./custom-object-field-section.js"; import { type ExistingManifestContextOptions } from "./existing-manifest-context.js"; import type { ManifestComponentDeletion } from "./manifest-builder.js"; export interface CustomObjectFieldDeletionIdentifier { customObjectApiName: string; fieldApiName: string; } /** * A filter condition applied to a {@link SummaryField}. * * Filters restrict which child records are included in the aggregation. * Only scalar field types are supported as filter fields — see * `FILTER_OPERATORS_BY_TYPE` in `_helpers.ts` for the per-type operator allow-list. */ export interface SummaryFilter { /** * The child-CO field to filter on. * * Required. Must be a scalar field on the same child object as `lookup`. * Cannot be a formula field, summary field, or the `lookup` field itself. */ field: Field; /** * Comparison operator. Allowed operators depend on the field's type — * text/boolean fields support `=` and `!=`; numeric/date fields additionally * support `>`, `>=`, `<`, `<=`. * * Required. */ operator: SummaryFilterOperator; /** * Raw RQL value string, e.g. `"'Active'"`, `"50"`, `"true"`, `"DATE(2026,1,1)"`. * * Required. */ value: string; } interface SummarySpec { aggregates: Field; using: SummaryAggregation; lookup: Field; filters: SummaryFilter[]; currencyCode: string | null; } /** Props shared by every field variant. */ interface CommonFieldProps { apiName: string; displayName: string; description: string; section: CustomObjectFieldSection; } /** * Low-level props for the base `Field`. Most users should use one of the * concrete subclasses (`TextField`, `LookupField`, …) instead of constructing * `Field` directly. */ export interface FieldProps { apiName: string; displayName: string; fieldType?: FieldType | undefined; dataType?: Record | undefined; description: string; required?: boolean | null | undefined; unique?: boolean | null | undefined; indexed?: boolean | null | undefined; rqlFormula?: string | null | undefined; formulaAttrMetas?: Record | null | undefined; derivedAggregatedField?: Record | null | undefined; derivedFieldFormula?: string | null | undefined; section: CustomObjectFieldSection; maxLength?: number | undefined; decimalPlaces?: number | undefined; currency?: string | undefined; options?: string[] | undefined; /** Internal — set by `SummaryField`; drives the `derived_aggregated_field` wire field. */ summarySpec?: SummarySpec | undefined; } export interface FieldLoadFromExistingOptions extends ExistingManifestContextOptions { customObjectApiName?: string; } /** * Base class for every custom-object field. * * Prefer the typed subclasses (`TextField`, `NumberField`, `LookupField`, …) over * constructing `Field` directly. Use `Field` only for wire-level field types the * SDK does not yet model with a dedicated subclass. * * All field classes share the same scope-first CDK pattern: pass the parent * {@link CustomObject} as the first argument and the field auto-registers with * the manifest. Every field api_name must end with `__c`. * * @example * ```ts * // Prefer typed subclasses: * const firstName = new TextField(memberObj, { * apiName: 'first_name__c', * displayName: 'First name', * required: true, * maxLength: 80, * section: profileSection, * }); * ``` * * @see {@link TextField}, {@link NumberField}, {@link LookupField}, {@link SummaryField} */ export declare class Field { static readonly componentType: "CUSTOM_OBJECT_FIELD"; static toDeletionIdentifier(identifier: CustomObjectFieldDeletionIdentifier): ManifestComponentDeletion; private readonly _fieldApiName; private readonly _fieldDisplayName; private readonly _customObjectApiName; private readonly _dataType; private readonly _description; private readonly _isRequired; private readonly _isUnique; private readonly _isIndexed; private readonly _rqlFormula; private readonly _formulaAttrMetas; private readonly _derivedFieldFormula; private _section; private readonly _summarySpec; private readonly _derivedAggregatedFieldStatic; /** * @param customObject - The custom object this field belongs to. * @param props - Field configuration. See {@link FieldProps}. * @throws {Error} If `props.apiName` does not end with `__c`. */ constructor(customObject: CustomObject, props: FieldProps); /** * Loads this field from the active existing-manifest JSON context. * * For fields whose api_name is not globally unique, pass `customObjectApiName` * or use a qualified id like `'object__c.field__c'`. */ static loadFromExisting(apiName: string, options?: FieldLoadFromExistingOptions): Field; /** @internal Hydrates a custom object field from existing manifest wire JSON. */ static _fromExistingComponent(customObject: CustomObject, component: Record): Field; /** @internal Creates a non-registered reference for standard or external fields. */ static _referenceFromExistingComponent(component: Record): Field; /** * @internal Creates a non-registered reference for a known wire field name. * @deprecated Agent-facing code should use CustomObject.standardFields or CustomObject.standardField(...). */ static _syntheticReference(customObjectApiName: string, fieldApiName: string): Field; /** Returns the api_name of this field (e.g. `'first_name__c'`). */ getApiName(): string; /** Returns the display name of this field. */ getDisplayName(): string; /** Returns the api_name of the custom object this field belongs to. */ getCustomObjectApiName(): string; /** Returns the resolved `field_type` (e.g. `'TEXT'`), or `null` if unset. */ getFieldType(): FieldType | null; /** Returns a read-only view of the raw `data_type` dict. */ getDataType(): Readonly>; /** Returns `true` if this is a formula (computed) field. */ isFormula(): boolean; /** Returns `true` if this is a summary (rollup) field. */ isSummary(): boolean; /** Returns `true` if this is a platform-managed standard field reference. */ isStandard(): boolean; /** Returns the field section id assigned to this field, if any. */ getSectionId(): string | null; /** @internal Assigns this field to a field section during page-layout normalization. */ _assignSection(section: CustomObjectFieldSection | string): void; /** * Serializes this field to the wire format consumed by the manifest install endpoint. * * @returns A plain object with `type: 'CUSTOM_OBJECT_FIELD'`. */ toDict(): Record; /** Build the `derived_aggregated_field` dict from `_summarySpec` with cross-CO checks. */ private _resolveAggregatedField; } /** Initialization properties for {@link TextField}. */ export interface TextFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; /** Whether values must be unique across records. Optional. */ unique?: boolean; /** Maximum character length. Optional. */ maxLength?: number; } /** Single-line text field. */ export declare class TextField extends Field { constructor(customObject: CustomObject, props: TextFieldProps); } /** Initialization properties for {@link LongTextField}. */ export interface LongTextFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; /** Maximum character length. Optional. */ maxLength?: number; } /** Multi-line text field. */ export declare class LongTextField extends Field { constructor(customObject: CustomObject, props: LongTextFieldProps); } /** Initialization properties for {@link EmailField}. */ export interface EmailFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; /** Whether values must be unique across records. Optional. */ unique?: boolean; } /** Email address field. Format is validated by the Rippling UI. */ export declare class EmailField extends Field { constructor(customObject: CustomObject, props: EmailFieldProps); } /** Initialization properties for {@link UrlField}. */ export interface UrlFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** URL field. Format is validated by the Rippling UI. */ export declare class UrlField extends Field { constructor(customObject: CustomObject, props: UrlFieldProps); } /** Initialization properties for {@link PhoneField}. */ export interface PhoneFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Phone number field. */ export declare class PhoneField extends Field { constructor(customObject: CustomObject, props: PhoneFieldProps); } /** Initialization properties for {@link NumberField}. */ export interface NumberFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; /** Whether values must be unique across records. Optional. */ unique?: boolean; /** Number of decimal places to display and store. Optional. */ decimalPlaces?: number; } /** Numeric field. */ export declare class NumberField extends Field { constructor(customObject: CustomObject, props: NumberFieldProps); } /** Initialization properties for {@link CurrencyField}. */ export interface CurrencyFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; /** ISO 4217 currency code (e.g. `'USD'`). Optional. Forwarded to the wire only when set. */ currency?: string; /** Number of decimal places. Optional. */ decimalPlaces?: number; } /** Currency amount field. */ export declare class CurrencyField extends Field { constructor(customObject: CustomObject, props: CurrencyFieldProps); } /** Initialization properties for {@link PercentageField}. */ export interface PercentageFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Percentage field. */ export declare class PercentageField extends Field { constructor(customObject: CustomObject, props: PercentageFieldProps); } /** Initialization properties for {@link DateField}. */ export interface DateFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Date field (no time component). */ export declare class DateField extends Field { constructor(customObject: CustomObject, props: DateFieldProps); } /** Initialization properties for {@link DatetimeField}. */ export interface DatetimeFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Date and time field. */ export declare class DatetimeField extends Field { constructor(customObject: CustomObject, props: DatetimeFieldProps); } /** Initialization properties for {@link TimeField}. */ export interface TimeFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Time-of-day field. */ export declare class TimeField extends Field { constructor(customObject: CustomObject, props: TimeFieldProps); } /** Initialization properties for {@link SelectField}. */ export interface SelectFieldProps extends CommonFieldProps { /** * The list of selectable options (e.g. `['Active', 'Frozen', 'Cancelled']`). * * Required. */ options: string[]; /** Whether a value is required on save. Optional. */ required?: boolean; } /** * Multi-select dropdown field. Renders as a dropdown that allows multiple * options to be selected at once. * * Use {@link RadioField} instead when only one option should be selectable. */ export declare class SelectField extends Field { constructor(customObject: CustomObject, props: SelectFieldProps); } /** Initialization properties for {@link RadioField}. */ export interface RadioFieldProps extends CommonFieldProps { /** * The list of selectable options. * * Required. */ options: string[]; /** Whether a value is required on save. Optional. */ required?: boolean; } /** * Single-select radio button group field. Exactly one option can be selected. * * Use {@link SelectField} instead when multiple options should be selectable. */ export declare class RadioField extends Field { constructor(customObject: CustomObject, props: RadioFieldProps); } /** Initialization properties for {@link BooleanField}. */ export interface BooleanFieldProps extends CommonFieldProps { /** Whether a value is required on save. Optional. */ required?: boolean; } /** Boolean (checkbox) field. */ export declare class BooleanField extends Field { constructor(customObject: CustomObject, props: BooleanFieldProps); } /** Initialization properties for {@link FileField}. */ export interface FileFieldProps extends CommonFieldProps { /** * Restricts which file types can be uploaded. Mirrors the UI's "File type" dropdown. * * Required. * - `'images'` — jpg, jpeg, png, gif, bmp, svg * - `'documents'` — doc, docx, pdf, csv, txt, rtf, ppt, pptx * - `'any'` — any file type */ allowedType: 'images' | 'documents' | 'any'; /** Whether a file is required on save. Optional. */ required?: boolean; } /** File attachment field. */ export declare class FileField extends Field { constructor(customObject: CustomObject, props: FileFieldProps); } /** Initialization properties for {@link LookupField}. */ export interface LookupFieldProps extends CommonFieldProps { /** * The object this field points to. Pass a live {@link CustomObject} instance, * or a raw api_name string for native Rippling models (e.g. `'Employee'`). * * Required. */ target: CustomObject | string; /** * Label for the related-records panel on the target object's detail page * (e.g. `'Class enrollments'`). * * Optional. */ relatedDataLabel?: string; /** Whether a value is required on save. Optional. */ required?: boolean; } /** * Many-to-one reference field. Links this record to one record on the target object. * * Use {@link ParentChildField} instead when the relationship should create a * parent-child hierarchy with rollup support. * * @remarks * **For "the employee responsible for this record" semantics, consider the built-in * `owner_role` standard field instead of a new `LookupField` to `'Employee'`.** Every * `CustomObject` ships with `owner_role` (an Employee reference) plus `created_by` * and `last_modified_by`. `owner_role` drives Rippling's record-level permissions, * so a parallel custom employee field can fragment ownership and complicate the * permission story. Consider a new `LookupField` to `'Employee'` when you need a * *second*, non-owner employee reference (e.g. an "approver", a "manager on record"). */ export declare class LookupField extends Field { constructor(customObject: CustomObject, props: LookupFieldProps); } /** Initialization properties for {@link ParentChildField}. */ export interface ParentChildFieldProps extends CommonFieldProps { /** * The parent object. Must be a live {@link CustomObject} instance. * * Required. */ target: CustomObject; /** * Label for the child-records panel on the parent's detail page * (e.g. `'Enrollments'`). * * Optional. */ relatedDataLabel?: string; /** * Whether this is the primary or secondary parent-child edge. * One of `'PRIMARY'` | `'SECONDARY'`. * * Optional. */ parentChildType?: 'PRIMARY' | 'SECONDARY'; /** * Whether the child record inherits the owner from the parent. * * Optional. */ enableParentOwnerInheritance?: boolean; } /** * Parent-child reference field. Creates a hierarchical relationship between * this object (child) and the target (parent), enabling {@link SummaryField} * rollups from the child to the parent. * * Always emitted as `required: true` on the wire. */ export declare class ParentChildField extends Field { constructor(customObject: CustomObject, props: ParentChildFieldProps); } /** Initialization properties for {@link FormulaField}. */ export interface FormulaFieldProps extends CommonFieldProps { /** * The RQL expression that computes this field's value * (e.g. `"CONCATENATE(TRIM(first_name__c), ' ', TRIM(last_name__c))"`). * * Required. */ formula: string; /** * Output data type. One of `'TEXT'` | `'NUMBER'` | `'BOOLEAN'` | `'CURRENCY'` * | `'PERCENTAGE'` | `'DATE'` | `'URL'`. * * Required. */ fieldType: FormulaFieldType; /** * Maximum character length of the computed value. * * Required when `fieldType === 'TEXT'`. The constructor throws if omitted for text formulas. */ maxLength?: number; } /** * Read-only computed field whose value is derived from an RQL formula. * * `fieldType` is required and restricted to the 7 output types the Rippling * formula editor supports. `maxLength` is required when `fieldType === 'TEXT'`. * * @example * ```ts * const memberLabel = new FormulaField(memberObj, { * apiName: 'member_label__c', * displayName: 'Member label', * fieldType: 'TEXT', * maxLength: 200, * formula: "CONCATENATE(TRIM(first_name__c), ' ', TRIM(last_name__c))", * section: profileSection, * }); * ``` */ export declare class FormulaField extends Field { constructor(customObject: CustomObject, props: FormulaFieldProps); } /** Initialization properties for {@link SummaryField}. */ export interface SummaryFieldProps extends CommonFieldProps { /** * The child-CO field whose values are aggregated. * * Required. Must have a known `fieldType` (use a typed subclass, not bare `Field`). * Must live on the same child object as `lookup`. */ aggregates: Field; /** * Aggregation function. One of `'COUNT'` | `'SUM'` | `'MIN'` | `'MAX'`. * * Required. `COUNT` always produces a `NUMBER` output; other functions * inherit the output type from `aggregates`. */ using: SummaryAggregation; /** * The {@link ParentChildField} on the child CO that points back at this parent object. * * Required. Must be a `ParentChildField` (the constructor throws otherwise). */ lookup: Field; /** * Optional filter conditions applied before aggregating. Each filter restricts * which child records are included. * * Optional. @default `[]` */ filters?: SummaryFilter[]; /** * ISO 4217 currency code (e.g. `'USD'`). Only valid when the aggregated field * resolves to `'CURRENCY'`. * * Optional. */ currencyCode?: string; } /** * Read-only rollup field that aggregates a child object's field values. * * Defined on the **parent** object. Requires a {@link ParentChildField} on the * child object pointing back at this parent as the `lookup` edge. * * @example * ```ts * // Count enrollments on a class session: * const enrollmentCount = new SummaryField(sessionObj, { * apiName: 'enrollment_count__c', * displayName: 'Enrolled (count)', * aggregates: enrollmentMemberRef, * using: 'COUNT', * lookup: enrollmentSessionRef, // ParentChildField on enrollmentObj → sessionObj * section: sessionStatsSection, * }); * ``` * * @see {@link ParentChildField} — must be used as `lookup`. */ export declare class SummaryField extends Field { constructor(customObject: CustomObject, props: SummaryFieldProps); } export {}; //# sourceMappingURL=field.d.ts.map