Type Definitions
Complete TypeScript type reference for the dcupl SDK.
Configuration Types
DcuplInitOptions
Configuration options for initializing a dcupl instance.
type DcuplInitOptions = {
config?: DcuplInitConfig;
quality?: DcuplInitQualityConfig;
performance?: DcuplInitPerformanceConfig;
analytics?: DcuplInitErrorAnalyticsConfig;
referenceMetadata?: DcuplInitReferenceMetadataConfig;
logging?: DcuplInitLoggingConfig;
};| Property | Type | Description |
|---|---|---|
config |
DcuplInitConfig |
Project configuration |
quality |
DcuplInitQualityConfig |
Data validation settings |
performance |
DcuplInitPerformanceConfig |
Performance optimization |
analytics |
DcuplInitErrorAnalyticsConfig |
Analytics tracking |
referenceMetadata |
DcuplInitReferenceMetadataConfig |
Reference metadata |
logging |
DcuplInitLoggingConfig |
Logging configuration |
DcuplInitConfig
Project configuration settings.
type DcuplInitConfig = {
projectId?: string;
apiKey?: string;
version?: string;
};| Property | Type | Description |
|---|---|---|
projectId |
string |
dcupl project identifier |
apiKey |
string |
API key for authentication |
version |
string |
Version identifier (e.g., 'draft', 'published', 'v1.0.0') |
DcuplInitPerformanceConfig
Performance optimization settings.
type DcuplInitPerformanceConfig = {
cache?: {
enabled: boolean;
};
clone?: {
enabled: boolean;
};
partialUpdates?: DcuplPartialUpdateConfig;
containerBatchSize?: number;
autoUpdateLists?: {
enabled: boolean;
};
};| Property | Type | Default | Description |
|---|---|---|---|
cache.enabled |
boolean |
true |
Enable internal caching |
clone.enabled |
boolean |
true |
Clone query results |
partialUpdates |
DcuplPartialUpdateConfig |
- | Partial update settings |
containerBatchSize |
number |
undefined |
Batch size (0 = sync, undefined = async) |
autoUpdateLists.enabled |
boolean |
false |
Auto-update lists on data changes |
DcuplPartialUpdateConfig
Partial update optimization settings.
type DcuplPartialUpdateConfig = {
modelRatioThreshold?: number;
itemRatioThreshold?: number;
cacheInvalidationThreshold?: number;
enableDetailedLogging?: boolean;
};| Property | Type | Default | Description |
|---|---|---|---|
modelRatioThreshold |
number |
0.5 |
Triggers full update when exceeded |
itemRatioThreshold |
number |
0.5 |
Triggers full update when exceeded |
cacheInvalidationThreshold |
number |
0.7 |
Triggers full cache clear |
enableDetailedLogging |
boolean |
false |
Enable detailed update logging |
DcuplInitQualityConfig
Data quality validation settings.
type DcuplInitQualityConfig = {
enabled: boolean;
};DcuplInitLoggingConfig
Logging configuration.
type DcuplInitLoggingConfig = {
level?: LogLevel;
format?: 'json' | 'pretty';
onLog?: (entry: LogEntry) => void;
modules?: Record<string, LogLevel>;
};
type LogLevel = 'debug' | 'info' | 'warn' | 'error';DcuplUpdateOptions
Options for the update() method.
type DcuplUpdateOptions = {
autoUpdateLists?: boolean;
};Model Types
ModelDefinition
Defines a data model structure.
type ModelDefinition = {
key: string;
keyProperty?: string;
properties?: PropertyDefinition[];
references?: ReferenceDefinition[];
quality?: ModelQualityConfig;
data?: RawItem[];
autoGenerateKey?: boolean;
autoGenerateProperties?: boolean;
supportsAutoCreation?: boolean;
valueMappings?: ValueMappingConfig[];
meta?: ModelMetadata;
};| Property | Type | Description |
|---|---|---|
key |
string |
Unique model identifier |
keyProperty |
string |
Property to use as item key (default: 'key') |
properties |
PropertyDefinition[] |
Property definitions |
references |
ReferenceDefinition[] |
Reference definitions |
quality |
ModelQualityConfig |
Quality validation rules |
data |
RawItem[] |
Inline data for the model |
autoGenerateKey |
boolean |
Auto-generate keys for items without keys |
autoGenerateProperties |
boolean |
Auto-generate property definitions from data |
supportsAutoCreation |
boolean |
Allow auto-creation of referenced items |
valueMappings |
ValueMappingConfig[] |
Value transformation mappings |
meta |
ModelMetadata |
Additional model metadata |
PropertyDefinition
Defines a model property.
type PropertyDefinition = {
key: string;
type: PropertyType;
displayKey?: string;
quality?: PropertyQualityConfig;
expression?: string;
derive?: {
localReference: string;
remoteProperty: string;
separator?: string;
};
filter?: boolean | FilterConfig;
aggregate?: boolean | AggregationOptionsModel;
index?: boolean;
};
type PropertyType =
| 'string'
| 'int'
| 'float'
| 'boolean'
| 'date'
| 'json'
| 'any'
| 'Array<string>'
| 'Array<int>'
| 'Array<float>'
| 'Array<date>';ReferenceDefinition
Defines a reference to another model.
type ReferenceDefinition = {
key: string;
model: string;
type: ReferenceType;
separator?: string;
filter?: boolean | FilterConfig;
aggregate?: boolean | AggregationOptionsModel;
index?: boolean;
validity?: ValidityConfig;
};
type ReferenceType = 'singleValued' | 'multiValued';| Property | Type | Description |
|---|---|---|
key |
string |
Reference property name |
model |
string |
Target model key |
type |
ReferenceType |
Relationship type |
separator |
string |
Separator for multiValued string references |
filter |
boolean | FilterConfig |
Enable filtering on this reference |
aggregate |
boolean | AggregationOptionsModel |
Enable aggregation on this reference |
index |
boolean |
Enable indexing for this reference |
validity |
ValidityConfig |
Validity period configuration |
Data Types
RawItem
Generic raw data item.
type RawItem = {
key?: string;
[property: string]: any;
};DataOptions
Options for data operations.
type DataOptions = {
model: string;
keyProperty?: string;
autoGenerateKey?: boolean;
};| Property | Type | Default | Description |
|---|---|---|---|
model |
string |
- | Model key (required) |
keyProperty |
string |
'key' |
Property name for item key |
autoGenerateKey |
boolean |
false |
Auto-generate missing keys |
DataContainer
Advanced data container for direct application.
type DataContainer = {
model: string;
type?: DataContainerType;
data: RawItem[];
keyProperty?: string;
autoGenerateKey?: boolean;
autoGenerateProperties?: boolean;
placeholderUid?: string;
};
type DataContainerType = 'upsert' | 'update' | 'set' | 'remove';Query Types
DcuplQuery
A single query condition for filtering items based on attribute values. This is a discriminated union type based on the operator.
type DcuplQuery =
| DcuplQueryEq
| DcuplQueryNumbers
| DcuplQueryTypeOf
| DcuplQueryIsTruthy
| DcuplQuerySize
| DcuplQueryFind;Base properties shared by all query types:
type DcuplQueryBase = {
attribute: string;
queryKey?: any;
options?: DcuplQueryOptions;
};| Property | Type | Description |
|---|---|---|
attribute |
string |
Property to query against. Supports dot notation for nested properties (e.g., 'user.email') |
operator |
DcuplQueryOperator |
Comparison operator |
value |
any |
Value to compare against (type depends on operator) |
queryKey |
any |
Optional identifier for tracking or removing specific queries |
options |
DcuplQueryOptions |
Query behavior modifiers |
Example:
// Equality check
const statusQuery: DcuplQuery = {
operator: 'eq',
attribute: 'status',
value: 'active'
};
// Numeric comparison with options
const priceQuery: DcuplQuery = {
operator: 'gte',
attribute: 'price',
value: 100,
options: { invert: false }
};
// Text search
const searchQuery: DcuplQuery = {
operator: 'find',
attribute: 'description',
value: 'search term'
};DcuplQueryOperator
Available query operators for filtering data.
type DcuplQueryOperator =
| 'eq' // Equality check - matches exact values
| 'find' // Partial text or object match
| 'gt' // Greater than (exclusive)
| 'gte' // Greater than or equal (inclusive)
| 'lt' // Less than (exclusive)
| 'lte' // Less than or equal (inclusive)
| 'typeof' // Type check - validates data type
| 'isTruthy' // Boolean check - evaluates truthiness
| 'size'; // Array/string length check| Operator | Description | Value Type |
|---|---|---|
eq |
Exact equality match | any |
find |
Substring search or object property match | string | Record |
gt |
Greater than (exclusive) | string | number | Date |
gte |
Greater than or equal (inclusive) | string | number | Date |
lt |
Less than (exclusive) | string | number | Date |
lte |
Less than or equal (inclusive) | string | number | Date |
typeof |
JavaScript type check | string (e.g., 'number') |
isTruthy |
Truthiness evaluation | boolean |
size |
Array or string length | number |
Example:
// Equality
{ operator: 'eq', attribute: 'status', value: 'active' }
// Numeric comparison
{ operator: 'gte', attribute: 'price', value: 100 }
// Text search
{ operator: 'find', attribute: 'name', value: 'search term' }
// Type check
{ operator: 'typeof', attribute: 'price', value: 'number' }
// Truthiness
{ operator: 'isTruthy', attribute: 'isActive', value: true }
// Array size
{ operator: 'size', attribute: 'tags', value: 3 }DcuplQueryOptions
Query behavior modifiers for fine-tuning condition matching.
type DcuplQueryOptions = {
transform?: DcuplQueryTransformOptions[];
invert?: boolean;
arrayValueHandling?: 'some' | 'every';
};
type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace';| Property | Type | Default | Description |
|---|---|---|---|
transform |
DcuplQueryTransformOptions[] |
- | Value transformations applied in order before comparison |
invert |
boolean |
false |
Negate the query result (NOT operation) |
arrayValueHandling |
'some' | 'every' |
'some' |
How to match when querying array values |
Transform Options:
| Transform | Description |
|---|---|
lowercase |
Convert value to lowercase before comparison |
trim |
Remove leading/trailing whitespace |
removeWhitespace |
Remove all whitespace characters |
Example:
// Case-insensitive search
{
operator: 'eq',
attribute: 'name',
value: 'john',
options: { transform: ['lowercase', 'trim'] }
}
// Find items where status is NOT 'active'
{
operator: 'eq',
attribute: 'status',
value: 'active',
options: { invert: true }
}
// Match items where ALL tags equal 'featured'
{
operator: 'eq',
attribute: 'tags',
value: 'featured',
options: { arrayValueHandling: 'every' }
}DcuplQueryGroup
Combines multiple query conditions with AND/OR logic. Groups can be nested to create complex filter expressions.
type DcuplQueryGroup<ChildQuery = DcuplQuery | DcuplQueryGroup> = {
groupType?: 'and' | 'or';
groupKey?: string;
queries: Array<ChildQuery>;
};| Property | Type | Default | Description |
|---|---|---|---|
groupType |
'and' | 'or' |
'and' |
Combination logic for conditions in this group |
groupKey |
string |
- | Optional identifier for tracking or removing specific query groups |
queries |
Array |
- | Array of query conditions or nested groups |
Example:
// AND group - all conditions must match
const andGroup: DcuplQueryGroup = {
groupType: 'and',
groupKey: 'active-products',
queries: [
{ operator: 'eq', attribute: 'status', value: 'active' },
{ operator: 'gte', attribute: 'price', value: 100 }
]
};
// OR group - at least one condition must match
const orGroup: DcuplQueryGroup = {
groupType: 'or',
queries: [
{ operator: 'eq', attribute: 'category', value: 'electronics' },
{ operator: 'eq', attribute: 'category', value: 'books' }
]
};
// Nested groups for complex logic
const nestedGroup: DcuplQueryGroup = {
groupType: 'and',
queries: [
{ operator: 'eq', attribute: 'status', value: 'active' },
{
groupType: 'or',
queries: [
{ operator: 'eq', attribute: 'featured', value: true },
{ operator: 'gte', attribute: 'rating', value: 4.5 }
]
}
]
};DcuplListQueryOptions
Options for executing queries on a list instance. Combines query conditions with pagination, projection, and sorting options.
type DcuplListQueryOptions<T> = {
// Query group properties
groupType?: 'and' | 'or';
groupKey?: string;
queries: Array<DcuplQuery | DcuplQueryGroup>;
// Pagination
start?: number;
count?: number;
// Projection and sorting
projection?: Projection<T>;
sort?: SortingProjection<T>;
};| Property | Type | Description |
|---|---|---|
groupType |
'and' | 'or' |
Combination logic for queries |
groupKey |
string |
Optional group identifier |
queries |
Array |
Query conditions |
start |
number |
Starting index for pagination (0-based) |
count |
number |
Maximum number of items to return |
projection |
Projection |
Properties to include/exclude in results |
sort |
SortingProjection |
Sorting order for results |
Example:
const options: DcuplListQueryOptions<Product> = {
groupType: 'and',
queries: [
{ operator: 'eq', attribute: 'status', value: 'active' },
{ operator: 'gte', attribute: 'price', value: 50 }
],
start: 0,
count: 10,
sort: {
attributes: ['price'],
order: ['ASC']
}
};
const results = list.catalog.query.execute(options);DcuplGlobalQueryOptions
Options for executing queries across the global dcupl instance. Combines model specification, query conditions, and data retrieval options.
type DcuplGlobalQueryOptions<T> = {
modelKey: string;
// Query group properties
groupType?: 'and' | 'or';
groupKey?: string;
queries: Array<DcuplQuery | DcuplQueryGroup>;
// Pagination
start?: number;
count?: number;
// Projection and sorting
projection?: Projection<T>;
sort?: SortingProjection<T>;
};| Property | Type | Description |
|---|---|---|
modelKey |
string |
Model identifier to query against |
groupType |
'and' | 'or' |
Combination logic for queries |
queries |
Array |
Query conditions |
start |
number |
Starting index for pagination |
count |
number |
Maximum number of items to return |
projection |
Projection |
Properties to include/exclude |
sort |
SortingProjection |
Sorting order |
Example:
const options: DcuplGlobalQueryOptions<Product> = {
modelKey: 'Product',
groupType: 'and',
queries: [
{ operator: 'eq', attribute: 'status', value: 'active' }
],
start: 0,
count: 20,
sort: {
attributes: ['price'],
order: ['ASC']
}
};
const results = dcupl.query.execute(options);SortingProjection
Sorting configuration for query results.
type SortingProjection<T> = {
attributes: Array<keyof T>;
order: Array<'ASC' | 'DESC'>;
script?: {
key: string;
options: any;
};
};| Property | Type | Description |
|---|---|---|
attributes |
Array |
Properties to sort by (in order of priority) |
order |
Array<'ASC' | 'DESC'> |
Sort direction for each attribute |
script |
object |
Optional custom sorting script |
Example:
// Sort by price ascending, then by name descending
const sort: SortingProjection<Product> = {
attributes: ['price', 'name'],
order: ['ASC', 'DESC']
};List Types
DcuplListOptions
Options for creating a list.
type DcuplListOptions = {
modelKey: string;
listKey?: string;
listItemKeys?: string[];
query?: DcuplGlobalQueryOptions;
autoUpdate?: boolean;
};| Property | Type | Description |
|---|---|---|
modelKey |
string |
Model this list is based on |
listKey |
string |
Unique list identifier |
listItemKeys |
string[] |
Specific item keys to include |
query |
DcuplGlobalQueryOptions |
Initial query |
autoUpdate |
boolean |
Auto-update on data changes |
DcuplList
List instance interface.
interface DcuplList<T = any> {
key: string;
modelKey: string;
catalog: Catalog<T>;
update(options?: { reprocessData?: boolean }): void;
destroy(): void;
on(callback: CallbackFunction): () => void;
}Function Types
DcuplFacetOptions
Options for facet generation to create filterable value lists.
type DcuplFacetOptions = {
attribute: string;
count?: number;
excludeZeros?: boolean;
excludeUndefineds?: boolean;
excludeUnresolved?: boolean;
calculateResults?: boolean;
};| Property | Type | Default | Description |
|---|---|---|---|
attribute |
string |
- | Property to generate facets for |
count |
number |
- | Maximum number of facet values to return |
excludeZeros |
boolean |
false |
Exclude facet values with zero count |
excludeUndefineds |
boolean |
false |
Exclude undefined values from facets |
excludeUnresolved |
boolean |
false |
Exclude unresolved references from facets |
calculateResults |
boolean |
false |
Include result keys for each facet value |
Example:
const facetOptions: DcuplFacetOptions = {
attribute: 'category',
count: 10,
excludeZeros: true,
calculateResults: true
};
const facets = list.catalog.fn.facet(facetOptions);DcuplFacet
Facet result entry returned from facet operations.
type DcuplFacet = {
key: string;
enabled: boolean;
selected: boolean;
size: number;
value: boolean | string | null | undefined;
entry: ListItem;
resultKeys: string[];
children?: Array<DcuplFacet>;
};| Property | Type | Description |
|---|---|---|
key |
string |
Unique identifier for the facet value |
enabled |
boolean |
Whether the facet is currently enabled |
selected |
boolean |
Whether the facet is currently selected |
size |
number |
Count of items matching this facet value |
value |
boolean | string | null | undefined |
The actual facet value |
entry |
ListItem |
Reference to the list item |
resultKeys |
string[] |
Keys of items matching this facet |
children |
Array |
Nested child facets for hierarchical data |
AggregationOptions
Options for performing aggregations on numeric data.
type AggregationOptions = {
attribute: string;
types: AggregationType[];
distinctOptions?: {
limit?: number;
skipKeys?: boolean;
};
groupOptions?: {
limit?: number;
calculateNotFound?: boolean;
groups?: AggregationGroupOption[];
};
excludeZeros?: boolean;
excludeUndefineds?: boolean;
excludeUnresolved?: boolean;
};
type AggregationType = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'distinct' | 'group';
type AggregationGroupOption = {
from?: any;
to?: any;
value?: any[];
};| Property | Type | Default | Description |
|---|---|---|---|
attribute |
string |
- | Property to aggregate |
types |
AggregationType[] |
- | Aggregation types to calculate |
distinctOptions |
object |
- | Options for distinct value aggregation |
groupOptions |
object |
- | Options for group-based aggregation |
excludeZeros |
boolean |
false |
Exclude zero values from aggregation |
excludeUndefineds |
boolean |
false |
Exclude undefined values from aggregation |
excludeUnresolved |
boolean |
false |
Exclude unresolved references from aggregation |
Aggregation Types:
| Type | Description |
|---|---|
sum |
Sum of all values |
avg |
Average of all values |
count |
Count of items |
min |
Minimum value |
max |
Maximum value |
distinct |
Distinct values with counts |
group |
Group values into custom ranges |
Example:
// Basic aggregation
const basicOptions: AggregationOptions = {
attribute: 'price',
types: ['sum', 'avg', 'min', 'max', 'count']
};
// With distinct values
const distinctOptions: AggregationOptions = {
attribute: 'category',
types: ['distinct'],
distinctOptions: {
limit: 20,
skipKeys: false
}
};
// With custom grouping (price ranges)
const groupOptions: AggregationOptions = {
attribute: 'price',
types: ['group'],
groupOptions: {
groups: [
{ from: 0, to: 50 },
{ from: 50, to: 100 },
{ from: 100, to: 500 }
]
}
};
const result = list.catalog.fn.aggregate(basicOptions);Aggregation
Result of an aggregation operation.
type Aggregation = {
attribute: string;
types: AggregationType[];
sum?: number;
avg?: number;
count?: number;
min?: number;
max?: number;
distinct?: AggregationDistinctValue[];
group?: AggregationGroupValue[];
};
type AggregationDistinctValue = {
value: string;
count: number;
keys?: string[];
};
type AggregationGroupValue = {
option: AggregationGroupOption;
count: number;
keys: string[];
};SuggestionOptions
Options for generating autocomplete suggestions.
type SuggestionOptions =
| SuggestionOptionsFiltered
| SuggestionOptionsAll
| SuggestionOptionsExcludeQuery;
type SuggestionOptionsBase = {
attribute: string;
value: any;
max?: number;
calculateResultKeys?: boolean;
excludeUndefineds?: boolean;
excludeNulls?: boolean;
transform?: DcuplQueryTransformOptions[];
};
// Use filtered data (respects current query state)
type SuggestionOptionsFiltered = SuggestionOptionsBase & {
relevantData?: 'filtered';
};
// Use all data (ignores current query state)
type SuggestionOptionsAll = SuggestionOptionsBase & {
relevantData?: 'all';
};
// Use data excluding specific query
type SuggestionOptionsExcludeQuery = SuggestionOptionsBase & {
relevantData: 'excludeQuery';
excludeQuery: Partial<DcuplQuery | DcuplQueryGroup>;
};| Property | Type | Default | Description |
|---|---|---|---|
attribute |
string |
- | Property to generate suggestions for |
value |
any |
- | Search term to match against |
max |
number |
- | Maximum number of suggestions to return |
calculateResultKeys |
boolean |
false |
Include item keys for each suggestion |
excludeUndefineds |
boolean |
false |
Exclude undefined values from suggestions |
excludeNulls |
boolean |
false |
Exclude null values from suggestions |
transform |
DcuplQueryTransformOptions[] |
- | Value transformations before matching |
relevantData |
'filtered' | 'all' | 'excludeQuery' |
'filtered' |
Data scope for generating suggestions |
excludeQuery |
DcuplQuery | DcuplQueryGroup |
- | Query to exclude (only with relevantData: 'excludeQuery') |
Example:
// Basic suggestions
const options: SuggestionOptions = {
attribute: 'name',
value: 'app',
max: 10,
transform: ['lowercase']
};
// Suggestions from all data (ignoring filters)
const allOptions: SuggestionOptions = {
attribute: 'name',
value: 'app',
relevantData: 'all',
max: 10
};
// Suggestions excluding a specific query
const excludeOptions: SuggestionOptions = {
attribute: 'category',
value: 'elec',
relevantData: 'excludeQuery',
excludeQuery: {
operator: 'eq',
attribute: 'category',
queryKey: 'category-filter'
}
};
const suggestions = list.catalog.fn.suggest(options);Suggestion
Suggestion result entry.
type Suggestion = {
value: string;
keys: string[];
};DcuplGroupByOptions
Options for grouping data by attribute values.
type DcuplGroupByOptions<T> = {
attribute: string;
aggregates?: AggregationOptions[];
items?: DcuplSectionItemOption<T>[];
excludeZeros?: boolean;
excludeUndefineds?: boolean;
excludeUnresolved?: boolean;
// Pagination options inherited
start?: number;
count?: number;
projection?: Projection<T>;
sort?: SortingProjection<T>;
};
type DcuplSectionItemOption<T> = {
key: string;
start?: number;
count?: number;
projection?: Projection<T>;
sort?: SortingProjection<T>;
};| Property | Type | Description |
|---|---|---|
attribute |
string |
Property to group by |
aggregates |
AggregationOptions[] |
Aggregations to calculate per group |
items |
DcuplSectionItemOption[] |
Configure item retrieval for specific groups |
excludeZeros |
boolean |
Exclude groups with zero items |
excludeUndefineds |
boolean |
Exclude undefined group values |
excludeUnresolved |
boolean |
Exclude unresolved reference groups |
Example:
const groupByOptions: DcuplGroupByOptions<Product> = {
attribute: 'category',
aggregates: [
{ attribute: 'price', types: ['avg', 'min', 'max'] }
],
excludeZeros: true,
count: 10,
sort: {
attributes: ['name'],
order: ['ASC']
}
};
const grouped = list.catalog.fn.groupBy(groupByOptions);PivotOptions
Options for creating pivot table analyses.
type PivotOptions = {
rows: PivotRowOption[];
columns: PivotColumnOption[];
values: PivotValueOption[];
options?: {
calculateTotals?: boolean;
};
};
type PivotRowOption = {
attribute: string;
calculateTotals?: boolean;
};
type PivotColumnOption = {
attribute: string;
calculateTotals?: boolean;
};
type PivotValueOption = AggregationOptions;| Property | Type | Description |
|---|---|---|
rows |
PivotRowOption[] |
Row dimension attributes |
columns |
PivotColumnOption[] |
Column dimension attributes |
values |
PivotValueOption[] |
Value aggregations (uses AggregationOptions) |
options |
object |
Global pivot options |
Row/Column Option Properties:
| Property | Type | Default | Description |
|---|---|---|---|
attribute |
string |
- | Attribute to use for this dimension |
calculateTotals |
boolean |
true |
Calculate subtotals for this dimension |
Example:
const pivotOptions: PivotOptions = {
rows: [
{ attribute: 'category', calculateTotals: true },
{ attribute: 'brand' }
],
columns: [
{ attribute: 'year' }
],
values: [
{ attribute: 'revenue', types: ['sum'] },
{ attribute: 'quantity', types: ['count', 'avg'] }
],
options: {
calculateTotals: true
}
};
const pivotResult = dcupl.fn.pivot({
modelKey: 'Sales',
options: pivotOptions
});PivotResponse
Response structure from pivot operations.
type PivotResponse = {
key: string;
value?: any;
values?: Aggregation[];
columns?: PivotResponseItem[];
rows?: PivotResponseItem[];
};
type PivotResponseItem = {
key: string;
value?: any;
values?: Aggregation[];
columns?: PivotResponseItem[];
rows?: PivotResponseItem[];
};Event Types
CallbackFunction
Event callback signature.
type CallbackFunction = (message: DcuplMessage) => void;DcuplMessage
Event message structure.
type DcuplMessage = {
type: DcuplMessageType;
scope: string;
args?: any[];
};DcuplMessageType
Event types.
type DcuplMessageType =
| 'dcupl_init_completed'
| 'dcupl_updated_manually'
| 'dcupl_partial_update'
| 'list_updated'
| 'query_apply'
| 'query_reset';View Types
ViewDefinition
View configuration.
type ViewDefinition = {
key: string;
modelKey: string;
query?: DcuplGlobalQueryOptions;
};Quality Types
PropertyQualityConfig
Property validation rules.
type PropertyQualityConfig = {
required?: boolean;
validators?: {
min?: { value: number };
max?: { value: number };
minLength?: { value: number };
maxLength?: { value: number };
pattern?: { value: string };
};
};ModelQualityConfig
Model-level validation settings.
type ModelQualityConfig = {
enabled?: boolean;
};Generic Types
Dcupl
Main dcupl instance interface.
interface Dcupl {
// Properties
models: ModelsAPI;
lists: ListsAPI;
data: DataAPI;
query: QueryAPI;
fn: FunctionsAPI;
views: ViewsAPI;
scripts: ScriptsAPI;
loaders: LoadersAPI;
initOptions: DcuplInitOptions;
version: string;
// Methods
init(): Promise<boolean>;
update(options?: DcuplUpdateOptions): Promise<boolean>;
destroy(): void;
on(callback: CallbackFunction): () => void;
}See Also
- Dcupl Class API - Main class reference
- Query Operators - Operator reference
- Data API - Data operations
- Lists API - List management