Core Types
Key TypeScript types used throughout the SDK.
TagRepresentation
The unified type representing variables, dimension tables, and dimension members.
interface TagRepresentation {
id: number;
name: string;
type: TagType; // "ACCOUNT" | "DIMENSION" | "TABLE"
internalType?: InternalTagType; // "YEAR" | "QUARTER" | "MONTH" | etc.
description: string | null;
expression?: string | null; // Formula expression
jsonData: object | null;
ParentId: number | null;
connectedTagIds?: number[]; // Hierarchy connections
dimensionTagIds?: number[]; // For variables: linked dimension table IDs
active: boolean;
order: number;
rollupType?: RollupType; // "Sum" | "Average" | "Min" | "Max"
dataType?: VariableDataType; // "Decimal" | "Integer" | "Text"
numberFormat?: NumberFormatComponent;
numberValidation?: NumberValidationComponent;
defaultValue?: number | null;
readonly?: boolean;
calculateOnDemand?: boolean;
canEdit: boolean;
columns?: DimensionTableColumn[]; // For tables: column definitions
}
Used by: getVariable(), getDimensionTable(), getDimensionMember(), getDimensionMembersForTable(), filterDimensionMembers()
TagMaps
In-memory lookup structure returned by initTagMap().
interface TagMaps {
variableMapByName: Map<string, TagRepresentation>;
dimensionTableMapByName: Map<string, TagRepresentation>;
dimensionMemberMapsByTableId: Map<number, Map<string, TagRepresentation>>;
mapById: Map<number, TagRepresentation>;
}
Example:
await client.initTagMap();
// Direct access to tag maps
const revenue = client.tagMaps.variableMapByName.get('Revenue');
const productTable = client.tagMaps.dimensionTableMapByName.get('Products');
const memberById = client.tagMaps.mapById.get(42);
ImportActions
Object returned by createImportJob() with methods for managing the import.
interface ImportActions {
addRow(row: ImportJobRowDataCell[]): Promise<void>;
addRows(rows: ImportJobRowDataCell[][]): Promise<void>;
flushRows(): Promise<void>;
importDimensions(replaceAll?: boolean): Promise<void>;
detectDimensions(): Promise<void>;
commit(): Promise<ImportCommitReport>;
undoPrevious(): Promise<void>;
delete(): Promise<void>;
}
type ImportJobRowDataCell = string | number | null;
| Method | Description |
|---|---|
addRow(row) | Add a single row |
addRows(rows) | Add multiple rows (auto-batched at 500) |
flushRows() | Flush remaining buffered rows. Only needed when inspecting before commit() |
importDimensions(replaceAll?) | Import dimension members from job data |
detectDimensions() | Auto-detect dimension mappings |
commit() | Commit the import and process data |
undoPrevious() | Undo the previous import with matching labels |
delete() | Delete the import job |
Standard import flow:
const job = await client.createImportJob({ title, columns, labels });
await job.addRows(data);
await job.undoPrevious();
await job.commit(); // Automatically flushes remaining buffered rows
ImportMetadataColumn
Simplified column definition for createImportJob().
type ImportMetadataColumn =
| { type: 'DIMENSION_TABLE'; dimensionTableName: string; columnName?: string }
| { type: 'VARIABLE'; variableName: string; dimensionsNames?: DimensionMemberType[]; columnName?: string }
| { type: 'DATE'; dateFormat: string; columnName?: string }
| { type: 'DESCRIPTION'; columnName?: string }
| { type: 'CUSTOM'; columnName: string }
| { type: 'NONE'; columnName?: string };
| Type | Purpose | Example |
|---|---|---|
DIMENSION_TABLE | Maps column to a dimension table | { type: 'DIMENSION_TABLE', dimensionTableName: 'Products' } |
VARIABLE | Maps column to a variable for value import | { type: 'VARIABLE', variableName: 'Revenue' } |
DATE | Date column with format | { type: 'DATE', dateFormat: 'YYYY-MM-DD' } |
DESCRIPTION | Cell description column | { type: 'DESCRIPTION' } |
CUSTOM | Custom/ignored column | { type: 'CUSTOM', columnName: 'Notes' } |
NONE | Skip column | { type: 'NONE' } |
ModelTableColumnType
Column types used in model.load() for dimension table sync.
enum ModelTableColumnType {
PrimaryKey = 'PrimaryKey',
Description = 'Description',
ForeignKey = 'ForeignKey',
Formula = 'Formula',
Number = 'Number',
Text = 'Text',
Date = 'Date',
}
| Type | Purpose | Example |
|---|---|---|
PrimaryKey | Unique identifier for the member | Product name |
Description | Display description | Product details |
ForeignKey | Reference to another dimension table | Category |
Formula | Calculated expression | sum(...) |
Number | Numeric property | Price |
Text | Text property | Notes |
Date | Date property | Created date |
FolderItemRepresentation
Represents a file or folder in the Farseer file system.
interface FolderItemRepresentation {
id: number;
name: string;
type: FolderItemType;
reference?: string; // File reference for download
parentId?: number;
// ... additional properties
}
DimensionMemberType
Used in ImportMetadataVariableColumn.dimensionsNames to specify fixed dimension members for a variable import column.
interface DimensionMemberType {
tableName: string; // Dimension table name
memberName: string; // Member name within that table
}
Example:
const column: ImportMetadataVariableColumn = {
type: 'VARIABLE',
variableName: 'Revenue',
dimensionsNames: [
{ tableName: 'Versions', memberName: 'Plan' },
{ tableName: 'Years', memberName: 'Y2024' },
],
};
ExportConfiguration
Configuration for evaluatorExport(). Defines the columns and format for data export.
interface ExportConfiguration {
format: 'json' | 'csv';
columns: ExportColumn[];
}
type ExportColumn =
| ExportDimensionColumn
| ExportAccountTagColumn
| ExportLiteralColumn
| ExportFormulaColumn;
ExportDimensionColumn
interface ExportDimensionColumn {
type: 'DIMENSION';
name: string;
dimensionTagId: number;
valueTemplate?: string;
}
ExportAccountTagColumn
interface ExportAccountTagColumn {
type: 'ACCOUNT';
name: string;
accountTagId: number;
filterTagIds: number[];
}
ExportLiteralColumn
interface ExportLiteralColumn {
type: 'LITERAL';
name: string;
value: string | number | null;
}
ExportFormulaColumn
interface ExportFormulaColumn {
type: 'FORMULA';
name: string;
formula: string;
}
EvaluateRequest
Request object for evaluator.evaluate().
interface EvaluateRequest {
filters: Array<Array<string>>; // [alias, value] substitution pairs
cellQueries: Array<CellQuery>; // Queries to evaluate
}
CellQuery
Discriminated union for cell evaluation queries.
type CellQuery =
| { type: 'VARIABLE'; formula: string }
| { type: 'DTABLE'; tableGid: number; columnIds: number[];
fkColumnId?: number; formula: string };
EvaluateCell
Response from evaluator.evaluate() — one per cell query.
interface EvaluateCell {
value: any | null; // Computed value
readonly: boolean; // Read-only cell
calculated: boolean; // Whether it's a calculated field
frozen: boolean; // Frozen cell
goal?: number; // Target value if set
}
ParsedWorksheetData
Returned by readExcelWorksheetsFromFarseerFile().
interface ParsedWorksheetData {
worksheetName: string;
data: Generator<(string | number | boolean | Date | null)[], void, void>;
}
ConfigurationParameters
Full client configuration options.
interface ConfigurationParameters {
basePath?: string;
fetchApi?: FetchAPI;
middleware?: Middleware[];
queryParamsStringify?: (params: HTTPQuery) => string;
username?: string;
password?: string;
apiKey?: string | ((name: string) => string);
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => Promise<string>);
headers?: HTTPHeaders;
credentials?: RequestCredentials;
}