@dcupl/common 0.0.81-beta.1 → 0.0.81-beta.3
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/lib-cjs/getFacets.d.ts +2 -0
- package/dist/lib-cjs/getFacets.js +140 -0
- package/dist/lib-cjs/getFacets.js.map +1 -0
- package/dist/lib-cjs/index.d.ts +2 -0
- package/dist/lib-cjs/index.js +2 -0
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/query-builder.d.ts +22 -0
- package/dist/lib-cjs/query-builder.js +229 -0
- package/dist/lib-cjs/query-builder.js.map +1 -0
- package/dist/lib-cjs/queryData.d.ts +2 -2
- package/dist/lib-cjs/queryData.js +284 -70
- package/dist/lib-cjs/queryData.js.map +1 -1
- package/dist/lib-cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/lib-cjs/types/dcupl.types.d.ts +44 -13
- package/dist/lib-cjs/types/dcupl.types.js +12 -0
- package/dist/lib-cjs/types/dcupl.types.js.map +1 -1
- package/dist/lib-cjs/types/filter.types.d.ts +4 -3
- package/dist/lib-cjs/types/filter.types.js.map +1 -1
- package/dist/lib-cjs/types/list.types.d.ts +2 -2
- package/dist/lib-esm/getFacets.d.ts +2 -0
- package/dist/lib-esm/getFacets.js +136 -0
- package/dist/lib-esm/getFacets.js.map +1 -0
- package/dist/lib-esm/index.d.ts +2 -0
- package/dist/lib-esm/index.js +2 -0
- package/dist/lib-esm/index.js.map +1 -1
- package/dist/lib-esm/query-builder.d.ts +22 -0
- package/dist/lib-esm/query-builder.js +226 -0
- package/dist/lib-esm/query-builder.js.map +1 -0
- package/dist/lib-esm/queryData.d.ts +2 -2
- package/dist/lib-esm/queryData.js +285 -71
- package/dist/lib-esm/queryData.js.map +1 -1
- package/dist/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib-esm/types/dcupl.types.d.ts +44 -13
- package/dist/lib-esm/types/dcupl.types.js +11 -1
- package/dist/lib-esm/types/dcupl.types.js.map +1 -1
- package/dist/lib-esm/types/filter.types.d.ts +4 -3
- package/dist/lib-esm/types/filter.types.js.map +1 -1
- package/dist/lib-esm/types/list.types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -50,29 +50,60 @@ export type DcuplGlobalQueryOptions<T> = DcuplItemsOptions<T> & {
|
|
|
50
50
|
listKey: string;
|
|
51
51
|
query: FilterOptions[];
|
|
52
52
|
};
|
|
53
|
-
type DcuplQueryTransformOptions = '
|
|
53
|
+
export type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace';
|
|
54
54
|
type DcuplQueryOptions = {
|
|
55
|
-
transform
|
|
55
|
+
transform?: DcuplQueryTransformOptions[];
|
|
56
|
+
/**
|
|
57
|
+
* Invert possible for eq, typeof
|
|
58
|
+
*/
|
|
59
|
+
invert?: boolean;
|
|
56
60
|
};
|
|
57
|
-
|
|
58
|
-
type
|
|
59
|
-
type DcuplQueryGeneralOperators = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
60
|
-
type DcuplQueryFalsy = 'isUndefined' | 'isNotUndefined' | 'isNull' | 'isNotNull' | 'isFalsy' | 'isTruthy';
|
|
61
|
-
export type DcuplQueryOperator = DcuplQueryGeneralOperators | DcuplQueryArrayOperators | DcuplQueryFalsy | DcuplQueryStringOperators;
|
|
61
|
+
export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "gte", "lt", "lte", "typeof", "isTruthy", "size"];
|
|
62
|
+
export type DcuplQueryOperator = (typeof DcuplQueryOperatorsAsArray)[number];
|
|
62
63
|
export type DcuplQueryType = 'and' | 'or';
|
|
63
|
-
|
|
64
|
+
type DcuplQueryBase = {
|
|
65
|
+
/**
|
|
66
|
+
* title, something.key someArray[0].key
|
|
67
|
+
* */
|
|
64
68
|
attribute: string;
|
|
65
|
-
operator: DcuplQueryOperator;
|
|
66
|
-
value: any;
|
|
67
69
|
options?: DcuplQueryOptions;
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
type DcuplQueryEq = DcuplQueryBase & {
|
|
72
|
+
operator: 'eq';
|
|
73
|
+
/**
|
|
74
|
+
* You may search for any value but
|
|
75
|
+
* only values of type string and { key:string } may be used for indexed search
|
|
76
|
+
*/
|
|
77
|
+
value: any;
|
|
78
|
+
};
|
|
79
|
+
type DcuplQueryFind = DcuplQueryBase & {
|
|
80
|
+
operator: 'find';
|
|
81
|
+
value: Record<string, unknown> | string;
|
|
82
|
+
};
|
|
83
|
+
type DcuplQueryNumbers = DcuplQueryBase & {
|
|
84
|
+
operator: 'gt' | 'lt' | 'gte' | 'lte';
|
|
85
|
+
value: string | number | Date;
|
|
86
|
+
};
|
|
87
|
+
type DcuplQueryTypeOf = DcuplQueryBase & {
|
|
88
|
+
operator: 'typeof';
|
|
89
|
+
value: string;
|
|
90
|
+
};
|
|
91
|
+
type DcuplQueryIsTruthy = DcuplQueryBase & {
|
|
92
|
+
operator: 'isTruthy';
|
|
93
|
+
value: boolean;
|
|
94
|
+
};
|
|
95
|
+
type DcuplQuerySize = DcuplQueryBase & {
|
|
96
|
+
operator: 'size';
|
|
97
|
+
value: number;
|
|
98
|
+
};
|
|
99
|
+
export type DcuplQuery = DcuplQueryEq | DcuplQueryNumbers | DcuplQueryTypeOf | DcuplQueryIsTruthy | DcuplQuerySize | DcuplQueryFind;
|
|
100
|
+
export type DcuplQueryGroup<QueryType extends DcuplQuery | DcuplQueryGroup = DcuplQuery> = {
|
|
70
101
|
queryType?: DcuplQueryType;
|
|
71
102
|
queryKey?: string;
|
|
72
|
-
query: Array<
|
|
103
|
+
query: Array<QueryType>;
|
|
73
104
|
options?: DcuplQueryOptions;
|
|
74
105
|
};
|
|
75
106
|
export type DcuplGlobalQueryOptionsNew<T> = DcuplItemsOptions<T> & {
|
|
76
107
|
listKey: string;
|
|
77
|
-
} & DcuplQueryGroup
|
|
108
|
+
} & DcuplQueryGroup<DcuplQueryGroup<DcuplQuery>>;
|
|
78
109
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcupl.types.js","sourceRoot":"","sources":["../../../src/types/dcupl.types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"dcupl.types.js","sourceRoot":"","sources":["../../../src/types/dcupl.types.ts"],"names":[],"mappings":"AAkEA,MAAM,CAAC,IAAM,0BAA0B,GAAG;IACxC,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListItem } from '.';
|
|
1
|
+
import { DcuplQueryGroup, ListItem } from '.';
|
|
2
2
|
import { CatalogApiOptions } from './list.types';
|
|
3
3
|
import { FilterComparisonType } from './model.types';
|
|
4
4
|
export type ConstraintTypes = 'referenceConstraint' | 'textConstraint' | 'numberConstraint' | 'dateConstraint' | 'booleanConstraint';
|
|
@@ -7,6 +7,7 @@ export type ConstraintBase = {
|
|
|
7
7
|
filterKey: string;
|
|
8
8
|
attributeKey: string;
|
|
9
9
|
type: ConstraintTypes;
|
|
10
|
+
query?: any;
|
|
10
11
|
};
|
|
11
12
|
export type ReferenceConstraint = ConstraintBase & {
|
|
12
13
|
type: 'referenceConstraint';
|
|
@@ -90,12 +91,12 @@ export type BooleanFilterItem = FilterItemBase & {
|
|
|
90
91
|
export type FilterItemNumberRangeValue = {
|
|
91
92
|
available: FilterEntryNumberRange;
|
|
92
93
|
initial: FilterEntryNumberRange;
|
|
93
|
-
|
|
94
|
+
relatedQuery: DcuplQueryGroup | undefined;
|
|
94
95
|
};
|
|
95
96
|
export type FilterItemDateRangeValue = {
|
|
96
97
|
available: FilterEntryDateRange;
|
|
97
98
|
initial: FilterEntryDateRange;
|
|
98
|
-
|
|
99
|
+
relatedQuery: DcuplQueryGroup | undefined;
|
|
99
100
|
};
|
|
100
101
|
export type ReferenceFilterItem = FilterItemBase & {
|
|
101
102
|
type: 'reference';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/types/filter.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/types/filter.types.ts"],"names":[],"mappings":"AAqDA,MAAM,CAAC,IAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DcuplGlobalQueryOptionsNew } from './dcupl.types';
|
|
2
2
|
import { ViewDefinition, ModelAttribute } from './model.types';
|
|
3
3
|
import { Projection, SortingProjection } from './projection.types';
|
|
4
4
|
export type DcuplItemsOptions<T> = {
|
|
@@ -52,7 +52,7 @@ export type ListMetadata = {
|
|
|
52
52
|
key: string;
|
|
53
53
|
currentSize: number;
|
|
54
54
|
initialSize: number;
|
|
55
|
-
|
|
55
|
+
appliedQuery: DcuplGlobalQueryOptionsNew<any>;
|
|
56
56
|
attributes: ModelAttribute[];
|
|
57
57
|
itemOptions: DcuplItemsOptions<any>;
|
|
58
58
|
views: ViewDefinition[];
|