@empathyco/x-adapter-platform 1.0.0-alpha.37 → 1.0.0-alpha.39
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/cjs/schemas/facets/types.js.map +1 -1
- package/dist/cjs/schemas/facets/utils.js +20 -4
- package/dist/cjs/schemas/facets/utils.js.map +1 -1
- package/dist/cjs/schemas/models/facet.schema.js +3 -22
- package/dist/cjs/schemas/models/facet.schema.js.map +1 -1
- package/dist/cjs/types/models/facet.model.js.map +1 -1
- package/dist/esm/schemas/facets/types.js.map +1 -1
- package/dist/esm/schemas/facets/utils.js +20 -4
- package/dist/esm/schemas/facets/utils.js.map +1 -1
- package/dist/esm/schemas/models/facet.schema.js +2 -21
- package/dist/esm/schemas/models/facet.schema.js.map +1 -1
- package/dist/esm/types/models/facet.model.js.map +1 -1
- package/dist/types/schemas/facets/types.d.ts +1 -7
- package/dist/types/schemas/facets/utils.d.ts +3 -2
- package/dist/types/schemas/models/facet.schema.d.ts +0 -2
- package/dist/types/types/models/facet.model.d.ts +7 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/schemas/facets/types.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/schemas/facets/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Schema } from '@empathyco/x-adapter';\nimport { FacetModelName } from '@empathyco/x-types';\n\n/**\n * Facet configuration containing the model name and the schema.\n */\nexport interface FacetConfig {\n modelName: FacetModelName;\n schema: Schema;\n}\n"]}
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFacetConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const hierarchical_filter_schema_1 = require("../models/filters/hierarchical-filter.schema");
|
|
5
|
+
const number_filter_schema_1 = require("../models/filters/number-filter.schema");
|
|
6
|
+
const simple_filter_schema_1 = require("../models/filters/simple-filter.schema");
|
|
5
7
|
/**
|
|
6
8
|
* Returns the facet's config.
|
|
7
9
|
*
|
|
8
|
-
* @param
|
|
10
|
+
* @param type - The facet type to resolve the configuration.
|
|
9
11
|
* @returns The facet's config.
|
|
10
12
|
*/
|
|
11
|
-
function getFacetConfig(
|
|
13
|
+
function getFacetConfig(type) {
|
|
12
14
|
var _a;
|
|
13
|
-
|
|
15
|
+
const typeConfigs = {
|
|
16
|
+
value: {
|
|
17
|
+
modelName: 'SimpleFacet',
|
|
18
|
+
schema: simple_filter_schema_1.simpleFilterSchema
|
|
19
|
+
},
|
|
20
|
+
hierarchical: {
|
|
21
|
+
modelName: 'HierarchicalFacet',
|
|
22
|
+
schema: hierarchical_filter_schema_1.hierarchicalFilterSchema
|
|
23
|
+
},
|
|
24
|
+
range: {
|
|
25
|
+
modelName: 'NumberRangeFacet',
|
|
26
|
+
schema: number_filter_schema_1.numberFilterSchema
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return (_a = typeConfigs[type]) !== null && _a !== void 0 ? _a : typeConfigs.value;
|
|
14
30
|
}
|
|
15
31
|
exports.getFacetConfig = getFacetConfig;
|
|
16
32
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":";;;AACA,6FAAwF;AACxF,iFAA4E;AAC5E,iFAA4E;AAG5E;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,IAAuB;;IACpD,MAAM,WAAW,GAA2C;QAC1D,KAAK,EAAE;YACL,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,yCAAkB;SAC3B;QACD,YAAY,EAAE;YACZ,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,qDAAwB;SACjC;QACD,KAAK,EAAE;YACL,SAAS,EAAE,kBAAkB;YAC7B,MAAM,EAAE,yCAAkB;SAC3B;KACF,CAAC;IACF,OAAO,MAAA,WAAW,CAAC,IAAI,CAAC,mCAAI,WAAW,CAAC,KAAK,CAAC;AAChD,CAAC;AAhBD,wCAgBC","sourcesContent":["import { PlatformFacetType } from '../../types/models/facet.model';\nimport { hierarchicalFilterSchema } from '../models/filters/hierarchical-filter.schema';\nimport { numberFilterSchema } from '../models/filters/number-filter.schema';\nimport { simpleFilterSchema } from '../models/filters/simple-filter.schema';\nimport { FacetConfig } from './types';\n\n/**\n * Returns the facet's config.\n *\n * @param type - The facet type to resolve the configuration.\n * @returns The facet's config.\n */\nexport function getFacetConfig(type: PlatformFacetType): FacetConfig {\n const typeConfigs: Record<PlatformFacetType, FacetConfig> = {\n value: {\n modelName: 'SimpleFacet',\n schema: simpleFilterSchema\n },\n hierarchical: {\n modelName: 'HierarchicalFacet',\n schema: hierarchicalFilterSchema\n },\n range: {\n modelName: 'NumberRangeFacet',\n schema: numberFilterSchema\n }\n };\n return typeConfigs[type] ?? typeConfigs.value;\n}\n"]}
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.facetSchema = void 0;
|
|
4
4
|
const x_adapter_1 = require("@empathyco/x-adapter");
|
|
5
5
|
const utils_1 = require("../facets/utils");
|
|
6
|
-
const hierarchical_filter_schema_1 = require("./filters/hierarchical-filter.schema");
|
|
7
|
-
const number_filter_schema_1 = require("./filters/number-filter.schema");
|
|
8
|
-
const simple_filter_schema_1 = require("./filters/simple-filter.schema");
|
|
9
6
|
exports.facetSchema = (0, x_adapter_1.createMutableSchema)({
|
|
10
7
|
id: 'facet',
|
|
11
8
|
label: 'facet',
|
|
12
|
-
modelName:
|
|
13
|
-
return (0, utils_1.getFacetConfig)(source.facet).modelName;
|
|
14
|
-
},
|
|
9
|
+
modelName: ({ type }) => (0, utils_1.getFacetConfig)(type).modelName,
|
|
15
10
|
filters: {
|
|
16
11
|
$path: 'values',
|
|
17
|
-
$subSchema: ({
|
|
12
|
+
$subSchema: ({ type }) => (0, utils_1.getFacetConfig)(type).schema,
|
|
18
13
|
$context: {
|
|
19
14
|
facetId: 'facet'
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
17
|
});
|
|
23
|
-
exports.facetsConfig = {
|
|
24
|
-
categoryPaths: {
|
|
25
|
-
modelName: 'HierarchicalFacet',
|
|
26
|
-
schema: hierarchical_filter_schema_1.hierarchicalFilterSchema
|
|
27
|
-
},
|
|
28
|
-
price: {
|
|
29
|
-
modelName: 'NumberRangeFacet',
|
|
30
|
-
schema: number_filter_schema_1.numberFilterSchema
|
|
31
|
-
},
|
|
32
|
-
default: {
|
|
33
|
-
modelName: 'SimpleFacet',
|
|
34
|
-
schema: simple_filter_schema_1.simpleFilterSchema
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
18
|
//# sourceMappingURL=facet.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/facet.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAQnE,2CAAiD;
|
|
1
|
+
{"version":3,"file":"facet.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/facet.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAQnE,2CAAiD;AAEpC,QAAA,WAAW,GAAG,IAAA,+BAAmB,EAK5C;IACA,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC,SAAgB;IAC9D,OAAO,EAAE;QACP,KAAK,EAAE,QAAQ;QACf,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC,MAAM;QACrD,QAAQ,EAAE;YACR,OAAO,EAAE,OAAO;SACjB;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport {\n EditableNumberRangeFacet,\n HierarchicalFacet,\n NumberRangeFacet,\n SimpleFacet\n} from '@empathyco/x-types';\nimport { PlatformFacet } from '../../types/models/facet.model';\nimport { getFacetConfig } from '../facets/utils';\n\nexport const facetSchema = createMutableSchema<\n Schema<\n PlatformFacet,\n HierarchicalFacet | NumberRangeFacet | SimpleFacet | EditableNumberRangeFacet\n >\n>({\n id: 'facet',\n label: 'facet',\n modelName: ({ type }) => getFacetConfig(type).modelName as any,\n filters: {\n $path: 'values',\n $subSchema: ({ type }) => getFacetConfig(type).schema,\n $context: {\n facetId: 'facet'\n }\n }\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.model.js","sourceRoot":"","sources":["../../../../src/types/models/facet.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BooleanFilter, Facet, Filter } from '@empathyco/x-types';\n\n/**\n * Facet model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFacet {\n facet: string;\n values: PlatformFilter[];\n}\n\n/**\n * Filter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFilter {\n count: number;\n filter: string;\n id: string;\n value: string;\n}\n\n/**\n * HierarchicalFilter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformHierarchicalFilter extends PlatformFilter {\n children: PlatformFacet;\n}\n\n/**\n * Hierarchical Facet model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFacet extends Facet {\n /** Model name to indicate the facet type. */\n modelName: 'HierarchicalFacet';\n /** Filters available for the facet. */\n filters: AdapterHierarchicalFilter[];\n}\n\n/**\n * Hierarchical Filter model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFilter extends BooleanFilter {\n /** Model name to indicate the filter type. */\n modelName: 'HierarchicalFilter';\n /** A unique id used to reference the parent filter or null if it hasn't. */\n parentId: Filter['id'] | null;\n /** Descendants filters. */\n children?: AdapterHierarchicalFilter[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"facet.model.js","sourceRoot":"","sources":["../../../../src/types/models/facet.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BooleanFilter, Facet, Filter } from '@empathyco/x-types';\n\n/**\n * Facet model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFacet {\n facet: string;\n type: PlatformFacetType;\n values: PlatformFilter[];\n}\n\n/**\n * Facet type for the `platform` API. It can be: value, hierarchical or range.\n *\n * @public\n */\nexport type PlatformFacetType = 'value' | 'hierarchical' | 'range';\n\n/**\n * Filter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFilter {\n count: number;\n filter: string;\n id: string;\n value: string;\n}\n\n/**\n * HierarchicalFilter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformHierarchicalFilter extends PlatformFilter {\n children: PlatformFacet;\n}\n\n/**\n * Hierarchical Facet model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFacet extends Facet {\n /** Model name to indicate the facet type. */\n modelName: 'HierarchicalFacet';\n /** Filters available for the facet. */\n filters: AdapterHierarchicalFilter[];\n}\n\n/**\n * Hierarchical Filter model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFilter extends BooleanFilter {\n /** Model name to indicate the filter type. */\n modelName: 'HierarchicalFilter';\n /** A unique id used to reference the parent filter or null if it hasn't. */\n parentId: Filter['id'] | null;\n /** Descendants filters. */\n children?: AdapterHierarchicalFilter[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/schemas/facets/types.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/schemas/facets/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Schema } from '@empathyco/x-adapter';\nimport { FacetModelName } from '@empathyco/x-types';\n\n/**\n * Facet configuration containing the model name and the schema.\n */\nexport interface FacetConfig {\n modelName: FacetModelName;\n schema: Schema;\n}\n"]}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hierarchicalFilterSchema } from '../models/filters/hierarchical-filter.schema';
|
|
2
|
+
import { numberFilterSchema } from '../models/filters/number-filter.schema';
|
|
3
|
+
import { simpleFilterSchema } from '../models/filters/simple-filter.schema';
|
|
2
4
|
/**
|
|
3
5
|
* Returns the facet's config.
|
|
4
6
|
*
|
|
5
|
-
* @param
|
|
7
|
+
* @param type - The facet type to resolve the configuration.
|
|
6
8
|
* @returns The facet's config.
|
|
7
9
|
*/
|
|
8
|
-
export function getFacetConfig(
|
|
10
|
+
export function getFacetConfig(type) {
|
|
9
11
|
var _a;
|
|
10
|
-
|
|
12
|
+
const typeConfigs = {
|
|
13
|
+
value: {
|
|
14
|
+
modelName: 'SimpleFacet',
|
|
15
|
+
schema: simpleFilterSchema
|
|
16
|
+
},
|
|
17
|
+
hierarchical: {
|
|
18
|
+
modelName: 'HierarchicalFacet',
|
|
19
|
+
schema: hierarchicalFilterSchema
|
|
20
|
+
},
|
|
21
|
+
range: {
|
|
22
|
+
modelName: 'NumberRangeFacet',
|
|
23
|
+
schema: numberFilterSchema
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_a = typeConfigs[type]) !== null && _a !== void 0 ? _a : typeConfigs.value;
|
|
11
27
|
}
|
|
12
28
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAuB;;IACpD,MAAM,WAAW,GAA2C;QAC1D,KAAK,EAAE;YACL,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,kBAAkB;SAC3B;QACD,YAAY,EAAE;YACZ,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,wBAAwB;SACjC;QACD,KAAK,EAAE;YACL,SAAS,EAAE,kBAAkB;YAC7B,MAAM,EAAE,kBAAkB;SAC3B;KACF,CAAC;IACF,OAAO,MAAA,WAAW,CAAC,IAAI,CAAC,mCAAI,WAAW,CAAC,KAAK,CAAC;AAChD,CAAC","sourcesContent":["import { PlatformFacetType } from '../../types/models/facet.model';\nimport { hierarchicalFilterSchema } from '../models/filters/hierarchical-filter.schema';\nimport { numberFilterSchema } from '../models/filters/number-filter.schema';\nimport { simpleFilterSchema } from '../models/filters/simple-filter.schema';\nimport { FacetConfig } from './types';\n\n/**\n * Returns the facet's config.\n *\n * @param type - The facet type to resolve the configuration.\n * @returns The facet's config.\n */\nexport function getFacetConfig(type: PlatformFacetType): FacetConfig {\n const typeConfigs: Record<PlatformFacetType, FacetConfig> = {\n value: {\n modelName: 'SimpleFacet',\n schema: simpleFilterSchema\n },\n hierarchical: {\n modelName: 'HierarchicalFacet',\n schema: hierarchicalFilterSchema\n },\n range: {\n modelName: 'NumberRangeFacet',\n schema: numberFilterSchema\n }\n };\n return typeConfigs[type] ?? typeConfigs.value;\n}\n"]}
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
import { createMutableSchema } from '@empathyco/x-adapter';
|
|
2
2
|
import { getFacetConfig } from '../facets/utils';
|
|
3
|
-
import { hierarchicalFilterSchema } from './filters/hierarchical-filter.schema';
|
|
4
|
-
import { numberFilterSchema } from './filters/number-filter.schema';
|
|
5
|
-
import { simpleFilterSchema } from './filters/simple-filter.schema';
|
|
6
3
|
export const facetSchema = createMutableSchema({
|
|
7
4
|
id: 'facet',
|
|
8
5
|
label: 'facet',
|
|
9
|
-
modelName:
|
|
10
|
-
return getFacetConfig(source.facet).modelName;
|
|
11
|
-
},
|
|
6
|
+
modelName: ({ type }) => getFacetConfig(type).modelName,
|
|
12
7
|
filters: {
|
|
13
8
|
$path: 'values',
|
|
14
|
-
$subSchema: ({
|
|
9
|
+
$subSchema: ({ type }) => getFacetConfig(type).schema,
|
|
15
10
|
$context: {
|
|
16
11
|
facetId: 'facet'
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
14
|
});
|
|
20
|
-
export const facetsConfig = {
|
|
21
|
-
categoryPaths: {
|
|
22
|
-
modelName: 'HierarchicalFacet',
|
|
23
|
-
schema: hierarchicalFilterSchema
|
|
24
|
-
},
|
|
25
|
-
price: {
|
|
26
|
-
modelName: 'NumberRangeFacet',
|
|
27
|
-
schema: numberFilterSchema
|
|
28
|
-
},
|
|
29
|
-
default: {
|
|
30
|
-
modelName: 'SimpleFacet',
|
|
31
|
-
schema: simpleFilterSchema
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
15
|
//# sourceMappingURL=facet.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/facet.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAQnE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"facet.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/facet.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAQnE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAK5C;IACA,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAgB;IAC9D,OAAO,EAAE;QACP,KAAK,EAAE,QAAQ;QACf,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM;QACrD,QAAQ,EAAE;YACR,OAAO,EAAE,OAAO;SACjB;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport {\n EditableNumberRangeFacet,\n HierarchicalFacet,\n NumberRangeFacet,\n SimpleFacet\n} from '@empathyco/x-types';\nimport { PlatformFacet } from '../../types/models/facet.model';\nimport { getFacetConfig } from '../facets/utils';\n\nexport const facetSchema = createMutableSchema<\n Schema<\n PlatformFacet,\n HierarchicalFacet | NumberRangeFacet | SimpleFacet | EditableNumberRangeFacet\n >\n>({\n id: 'facet',\n label: 'facet',\n modelName: ({ type }) => getFacetConfig(type).modelName as any,\n filters: {\n $path: 'values',\n $subSchema: ({ type }) => getFacetConfig(type).schema,\n $context: {\n facetId: 'facet'\n }\n }\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.model.js","sourceRoot":"","sources":["../../../../src/types/models/facet.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BooleanFilter, Facet, Filter } from '@empathyco/x-types';\n\n/**\n * Facet model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFacet {\n facet: string;\n values: PlatformFilter[];\n}\n\n/**\n * Filter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFilter {\n count: number;\n filter: string;\n id: string;\n value: string;\n}\n\n/**\n * HierarchicalFilter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformHierarchicalFilter extends PlatformFilter {\n children: PlatformFacet;\n}\n\n/**\n * Hierarchical Facet model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFacet extends Facet {\n /** Model name to indicate the facet type. */\n modelName: 'HierarchicalFacet';\n /** Filters available for the facet. */\n filters: AdapterHierarchicalFilter[];\n}\n\n/**\n * Hierarchical Filter model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFilter extends BooleanFilter {\n /** Model name to indicate the filter type. */\n modelName: 'HierarchicalFilter';\n /** A unique id used to reference the parent filter or null if it hasn't. */\n parentId: Filter['id'] | null;\n /** Descendants filters. */\n children?: AdapterHierarchicalFilter[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"facet.model.js","sourceRoot":"","sources":["../../../../src/types/models/facet.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BooleanFilter, Facet, Filter } from '@empathyco/x-types';\n\n/**\n * Facet model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFacet {\n facet: string;\n type: PlatformFacetType;\n values: PlatformFilter[];\n}\n\n/**\n * Facet type for the `platform` API. It can be: value, hierarchical or range.\n *\n * @public\n */\nexport type PlatformFacetType = 'value' | 'hierarchical' | 'range';\n\n/**\n * Filter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformFilter {\n count: number;\n filter: string;\n id: string;\n value: string;\n}\n\n/**\n * HierarchicalFilter model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformHierarchicalFilter extends PlatformFilter {\n children: PlatformFacet;\n}\n\n/**\n * Hierarchical Facet model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFacet extends Facet {\n /** Model name to indicate the facet type. */\n modelName: 'HierarchicalFacet';\n /** Filters available for the facet. */\n filters: AdapterHierarchicalFilter[];\n}\n\n/**\n * Hierarchical Filter model used when combining search response mappers.\n *\n * @internal\n */\nexport interface AdapterHierarchicalFilter extends BooleanFilter {\n /** Model name to indicate the filter type. */\n modelName: 'HierarchicalFilter';\n /** A unique id used to reference the parent filter or null if it hasn't. */\n parentId: Filter['id'] | null;\n /** Descendants filters. */\n children?: AdapterHierarchicalFilter[];\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FacetModelName, Facet } from '@empathyco/x-types';
|
|
2
1
|
import { Schema } from '@empathyco/x-adapter';
|
|
2
|
+
import { FacetModelName } from '@empathyco/x-types';
|
|
3
3
|
/**
|
|
4
4
|
* Facet configuration containing the model name and the schema.
|
|
5
5
|
*/
|
|
@@ -7,9 +7,3 @@ export interface FacetConfig {
|
|
|
7
7
|
modelName: FacetModelName;
|
|
8
8
|
schema: Schema;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Dictionary grouping facets configurations.
|
|
12
|
-
*/
|
|
13
|
-
export interface FacetsConfig {
|
|
14
|
-
[key: Facet['id']]: FacetConfig;
|
|
15
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { PlatformFacetType } from '../../types/models/facet.model';
|
|
1
2
|
import { FacetConfig } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Returns the facet's config.
|
|
4
5
|
*
|
|
5
|
-
* @param
|
|
6
|
+
* @param type - The facet type to resolve the configuration.
|
|
6
7
|
* @returns The facet's config.
|
|
7
8
|
*/
|
|
8
|
-
export declare function getFacetConfig(
|
|
9
|
+
export declare function getFacetConfig(type: PlatformFacetType): FacetConfig;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Schema } from '@empathyco/x-adapter';
|
|
2
2
|
import { EditableNumberRangeFacet, HierarchicalFacet, NumberRangeFacet, SimpleFacet } from '@empathyco/x-types';
|
|
3
3
|
import { PlatformFacet } from '../../types/models/facet.model';
|
|
4
|
-
import { FacetsConfig } from '../facets/types';
|
|
5
4
|
export declare const facetSchema: import("@empathyco/x-adapter").MutableSchema<Schema<PlatformFacet, EditableNumberRangeFacet | HierarchicalFacet | NumberRangeFacet | SimpleFacet>>;
|
|
6
|
-
export declare const facetsConfig: FacetsConfig;
|
|
@@ -6,8 +6,15 @@ import { BooleanFilter, Facet, Filter } from '@empathyco/x-types';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface PlatformFacet {
|
|
8
8
|
facet: string;
|
|
9
|
+
type: PlatformFacetType;
|
|
9
10
|
values: PlatformFilter[];
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Facet type for the `platform` API. It can be: value, hierarchical or range.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare type PlatformFacetType = 'value' | 'hierarchical' | 'range';
|
|
11
18
|
/**
|
|
12
19
|
* Filter model for the `platform` API.
|
|
13
20
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-adapter-platform",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.39",
|
|
4
4
|
"description": "A search client for the Empathy Platform API",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@empathyco/x-adapter": "^8.0.0-alpha.11",
|
|
42
|
-
"@empathyco/x-types": "^10.0.0-alpha.
|
|
42
|
+
"@empathyco/x-types": "^10.0.0-alpha.39",
|
|
43
43
|
"@empathyco/x-utils": "^1.0.0-alpha.10",
|
|
44
44
|
"tslib": "~2.3.0"
|
|
45
45
|
},
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "a7c306fd475bd3d2d74dcd8f314d37d766a6e782"
|
|
60
60
|
}
|