@dcupl/common 2.0.0-beta.3 → 2.0.0-beta.6
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/analytics.controller.d.ts +1 -1
- package/dist/esm/changeDetection.d.ts +2 -2
- package/dist/esm/computeSuggestions.d.ts +2 -2
- package/dist/esm/deep-query.service.d.ts +1 -1
- package/dist/esm/getAggregation.d.ts +1 -1
- package/dist/esm/getFacets.d.ts +25 -2
- package/dist/esm/helper.d.ts +1 -1
- package/dist/esm/index.d.ts +22 -22
- package/dist/esm/index.js +678 -622
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/indices.controller.d.ts +1 -1
- package/dist/esm/logger/index.d.ts +2 -2
- package/dist/esm/pivot.d.ts +2 -2
- package/dist/esm/property-parser.d.ts +27 -2
- package/dist/esm/query-builder.d.ts +2 -2
- package/dist/esm/query.helper.d.ts +1 -1
- package/dist/esm/queryData.d.ts +2 -2
- package/dist/esm/types/app-loader.types.d.ts +21 -4
- package/dist/esm/types/data.types.d.ts +7 -3
- package/dist/esm/types/dcupl.types.d.ts +21 -9
- package/dist/esm/types/facets.types.d.ts +6 -1
- package/dist/esm/types/filter.types.d.ts +3 -3
- package/dist/esm/types/group-by.types.d.ts +2 -2
- package/dist/esm/types/index.d.ts +17 -16
- package/dist/esm/types/internal.types.d.ts +1 -1
- package/dist/esm/types/key-property.types.d.ts +11 -0
- package/dist/esm/types/list.types.d.ts +20 -4
- package/dist/esm/types/model.types.d.ts +30 -4
- package/dist/esm/types/quality.types.d.ts +55 -1
- package/dist/esm/types/query.types.d.ts +19 -10
- package/dist/esm/types/section.types.d.ts +2 -2
- package/dist/esm/types/suggestion.types.d.ts +1 -1
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.cjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Logger, logger } from './logger';
|
|
2
|
-
export type { LogLevel, LoggerConfig, LogEntry, TrackedErrorEntry } from './logger';
|
|
1
|
+
export { Logger, logger } from './logger.js';
|
|
2
|
+
export type { LogLevel, LoggerConfig, LogEntry, TrackedErrorEntry } from './logger.js';
|
package/dist/esm/pivot.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IndicesController } from './indices.controller';
|
|
2
|
-
import { ListItem, Aggregation, AggregationOptions } from './types';
|
|
1
|
+
import { IndicesController } from './indices.controller.js';
|
|
2
|
+
import { ListItem, Aggregation, AggregationOptions } from './types/index.js';
|
|
3
3
|
type PivotRowOption = {
|
|
4
4
|
attribute: string;
|
|
5
5
|
calculateTotals?: boolean;
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import { Property, PropertyType } from './types';
|
|
2
|
-
export declare const
|
|
1
|
+
import { Property, PropertyType } from './types/index.js';
|
|
2
|
+
export declare const coerceStringType: (value: string) => PropertyType;
|
|
3
|
+
export declare const looksDateLike: (value: string) => boolean;
|
|
4
|
+
export type GetPropertiesForDataOptions = {
|
|
5
|
+
deep?: boolean;
|
|
6
|
+
sampleSize?: number;
|
|
7
|
+
/** @deprecated No longer honored — empty values are always skipped for type
|
|
8
|
+
* inference and counted toward ColumnDiagnostic.emptyRate. */
|
|
9
|
+
ignoreEmpty?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type ColumnDiagnostic = {
|
|
12
|
+
column: string;
|
|
13
|
+
inferredType: PropertyType;
|
|
14
|
+
observedTypes: PropertyType[];
|
|
15
|
+
emptyRate: number;
|
|
16
|
+
conflict: boolean;
|
|
17
|
+
hint?: string;
|
|
18
|
+
};
|
|
19
|
+
export type InferModelOptions = GetPropertiesForDataOptions & {
|
|
20
|
+
coerceStrings?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type InferModelResult = {
|
|
23
|
+
properties: Property[];
|
|
24
|
+
diagnostics: ColumnDiagnostic[];
|
|
25
|
+
};
|
|
26
|
+
export declare const inferModel: (data: any[], options?: InferModelOptions) => InferModelResult;
|
|
27
|
+
export declare const getPropertiesForData: (data: any[], deepOrOptions?: boolean | GetPropertiesForDataOptions) => Property[];
|
|
3
28
|
export declare const isInt: (n: any) => boolean;
|
|
4
29
|
export declare const isFloat: (n: any) => boolean;
|
|
5
30
|
export declare const getDcuplPropertyTypeForNativeType: (value: any) => PropertyType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DcuplGlobalQueryOptions, DcuplItemsOptions, DcuplQuery, DcuplQueryGroup } from './types';
|
|
2
|
-
import { DeepQueryService } from './deep-query.service';
|
|
1
|
+
import { DcuplGlobalQueryOptions, DcuplItemsOptions, DcuplQuery, DcuplQueryGroup } from './types/index.js';
|
|
2
|
+
import { DeepQueryService } from './deep-query.service.js';
|
|
3
3
|
export type QueryAttributeEntry = {
|
|
4
4
|
attribute: string;
|
|
5
5
|
reference?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BooleanFilterItem, BooleanFilterOptions, DateFilterItem, DateFilterOptions, DcuplQueryGroup, DcuplQueryStatement, NumberFilterItem, NumberFilterOptions, ReferenceFilterItem, ReferenceFilterOptions, TextFilterItem, TextFilterOptions } from './types';
|
|
1
|
+
import { BooleanFilterItem, BooleanFilterOptions, DateFilterItem, DateFilterOptions, DcuplQueryGroup, DcuplQueryStatement, NumberFilterItem, NumberFilterOptions, ReferenceFilterItem, ReferenceFilterOptions, TextFilterItem, TextFilterOptions } from './types/index.js';
|
|
2
2
|
export declare const generateTextQuery: (options: TextFilterOptions, filterItem?: TextFilterItem) => DcuplQueryGroup;
|
|
3
3
|
export declare const generateBooleanQuery: (options: BooleanFilterOptions, filterItem?: BooleanFilterItem) => DcuplQueryGroup;
|
|
4
4
|
export declare const generateNumberAndDateQuery: (options: NumberFilterOptions | DateFilterOptions, filterItem?: NumberFilterItem | DateFilterItem) => DcuplQueryGroup;
|
package/dist/esm/queryData.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ListItem, InverseIndexReferenceMap, DcuplQueryTransformOptions, CustomOperatorFn, DcuplGlobalQueryOptions } from './types';
|
|
2
|
-
import { ScriptController } from './script.controller';
|
|
1
|
+
import { ListItem, InverseIndexReferenceMap, DcuplQueryTransformOptions, CustomOperatorFn, DcuplGlobalQueryOptions } from './types/index.js';
|
|
2
|
+
import { ScriptController } from './script.controller.js';
|
|
3
3
|
import { ModelParser } from '@dcupl/core/model-parser';
|
|
4
4
|
import { ItemService } from '@dcupl/core/catalog';
|
|
5
5
|
export declare class QueryManager {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DataContainerType } from './';
|
|
1
|
+
import { AutoGeneratePropertiesOption, DataContainerType } from './index.js';
|
|
2
|
+
import { KeyPropertySpec } from './key-property.types.js';
|
|
2
3
|
export declare namespace AppLoaderConfiguration {
|
|
3
4
|
/**
|
|
4
5
|
* The base structure for configuration file contains all resources, evnironments and headers
|
|
@@ -55,7 +56,7 @@ export declare namespace AppLoaderConfiguration {
|
|
|
55
56
|
defaultDataContainerUpdateType?: DataContainerType;
|
|
56
57
|
csvParserOptions?: CsvParserOptions;
|
|
57
58
|
missingModelHandling?: {
|
|
58
|
-
autoGenerateProperties?:
|
|
59
|
+
autoGenerateProperties?: AutoGeneratePropertiesOption;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
export type CsvParserOptions = {
|
|
@@ -181,9 +182,25 @@ export declare namespace AppLoaderConfiguration {
|
|
|
181
182
|
};
|
|
182
183
|
export type DataResourceOptions = {
|
|
183
184
|
updateType?: DataContainerType;
|
|
184
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Property name(s) on each row that uniquely identify it.
|
|
187
|
+
*
|
|
188
|
+
* Pass a single string for a simple key (`keyProperty: 'ID'`) or a
|
|
189
|
+
* non-empty array for a composite key (`keyProperty: ['ID', 'Language']`).
|
|
190
|
+
* Composite parts are joined into the internal `.key` using
|
|
191
|
+
* `keyPropertySeparator` (default `::`). Order is preserved literally.
|
|
192
|
+
*
|
|
193
|
+
* Each part is stringified via `String(value)`, so `null`, `undefined`,
|
|
194
|
+
* and `''` produce distinct keys (`'null'`, `'undefined'`, `''`).
|
|
195
|
+
*/
|
|
196
|
+
keyProperty?: KeyPropertySpec;
|
|
197
|
+
/**
|
|
198
|
+
* Separator joining composite `keyProperty` parts. Default `'::'`.
|
|
199
|
+
* Ignored when `keyProperty` is a string or a single-element array.
|
|
200
|
+
*/
|
|
201
|
+
keyPropertySeparator?: string;
|
|
185
202
|
autoGenerateKey?: boolean;
|
|
186
|
-
autoGenerateProperties?:
|
|
203
|
+
autoGenerateProperties?: AutoGeneratePropertiesOption;
|
|
187
204
|
csvParserOptions?: CsvParserOptions;
|
|
188
205
|
};
|
|
189
206
|
export type Resource = ModelResource | DataResource | TransformerResource | CustomOperatorResource | CustomScriptResource;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AutoGeneratePropertiesOption } from './model.types.js';
|
|
2
|
+
import { KeyPropertySpec } from './key-property.types.js';
|
|
1
3
|
export type RawItem = any;
|
|
2
4
|
export type ListItem = {
|
|
3
5
|
key: string;
|
|
@@ -7,15 +9,17 @@ export type DataContainer<ListType extends RawItem | ListItem = ListItem, ModelN
|
|
|
7
9
|
model: ModelNames;
|
|
8
10
|
type?: DataContainerType;
|
|
9
11
|
data: ListType[];
|
|
10
|
-
keyProperty?:
|
|
12
|
+
keyProperty?: KeyPropertySpec;
|
|
13
|
+
keyPropertySeparator?: string;
|
|
11
14
|
autoGenerateKey?: boolean;
|
|
12
|
-
autoGenerateProperties?:
|
|
15
|
+
autoGenerateProperties?: AutoGeneratePropertiesOption;
|
|
13
16
|
placeholderUid?: string;
|
|
14
17
|
};
|
|
15
18
|
export type DataContainerType = 'upsert' | 'update' | 'set' | 'remove';
|
|
16
19
|
export type ReferenceDataTypes<ListType extends ListItem = ListItem> = string | string[] | ListType | ListType[];
|
|
17
20
|
export type DataOptions<ModelNames extends string = string> = {
|
|
18
21
|
model: ModelNames;
|
|
19
|
-
keyProperty?:
|
|
22
|
+
keyProperty?: KeyPropertySpec;
|
|
23
|
+
keyPropertySeparator?: string;
|
|
20
24
|
autoGenerateKey?: boolean;
|
|
21
25
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DcuplUpdateMessage } from '../changeDetection';
|
|
2
|
-
import { PivotOptions } from '../pivot';
|
|
3
|
-
import { AggregationOptions } from './aggregation.types';
|
|
4
|
-
import { DcuplFacetOptions } from './facets.types';
|
|
5
|
-
import { DcuplGroupByOptions } from './group-by.types';
|
|
6
|
-
import { DcuplItemsOptions } from './list.types';
|
|
7
|
-
import { DcuplGlobalQueryOptions } from './query.types';
|
|
8
|
-
import { SuggestionOptions } from './suggestion.types';
|
|
9
|
-
import { LogLevel, LogEntry } from '../logger';
|
|
1
|
+
import { DcuplUpdateMessage } from '../changeDetection.js';
|
|
2
|
+
import { PivotOptions } from '../pivot.js';
|
|
3
|
+
import { AggregationOptions } from './aggregation.types.js';
|
|
4
|
+
import { DcuplFacetOptions } from './facets.types.js';
|
|
5
|
+
import { DcuplGroupByOptions } from './group-by.types.js';
|
|
6
|
+
import { DcuplItemsOptions } from './list.types.js';
|
|
7
|
+
import { DcuplGlobalQueryOptions } from './query.types.js';
|
|
8
|
+
import { SuggestionOptions } from './suggestion.types.js';
|
|
9
|
+
import { LogLevel, LogEntry } from '../logger/index.js';
|
|
10
10
|
export type DcuplInitOptions = {
|
|
11
11
|
config?: DcuplInitConfig;
|
|
12
12
|
/**
|
|
@@ -98,6 +98,18 @@ export type DcuplPartialUpdateConfig = {
|
|
|
98
98
|
};
|
|
99
99
|
export type DcuplInitQualityConfig = {
|
|
100
100
|
enabled: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Maximum number of stored error objects per (model, property, errorType)
|
|
103
|
+
* group. Quality errors are still counted exactly beyond this limit and are
|
|
104
|
+
* reachable via `getErrorCounts()`; only the retained error objects (and the
|
|
105
|
+
* `$DcuplErrorTrackingErrors` model) are bounded. Default: 1000.
|
|
106
|
+
*
|
|
107
|
+
* Note: for error groups whose true count exceeds `maxErrorsPerGroup`,
|
|
108
|
+
* partial-update cleanup may cause `getErrorCounts()` to slightly
|
|
109
|
+
* over-report, since over-cap occurrences are counted but never stored as
|
|
110
|
+
* error objects and therefore cannot be decremented on removal.
|
|
111
|
+
*/
|
|
112
|
+
maxErrorsPerGroup?: number;
|
|
101
113
|
};
|
|
102
114
|
export type DcuplInitErrorTrackingConfig = {
|
|
103
115
|
enabled: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListItem } from './data.types';
|
|
1
|
+
import { ListItem } from './data.types.js';
|
|
2
2
|
export type DcuplFacetOptions = {
|
|
3
3
|
attribute: string;
|
|
4
4
|
count?: number;
|
|
@@ -6,6 +6,11 @@ export type DcuplFacetOptions = {
|
|
|
6
6
|
excludeUndefineds?: boolean;
|
|
7
7
|
excludeUnresolved?: boolean;
|
|
8
8
|
calculateResults?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Opt-in deterministic ordering. See `DcuplFilterOptions.sort` for full semantics.
|
|
11
|
+
* When omitted the fast (insertion-order) path is preserved.
|
|
12
|
+
*/
|
|
13
|
+
sort?: 'size-desc' | 'size-asc' | 'value-asc' | 'value-desc';
|
|
9
14
|
};
|
|
10
15
|
export type DcuplFacet = {
|
|
11
16
|
key: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DcuplQueryGroup, ListItem } from '.';
|
|
2
|
-
import { CatalogApiOptions } from './list.types';
|
|
3
|
-
import { FilterComparisonType } from './model.types';
|
|
1
|
+
import { DcuplQueryGroup, ListItem } from './index.js';
|
|
2
|
+
import { CatalogApiOptions } from './list.types.js';
|
|
3
|
+
import { FilterComparisonType } from './model.types.js';
|
|
4
4
|
export type NumberConstraintOperators = {
|
|
5
5
|
gt?: number;
|
|
6
6
|
lt?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AggregationOptions } from './aggregation.types';
|
|
2
|
-
import { DcuplItemsOptions } from './list.types';
|
|
1
|
+
import { AggregationOptions } from './aggregation.types.js';
|
|
2
|
+
import { DcuplItemsOptions } from './list.types.js';
|
|
3
3
|
export type DcuplSectionItemOption<T> = DcuplItemsOptions<T> & {
|
|
4
4
|
key: string;
|
|
5
5
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export * from './aggregation.types';
|
|
2
|
-
export * from './app-loader.types';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
1
|
+
export * from './aggregation.types.js';
|
|
2
|
+
export * from './app-loader.types.js';
|
|
3
|
+
export * from './key-property.types.js';
|
|
4
|
+
export * from './data.types.js';
|
|
5
|
+
export * from './dcupl.types.js';
|
|
6
|
+
export * from './facets.types.js';
|
|
7
|
+
export * from './filter.types.js';
|
|
8
|
+
export * from './group-by.types.js';
|
|
9
|
+
export * from './internal.types.js';
|
|
10
|
+
export * from './list.types.js';
|
|
11
|
+
export * from './model.types.js';
|
|
12
|
+
export * from './projection.types.js';
|
|
13
|
+
export * from './quality.types.js';
|
|
14
|
+
export * from './query.types.js';
|
|
15
|
+
export * from './section.types.js';
|
|
16
|
+
export * from './suggestion.types.js';
|
|
17
|
+
export * from './testing.types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListItem } from './data.types';
|
|
1
|
+
import { ListItem } from './data.types.js';
|
|
2
2
|
export type InverseIndexReferenceMap = Map<string, InverseIndexValuesMap>;
|
|
3
3
|
export type InverseIndexValuesMap = Map<string, Set<string>>;
|
|
4
4
|
export type InverseIndexDataMap = Map<string, InverseIndexDataValuesMap>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the property (or properties) on a row that uniquely identifies it.
|
|
3
|
+
*
|
|
4
|
+
* - A single string names one property: `keyProperty: 'id'`.
|
|
5
|
+
* - A non-empty array of strings produces a composite key by joining the
|
|
6
|
+
* stringified values of each property with the configured separator
|
|
7
|
+
* (default `::`): `keyProperty: ['ID', 'Language']` → `.key === 'A1::en'`.
|
|
8
|
+
*
|
|
9
|
+
* The order of array entries is significant and preserved verbatim.
|
|
10
|
+
*/
|
|
11
|
+
export type KeyPropertySpec = string | readonly string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DcuplGlobalQueryOptions } from './query.types';
|
|
2
|
-
import { ViewDefinition, ModelAttribute } from './model.types';
|
|
3
|
-
import { Projection, SortingProjection } from './projection.types';
|
|
4
|
-
import { ListItem } from './data.types';
|
|
1
|
+
import { DcuplGlobalQueryOptions } from './query.types.js';
|
|
2
|
+
import { ViewDefinition, ModelAttribute } from './model.types.js';
|
|
3
|
+
import { Projection, SortingProjection } from './projection.types.js';
|
|
4
|
+
import { ListItem } from './data.types.js';
|
|
5
5
|
export type DcuplItemsOptions<T> = {
|
|
6
6
|
start?: number;
|
|
7
7
|
count?: number;
|
|
@@ -22,6 +22,22 @@ export type DcuplFilterOptions = CatalogApiOptions & {
|
|
|
22
22
|
excludeUndefineds?: boolean;
|
|
23
23
|
excludeUnresolved?: boolean;
|
|
24
24
|
count?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Opt-in deterministic ordering for facet results.
|
|
27
|
+
*
|
|
28
|
+
* When omitted (default), results are returned in inverse-index iteration
|
|
29
|
+
* order and `count` truncation is applied mid-iteration. This is the
|
|
30
|
+
* fast path and matches all existing call sites.
|
|
31
|
+
*
|
|
32
|
+
* When set, `getFacets` walks all facet keys, computes real sizes
|
|
33
|
+
* (overriding `calculateFacets: false`), applies the chosen sort with
|
|
34
|
+
* deterministic tie-break, and truncates to `count` after sorting.
|
|
35
|
+
* This is the slow but correct path — opt in when ordering matters.
|
|
36
|
+
*
|
|
37
|
+
* Tie-break for size sorts is always `value` ascending with `undefined`
|
|
38
|
+
* last. `value-desc` keeps `undefined` last as well.
|
|
39
|
+
*/
|
|
40
|
+
sort?: 'size-desc' | 'size-asc' | 'value-asc' | 'value-desc';
|
|
25
41
|
};
|
|
26
42
|
export type DcuplFiltersOptions = DcuplFilterOptions & {
|
|
27
43
|
filterKeys?: string[];
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
import { AggregationOptions, DcuplGlobalQueryOptions, DcuplQuery, DcuplQueryGroup, RawItem } from '.';
|
|
2
|
-
import {
|
|
1
|
+
import { AggregationOptions, DcuplGlobalQueryOptions, DcuplQuery, DcuplQueryGroup, RawItem } from './index.js';
|
|
2
|
+
import { KeyPropertySpec } from './key-property.types.js';
|
|
3
|
+
import { PivotOptions } from '../pivot.js';
|
|
3
4
|
type AggregationOptionsModel = Omit<AggregationOptions, 'attribute'>;
|
|
4
5
|
export type PropertyType = 'any' | 'Array<date>' | 'Array<float>' | 'Array<int>' | 'Array<string>' | 'boolean' | 'date' | 'float' | 'int' | 'json' | 'string';
|
|
5
6
|
export declare const PropertyTypesAsArray: PropertyType[];
|
|
6
7
|
export declare const NumberPropertyTypes: PropertyType[];
|
|
7
8
|
export declare const DatePropertyTypes: PropertyType[];
|
|
9
|
+
/**
|
|
10
|
+
* Configures how property auto-generation inspects input data.
|
|
11
|
+
*
|
|
12
|
+
* - `true` / `false`: enable/disable auto-generation. When enabled with `true`,
|
|
13
|
+
* only the first row of input data is inspected (fast, default behavior).
|
|
14
|
+
* - Object form lets you scan more rows:
|
|
15
|
+
* - `deep: true` walks every row and reconciles types across them.
|
|
16
|
+
* - `sampleSize: N` walks at most N rows (implies deep). Useful for large datasets
|
|
17
|
+
* where row 1 alone may not represent the schema.
|
|
18
|
+
*
|
|
19
|
+
* When more than one row is scanned, empty values (`null`, `undefined`, `''`)
|
|
20
|
+
* are ignored during inference so a single blank cell does not poison a column's type.
|
|
21
|
+
*/
|
|
22
|
+
export type AutoGeneratePropertiesOption = boolean | {
|
|
23
|
+
deep?: boolean;
|
|
24
|
+
sampleSize?: number;
|
|
25
|
+
};
|
|
8
26
|
/**
|
|
9
27
|
* must be singleValued or multiValued
|
|
10
28
|
* singleValued contains only one key to an object
|
|
@@ -355,9 +373,17 @@ export type ModelDefinition<ModelNames extends string = string> = {
|
|
|
355
373
|
properties?: Property[];
|
|
356
374
|
references?: Reference[];
|
|
357
375
|
data?: RawItem[];
|
|
358
|
-
|
|
376
|
+
/**
|
|
377
|
+
* Property name(s) on each row that uniquely identify it.
|
|
378
|
+
* See `KeyPropertySpec` for composite-key behavior.
|
|
379
|
+
*/
|
|
380
|
+
keyProperty?: KeyPropertySpec;
|
|
381
|
+
/**
|
|
382
|
+
* Separator joining composite `keyProperty` parts. Default `'::'`.
|
|
383
|
+
*/
|
|
384
|
+
keyPropertySeparator?: string;
|
|
359
385
|
autoGenerateKey?: boolean;
|
|
360
|
-
autoGenerateProperties?:
|
|
386
|
+
autoGenerateProperties?: AutoGeneratePropertiesOption;
|
|
361
387
|
supportsAutoCreation?: boolean;
|
|
362
388
|
valueMappings?: ValueMappingConfig[];
|
|
363
389
|
meta?: ModelMetadata;
|
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
export declare namespace QualityAnalyzer {
|
|
2
2
|
type ModelErrorGroup = 'ReferenceDataError' | 'PropertyDataError' | 'DataContainerError' | 'ModelDefinitionError';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Error types emitted by the quality controller during model registration
|
|
5
|
+
* and data ingest.
|
|
6
|
+
*
|
|
7
|
+
* - `UndefinedAttribute` — A declared attribute has no corresponding column /
|
|
8
|
+
* field in an ingested data container. Fires once per (model, attribute).
|
|
9
|
+
* - `InvalidValidator` — A validator on a property could not be parsed or
|
|
10
|
+
* evaluated against the data.
|
|
11
|
+
* - `UndefinedValue` — A required property has no value on a specific
|
|
12
|
+
* data entry (the cell is `undefined`). Fires per-row.
|
|
13
|
+
* - `NullValue` — A non-nullable property has an explicit `null` on
|
|
14
|
+
* a specific data entry. Fires per-row.
|
|
15
|
+
* - `WrongDataType` — A value present on a data entry could not be
|
|
16
|
+
* coerced to the declared property type. Fires per-row. Also covers *lossy*
|
|
17
|
+
* numeric coercions where coercion succeeds but silently drops information —
|
|
18
|
+
* trailing/embedded non-numeric content (e.g. `"1.2 lbs"` → `1.2`) or
|
|
19
|
+
* fractional truncation for `int` properties (e.g. `"1.2"` → `1`). Lossy
|
|
20
|
+
* records carry `meta.lossy: true` plus `meta.rawValue` and
|
|
21
|
+
* `meta.coercedValue`; the coerced value is still kept on the data entry.
|
|
22
|
+
* Representation-only differences that preserve the value (leading/trailing
|
|
23
|
+
* zeros, surrounding whitespace, `"4.0"` → `4`) are not flagged.
|
|
24
|
+
* Aggregation (#197): when one or more cells of a typed column fail to coerce,
|
|
25
|
+
* the per-row signals are consolidated into a single `WrongDataType` per
|
|
26
|
+
* `(model, attribute)` with `meta.rowCount` = the number of failing rows
|
|
27
|
+
* (exact and cap-independent for loader/CSV sources; bounded by
|
|
28
|
+
* `maxErrorsPerGroup` for inline data). `getErrorCounts()` reports the stored
|
|
29
|
+
* *record* count (1 for an aggregated column), which is intentionally distinct
|
|
30
|
+
* from `meta.rowCount`. A column entirely absent from the source still
|
|
31
|
+
* produces `UndefinedAttribute`, not `WrongDataType`.
|
|
32
|
+
* - `NonUniqueKey` — Two or more data entries share the same key value
|
|
33
|
+
* in the same model; later rows are dropped.
|
|
34
|
+
* - `MissingModel` — A reference points to a model key that has not
|
|
35
|
+
* been registered.
|
|
36
|
+
* - `MissingProperty` — Emitted only during model-definition validation
|
|
37
|
+
* when a *derived property* declares `derive.remoteProperty` pointing to a
|
|
38
|
+
* property that does not exist on the remote model. Not used in any
|
|
39
|
+
* CSV/JSON data-ingest path — those are covered by `UndefinedAttribute`,
|
|
40
|
+
* `UndefinedValue`, and `WrongDataType`. See model.helper.ts (derived-
|
|
41
|
+
* property validator) for the sole emit site.
|
|
42
|
+
* - `MissingReference` — A derived property's `derive.localReference` names
|
|
43
|
+
* a reference that does not exist on the local model.
|
|
44
|
+
* - `UnknownExpressionVariable` — An expression property references a
|
|
45
|
+
* variable that is neither a property nor a reference on the local model.
|
|
46
|
+
* - `RemoteReferenceKeyNotFound` — A foreign-key value does not match any
|
|
47
|
+
* key in the referenced remote model. Fires per-row.
|
|
48
|
+
* - `InvalidModelDefinition` — Catch-all for structural problems detected
|
|
49
|
+
* when registering a model.
|
|
50
|
+
* - `UnknownColumn` — A CSV (or otherwise source-tracked) data
|
|
51
|
+
* container contains a column / attribute that is not declared on the
|
|
52
|
+
* target model. Values for the column are silently dropped during ingest;
|
|
53
|
+
* this error surfaces that data loss without failing the load. Fires once
|
|
54
|
+
* per (model, attribute). Only emitted when the loader registers source
|
|
55
|
+
* metadata for the container (so inline `model.data` is unaffected).
|
|
56
|
+
*/
|
|
57
|
+
type ModelErrorType = 'UndefinedAttribute' | 'InvalidValidator' | 'UndefinedValue' | 'NullValue' | 'WrongDataType' | 'NonUniqueKey' | 'MissingModel' | 'MissingProperty' | 'MissingReference' | 'UnknownExpressionVariable' | 'RemoteReferenceKeyNotFound' | 'InvalidModelDefinition' | 'UnknownColumn';
|
|
4
58
|
type DcuplErrorType = 'model' | 'loader';
|
|
5
59
|
type DcuplErrorBase = {
|
|
6
60
|
key?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ListItem } from './data.types';
|
|
2
|
-
import { Projection, SortingProjection } from './projection.types';
|
|
1
|
+
import { ListItem } from './data.types.js';
|
|
2
|
+
import { Projection, SortingProjection } from './projection.types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Transform options for query values.
|
|
5
5
|
* - `lowercase`: Convert value to lowercase before comparison
|
|
@@ -13,7 +13,7 @@ export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "
|
|
|
13
13
|
*
|
|
14
14
|
* Available operators:
|
|
15
15
|
* - `eq`: Equality check - matches exact values
|
|
16
|
-
* - `find`:
|
|
16
|
+
* - `find`: Regex / exact / object match - bare string is exact-equality, `/regex/` for substring/pattern, object for property match
|
|
17
17
|
* - `gt`: Greater than - numeric/date comparison (exclusive)
|
|
18
18
|
* - `gte`: Greater than or equal - numeric/date comparison (inclusive)
|
|
19
19
|
* - `lt`: Less than - numeric/date comparison (exclusive)
|
|
@@ -30,8 +30,8 @@ export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "
|
|
|
30
30
|
* // Numeric comparison
|
|
31
31
|
* { operator: 'gte', attribute: 'price', value: 100 }
|
|
32
32
|
*
|
|
33
|
-
* //
|
|
34
|
-
* { operator: 'find', attribute: 'name', value: 'search term' }
|
|
33
|
+
* // Substring search (slash-delimited regex; bare string would be exact-match)
|
|
34
|
+
* { operator: 'find', attribute: 'name', value: '/search term/' }
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export type DcuplQueryOperator = (typeof DcuplQueryOperatorsAsArray)[number];
|
|
@@ -128,13 +128,22 @@ type DcuplQueryEq = DcuplQueryBase & {
|
|
|
128
128
|
value: any;
|
|
129
129
|
};
|
|
130
130
|
/**
|
|
131
|
-
* Find query -
|
|
132
|
-
*
|
|
131
|
+
* Find query - regex / exact / object match.
|
|
132
|
+
*
|
|
133
|
+
* Matching depends on the shape of `value`:
|
|
134
|
+
* - **Bare string** (e.g. `'search'`) — exact-equality against the *whole* field
|
|
135
|
+
* value, NOT a substring. `find` with `'Ball'` does not match `'Soccer Ball'`.
|
|
136
|
+
* - **Slash-delimited regex** (e.g. `'/search/'`, `'/^foo/i'`) — JS regex literal;
|
|
137
|
+
* use this for substring and pattern matching.
|
|
138
|
+
* - **Object** (e.g. `{ key: 'value' }`) — property matching against the field.
|
|
133
139
|
*
|
|
134
140
|
* @example
|
|
135
141
|
* ```typescript
|
|
136
|
-
* //
|
|
137
|
-
* { operator: 'find', attribute: 'description', value: 'search' }
|
|
142
|
+
* // Substring search — slash-delimited regex (bare string would be exact-match)
|
|
143
|
+
* { operator: 'find', attribute: 'description', value: '/search/' }
|
|
144
|
+
*
|
|
145
|
+
* // Exact-match the whole field value
|
|
146
|
+
* { operator: 'find', attribute: 'status', value: 'active' }
|
|
138
147
|
*
|
|
139
148
|
* // Find items with specific nested property
|
|
140
149
|
* { operator: 'find', attribute: 'metadata', value: { key: 'value' } }
|
|
@@ -143,7 +152,7 @@ type DcuplQueryEq = DcuplQueryBase & {
|
|
|
143
152
|
type DcuplQueryFind = DcuplQueryBase & {
|
|
144
153
|
operator: 'find';
|
|
145
154
|
/**
|
|
146
|
-
*
|
|
155
|
+
* Bare string (exact-match), `/regex/` (substring/pattern), or object (property match).
|
|
147
156
|
*/
|
|
148
157
|
value: Record<string, unknown> | string;
|
|
149
158
|
};
|