@dcupl/common 0.0.81-beta.5 → 0.0.81-beta.7

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.
Files changed (61) hide show
  1. package/dist/lib-cjs/changeDetection.d.ts +7 -7
  2. package/dist/lib-cjs/changeDetection.js +29 -32
  3. package/dist/lib-cjs/changeDetection.js.map +1 -1
  4. package/dist/lib-cjs/getFacets.js +5 -5
  5. package/dist/lib-cjs/getFacets.js.map +1 -1
  6. package/dist/lib-cjs/query-builder.d.ts +10 -9
  7. package/dist/lib-cjs/query-builder.js +103 -92
  8. package/dist/lib-cjs/query-builder.js.map +1 -1
  9. package/dist/lib-cjs/queryData.js +14 -14
  10. package/dist/lib-cjs/queryData.js.map +1 -1
  11. package/dist/lib-cjs/tsconfig-cjs.tsbuildinfo +1 -1
  12. package/dist/lib-cjs/types/aggregation.types.d.ts +79 -0
  13. package/dist/lib-cjs/types/aggregation.types.js +3 -0
  14. package/dist/lib-cjs/types/aggregation.types.js.map +1 -0
  15. package/dist/lib-cjs/types/dcupl.types.d.ts +4 -67
  16. package/dist/lib-cjs/types/dcupl.types.js +0 -12
  17. package/dist/lib-cjs/types/dcupl.types.js.map +1 -1
  18. package/dist/lib-cjs/types/facets.types.d.ts +20 -0
  19. package/dist/lib-cjs/types/facets.types.js +3 -0
  20. package/dist/lib-cjs/types/facets.types.js.map +1 -0
  21. package/dist/lib-cjs/types/index.d.ts +4 -1
  22. package/dist/lib-cjs/types/index.js +4 -1
  23. package/dist/lib-cjs/types/index.js.map +1 -1
  24. package/dist/lib-cjs/types/list.types.d.ts +7 -51
  25. package/dist/lib-cjs/types/query.types.d.ts +70 -0
  26. package/dist/lib-cjs/types/query.types.js +15 -0
  27. package/dist/lib-cjs/types/query.types.js.map +1 -0
  28. package/dist/lib-cjs/types/section.types.d.ts +1 -1
  29. package/dist/lib-cjs/types/selection.types.d.ts +1 -1
  30. package/dist/lib-cjs/types/suggestion.types.d.ts +12 -0
  31. package/dist/lib-esm/changeDetection.d.ts +7 -7
  32. package/dist/lib-esm/changeDetection.js +29 -32
  33. package/dist/lib-esm/changeDetection.js.map +1 -1
  34. package/dist/lib-esm/getFacets.js +6 -6
  35. package/dist/lib-esm/getFacets.js.map +1 -1
  36. package/dist/lib-esm/query-builder.d.ts +10 -9
  37. package/dist/lib-esm/query-builder.js +102 -91
  38. package/dist/lib-esm/query-builder.js.map +1 -1
  39. package/dist/lib-esm/queryData.js +15 -15
  40. package/dist/lib-esm/queryData.js.map +1 -1
  41. package/dist/lib-esm/tsconfig.tsbuildinfo +1 -1
  42. package/dist/lib-esm/types/aggregation.types.d.ts +79 -0
  43. package/dist/lib-esm/types/aggregation.types.js +2 -0
  44. package/dist/lib-esm/types/aggregation.types.js.map +1 -0
  45. package/dist/lib-esm/types/dcupl.types.d.ts +4 -67
  46. package/dist/lib-esm/types/dcupl.types.js +1 -11
  47. package/dist/lib-esm/types/dcupl.types.js.map +1 -1
  48. package/dist/lib-esm/types/facets.types.d.ts +20 -0
  49. package/dist/lib-esm/types/facets.types.js +2 -0
  50. package/dist/lib-esm/types/facets.types.js.map +1 -0
  51. package/dist/lib-esm/types/index.d.ts +4 -1
  52. package/dist/lib-esm/types/index.js +4 -1
  53. package/dist/lib-esm/types/index.js.map +1 -1
  54. package/dist/lib-esm/types/list.types.d.ts +7 -51
  55. package/dist/lib-esm/types/query.types.d.ts +70 -0
  56. package/dist/lib-esm/types/query.types.js +12 -0
  57. package/dist/lib-esm/types/query.types.js.map +1 -0
  58. package/dist/lib-esm/types/section.types.d.ts +1 -1
  59. package/dist/lib-esm/types/selection.types.d.ts +1 -1
  60. package/dist/lib-esm/types/suggestion.types.d.ts +12 -0
  61. package/package.json +2 -4
