@webiny/api-headless-cms 5.43.2 → 5.43.3-beta.1
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/crud/contentEntry/FullTextSearchFields.d.ts +22 -0
- package/crud/contentEntry/FullTextSearchFields.js +109 -0
- package/crud/contentEntry/FullTextSearchFields.js.map +1 -0
- package/crud/contentEntry/abstractions/IListEntries.d.ts +2 -2
- package/crud/contentEntry/abstractions/IListEntries.js.map +1 -1
- package/crud/contentEntry/searchableFields.d.ts +4 -4
- package/crud/contentEntry/searchableFields.js +4 -51
- package/crud/contentEntry/searchableFields.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +3 -3
- package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +3 -4
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js +2 -10
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/index.js +1 -1
- package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -1
- package/crud/contentEntry.crud.js +41 -5
- package/crud/contentEntry.crud.js.map +1 -1
- package/package.json +21 -21
- package/types/types.d.ts +23 -1
- package/types/types.js.map +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CmsModelField, CmsModelFieldToGraphQLPlugin, IFullTextSearchField, IFullTextSearchFields, IFullTextSearchFieldsFindCallable, IFullTextSearchFieldsMapCallable } from "../../types";
|
|
2
|
+
export interface IFullTextSearchFieldsParams {
|
|
3
|
+
allowedFields: string[];
|
|
4
|
+
fields: CmsModelField[];
|
|
5
|
+
plugins: Record<string, CmsModelFieldToGraphQLPlugin>;
|
|
6
|
+
}
|
|
7
|
+
export declare class FullTextSearchFields implements IFullTextSearchFields {
|
|
8
|
+
private readonly allowedFields;
|
|
9
|
+
private readonly fields;
|
|
10
|
+
private readonly plugins;
|
|
11
|
+
constructor(params: IFullTextSearchFieldsParams);
|
|
12
|
+
map<T>(cb: IFullTextSearchFieldsMapCallable<T>): T[];
|
|
13
|
+
find(cb: IFullTextSearchFieldsFindCallable): IFullTextSearchField | undefined;
|
|
14
|
+
hasAny(): boolean;
|
|
15
|
+
hasFieldId(fieldId: string): boolean;
|
|
16
|
+
getByPath(path: string): IFullTextSearchField | undefined;
|
|
17
|
+
getByStoragePath(storagePath: string): IFullTextSearchField | undefined;
|
|
18
|
+
getAllPaths(): string[];
|
|
19
|
+
getAllStoragePaths(): string[];
|
|
20
|
+
private add;
|
|
21
|
+
private buildPaths;
|
|
22
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FullTextSearchFields = void 0;
|
|
7
|
+
class FullTextSearchFields {
|
|
8
|
+
allowedFields = [];
|
|
9
|
+
fields = [];
|
|
10
|
+
constructor(params) {
|
|
11
|
+
const {
|
|
12
|
+
fields,
|
|
13
|
+
plugins,
|
|
14
|
+
allowedFields
|
|
15
|
+
} = params;
|
|
16
|
+
this.plugins = plugins;
|
|
17
|
+
this.allowedFields = allowedFields;
|
|
18
|
+
for (const field of fields) {
|
|
19
|
+
this.add(field, null);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
map(cb) {
|
|
23
|
+
return this.fields.map(cb);
|
|
24
|
+
}
|
|
25
|
+
find(cb) {
|
|
26
|
+
return this.fields.find(cb);
|
|
27
|
+
}
|
|
28
|
+
hasAny() {
|
|
29
|
+
return this.fields.length > 0;
|
|
30
|
+
}
|
|
31
|
+
hasFieldId(fieldId) {
|
|
32
|
+
return this.fields.some(field => {
|
|
33
|
+
return field.field.fieldId === fieldId;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getByPath(path) {
|
|
37
|
+
return this.fields.find(field => {
|
|
38
|
+
return path === field.path;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getByStoragePath(storagePath) {
|
|
42
|
+
return this.fields.find(field => {
|
|
43
|
+
return storagePath === field.storagePath;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getAllPaths() {
|
|
47
|
+
return this.fields.map(field => field.path);
|
|
48
|
+
}
|
|
49
|
+
getAllStoragePaths() {
|
|
50
|
+
return this.fields.map(field => field.storagePath);
|
|
51
|
+
}
|
|
52
|
+
add(input, parent) {
|
|
53
|
+
const plugin = this.plugins[input.type];
|
|
54
|
+
if (!plugin) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const {
|
|
58
|
+
path,
|
|
59
|
+
storagePath
|
|
60
|
+
} = this.buildPaths(input, parent);
|
|
61
|
+
/**
|
|
62
|
+
* There is a possibility that the field is not allowed to be added to the full text search.
|
|
63
|
+
* User controls the allowed fields if they want to.
|
|
64
|
+
*/
|
|
65
|
+
if (this.allowedFields.length > 0 && !this.allowedFields.includes(path)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const field = {
|
|
69
|
+
field: input,
|
|
70
|
+
parent,
|
|
71
|
+
path,
|
|
72
|
+
storagePath
|
|
73
|
+
};
|
|
74
|
+
for (const child of input.settings?.fields || []) {
|
|
75
|
+
this.add(child, field);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* We do not want to add a field which has a fullTextSearch set to false via the plugin.
|
|
80
|
+
*/
|
|
81
|
+
if (plugin.fullTextSearch !== true) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Also, we do not want to add a field which has fullTextSearch disabled via the settings.
|
|
86
|
+
*/
|
|
87
|
+
if (input.settings?.disableFullTextSearch === true) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.fields.push(field);
|
|
91
|
+
}
|
|
92
|
+
buildPaths(input, initialParent) {
|
|
93
|
+
const paths = [input.fieldId];
|
|
94
|
+
const storagePaths = [input.storageId];
|
|
95
|
+
let parent = initialParent;
|
|
96
|
+
while (parent) {
|
|
97
|
+
paths.unshift(parent.field.fieldId);
|
|
98
|
+
storagePaths.unshift(parent.field.storageId);
|
|
99
|
+
parent = parent.parent;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
path: paths.join("."),
|
|
103
|
+
storagePath: storagePaths.join(".")
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.FullTextSearchFields = FullTextSearchFields;
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=FullTextSearchFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FullTextSearchFields","allowedFields","fields","constructor","params","plugins","field","add","map","cb","find","hasAny","length","hasFieldId","fieldId","some","getByPath","path","getByStoragePath","storagePath","getAllPaths","getAllStoragePaths","input","parent","plugin","type","buildPaths","includes","child","settings","fullTextSearch","disableFullTextSearch","push","initialParent","paths","storagePaths","storageId","unshift","join","exports"],"sources":["FullTextSearchFields.ts"],"sourcesContent":["import type {\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n IFullTextSearchField,\n IFullTextSearchFields,\n IFullTextSearchFieldsFindCallable,\n IFullTextSearchFieldsMapCallable\n} from \"~/types\";\n\nexport interface IFullTextSearchFieldsParams {\n allowedFields: string[];\n fields: CmsModelField[];\n plugins: Record<string, CmsModelFieldToGraphQLPlugin>;\n}\n\nexport class FullTextSearchFields implements IFullTextSearchFields {\n private readonly allowedFields: string[] = [];\n private readonly fields: IFullTextSearchField[] = [];\n private readonly plugins: Record<string, CmsModelFieldToGraphQLPlugin>;\n\n public constructor(params: IFullTextSearchFieldsParams) {\n const { fields, plugins, allowedFields } = params;\n\n this.plugins = plugins;\n this.allowedFields = allowedFields;\n\n for (const field of fields) {\n this.add(field, null);\n }\n }\n\n public map<T>(cb: IFullTextSearchFieldsMapCallable<T>): T[] {\n return this.fields.map(cb);\n }\n\n public find(cb: IFullTextSearchFieldsFindCallable): IFullTextSearchField | undefined {\n return this.fields.find(cb);\n }\n\n public hasAny(): boolean {\n return this.fields.length > 0;\n }\n\n public hasFieldId(fieldId: string): boolean {\n return this.fields.some(field => {\n return field.field.fieldId === fieldId;\n });\n }\n\n public getByPath(path: string): IFullTextSearchField | undefined {\n return this.fields.find(field => {\n return path === field.path;\n });\n }\n\n public getByStoragePath(storagePath: string): IFullTextSearchField | undefined {\n return this.fields.find(field => {\n return storagePath === field.storagePath;\n });\n }\n\n public getAllPaths(): string[] {\n return this.fields.map(field => field.path);\n }\n\n public getAllStoragePaths(): string[] {\n return this.fields.map(field => field.storagePath);\n }\n\n private add(input: CmsModelField, parent: IFullTextSearchField | null): void {\n const plugin = this.plugins[input.type];\n if (!plugin) {\n return;\n }\n\n const { path, storagePath } = this.buildPaths(input, parent);\n /**\n * There is a possibility that the field is not allowed to be added to the full text search.\n * User controls the allowed fields if they want to.\n */\n if (this.allowedFields.length > 0 && !this.allowedFields.includes(path)) {\n return;\n }\n\n const field: IFullTextSearchField = {\n field: input,\n parent,\n path,\n storagePath\n };\n\n for (const child of input.settings?.fields || []) {\n this.add(child, field);\n }\n\n /**\n * We do not want to add a field which has a fullTextSearch set to false via the plugin.\n */\n if (plugin.fullTextSearch !== true) {\n return;\n }\n /**\n * Also, we do not want to add a field which has fullTextSearch disabled via the settings.\n */\n if (input.settings?.disableFullTextSearch === true) {\n return;\n }\n this.fields.push(field);\n }\n\n private buildPaths(input: CmsModelField, initialParent: IFullTextSearchField | null) {\n const paths = [input.fieldId];\n const storagePaths = [input.storageId];\n\n let parent: IFullTextSearchField | null = initialParent;\n while (parent) {\n paths.unshift(parent.field.fieldId);\n storagePaths.unshift(parent.field.storageId);\n parent =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,aAA0C,EAAE;IACjF,MAAMC,KAAK,GAAG,CAACZ,KAAK,CAACR,OAAO,CAAC;IAC7B,MAAMqB,YAAY,GAAG,CAACb,KAAK,CAACc,SAAS,CAAC;IAEtC,IAAIb,MAAmC,GAAGU,aAAa;IACvD,OAAOV,MAAM,EAAE;MACXW,KAAK,CAACG,OAAO,CAACd,MAAM,CAACjB,KAAK,CAACQ,OAAO,CAAC;MACnCqB,YAAY,CAACE,OAAO,CAACd,MAAM,CAACjB,KAAK,CAAC8B,SAAS,CAAC;MAC5Cb,MAAM,GAAGA,MAAM,CAACA,MAAM;IAC1B;IAEA,OAAO;MACHN,IAAI,EAAEiB,KAAK,CAACI,IAAI,CAAC,GAAG,CAAC;MACrBnB,WAAW,EAAEgB,YAAY,CAACG,IAAI,CAAC,GAAG;IACtC,CAAC;EACL;AACJ;AAACC,OAAA,CAAAvC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CmsEntry,
|
|
1
|
+
import type { CmsEntry, CmsEntryMeta, CmsEntryStorageOperationsListParams, CmsEntryValues, CmsModel } from "../../../types";
|
|
2
2
|
export interface IListEntries {
|
|
3
|
-
execute: <T extends CmsEntryValues>(model: CmsModel, params
|
|
3
|
+
execute: <T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IListEntries.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":[],"sources":["IListEntries.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryMeta,\n CmsEntryStorageOperationsListParams,\n CmsEntryValues,\n CmsModel\n} from \"~/types\";\n\nexport interface IListEntries {\n execute: <T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CmsModelField } from "../../types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
interface
|
|
1
|
+
import type { CmsModelField, IFullTextSearchFields } from "../../types";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
interface IGetSearchableFieldsParams {
|
|
4
4
|
input: string[];
|
|
5
5
|
fields: CmsModelField[];
|
|
6
6
|
plugins: PluginsContainer;
|
|
7
7
|
}
|
|
8
|
-
export declare const getSearchableFields: (params:
|
|
8
|
+
export declare const getSearchableFields: (params: IGetSearchableFieldsParams) => IFullTextSearchFields;
|
|
9
9
|
export {};
|
|
@@ -4,53 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSearchableFields = void 0;
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
input,
|
|
10
|
-
plugins,
|
|
11
|
-
fields,
|
|
12
|
-
parents
|
|
13
|
-
} = params;
|
|
14
|
-
return fields.reduce((result, field) => {
|
|
15
|
-
/**
|
|
16
|
-
* We need to check if the field is full text searchable, and for that we need a plugin for the field type.
|
|
17
|
-
*/
|
|
18
|
-
const plugin = plugins[field.type];
|
|
19
|
-
if (!plugin) {
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* There is a possibility that searchable fields exist in nested object field, so check that as well.
|
|
24
|
-
*/
|
|
25
|
-
const childFields = field.settings?.fields || [];
|
|
26
|
-
if (childFields.length > 0) {
|
|
27
|
-
/**
|
|
28
|
-
* So we build a list of searchable child fields and push it into the main result set.
|
|
29
|
-
*/
|
|
30
|
-
const childResults = buildSearchableFieldList({
|
|
31
|
-
fields: childFields,
|
|
32
|
-
parents: [...parents, field.fieldId],
|
|
33
|
-
plugins,
|
|
34
|
-
input
|
|
35
|
-
});
|
|
36
|
-
result.push(...childResults);
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* If not searchable, continue further.
|
|
41
|
-
*/
|
|
42
|
-
if (!plugin.fullTextSearch || field.settings?.disableFullTextSearch === true) {
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Combine all parent paths with the current one and push it.
|
|
48
|
-
*/
|
|
49
|
-
const path = [...parents, field.fieldId].join(".");
|
|
50
|
-
result.push(path);
|
|
51
|
-
return result;
|
|
52
|
-
}, []);
|
|
53
|
-
};
|
|
7
|
+
var _FullTextSearchFields = require("./FullTextSearchFields");
|
|
54
8
|
const getSearchableFields = params => {
|
|
55
9
|
const {
|
|
56
10
|
plugins,
|
|
@@ -61,11 +15,10 @@ const getSearchableFields = params => {
|
|
|
61
15
|
collection[field.fieldType] = field;
|
|
62
16
|
return collection;
|
|
63
17
|
}, {});
|
|
64
|
-
return
|
|
18
|
+
return new _FullTextSearchFields.FullTextSearchFields({
|
|
65
19
|
fields,
|
|
66
|
-
input,
|
|
67
|
-
plugins: fieldPluginMap
|
|
68
|
-
parents: []
|
|
20
|
+
allowedFields: input,
|
|
21
|
+
plugins: fieldPluginMap
|
|
69
22
|
});
|
|
70
23
|
};
|
|
71
24
|
exports.getSearchableFields = getSearchableFields;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_FullTextSearchFields","require","getSearchableFields","params","plugins","input","fields","fieldPluginMap","byType","reduce","collection","field","fieldType","FullTextSearchFields","allowedFields","exports"],"sources":["searchableFields.ts"],"sourcesContent":["import type { CmsModelField, CmsModelFieldToGraphQLPlugin, IFullTextSearchFields } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { FullTextSearchFields } from \"./FullTextSearchFields\";\n\ninterface IGetSearchableFieldsParams {\n input: string[];\n fields: CmsModelField[];\n plugins: PluginsContainer;\n}\n\nexport const getSearchableFields = (params: IGetSearchableFieldsParams): IFullTextSearchFields => {\n const { plugins, input, fields } = params;\n const fieldPluginMap = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce((collection, field) => {\n collection[field.fieldType] = field;\n return collection;\n }, {} as Record<string, CmsModelFieldToGraphQLPlugin>);\n\n return new FullTextSearchFields({\n fields,\n allowedFields: input,\n plugins: fieldPluginMap\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AAQO,MAAMC,mBAAmB,GAAIC,MAAkC,IAA4B;EAC9F,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGH,MAAM;EACzC,MAAMI,cAAc,GAAGH,OAAO,CACzBI,MAAM,CAA+B,4BAA4B,CAAC,CAClEC,MAAM,CAAC,CAACC,UAAU,EAAEC,KAAK,KAAK;IAC3BD,UAAU,CAACC,KAAK,CAACC,SAAS,CAAC,GAAGD,KAAK;IACnC,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAAiD,CAAC;EAE1D,OAAO,IAAIG,0CAAoB,CAAC;IAC5BP,MAAM;IACNQ,aAAa,EAAET,KAAK;IACpBD,OAAO,EAAEG;EACb,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAb,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CmsEntry,
|
|
1
|
+
import { IListEntries, IListEntriesOperation } from "../../abstractions";
|
|
2
|
+
import { CmsEntry, CmsEntryMeta, CmsEntryStorageOperationsListParams, CmsEntryValues, CmsModel } from "../../../../types";
|
|
3
3
|
export declare class ListEntries implements IListEntries {
|
|
4
4
|
private listEntries;
|
|
5
5
|
constructor(listEntries: IListEntriesOperation);
|
|
6
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params
|
|
6
|
+
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","ListEntries","constructor","listEntries","execute","model","params","where","initialWhere","limit","initialLimit","fields","listParams","hasMoreItems","totalCount","cursor","items","meta","ex","WebinyError","message","code","data","error","exports"],"sources":["ListEntries.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","ListEntries","constructor","listEntries","execute","model","params","where","initialWhere","limit","initialLimit","fields","listParams","hasMoreItems","totalCount","cursor","items","meta","ex","WebinyError","message","code","data","error","exports"],"sources":["ListEntries.ts"],"sourcesContent":["import { IListEntries, IListEntriesOperation } from \"~/crud/contentEntry/abstractions\";\nimport {\n CmsEntry,\n CmsEntryMeta,\n CmsEntryStorageOperationsListParams,\n CmsEntryValues,\n CmsModel\n} from \"~/types\";\nimport WebinyError from \"@webiny/error\";\n\nexport class ListEntries implements IListEntries {\n private listEntries: IListEntriesOperation;\n\n constructor(listEntries: IListEntriesOperation) {\n this.listEntries = listEntries;\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n const { where: initialWhere, limit: initialLimit, fields } = params || {};\n\n try {\n const limit = initialLimit && initialLimit > 0 ? initialLimit : 50;\n const where = { ...initialWhere };\n const listParams = { ...params, where, limit };\n\n const { hasMoreItems, totalCount, cursor, items } = await this.listEntries.execute(\n model,\n listParams\n );\n\n const meta = {\n hasMoreItems,\n totalCount,\n /**\n * Cursor should be null if there are no more items to load.\n * Just make sure of that, disregarding what is returned from the storageOperations.entries.list method.\n */\n cursor: hasMoreItems ? cursor : null\n };\n\n return [items as CmsEntry<T>[], meta];\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Error while fetching entries from storage.\",\n ex.code || \"LIST_ENTRIES_ERROR\",\n {\n ...ex.data,\n params,\n error: {\n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IAAI,EAAEJ,EAAE,CAACI;QACb,CAAC;QACDjB,KAAK;QACLM;MACJ,CACJ,CAAC;IACL;EACJ;AACJ;AAACa,OAAA,CAAAvB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { IListEntriesOperation } from "../../abstractions";
|
|
2
|
-
import {
|
|
2
|
+
import { CmsEntryStorageOperationsListParams, CmsModel } from "../../../../types";
|
|
3
3
|
export declare class ListEntriesOperationWithSearchableFields implements IListEntriesOperation {
|
|
4
|
-
private
|
|
5
|
-
|
|
6
|
-
constructor(context: CmsContext, listEntries: IListEntriesOperation);
|
|
4
|
+
private readonly listEntries;
|
|
5
|
+
constructor(listEntries: IListEntriesOperation);
|
|
7
6
|
execute(model: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<import("../../../../types").CmsEntryStorageOperationsListResponse<import("../../../../types").CmsStorageEntry>>;
|
|
8
7
|
}
|
|
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ListEntriesOperationWithSearchableFields = void 0;
|
|
7
|
-
var _searchableFields = require("../../searchableFields");
|
|
8
7
|
class ListEntriesOperationWithSearchableFields {
|
|
9
|
-
constructor(
|
|
10
|
-
this.context = context;
|
|
8
|
+
constructor(listEntries) {
|
|
11
9
|
this.listEntries = listEntries;
|
|
12
10
|
}
|
|
13
11
|
async execute(model, params) {
|
|
14
|
-
const fields = (0, _searchableFields.getSearchableFields)({
|
|
15
|
-
fields: model.fields,
|
|
16
|
-
plugins: this.context.plugins,
|
|
17
|
-
input: params.fields || []
|
|
18
|
-
});
|
|
19
12
|
return await this.listEntries.execute(model, {
|
|
20
|
-
...params
|
|
21
|
-
fields
|
|
13
|
+
...params
|
|
22
14
|
});
|
|
23
15
|
}
|
|
24
16
|
}
|
package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ListEntriesOperationWithSearchableFields","constructor","listEntries","execute","model","params","exports"],"sources":["ListEntriesOperationWithSearchableFields.ts"],"sourcesContent":["import { IListEntriesOperation } from \"../../abstractions\";\nimport { CmsEntryStorageOperationsListParams, CmsModel } from \"~/types\";\n\nexport class ListEntriesOperationWithSearchableFields implements IListEntriesOperation {\n private readonly listEntries: IListEntriesOperation;\n\n constructor(listEntries: IListEntriesOperation) {\n this.listEntries = listEntries;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsListParams) {\n return await this.listEntries.execute(model, { ...params });\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,wCAAwC,CAAkC;EAGnFC,WAAWA,CAACC,WAAkC,EAAE;IAC5C,IAAI,CAACA,WAAW,GAAGA,WAAW;EAClC;EAEA,MAAMC,OAAOA,CAACC,KAAe,EAAEC,MAA2C,EAAE;IACxE,OAAO,MAAM,IAAI,CAACH,WAAW,CAACC,OAAO,CAACC,KAAK,EAAE;MAAE,GAAGC;IAAO,CAAC,CAAC;EAC/D;AACJ;AAACC,OAAA,CAAAN,wCAAA,GAAAA,wCAAA","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AccessControl } from "../../../AccessControl/AccessControl";
|
|
2
2
|
import { IListEntries } from "../../abstractions";
|
|
3
|
-
import { CmsEntry,
|
|
3
|
+
import { CmsEntry, CmsEntryMeta, CmsEntryStorageOperationsListParams, CmsEntryValues, CmsModel } from "../../../../types";
|
|
4
4
|
import { SecurityIdentity } from "@webiny/api-security/types";
|
|
5
5
|
export declare class ListEntriesSecure implements IListEntries {
|
|
6
6
|
private accessControl;
|
|
7
7
|
private getIdentity;
|
|
8
8
|
private useCase;
|
|
9
9
|
constructor(accessControl: AccessControl, getIdentity: () => SecurityIdentity, useCase: IListEntries);
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params
|
|
10
|
+
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ListEntriesSecure","constructor","accessControl","getIdentity","useCase","execute","model","params","ensureCanAccessEntry","where","initialWhere","canAccessOnlyOwnedEntries","createdBy","id","exports"],"sources":["ListEntriesSecure.ts"],"sourcesContent":["import { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport { IListEntries } from \"../../abstractions\";\nimport {
|
|
1
|
+
{"version":3,"names":["ListEntriesSecure","constructor","accessControl","getIdentity","useCase","execute","model","params","ensureCanAccessEntry","where","initialWhere","canAccessOnlyOwnedEntries","createdBy","id","exports"],"sources":["ListEntriesSecure.ts"],"sourcesContent":["import { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport { IListEntries } from \"../../abstractions\";\nimport {\n CmsEntry,\n CmsEntryMeta,\n CmsEntryStorageOperationsListParams,\n CmsEntryValues,\n CmsModel\n} from \"~/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport class ListEntriesSecure implements IListEntries {\n private accessControl: AccessControl;\n private getIdentity: () => SecurityIdentity;\n private useCase: IListEntries;\n\n constructor(\n accessControl: AccessControl,\n getIdentity: () => SecurityIdentity,\n useCase: IListEntries\n ) {\n this.accessControl = accessControl;\n this.getIdentity = getIdentity;\n this.useCase = useCase;\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n await this.accessControl.ensureCanAccessEntry({ model });\n const { where: initialWhere } = params || {};\n const where = { ...initialWhere };\n\n /**\n * Possibly only get records which are owned by current user.\n * Or if searching for the owner set that value - in the case that user can see other entries than their own.\n */\n if (await this.accessControl.canAccessOnlyOwnedEntries({ model })) {\n where.createdBy = this.getIdentity().id;\n }\n\n return await this.useCase.execute(model, {\n ...params,\n where\n });\n }\n}\n"],"mappings":";;;;;;AAWO,MAAMA,iBAAiB,CAAyB;EAKnDC,WAAWA,CACPC,aAA4B,EAC5BC,WAAmC,EACnCC,OAAqB,EACvB;IACE,IAAI,CAACF,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,OAAOA,CACTC,KAAe,EACfC,MAA2C,EACL;IACtC,MAAM,IAAI,CAACL,aAAa,CAACM,oBAAoB,CAAC;MAAEF;IAAM,CAAC,CAAC;IACxD,MAAM;MAAEG,KAAK,EAAEC;IAAa,CAAC,GAAGH,MAAM,IAAI,CAAC,CAAC;IAC5C,MAAME,KAAK,GAAG;MAAE,GAAGC;IAAa,CAAC;;IAEjC;AACR;AACA;AACA;IACQ,IAAI,MAAM,IAAI,CAACR,aAAa,CAACS,yBAAyB,CAAC;MAAEL;IAAM,CAAC,CAAC,EAAE;MAC/DG,KAAK,CAACG,SAAS,GAAG,IAAI,CAACT,WAAW,CAAC,CAAC,CAACU,EAAE;IAC3C;IAEA,OAAO,MAAM,IAAI,CAACT,OAAO,CAACC,OAAO,CAACC,KAAK,EAAE;MACrC,GAAGC,MAAM;MACTE;IACJ,CAAC,CAAC;EACN;AACJ;AAACK,OAAA,CAAAd,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ const listEntriesUseCases = params => {
|
|
|
22
22
|
const listOperationWithEvents = new _ListEntriesOperationWithEvents.ListEntriesOperationWithEvents(params.topics, listOperation);
|
|
23
23
|
const listOperationWithEventsSort = new _ListEntriesOperationWithSort.ListEntriesOperationWithSort(listOperationWithEvents);
|
|
24
24
|
const listOperationWithEventsSortStatusCheck = new _ListEntriesOperationWithStatusCheck.ListEntriesOperationWithStatusCheck(listOperationWithEventsSort);
|
|
25
|
-
const listOperationWithEventsSortStatusCheckFields = new _ListEntriesOperationWithSearchableFields.ListEntriesOperationWithSearchableFields(
|
|
25
|
+
const listOperationWithEventsSortStatusCheckFields = new _ListEntriesOperationWithSearchableFields.ListEntriesOperationWithSearchableFields(listOperationWithEventsSortStatusCheck);
|
|
26
26
|
const listNotDeletedOperation = new _ListEntriesOperationNotDeleted.ListEntriesOperationNotDeleted(listOperationWithEventsSortStatusCheckFields);
|
|
27
27
|
const listDeletedOperation = new _ListEntriesOperationDeleted.ListEntriesOperationDeleted(listOperationWithEventsSortStatusCheckFields);
|
|
28
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ListEntriesOperationWithSearchableFields","require","_ListEntriesOperation","_ListEntriesOperationWithEvents","_ListEntriesOperationWithSort","_ListEntriesOperationWithStatusCheck","_ListEntriesSecure","_ListEntriesOperationNotDeleted","_ListEntriesOperationDeleted","_ListEntriesOperationLatest","_ListEntriesOperationPublished","_ListEntries","_GetEntry","_GetEntrySecure","listEntriesUseCases","params","listOperation","ListEntriesOperation","operation","listOperationWithEvents","ListEntriesOperationWithEvents","topics","listOperationWithEventsSort","ListEntriesOperationWithSort","listOperationWithEventsSortStatusCheck","ListEntriesOperationWithStatusCheck","listOperationWithEventsSortStatusCheckFields","ListEntriesOperationWithSearchableFields","
|
|
1
|
+
{"version":3,"names":["_ListEntriesOperationWithSearchableFields","require","_ListEntriesOperation","_ListEntriesOperationWithEvents","_ListEntriesOperationWithSort","_ListEntriesOperationWithStatusCheck","_ListEntriesSecure","_ListEntriesOperationNotDeleted","_ListEntriesOperationDeleted","_ListEntriesOperationLatest","_ListEntriesOperationPublished","_ListEntries","_GetEntry","_GetEntrySecure","listEntriesUseCases","params","listOperation","ListEntriesOperation","operation","listOperationWithEvents","ListEntriesOperationWithEvents","topics","listOperationWithEventsSort","ListEntriesOperationWithSort","listOperationWithEventsSortStatusCheck","ListEntriesOperationWithStatusCheck","listOperationWithEventsSortStatusCheckFields","ListEntriesOperationWithSearchableFields","listNotDeletedOperation","ListEntriesOperationNotDeleted","listDeletedOperation","ListEntriesOperationDeleted","listEntriesOperation","ListEntries","listEntriesUseCase","ListEntriesSecure","accessControl","getIdentity","listLatestOperation","ListEntriesOperationLatest","listLatestEntries","listLatestUseCase","listLatestDeletedOperation","listDeletedEntries","listDeletedUseCase","listPublishedOperation","ListEntriesOperationPublished","listPublishedEntries","listPublishedUseCase","getEntryNotDeleted","GetEntry","getEntryUseCase","GetEntrySecure","exports"],"sources":["index.ts"],"sourcesContent":["import { CmsContext, CmsEntryStorageOperations, EntryBeforeListTopicParams } from \"~/types\";\nimport { AccessControl } from \"~/crud/AccessControl/AccessControl\";\n\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { ListEntriesOperationWithSearchableFields } from \"./ListEntriesOperationWithSearchableFields\";\nimport { ListEntriesOperation } from \"./ListEntriesOperation\";\nimport { ListEntriesOperationWithEvents } from \"./ListEntriesOperationWithEvents\";\nimport { ListEntriesOperationWithSort } from \"./ListEntriesOperationWithSort\";\nimport { ListEntriesOperationWithStatusCheck } from \"./ListEntriesOperationWithStatusCheck\";\nimport { ListEntriesSecure } from \"~/crud/contentEntry/useCases/ListEntries/ListEntriesSecure\";\nimport { ListEntriesOperationNotDeleted } from \"./ListEntriesOperationNotDeleted\";\nimport { ListEntriesOperationDeleted } from \"./ListEntriesOperationDeleted\";\nimport { ListEntriesOperationLatest } from \"./ListEntriesOperationLatest\";\nimport { ListEntriesOperationPublished } from \"./ListEntriesOperationPublished\";\nimport { ListEntries } from \"./ListEntries\";\nimport { GetEntry } from \"./GetEntry\";\nimport { GetEntrySecure } from \"./GetEntrySecure\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport interface ListEntriesUseCasesTopics {\n onEntryBeforeList: Topic<EntryBeforeListTopicParams>;\n}\n\ninterface ListEntriesUseCasesParams {\n operation: CmsEntryStorageOperations[\"list\"];\n accessControl: AccessControl;\n topics: ListEntriesUseCasesTopics;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\n\nexport const listEntriesUseCases = (params: ListEntriesUseCasesParams) => {\n const listOperation = new ListEntriesOperation(params.operation);\n const listOperationWithEvents = new ListEntriesOperationWithEvents(\n params.topics,\n listOperation\n );\n const listOperationWithEventsSort = new ListEntriesOperationWithSort(listOperationWithEvents);\n const listOperationWithEventsSortStatusCheck = new ListEntriesOperationWithStatusCheck(\n listOperationWithEventsSort\n );\n const listOperationWithEventsSortStatusCheckFields =\n new ListEntriesOperationWithSearchableFields(listOperationWithEventsSortStatusCheck);\n\n const listNotDeletedOperation = new ListEntriesOperationNotDeleted(\n listOperationWithEventsSortStatusCheckFields\n );\n\n const listDeletedOperation = new ListEntriesOperationDeleted(\n listOperationWithEventsSortStatusCheckFields\n );\n\n // List\n const listEntriesOperation = new ListEntries(listNotDeletedOperation);\n const listEntriesUseCase = new ListEntriesSecure(\n params.accessControl,\n params.getIdentity,\n listEntriesOperation\n );\n\n // List latest\n const listLatestOperation = new ListEntriesOperationLatest(listNotDeletedOperation);\n const listLatestEntries = new ListEntries(listLatestOperation);\n const listLatestUseCase = new ListEntriesSecure(\n params.accessControl,\n params.getIdentity,\n listLatestEntries\n );\n\n // List deleted\n const listLatestDeletedOperation = new ListEntriesOperationLatest(listDeletedOperation);\n const listDeletedEntries = new ListEntries(listLatestDeletedOperation);\n const listDeletedUseCase = new ListEntriesSecure(\n params.accessControl,\n params.getIdentity,\n listDeletedEntries\n );\n\n // List published\n const listPublishedOperation = new ListEntriesOperationPublished(listNotDeletedOperation);\n const listPublishedEntries = new ListEntries(listPublishedOperation);\n const listPublishedUseCase = new ListEntriesSecure(\n params.accessControl,\n params.getIdentity,\n listPublishedEntries\n );\n\n // Get\n const getEntryNotDeleted = new GetEntry(listNotDeletedOperation);\n const getEntryUseCase = new GetEntrySecure(\n params.accessControl,\n params.getIdentity,\n getEntryNotDeleted\n );\n\n return {\n listEntriesUseCase,\n listLatestUseCase,\n listDeletedUseCase,\n listPublishedUseCase,\n getEntry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ACnF,MAAMY,iBAAiB,GAAG,IAAIP,wBAAW,CAACK,mBAAmB,CAAC;EAC9D,MAAMG,iBAAiB,GAAG,IAAIN,oCAAiB,CAC3CpB,MAAM,CAACqB,aAAa,EACpBrB,MAAM,CAACsB,WAAW,EAClBG,iBACJ,CAAC;;EAED;EACA,MAAME,0BAA0B,GAAG,IAAIH,sDAA0B,CAACT,oBAAoB,CAAC;EACvF,MAAMa,kBAAkB,GAAG,IAAIV,wBAAW,CAACS,0BAA0B,CAAC;EACtE,MAAME,kBAAkB,GAAG,IAAIT,oCAAiB,CAC5CpB,MAAM,CAACqB,aAAa,EACpBrB,MAAM,CAACsB,WAAW,EAClBM,kBACJ,CAAC;;EAED;EACA,MAAME,sBAAsB,GAAG,IAAIC,4DAA6B,CAAClB,uBAAuB,CAAC;EACzF,MAAMmB,oBAAoB,GAAG,IAAId,wBAAW,CAACY,sBAAsB,CAAC;EACpE,MAAMG,oBAAoB,GAAG,IAAIb,oCAAiB,CAC9CpB,MAAM,CAACqB,aAAa,EACpBrB,MAAM,CAACsB,WAAW,EAClBU,oBACJ,CAAC;;EAED;EACA,MAAME,kBAAkB,GAAG,IAAIC,kBAAQ,CAACtB,uBAAuB,CAAC;EAChE,MAAMuB,eAAe,GAAG,IAAIC,8BAAc,CACtCrC,MAAM,CAACqB,aAAa,EACpBrB,MAAM,CAACsB,WAAW,EAClBY,kBACJ,CAAC;EAED,OAAO;IACHf,kBAAkB;IAClBO,iBAAiB;IACjBG,kBAAkB;IAClBI,oBAAoB;IACpBG;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAvC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1020,7 +1020,7 @@ const createContentEntryCrud = params => {
|
|
|
1020
1020
|
plugins: context.plugins,
|
|
1021
1021
|
input: []
|
|
1022
1022
|
});
|
|
1023
|
-
if (!fields.
|
|
1023
|
+
if (!fields.hasFieldId(fieldId)) {
|
|
1024
1024
|
throw new _error.default("Cannot list unique entry field values if the field is not searchable.", "LIST_UNIQUE_ENTRY_VALUES_ERROR", {
|
|
1025
1025
|
fieldId
|
|
1026
1026
|
});
|
|
@@ -1146,22 +1146,58 @@ const createContentEntryCrud = params => {
|
|
|
1146
1146
|
*/
|
|
1147
1147
|
async listEntries(model, params) {
|
|
1148
1148
|
return context.benchmark.measure("headlessCms.crud.entries.listEntries", async () => {
|
|
1149
|
-
return await listEntriesUseCase.execute(model,
|
|
1149
|
+
return await listEntriesUseCase.execute(model, {
|
|
1150
|
+
...params,
|
|
1151
|
+
where: params?.where || {},
|
|
1152
|
+
limit: params?.limit || 50,
|
|
1153
|
+
fields: (0, _searchableFields.getSearchableFields)({
|
|
1154
|
+
input: params?.fields || [],
|
|
1155
|
+
plugins: context.plugins,
|
|
1156
|
+
fields: model.fields
|
|
1157
|
+
})
|
|
1158
|
+
});
|
|
1150
1159
|
});
|
|
1151
1160
|
},
|
|
1152
1161
|
async listLatestEntries(model, params) {
|
|
1153
1162
|
return context.benchmark.measure("headlessCms.crud.entries.listLatestEntries", async () => {
|
|
1154
|
-
return await listLatestUseCase.execute(model,
|
|
1163
|
+
return await listLatestUseCase.execute(model, {
|
|
1164
|
+
...params,
|
|
1165
|
+
where: params?.where || {},
|
|
1166
|
+
limit: params?.limit || 50,
|
|
1167
|
+
fields: (0, _searchableFields.getSearchableFields)({
|
|
1168
|
+
input: params?.fields || [],
|
|
1169
|
+
plugins: context.plugins,
|
|
1170
|
+
fields: model.fields
|
|
1171
|
+
})
|
|
1172
|
+
});
|
|
1155
1173
|
});
|
|
1156
1174
|
},
|
|
1157
1175
|
async listDeletedEntries(model, params) {
|
|
1158
1176
|
return context.benchmark.measure("headlessCms.crud.entries.listDeletedEntries", async () => {
|
|
1159
|
-
return await listDeletedUseCase.execute(model,
|
|
1177
|
+
return await listDeletedUseCase.execute(model, {
|
|
1178
|
+
...params,
|
|
1179
|
+
where: params?.where || {},
|
|
1180
|
+
limit: params?.limit || 50,
|
|
1181
|
+
fields: (0, _searchableFields.getSearchableFields)({
|
|
1182
|
+
input: params?.fields || [],
|
|
1183
|
+
plugins: context.plugins,
|
|
1184
|
+
fields: model.fields
|
|
1185
|
+
})
|
|
1186
|
+
});
|
|
1160
1187
|
});
|
|
1161
1188
|
},
|
|
1162
1189
|
async listPublishedEntries(model, params) {
|
|
1163
1190
|
return context.benchmark.measure("headlessCms.crud.entries.listPublishedEntries", async () => {
|
|
1164
|
-
return await listPublishedUseCase.execute(model,
|
|
1191
|
+
return await listPublishedUseCase.execute(model, {
|
|
1192
|
+
...params,
|
|
1193
|
+
where: params?.where || {},
|
|
1194
|
+
limit: params?.limit || 50,
|
|
1195
|
+
fields: (0, _searchableFields.getSearchableFields)({
|
|
1196
|
+
input: params?.fields || [],
|
|
1197
|
+
plugins: context.plugins,
|
|
1198
|
+
fields: model.fields
|
|
1199
|
+
})
|
|
1200
|
+
});
|
|
1165
1201
|
});
|
|
1166
1202
|
},
|
|
1167
1203
|
async createEntry(model, input, options) {
|