@dcupl/common 1.11.11 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/attribute-dependency-graph.d.ts +119 -0
- package/dist/esm/cache.controller.d.ts +56 -1
- package/dist/esm/changeDetection.d.ts +1 -1
- package/dist/esm/date-utils.d.ts +50 -0
- package/dist/esm/deep-query.service.d.ts +133 -0
- package/dist/esm/dependency-graph.d.ts +102 -3
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +3096 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/indices.controller.d.ts +92 -0
- package/dist/esm/logger/index.d.ts +2 -0
- package/dist/esm/logger/logger.d.ts +101 -0
- package/dist/esm/pivot.d.ts +2 -1
- package/dist/esm/query-builder.d.ts +435 -2
- package/dist/esm/queryData.d.ts +9 -4
- package/dist/esm/types/dcupl.types.d.ts +80 -0
- package/dist/esm/types/internal.types.d.ts +1 -1
- package/dist/esm/types/list.types.d.ts +10 -0
- package/dist/esm/types/model.types.d.ts +49 -12
- package/dist/esm/types/query.types.d.ts +500 -2
- package/dist/node/index.cjs +5 -0
- package/dist/node/index.cjs.map +1 -0
- package/package.json +7 -8
- package/dist/browser/common.umd.js +0 -2
- package/dist/browser/common.umd.js.map +0 -1
- package/dist/esm/analytics.controller.js +0 -105
- package/dist/esm/analytics.controller.js.map +0 -1
- package/dist/esm/cache.controller.js +0 -40
- package/dist/esm/cache.controller.js.map +0 -1
- package/dist/esm/changeDetection.js +0 -179
- package/dist/esm/changeDetection.js.map +0 -1
- package/dist/esm/computeSuggestions.js +0 -38
- package/dist/esm/computeSuggestions.js.map +0 -1
- package/dist/esm/dependency-graph.js +0 -136
- package/dist/esm/dependency-graph.js.map +0 -1
- package/dist/esm/getAggregation.js +0 -170
- package/dist/esm/getAggregation.js.map +0 -1
- package/dist/esm/getFacets.js +0 -67
- package/dist/esm/getFacets.js.map +0 -1
- package/dist/esm/helper.js +0 -102
- package/dist/esm/helper.js.map +0 -1
- package/dist/esm/indices.controller.js +0 -97
- package/dist/esm/indices.controller.js.map +0 -1
- package/dist/esm/object-hash.js +0 -33
- package/dist/esm/object-hash.js.map +0 -1
- package/dist/esm/performance.js +0 -33
- package/dist/esm/performance.js.map +0 -1
- package/dist/esm/pivot.js +0 -132
- package/dist/esm/pivot.js.map +0 -1
- package/dist/esm/property-parser.js +0 -57
- package/dist/esm/property-parser.js.map +0 -1
- package/dist/esm/query-builder.js +0 -233
- package/dist/esm/query-builder.js.map +0 -1
- package/dist/esm/query.helper.js +0 -172
- package/dist/esm/query.helper.js.map +0 -1
- package/dist/esm/queryData.js +0 -360
- package/dist/esm/queryData.js.map +0 -1
- package/dist/esm/script.controller.js +0 -54
- package/dist/esm/script.controller.js.map +0 -1
- package/dist/esm/template-parser.js +0 -22
- package/dist/esm/template-parser.js.map +0 -1
- package/dist/esm/types/aggregation.types.js +0 -2
- package/dist/esm/types/aggregation.types.js.map +0 -1
- package/dist/esm/types/app-loader.types.js +0 -2
- package/dist/esm/types/app-loader.types.js.map +0 -1
- package/dist/esm/types/data.types.js +0 -2
- package/dist/esm/types/data.types.js.map +0 -1
- package/dist/esm/types/dcupl.types.js +0 -2
- package/dist/esm/types/dcupl.types.js.map +0 -1
- package/dist/esm/types/facets.types.js +0 -2
- package/dist/esm/types/facets.types.js.map +0 -1
- package/dist/esm/types/filter.types.js +0 -2
- package/dist/esm/types/filter.types.js.map +0 -1
- package/dist/esm/types/group-by.types.js +0 -2
- package/dist/esm/types/group-by.types.js.map +0 -1
- package/dist/esm/types/index.js +0 -17
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/internal.types.js +0 -2
- package/dist/esm/types/internal.types.js.map +0 -1
- package/dist/esm/types/list.types.js +0 -2
- package/dist/esm/types/list.types.js.map +0 -1
- package/dist/esm/types/model.types.js +0 -16
- package/dist/esm/types/model.types.js.map +0 -1
- package/dist/esm/types/projection.types.js +0 -2
- package/dist/esm/types/projection.types.js.map +0 -1
- package/dist/esm/types/quality.types.js +0 -2
- package/dist/esm/types/quality.types.js.map +0 -1
- package/dist/esm/types/query.types.js +0 -12
- package/dist/esm/types/query.types.js.map +0 -1
- package/dist/esm/types/section.types.js +0 -2
- package/dist/esm/types/section.types.js.map +0 -1
- package/dist/esm/types/suggestion.types.js +0 -2
- package/dist/esm/types/suggestion.types.js.map +0 -1
- package/dist/esm/types/testing.types.js +0 -2
- package/dist/esm/types/testing.types.js.map +0 -1
- package/dist/node/index.cjs.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/esm/queryData.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ListItem,
|
|
1
|
+
import { ListItem, InverseIndexReferenceMap, DcuplQueryTransformOptions, CustomOperatorFn, DcuplGlobalQueryOptions } from './types';
|
|
2
2
|
import { ScriptController } from './script.controller';
|
|
3
|
+
import { ModelParser } from '@dcupl/core/model-parser';
|
|
4
|
+
import { ItemService } from '@dcupl/core/catalog';
|
|
3
5
|
export declare class QueryManager {
|
|
4
|
-
|
|
6
|
+
scriptController: ScriptController;
|
|
7
|
+
globalItemService: ItemService;
|
|
8
|
+
modelParser: ModelParser;
|
|
5
9
|
private registeredCustomOperator;
|
|
6
10
|
private queryBuilder;
|
|
7
|
-
constructor(scriptController: ScriptController);
|
|
11
|
+
constructor(scriptController: ScriptController, globalItemService: ItemService, modelParser: ModelParser);
|
|
8
12
|
registerCustomOperator(operator: string, fn: CustomOperatorFn): void;
|
|
9
13
|
transformValue(value: any, transformers: DcuplQueryTransformOptions[]): any;
|
|
10
14
|
private evaluateQuery;
|
|
@@ -13,6 +17,7 @@ export declare class QueryManager {
|
|
|
13
17
|
queryFind(entryValue: any | any[], queryValue: any, arrayValueHandling: 'some' | 'every'): boolean;
|
|
14
18
|
private validateQuery;
|
|
15
19
|
private getEvaluatedQueryDataset;
|
|
20
|
+
private handleArrayStarQuery;
|
|
16
21
|
private evaluateQueryGroup;
|
|
17
|
-
queryData<ListType extends ListItem = ListItem>(initialData: Map<string, ListType>, rootQuery:
|
|
22
|
+
queryData<ListType extends ListItem = ListItem>(initialData: Map<string, ListType>, rootQuery: DcuplGlobalQueryOptions<any>, earlyReturn: boolean, indexMap: InverseIndexReferenceMap): Map<string, ListType>;
|
|
18
23
|
}
|
|
@@ -6,6 +6,7 @@ import { DcuplGroupByOptions } from './group-by.types';
|
|
|
6
6
|
import { DcuplItemsOptions } from './list.types';
|
|
7
7
|
import { DcuplGlobalQueryOptions } from './query.types';
|
|
8
8
|
import { SuggestionOptions } from './suggestion.types';
|
|
9
|
+
import { LogLevel, LogEntry } from '../logger';
|
|
9
10
|
export type DcuplInitOptions = {
|
|
10
11
|
config?: DcuplInitConfig;
|
|
11
12
|
/**
|
|
@@ -22,6 +23,10 @@ export type DcuplInitOptions = {
|
|
|
22
23
|
performance?: DcuplInitPerformanceConfig;
|
|
23
24
|
analytics?: DcuplInitErrorAnalyticsConfig;
|
|
24
25
|
referenceMetadata?: DcuplInitReferenceMetadataConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Configure logging behavior
|
|
28
|
+
*/
|
|
29
|
+
logging?: DcuplInitLoggingConfig;
|
|
25
30
|
};
|
|
26
31
|
export type DcuplInitPerformanceConfig = {
|
|
27
32
|
/**
|
|
@@ -38,6 +43,58 @@ export type DcuplInitPerformanceConfig = {
|
|
|
38
43
|
clone?: {
|
|
39
44
|
enabled: boolean;
|
|
40
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for partial update optimization strategy
|
|
48
|
+
*/
|
|
49
|
+
partialUpdates?: DcuplPartialUpdateConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Controls async/sync processing mode for containers:
|
|
52
|
+
* - undefined (default): Async mode - yield after every container (backward compatible)
|
|
53
|
+
* - 0: Synchronous mode - never yield (best performance, may block UI)
|
|
54
|
+
* - N > 0: Batched mode - yield every N containers (balanced performance)
|
|
55
|
+
*
|
|
56
|
+
* Note: Synchronous/batched modes are opt-in optimizations. Use only if your
|
|
57
|
+
* application can handle synchronous processing without UI blocking.
|
|
58
|
+
*/
|
|
59
|
+
containerBatchSize?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Controls whether lists automatically update when affected by data changes.
|
|
62
|
+
* When enabled, lists automatically call update() when their data changes.
|
|
63
|
+
* When disabled, manual list.update() calls are required.
|
|
64
|
+
*
|
|
65
|
+
* Can be overridden at list-level or per-update.
|
|
66
|
+
*/
|
|
67
|
+
autoUpdateLists?: {
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Configuration options for partial update optimization
|
|
73
|
+
*/
|
|
74
|
+
export type DcuplPartialUpdateConfig = {
|
|
75
|
+
/**
|
|
76
|
+
* Threshold for model ratio (0-1). If more than this percentage of models are affected,
|
|
77
|
+
* a full update will be triggered instead of a partial update.
|
|
78
|
+
* Default: 0.5 (50%)
|
|
79
|
+
*/
|
|
80
|
+
modelRatioThreshold?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Threshold for item ratio (0-1). If more than this percentage of items in affected models change,
|
|
83
|
+
* a full update will be triggered instead of a partial update.
|
|
84
|
+
* Default: 0.5 (50%)
|
|
85
|
+
*/
|
|
86
|
+
itemRatioThreshold?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Threshold for cache invalidation (0-1). If more than this percentage of models are affected,
|
|
89
|
+
* the entire cache will be cleared instead of selective invalidation.
|
|
90
|
+
* Default: 0.7 (70%)
|
|
91
|
+
*/
|
|
92
|
+
cacheInvalidationThreshold?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Enable detailed logging of update decisions and performance metrics
|
|
95
|
+
* Default: false
|
|
96
|
+
*/
|
|
97
|
+
enableDetailedLogging?: boolean;
|
|
41
98
|
};
|
|
42
99
|
export type DcuplInitQualityConfig = {
|
|
43
100
|
enabled: boolean;
|
|
@@ -51,6 +108,29 @@ export type DcuplInitErrorAnalyticsConfig = {
|
|
|
51
108
|
export type DcuplInitReferenceMetadataConfig = {
|
|
52
109
|
enabled: boolean;
|
|
53
110
|
};
|
|
111
|
+
export type DcuplInitLoggingConfig = {
|
|
112
|
+
/**
|
|
113
|
+
* Minimum log level to output
|
|
114
|
+
* Default: 'info' in production, 'debug' in development
|
|
115
|
+
*/
|
|
116
|
+
level?: LogLevel;
|
|
117
|
+
/**
|
|
118
|
+
* Output format
|
|
119
|
+
* - 'json': Structured logs for production/cloud platforms (AWS, Azure, etc.)
|
|
120
|
+
* - 'pretty': Human-readable logs with colors/icons for development
|
|
121
|
+
* Default: 'json' in production, 'pretty' in development
|
|
122
|
+
*/
|
|
123
|
+
format?: 'json' | 'pretty';
|
|
124
|
+
/**
|
|
125
|
+
* Custom log handler for sending logs to external services
|
|
126
|
+
*/
|
|
127
|
+
onLog?: (entry: LogEntry) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Module-specific log levels
|
|
130
|
+
* @example { 'ModelParser': 'debug', 'Catalog': 'warn' }
|
|
131
|
+
*/
|
|
132
|
+
modules?: Record<string, LogLevel>;
|
|
133
|
+
};
|
|
54
134
|
export type DcuplInitConfig = {
|
|
55
135
|
/**
|
|
56
136
|
* The project id optained from the dcupl console
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListItem } from './data.types';
|
|
2
2
|
export type InverseIndexReferenceMap = Map<string, InverseIndexValuesMap>;
|
|
3
|
-
export type InverseIndexValuesMap = Map<string, string
|
|
3
|
+
export type InverseIndexValuesMap = Map<string, Set<string>>;
|
|
4
4
|
export type InverseIndexDataMap = Map<string, InverseIndexDataValuesMap>;
|
|
5
5
|
export type InverseIndexDataValuesMap = Map<string, ListItem>;
|
|
@@ -31,6 +31,16 @@ export type DcuplListOptions<ModelNames extends string = string> = {
|
|
|
31
31
|
listKey?: string;
|
|
32
32
|
listItemKeys?: string[];
|
|
33
33
|
query?: DcuplGlobalQueryOptions<ListItem>;
|
|
34
|
+
/**
|
|
35
|
+
* Controls auto-update for this specific list.
|
|
36
|
+
* - true: Always auto-update
|
|
37
|
+
* - false: Never auto-update
|
|
38
|
+
* - undefined: Inherit from global config
|
|
39
|
+
*
|
|
40
|
+
* Overrides global autoUpdateLists setting.
|
|
41
|
+
* @default undefined
|
|
42
|
+
*/
|
|
43
|
+
autoUpdate?: boolean;
|
|
34
44
|
};
|
|
35
45
|
export type DcuplRangeOptions = {
|
|
36
46
|
propertyKey: string;
|
|
@@ -56,7 +56,7 @@ export type PropertyBase = {
|
|
|
56
56
|
separator?: string;
|
|
57
57
|
};
|
|
58
58
|
origin?: string;
|
|
59
|
-
filter?: boolean | FilterStringSingle | FilterStringArray[]
|
|
59
|
+
filter?: boolean | FilterStringSingle | FilterStringArray[];
|
|
60
60
|
aggregate?: boolean | AggregationOptionsModel;
|
|
61
61
|
meta?: ModelMetadata;
|
|
62
62
|
index?: boolean;
|
|
@@ -74,21 +74,37 @@ export type PropertyBoolean = PropertyBase & {
|
|
|
74
74
|
* @defaultSnippets { "label": "Int Property", "properties": ["key", "type:int"] }
|
|
75
75
|
*/
|
|
76
76
|
export type PropertyInt = PropertyBase & {
|
|
77
|
-
type: 'int'
|
|
77
|
+
type: 'int';
|
|
78
|
+
aggregate?: boolean | AggregationOptionsModel;
|
|
79
|
+
filter?: boolean;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @defaultSnippets { "label": "Int Array Property", "properties": ["key", "type:Array<int>"] }
|
|
83
|
+
*/
|
|
84
|
+
export type PropertyIntArray = PropertyBase & {
|
|
85
|
+
type: 'Array<int>';
|
|
86
|
+
separator?: string;
|
|
78
87
|
aggregate?: boolean | AggregationOptionsModel;
|
|
79
|
-
filter?: boolean
|
|
88
|
+
filter?: boolean;
|
|
80
89
|
};
|
|
81
90
|
/**
|
|
82
91
|
* @defaultSnippets { "label": "Float Property", "properties": ["key", "type:float"] }
|
|
83
92
|
*/
|
|
84
93
|
export type PropertyFloat = PropertyBase & {
|
|
85
|
-
type: 'float'
|
|
94
|
+
type: 'float';
|
|
86
95
|
aggregate?: boolean | AggregationOptionsModel;
|
|
87
96
|
fractionDigits?: number;
|
|
88
|
-
filter?: boolean
|
|
97
|
+
filter?: boolean;
|
|
89
98
|
};
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
/**
|
|
100
|
+
* @defaultSnippets { "label": "Float Property", "properties": ["key", "type:float"] }
|
|
101
|
+
*/
|
|
102
|
+
export type PropertyFloatArray = PropertyBase & {
|
|
103
|
+
type: 'Array<float>';
|
|
104
|
+
separator?: string;
|
|
105
|
+
aggregate?: boolean | AggregationOptionsModel;
|
|
106
|
+
fractionDigits?: number;
|
|
107
|
+
filter?: boolean;
|
|
92
108
|
};
|
|
93
109
|
/**
|
|
94
110
|
* @defaultSnippets { "label": "Json Property", "properties": ["key", "type:string:json"] }
|
|
@@ -104,14 +120,24 @@ export type PropertyAny = PropertyBase & {
|
|
|
104
120
|
type: 'any' | 'Array<any>';
|
|
105
121
|
};
|
|
106
122
|
/**
|
|
107
|
-
* Example: 'yyyy-MM-dd' |
|
|
123
|
+
* Example: 'yyyy-MM-dd' | 'dd.MM.yyyy' | ...
|
|
108
124
|
*/
|
|
109
125
|
export type PropertyDateInputFormat = string;
|
|
110
126
|
/**
|
|
111
127
|
* @defaultSnippets { "label": "Date Property", "properties": ["key", "type:date"] }
|
|
112
128
|
*/
|
|
113
129
|
export type PropertyDate = PropertyBase & {
|
|
114
|
-
type: 'date'
|
|
130
|
+
type: 'date';
|
|
131
|
+
inputFormat?: PropertyDateInputFormat;
|
|
132
|
+
UTC?: boolean;
|
|
133
|
+
filter?: boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @defaultSnippets { "label": "Date Property", "properties": ["key", "type:date"] }
|
|
137
|
+
*/
|
|
138
|
+
export type PropertyDateArray = PropertyBase & {
|
|
139
|
+
type: 'Array<date>';
|
|
140
|
+
separator?: string;
|
|
115
141
|
inputFormat?: PropertyDateInputFormat;
|
|
116
142
|
UTC?: boolean;
|
|
117
143
|
filter?: boolean;
|
|
@@ -120,11 +146,21 @@ export type PropertyDate = PropertyBase & {
|
|
|
120
146
|
* @defaultSnippets { "label": "String Property", "properties": ["key", "type:string:string"] }
|
|
121
147
|
*/
|
|
122
148
|
export type PropertyString = PropertyBase & {
|
|
123
|
-
type: 'string'
|
|
149
|
+
type: 'string';
|
|
150
|
+
aggregate?: boolean | AggregationOptionsModel;
|
|
124
151
|
filter?: boolean | FilterStringSingle | FilterStringArray[];
|
|
125
152
|
};
|
|
126
|
-
|
|
127
|
-
|
|
153
|
+
/**
|
|
154
|
+
* @defaultSnippets { "label": "String Property", "properties": ["key", "type:string:string"] }
|
|
155
|
+
*/
|
|
156
|
+
export type PropertyStringArray = PropertyBase & {
|
|
157
|
+
type: 'Array<string>';
|
|
158
|
+
separator?: string;
|
|
159
|
+
filter?: boolean | FilterStringSingle | FilterStringArray[];
|
|
160
|
+
aggregate?: boolean | AggregationOptionsModel;
|
|
161
|
+
};
|
|
162
|
+
export type PropertyNumber = PropertyFloat | PropertyInt | PropertyFloatArray | PropertyIntArray;
|
|
163
|
+
export type Property = PropertyString | PropertyStringArray | PropertyInt | PropertyIntArray | PropertyFloat | PropertyFloatArray | PropertyDate | PropertyDateArray | PropertyJson | PropertyBoolean | PropertyAny;
|
|
128
164
|
/**
|
|
129
165
|
* Facet calculation is disabled by default
|
|
130
166
|
*/
|
|
@@ -160,6 +196,7 @@ export type ReferenceBase = {
|
|
|
160
196
|
origin?: string;
|
|
161
197
|
filter?: boolean | ReferenceFilterDefinition;
|
|
162
198
|
aggregate?: boolean | AggregationOptionsModel;
|
|
199
|
+
separator?: string;
|
|
163
200
|
meta?: ModelMetadata;
|
|
164
201
|
index?: boolean;
|
|
165
202
|
validity?: ReferenceValidity;
|