@@ -0,0 +1,79 @@
1
+ export type AggregationOptions = {
2
+ attributeKeys: string[];
3
+ };
4
+ export type AggregateType = 'number' | 'reference' | 'string';
5
+ export type AggregateBase = {
6
+ attribute: string;
7
+ type: AggregateType;
8
+ };
9
+ export type NumberAggregation = AggregateBase & {
10
+ attribute: string;
11
+ type: 'number';
12
+ value: NumberAggregationValue;
13
+ };
14
+ export type ReferenceAggregation = AggregateBase & {
15
+ attribute: string;
16
+ type: 'reference';
17
+ value: ReferenceAggregationValue[];
18
+ };
19
+ export type StringAggregation = AggregateBase & {
20
+ attribute: string;
21
+ type: 'string';
22
+ value: StringAggregationValue[];
23
+ };
24
+ export type Aggregation = NumberAggregation | StringAggregation | ReferenceAggregation;
25
+ export type NumberAggregationValue = {
26
+ average: number;
27
+ count: number;
28
+ sum: number;
29
+ };
30
+ export type ReferenceAggregationValue = {
31
+ value: string;
32
+ count: number;
33
+ itemKeys: string[];
34
+ };
35
+ export type StringAggregationValue = {
36
+ value: string;
37
+ count: number;
38
+ };
39
+ export type AggregationTypeNew = 'sum' | 'avg' | 'min' | 'max' | 'distinct' | 'group';
40
+ export type AggregationOptionsNew = {
41
+ attribute: string;
42
+ types: AggregationTypeNew[];
43
+ distinctOptions?: {
44
+ limit?: number;
45
+ };
46
+ groupOptions?: {
47
+ limit?: number;
48
+ calculateNotFound?: boolean;
49
+ groups?: AggregationGroupOption[];
50
+ };
51
+ excludeZeros?: boolean;
52
+ excludeUndefineds?: boolean;
53
+ excludeUnresolved?: boolean;
54
+ };
55
+ export type AggregationGroupOption = {
56
+ from?: any;
57
+ to?: any;
58
+ value?: any[];
59
+ };
60
+ export type AggregationDistinctValue = {
61
+ value: string;
62
+ count: number;
63
+ keys: string[];
64
+ };
65
+ export type AggregationGroupValue = {
66
+ option: AggregationGroupOption;
67
+ count: number;
68
+ keys: string[];
69
+ };
70
+ export type AggregationNew = {
71
+ attribute: string;
72
+ types: AggregationTypeNew[];
73
+ sum?: number;
74
+ avg?: number;
75
+ min?: number;
76
+ max?: number;
77
+ distinct?: AggregationDistinctValue[];
78
+ group?: AggregationGroupValue[];
79
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=aggregation.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregation.types.js","sourceRoot":"","sources":["../../../src/types/aggregation.types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { FilterOptions } from './filter.types';
2
- import { DcuplItemOptions, DcuplItemsOptions } from './list.types';
1
+ import { DcuplUpdateMessage } from '../changeDetection';
2
+ import { DcuplItemsOptions } from './list.types';
3
3
  export type DcuplInitOptions = {
4
4
  config?: DcuplInitConfig;
5
5
  logs?: DcuplInitLoggingConfig;
@@ -41,69 +41,6 @@ export type DcuplResponse<T> = {
41
41
  metrics: DcuplMetrics;
42
42
  };
43
43
  export type DcuplGlobalItemsOptions<T> = DcuplItemsOptions<T> & {
44
- listKey: string;
44
+ modelKey: string;
45
45
  };
46
- export type DcuplGlobalItemOptions<T> = DcuplItemOptions<T> & {
47
- listKey: string;
48
- };
49
- export type DcuplGlobalQueryOptions<T> = DcuplItemsOptions<T> & {
50
- listKey: string;
51
- query: FilterOptions[];
52
- };
53
- export type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace';
54
- type DcuplQueryOptions = {
55
- transform?: DcuplQueryTransformOptions[];
56
- /**
57
- * Invert possible for eq, typeof
58
- */
59
- invert?: boolean;
60
- };
61
- export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "gte", "lt", "lte", "typeof", "isTruthy", "size"];
62
- export type DcuplQueryOperator = (typeof DcuplQueryOperatorsAsArray)[number];
63
- export type DcuplQueryType = 'and' | 'or';
64
- type DcuplQueryBase = {
65
- /**
66
- * title, something.key someArray[0].key
67
- * */
68
- attribute: string;
69
- options?: DcuplQueryOptions;
70
- };
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> = {
101
- queryType?: DcuplQueryType;
102
- queryKey?: string;
103
- query: Array<QueryType>;
104
- options?: DcuplQueryOptions;
105
- };
106
- export type DcuplGlobalQueryOptionsNew<T> = DcuplItemsOptions<T> & {
107
- listKey: string;
108
- } & DcuplQueryGroup<DcuplQueryGroup<DcuplQuery>>;
109
- export {};
46
+ export type CallbackFunction = (item: DcuplUpdateMessage) => void;
@@ -1,15 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DcuplQueryOperatorsAsArray = void 0;
4
- exports.DcuplQueryOperatorsAsArray = [
5
- 'eq',
6
- 'find',
7
- 'gt',
8
- 'gte',
9
- 'lt',
10
- 'lte',
11
- 'typeof',
12
- 'isTruthy',
13
- 'size',
14
- ];
15
3
  //# sourceMappingURL=dcupl.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dcupl.types.js","sourceRoot":"","sources":["../../../src/types/dcupl.types.ts"],"names":[],"mappings":";;;AAkEa,QAAA,0BAA0B,GAAG;IACxC,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAC"}
1
+ {"version":3,"file":"dcupl.types.js","sourceRoot":"","sources":["../../../src/types/dcupl.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { ListItem } from './data.types';
2
+ export type DcuplFacetOptions = {
3
+ attributeKey: string;
4
+ filterKey?: string;
5
+ count?: number;
6
+ excludeZeros?: boolean;
7
+ excludeUndefineds?: boolean;
8
+ excludeUnresolved?: boolean;
9
+ calculateResults?: boolean;
10
+ };
11
+ export type DcuplFacet = {
12
+ key: string;
13
+ enabled: boolean;
14
+ selected: boolean;
15
+ size: number;
16
+ value: boolean | string | null | undefined;
17
+ entry: ListItem;
18
+ resultKeys: string[];
19
+ children?: Array<DcuplFacet>;
20
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=facets.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facets.types.js","sourceRoot":"","sources":["../../../src/types/facets.types.ts"],"names":[],"mappings":""}
@@ -1,11 +1,14 @@
1
+ export * from './aggregation.types';
1
2
  export * from './data.types';
2
3
  export * from './dcupl.types';
4
+ export * from './facets.types';
3
5
  export * from './filter.types';
4
6
  export * from './global.types';
5
7
  export * from './internal.types';
6
8
  export * from './list.types';
7
9
  export * from './model.types';
8
10
  export * from './projection.types';
9
- export * from './selection.types';
11
+ export * from './query.types';
10
12
  export * from './section.types';
13
+ export * from './selection.types';
11
14
  export * from './suggestion.types';
@@ -14,15 +14,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./aggregation.types"), exports);
17
18
  __exportStar(require("./data.types"), exports);
18
19
  __exportStar(require("./dcupl.types"), exports);
20
+ __exportStar(require("./facets.types"), exports);
19
21
  __exportStar(require("./filter.types"), exports);
20
22
  __exportStar(require("./global.types"), exports);
21
23
  __exportStar(require("./internal.types"), exports);
22
24
  __exportStar(require("./list.types"), exports);
23
25
  __exportStar(require("./model.types"), exports);
24
26
  __exportStar(require("./projection.types"), exports);
25
- __exportStar(require("./selection.types"), exports);
27
+ __exportStar(require("./query.types"), exports);
26
28
  __exportStar(require("./section.types"), exports);
29
+ __exportStar(require("./selection.types"), exports);
27
30
  __exportStar(require("./suggestion.types"), exports);
28
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,qDAAmC;AACnC,gDAA8B;AAC9B,kDAAgC;AAChC,oDAAkC;AAClC,qDAAmC"}
@@ -1,4 +1,4 @@
1
- import { DcuplGlobalQueryOptionsNew } from './dcupl.types';
1
+ import { DcuplGlobalQueryOptionsNew } from './query.types';
2
2
  import { ViewDefinition, ModelAttribute } from './model.types';
3
3
  import { Projection, SortingProjection } from './projection.types';
4
4
  export type DcuplItemsOptions<T> = {
@@ -11,6 +11,10 @@ export type DcuplItemOptions<T> = {
11
11
  projection?: Projection<T>;
12
12
  itemKey: string;
13
13
  };
14
+ export type DcuplManyItemsOptions<T> = {
15
+ projection?: Projection<T>;
16
+ itemKeys: string[];
17
+ };
14
18
  export type DcuplSectionItemOption<T> = DcuplItemsOptions<T> & {
15
19
  key: string;
16
20
  };
@@ -30,8 +34,8 @@ export type DcuplFiltersOptions = DcuplFilterOptions & {
30
34
  filterKeys?: string[];
31
35
  };
32
36
  export type DcuplListOptions<ModelNames extends string = string> = {
33
- listKey: ModelNames;
34
- name?: string;
37
+ modelKey: ModelNames;
38
+ key?: string;
35
39
  listItemKeys?: string[];
36
40
  empty?: boolean;
37
41
  };
@@ -39,22 +43,12 @@ export type DcuplRangeOptions = {
39
43
  propertyKey: string;
40
44
  filterKey?: string;
41
45
  };
42
- export type DcuplFacetOptions = {
43
- attributeKey: string;
44
- filterKey?: string;
45
- count?: number;
46
- excludeZeros?: boolean;
47
- excludeUndefineds?: boolean;
48
- excludeUnresolved?: boolean;
49
- calculateFacets?: boolean;
50
- };
51
46
  export type ListMetadata = {
52
47
  key: string;
53
48
  currentSize: number;
54
49
  initialSize: number;
55
50
  appliedQuery: DcuplGlobalQueryOptionsNew<any>;
56
51
  attributes: ModelAttribute[];
57
- itemOptions: DcuplItemsOptions<any>;
58
52
  views: ViewDefinition[];
59
53
  };
60
54
  export type ViewMetadata = {
@@ -62,44 +56,6 @@ export type ViewMetadata = {
62
56
  currentSize: number;
63
57
  initialSize: number;
64
58
  };
65
- export type AggregationOptions = {
66
- attributeKeys: string[];
67
- };
68
- export type AggregateType = 'number' | 'reference' | 'string';
69
- export type AggregateBase = {
70
- attribute: string;
71
- type: AggregateType;
72
- };
73
- export type NumberAggregation = AggregateBase & {
74
- attribute: string;
75
- type: 'number';
76
- value: NumberAggregationValue;
77
- };
78
- export type ReferenceAggregation = AggregateBase & {
79
- attribute: string;
80
- type: 'reference';
81
- value: ReferenceAggregationValue[];
82
- };
83
- export type StringAggregation = AggregateBase & {
84
- attribute: string;
85
- type: 'string';
86
- value: StringAggregationValue[];
87
- };
88
- export type Aggregation = NumberAggregation | StringAggregation | ReferenceAggregation;
89
- export type NumberAggregationValue = {
90
- average: number;
91
- count: number;
92
- sum: number;
93
- };
94
- export type ReferenceAggregationValue = {
95
- value: string;
96
- count: number;
97
- itemKeys: string[];
98
- };
99
- export type StringAggregationValue = {
100
- value: string;
101
- count: number;
102
- };
103
59
  export type CatalogApiOptions = {
104
60
  skipProcessing?: boolean;
105
61
  };
@@ -0,0 +1,70 @@
1
+ import { Projection, SortingProjection } from './projection.types';
2
+ export type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace';
3
+ type DcuplQueryOptions = {
4
+ transform?: DcuplQueryTransformOptions[];
5
+ /**
6
+ * Invert possible for eq, typeof
7
+ */
8
+ invert?: boolean;
9
+ };
10
+ export declare const DcuplQueryOperatorsAsArray: readonly ["eq", "find", "gt", "gte", "lt", "lte", "typeof", "isTruthy", "size"];
11
+ export type DcuplQueryOperator = (typeof DcuplQueryOperatorsAsArray)[number];
12
+ export type DcuplQueryType = 'and' | 'or';
13
+ type DcuplQueryBase = {
14
+ attribute: string;
15
+ options?: DcuplQueryOptions;
16
+ };
17
+ type DcuplQueryEq = DcuplQueryBase & {
18
+ operator: 'eq';
19
+ /**
20
+ * You may search for any value but
21
+ * only values of type string and { key:string } may be used for indexed search
22
+ */
23
+ value: any;
24
+ };
25
+ type DcuplQueryFind = DcuplQueryBase & {
26
+ operator: 'find';
27
+ value: Record<string, unknown> | string;
28
+ };
29
+ type DcuplQueryNumbers = DcuplQueryBase & {
30
+ operator: 'gt' | 'lt' | 'gte' | 'lte';
31
+ value: string | number | Date;
32
+ };
33
+ type DcuplQueryTypeOf = DcuplQueryBase & {
34
+ operator: 'typeof';
35
+ value: string;
36
+ };
37
+ type DcuplQueryIsTruthy = DcuplQueryBase & {
38
+ operator: 'isTruthy';
39
+ value: boolean;
40
+ };
41
+ type DcuplQuerySize = DcuplQueryBase & {
42
+ operator: 'size';
43
+ value: number;
44
+ };
45
+ export type DcuplQuery = DcuplQueryEq | DcuplQueryNumbers | DcuplQueryTypeOf | DcuplQueryIsTruthy | DcuplQuerySize | DcuplQueryFind;
46
+ export type DcuplQueryGroup<ChildQuery extends DcuplQuery | DcuplQueryGroup = any> = {
47
+ groupType?: DcuplQueryType;
48
+ groupKey?: string;
49
+ queries: Array<ChildQuery>;
50
+ options?: DcuplQueryOptions;
51
+ };
52
+ export type DcuplGlobalQueryOptionsNew<T> = DcuplGlobalQueryOptions<T>;
53
+ type DcuplItemOptions<T> = {
54
+ start?: number;
55
+ count?: number;
56
+ projection?: Projection<T>;
57
+ sort?: SortingProjection<T>;
58
+ };
59
+ export type DcuplGlobalQueryOptions<T> = {
60
+ modelKey: string;
61
+ } & DcuplItemOptions<T> & DcuplQueryGroup;
62
+ export type DcuplGlobalItemOptions<T> = {
63
+ modelKey: string;
64
+ itemKey: string;
65
+ } & DcuplItemOptions<T>;
66
+ export type DcuplListQueryOptions<T> = DcuplItemOptions<T> & DcuplQueryGroup;
67
+ export type DcuplListItemOptions<T> = DcuplItemOptions<T> & {
68
+ itemKey: string;
69
+ };
70
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DcuplQueryOperatorsAsArray = void 0;
4
+ exports.DcuplQueryOperatorsAsArray = [
5
+ 'eq',
6
+ 'find',
7
+ 'gt',
8
+ 'gte',
9
+ 'lt',
10
+ 'lte',
11
+ 'typeof',
12
+ 'isTruthy',
13
+ 'size',
14
+ ];
15
+ //# sourceMappingURL=query.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.types.js","sourceRoot":"","sources":["../../../src/types/query.types.ts"],"names":[],"mappings":";;;AAYa,QAAA,0BAA0B,GAAG;IACxC,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { ListItem } from './data.types';
2
- import { Aggregation } from './list.types';
2
+ import { Aggregation } from './aggregation.types';
3
3
  export type SectionItem = ListItem & {
4
4
  _meta: {
5
5
  size: number;
@@ -8,7 +8,7 @@ export type DcuplSelectionItem = {
8
8
  export type DcuplSelection = {
9
9
  uid?: string;
10
10
  selectionKey: string;
11
- listKey?: string;
11
+ modelKey?: string;
12
12
  items?: DcuplSelectionItem[];
13
13
  properties?: DcuplSelectionProperty;
14
14
  };
@@ -1,5 +1,6 @@
1
1
  import { CatalogApiOptions } from './list.types';
2
2
  import { FilterComparisonType } from './model.types';
3
+ import { DcuplQueryTransformOptions } from './query.types';
3
4
  export type SuggestionValueEntry = {
4
5
  key: string;
5
6
  value: string;
@@ -14,3 +15,14 @@ export type SuggestionOptions = CatalogApiOptions & {
14
15
  max?: number;
15
16
  comparisonType?: FilterComparisonType;
16
17
  };
18
+ export type SuggestionOptionsNew = CatalogApiOptions & {
19
+ attribute: string;
20
+ searchTerm: string;
21
+ max?: number;
22
+ calculateResultKeys?: boolean;
23
+ transform?: DcuplQueryTransformOptions;
24
+ };
25
+ export type SuggestionNew = {
26
+ value: string;
27
+ keys: string[];
28
+ };
@@ -1,4 +1,4 @@
1
- import { Observable } from 'rxjs';
1
+ import { CallbackFunction } from './types';
2
2
  export type DcuplUpdateScope = 'all' | 'global' | 'list' | 'list$';
3
3
  export type DcuplUpdateTrigger = 'user' | 'loader';
4
4
  export type DcuplUpdateType = 'loader_fetch_finished' | 'file_loaded' | 'file_processed' | 'dcupl_initialized' | 'dcupl_updated_manually' | 'data_reprocessed_manually' | 'result_updated' | 'filter_applied' | 'global_triggered_update';
@@ -12,20 +12,20 @@ export type DcuplUpdateMessage = {
12
12
  title?: string;
13
13
  origin?: DcuplUpdateTrigger;
14
14
  duration?: number;
15
- listId?: string;
15
+ originCdRefKey?: string;
16
16
  modelKey?: string;
17
17
  cloneResult?: boolean;
18
18
  };
19
19
  export declare class ChangeDetector {
20
- protected listId: string;
20
+ key: string;
21
21
  protected parentCd: ChangeDetector | undefined;
22
- private update$;
23
- private sub;
22
+ private off;
23
+ private updateListener;
24
24
  constructor();
25
- _init(listId: string, parentCd?: ChangeDetector): void;
25
+ _init(cdRefKey: string, parentCd?: ChangeDetector): void;
26
26
  destroy(): void;
27
27
  trigger(msg: DcuplUpdateMessage): void;
28
- on$(): Observable<DcuplUpdateMessage>;
28
+ on(cb: CallbackFunction): () => void;
29
29
  }
30
30
  export declare const clone: (obj: any, shouldClone: boolean) => any;
31
31
  export declare const trigger: (msg: DcuplUpdateMessage) => any;
@@ -1,45 +1,41 @@
1
1
  import cloneDeep from 'lodash/cloneDeep';
2
- import { Subject } from 'rxjs';
3
- import { map } from 'rxjs/operators';
4
2
  import { perf } from './performance';
5
3
  var ChangeDetector = /** @class */ (function () {
6
4
  function ChangeDetector() {
7
- this.update$ = new Subject();
5
+ this.updateListener = new Set();
8
6
  }
9
- ChangeDetector.prototype._init = function (listId, parentCd) {
7
+ ChangeDetector.prototype._init = function (cdRefKey, parentCd) {
10
8
  var _this = this;
11
- this.listId = listId;
9
+ this.key = cdRefKey;
12
10
  this.parentCd = parentCd;
13
11
  if (this.parentCd) {
14
- this.sub = this.parentCd.on$().subscribe(function (msg) {
12
+ this.off = this.parentCd.on(function (msg) {
15
13
  var _a;
16
- if (msg.action === 'update' && msg.listId == ((_a = _this.parentCd) === null || _a === void 0 ? void 0 : _a.listId)) {
17
- _this.trigger({
18
- scope: 'list',
19
- action: 'update',
20
- title: 'global_triggered_update',
21
- type: 'global_triggered_update',
22
- });
14
+ if (msg.action === 'update' && msg.originCdRefKey === ((_a = _this.parentCd) === null || _a === void 0 ? void 0 : _a.key)) {
15
+ _this.trigger(msg);
23
16
  }
24
17
  });
25
18
  }
26
19
  };
27
20
  ChangeDetector.prototype.destroy = function () {
28
- if (this.sub) {
29
- this.sub.unsubscribe();
21
+ if (this.off) {
22
+ this.off();
30
23
  }
31
24
  };
32
25
  ChangeDetector.prototype.trigger = function (msg) {
33
- if (!msg.listId) {
34
- msg.listId = this.listId;
35
- }
36
- this.update$.next(msg);
37
- if (this.parentCd) {
38
- this.parentCd.trigger(msg);
26
+ if (!msg.originCdRefKey) {
27
+ msg.originCdRefKey = this.key;
39
28
  }
29
+ this.updateListener.forEach(function (cb) {
30
+ cb(msg);
31
+ });
40
32
  };
41
- ChangeDetector.prototype.on$ = function () {
42
- return this.update$.asObservable();
33
+ ChangeDetector.prototype.on = function (cb) {
34
+ var _this = this;
35
+ this.updateListener.add(cb);
36
+ return function () {
37
+ _this.updateListener.delete(cb);
38
+ };
43
39
  };
44
40
  return ChangeDetector;
45
41
  }());
@@ -66,10 +62,9 @@ export var trigger = function (msg) {
66
62
  }
67
63
  var cdRef = this.cdRef;
68
64
  var start = perf.now();
69
- var listId = this.listId;
70
65
  var modelKey = (_a = this.model) === null || _a === void 0 ? void 0 : _a.key;
71
- if (listId) {
72
- msg.listId = listId;
66
+ if (!msg.originCdRefKey && cdRef.key) {
67
+ msg.originCdRefKey = cdRef.key;
73
68
  }
74
69
  if (modelKey) {
75
70
  msg.modelKey = modelKey;
@@ -79,23 +74,25 @@ export var trigger = function (msg) {
79
74
  msg.method = _propertyKey;
80
75
  msg.args = args;
81
76
  if (result && 'pipe' in result) {
82
- result = result.pipe(map(function (value) {
83
- cdRef.trigger(msg);
84
- return clone(value, !!msg.cloneResult);
85
- }));
77
+ // result = (result as Observable<any>).pipe(
78
+ // map((value) => {
79
+ // cdRef?.trigger(msg);
80
+ // return clone(value, !!msg.cloneResult);
81
+ // }),
82
+ // );
86
83
  return result;
87
84
  }
88
85
  else if (result && 'then' in result) {
89
86
  return result.then(function (value) {
90
87
  var end = perf.now();
91
88
  msg.duration = end - start;
92
- cdRef.trigger(msg);
89
+ cdRef === null || cdRef === void 0 ? void 0 : cdRef.trigger(msg);
93
90
  return clone(value, !!msg.cloneResult);
94
91
  });
95
92
  }
96
93
  var end = perf.now();
97
94
  msg.duration = end - start;
98
- cdRef.trigger(msg);
95
+ cdRef === null || cdRef === void 0 ? void 0 : cdRef.trigger(msg);
99
96
  try {
100
97
  return clone(result, !!msg.cloneResult);
101
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"changeDetection.js","sourceRoot":"","sources":["../../src/changeDetection.ts"],"names":[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