@webiny/api-headless-cms-ddb-es 5.39.13 → 5.39.14
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.
|
@@ -15,7 +15,11 @@ const createElasticsearchSort = params => {
|
|
|
15
15
|
plugins
|
|
16
16
|
} = params;
|
|
17
17
|
if (!sort || sort.length === 0) {
|
|
18
|
-
return [
|
|
18
|
+
return [{
|
|
19
|
+
["id.keyword"]: {
|
|
20
|
+
order: "asc"
|
|
21
|
+
}
|
|
22
|
+
}];
|
|
19
23
|
}
|
|
20
24
|
const searchPlugins = (0, _search.createSearchPluginList)({
|
|
21
25
|
plugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiElasticsearch","require","_keyword","_search","_path","createElasticsearchSort","params","sort","modelFields","plugins","length","searchPlugins","createSearchPluginList","createFieldPath","createFieldPathFactory","fieldIdToStorageIdIdMap","sortPlugins","Object","values","reduce","field","parents","fieldId","storageId","path","key","value","keyword","ElasticsearchFieldPlugin","unmappedType","hasKeyword","sortable","searchable","ALL","transformedSort","map","matched","match","
|
|
1
|
+
{"version":3,"names":["_apiElasticsearch","require","_keyword","_search","_path","createElasticsearchSort","params","sort","modelFields","plugins","length","order","searchPlugins","createSearchPluginList","createFieldPath","createFieldPathFactory","fieldIdToStorageIdIdMap","sortPlugins","Object","values","reduce","field","parents","fieldId","storageId","path","key","value","keyword","ElasticsearchFieldPlugin","unmappedType","hasKeyword","sortable","searchable","ALL","transformedSort","map","matched","match","filter","Boolean","createSort","fieldPlugins","exports"],"sources":["sort.ts"],"sourcesContent":["import { Sort as esSort } from \"@webiny/api-elasticsearch/types\";\nimport { createSort, ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryListSort, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { ModelFields } from \"./types\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\n\ninterface Params {\n plugins: PluginsContainer;\n sort?: CmsEntryListSort;\n modelFields: ModelFields;\n model: CmsModel;\n}\nexport const createElasticsearchSort = (params: Params): esSort => {\n const { sort, modelFields, plugins } = params;\n\n if (!sort || sort.length === 0) {\n return [\n {\n [\"id.keyword\"]: {\n order: \"asc\"\n }\n }\n ];\n }\n\n const searchPlugins = createSearchPluginList({\n plugins\n });\n\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n const fieldIdToStorageIdIdMap: Record<string, string> = {};\n\n const sortPlugins = Object.values(modelFields).reduce<Record<string, ElasticsearchFieldPlugin>>(\n (plugins, field) => {\n /**\n * We do not support sorting by nested fields.\n */\n if (field.parents.length > 0) {\n return plugins;\n }\n const { fieldId, storageId } = field.field;\n\n fieldIdToStorageIdIdMap[fieldId] = fieldId;\n\n const { path } = createFieldPath({\n key: storageId,\n field,\n value: \"\",\n keyword: false\n });\n /**\n * Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.\n */\n plugins[fieldId] = new ElasticsearchFieldPlugin({\n unmappedType: field.unmappedType,\n keyword: hasKeyword(field),\n sortable: field.sortable,\n searchable: field.searchable,\n field: fieldId,\n path\n });\n return plugins;\n },\n {\n [\"*\"]: new ElasticsearchFieldPlugin({\n field: ElasticsearchFieldPlugin.ALL,\n keyword: false\n })\n }\n );\n\n const transformedSort = sort\n .map(value => {\n const matched = value.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (!matched) {\n return null;\n }\n const [, fieldId, order] = matched;\n if (fieldIdToStorageIdIdMap[fieldId]) {\n return `${fieldIdToStorageIdIdMap[fieldId]}_${order}`;\n }\n\n return value;\n })\n .filter(Boolean) as string[];\n return createSort({\n fieldPlugins: sortPlugins,\n sort: transformedSort\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAA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AAQ,EAAEX,KAAK,CAACW,QAAQ;MACxBC,UAAU,EAAEZ,KAAK,CAACY,UAAU;MAC5BZ,KAAK,EAAEE,OAAO;MACdE;IACJ,CAAC,CAAC;IACF,OAAOhB,OAAO;EAClB,CAAC,EACD;IACI,CAAC,GAAG,GAAG,IAAIoB,0CAAwB,CAAC;MAChCR,KAAK,EAAEQ,0CAAwB,CAACK,GAAG;MACnCN,OAAO,EAAE;IACb,CAAC;EACL,CACJ,CAAC;EAED,MAAMO,eAAe,GAAG5B,IAAI,CACvB6B,GAAG,CAACT,KAAK,IAAI;IACV,MAAMU,OAAO,GAAGV,KAAK,CAACW,KAAK,CAAC,+BAA+B,CAAC;IAC5D,IAAI,CAACD,OAAO,EAAE;MACV,OAAO,IAAI;IACf;IACA,MAAM,GAAGd,OAAO,EAAEZ,KAAK,CAAC,GAAG0B,OAAO;IAClC,IAAIrB,uBAAuB,CAACO,OAAO,CAAC,EAAE;MAClC,OAAQ,GAAEP,uBAAuB,CAACO,OAAO,CAAE,IAAGZ,KAAM,EAAC;IACzD;IAEA,OAAOgB,KAAK;EAChB,CAAC,CAAC,CACDY,MAAM,CAACC,OAAO,CAAa;EAChC,OAAO,IAAAC,4BAAU,EAAC;IACdC,YAAY,EAAEzB,WAAW;IACzBV,IAAI,EAAE4B;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAtC,uBAAA,GAAAA,uBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.14",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "7.22.6",
|
|
30
|
-
"@webiny/api": "5.39.
|
|
31
|
-
"@webiny/api-elasticsearch": "5.39.
|
|
32
|
-
"@webiny/api-elasticsearch-tasks": "5.39.
|
|
33
|
-
"@webiny/api-headless-cms": "5.39.
|
|
34
|
-
"@webiny/aws-sdk": "5.39.
|
|
35
|
-
"@webiny/db-dynamodb": "5.39.
|
|
36
|
-
"@webiny/error": "5.39.
|
|
37
|
-
"@webiny/handler-db": "5.39.
|
|
38
|
-
"@webiny/plugins": "5.39.
|
|
39
|
-
"@webiny/utils": "5.39.
|
|
30
|
+
"@webiny/api": "5.39.14",
|
|
31
|
+
"@webiny/api-elasticsearch": "5.39.14",
|
|
32
|
+
"@webiny/api-elasticsearch-tasks": "5.39.14",
|
|
33
|
+
"@webiny/api-headless-cms": "5.39.14",
|
|
34
|
+
"@webiny/aws-sdk": "5.39.14",
|
|
35
|
+
"@webiny/db-dynamodb": "5.39.14",
|
|
36
|
+
"@webiny/error": "5.39.14",
|
|
37
|
+
"@webiny/handler-db": "5.39.14",
|
|
38
|
+
"@webiny/plugins": "5.39.14",
|
|
39
|
+
"@webiny/utils": "5.39.14",
|
|
40
40
|
"dataloader": "2.2.1",
|
|
41
41
|
"jsonpack": "1.1.5",
|
|
42
42
|
"lodash": "4.17.21"
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"@babel/preset-env": "7.22.7",
|
|
48
48
|
"@elastic/elasticsearch": "7.12.0",
|
|
49
49
|
"@types/jsonpack": "1.1.2",
|
|
50
|
-
"@webiny/api-dynamodb-to-elasticsearch": "5.39.
|
|
51
|
-
"@webiny/api-i18n": "5.39.
|
|
52
|
-
"@webiny/api-security": "5.39.
|
|
53
|
-
"@webiny/api-tenancy": "5.39.
|
|
54
|
-
"@webiny/api-wcp": "5.39.
|
|
55
|
-
"@webiny/cli": "5.39.
|
|
56
|
-
"@webiny/handler": "5.39.
|
|
57
|
-
"@webiny/handler-aws": "5.39.
|
|
58
|
-
"@webiny/handler-graphql": "5.39.
|
|
59
|
-
"@webiny/project-utils": "5.39.
|
|
60
|
-
"@webiny/tasks": "5.39.
|
|
50
|
+
"@webiny/api-dynamodb-to-elasticsearch": "5.39.14",
|
|
51
|
+
"@webiny/api-i18n": "5.39.14",
|
|
52
|
+
"@webiny/api-security": "5.39.14",
|
|
53
|
+
"@webiny/api-tenancy": "5.39.14",
|
|
54
|
+
"@webiny/api-wcp": "5.39.14",
|
|
55
|
+
"@webiny/cli": "5.39.14",
|
|
56
|
+
"@webiny/handler": "5.39.14",
|
|
57
|
+
"@webiny/handler-aws": "5.39.14",
|
|
58
|
+
"@webiny/handler-graphql": "5.39.14",
|
|
59
|
+
"@webiny/project-utils": "5.39.14",
|
|
60
|
+
"@webiny/tasks": "5.39.14",
|
|
61
61
|
"jest": "29.5.0",
|
|
62
62
|
"jest-dynalite": "3.6.1",
|
|
63
63
|
"prettier": "2.8.8",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"build": "yarn webiny run build",
|
|
75
75
|
"watch": "yarn webiny run watch"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "1d23eb7d17a10c290a280590c5e51dc8a7fa6be0"
|
|
78
78
|
}
|