@webiny/api-headless-cms-ddb-es 6.4.12-beta.4 → 6.5.0-beta.0
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/exports/api/cms/opensearch.d.ts +1 -1
- package/exports/api/cms/opensearch.js +1 -1
- package/feature.js +29 -15
- package/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +4 -4
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +11 -2
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +1 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -1
- package/helpers/fieldIdentifier.js +2 -2
- package/helpers/fieldIdentifier.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +2 -2
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
- package/operations/entry/elasticsearch/body.d.ts +5 -3
- package/operations/entry/elasticsearch/body.js +4 -3
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +3 -3
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +2 -2
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +2 -2
- package/operations/entry/elasticsearch/filtering/exec.js +7 -6
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.js +2 -2
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.js +2 -2
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/operator.js +3 -6
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/sort.d.ts +4 -1
- package/operations/entry/elasticsearch/sort.js +5 -5
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/types.d.ts +3 -6
- package/operations/entry/index.d.ts +4 -3
- package/operations/entry/index.js +40 -18
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +1 -1
- package/package.json +24 -24
- package/tasks/CreateElasticsearchIndexTask.d.ts +16 -0
- package/tasks/{createIndexTaskPlugin.js → CreateElasticsearchIndexTask.js} +25 -20
- package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
- package/types.d.ts +4 -7
- package/types.js.map +1 -1
- package/debuggerNamespaces.d.ts +0 -12
- package/debuggerNamespaces.js +0 -0
- package/tasks/createIndexTaskPlugin.d.ts +0 -2
- package/tasks/createIndexTaskPlugin.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OpenSearchTenantIndexFactory } from "@webiny/api-elasticsearch-tasks";
|
|
2
|
+
import type { Tenant } from "@webiny/api-core/types/tenancy.js";
|
|
3
|
+
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
4
|
+
import { CmsModelOpenSearchIndexProvider } from "../features/CmsModelOpenSearchIndex/index.js";
|
|
5
|
+
import { Logger } from "@webiny/api-core/exports/api/logger.js";
|
|
6
|
+
declare class CreateElasticsearchIndexTaskImpl implements OpenSearchTenantIndexFactory.Interface {
|
|
7
|
+
private readonly indexProvider;
|
|
8
|
+
private listModels;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(indexProvider: CmsModelOpenSearchIndexProvider.Interface, listModels: ListModelsUseCase.Interface, logger: Logger.Interface);
|
|
11
|
+
getIndexList(tenant: Tenant): Promise<OpenSearchTenantIndexFactory.IndexConfig[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare const CreateElasticsearchIndexTask: typeof CreateElasticsearchIndexTaskImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-elasticsearch-tasks/abstractions/OpenSearchTenantIndexFactory").IOpenSearchTenantIndexFactory>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenSearchTenantIndexFactory } from "@webiny/api-elasticsearch-tasks";
|
|
2
2
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
3
3
|
import { CmsModelOpenSearchIndexProvider } from "../features/CmsModelOpenSearchIndex/index.js";
|
|
4
4
|
import { getOpenSearchIndexPrefix } from "@webiny/api-opensearch";
|
|
5
5
|
import { Logger } from "@webiny/api-core/exports/api/logger.js";
|
|
6
|
-
class
|
|
7
|
-
constructor(
|
|
8
|
-
this.listModels = listModels;
|
|
6
|
+
class CreateElasticsearchIndexTaskImpl {
|
|
7
|
+
constructor(indexProvider, listModels, logger){
|
|
9
8
|
this.indexProvider = indexProvider;
|
|
9
|
+
this.listModels = listModels;
|
|
10
10
|
this.logger = logger;
|
|
11
11
|
}
|
|
12
|
-
async getIndexList(
|
|
12
|
+
async getIndexList(tenant) {
|
|
13
13
|
const result = await this.listModels.execute();
|
|
14
14
|
if (result.isFail()) {
|
|
15
15
|
this.logger.error(result.error);
|
|
@@ -18,25 +18,30 @@ class CreateElasticsearchIndexTask {
|
|
|
18
18
|
const models = result.value;
|
|
19
19
|
if (0 === models.length) return [];
|
|
20
20
|
const prefix = getOpenSearchIndexPrefix();
|
|
21
|
-
|
|
21
|
+
const configs = [];
|
|
22
|
+
for (const model of models){
|
|
22
23
|
const { index, settings } = await this.indexProvider.execute({
|
|
23
|
-
model
|
|
24
|
+
model: {
|
|
25
|
+
...model,
|
|
26
|
+
tenant: tenant.id
|
|
27
|
+
}
|
|
24
28
|
});
|
|
25
|
-
|
|
29
|
+
configs.push({
|
|
26
30
|
index: prefix ? prefix + index : index,
|
|
27
31
|
settings
|
|
28
|
-
};
|
|
29
|
-
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return configs;
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
37
|
+
const CreateElasticsearchIndexTask = OpenSearchTenantIndexFactory.createImplementation({
|
|
38
|
+
implementation: CreateElasticsearchIndexTaskImpl,
|
|
39
|
+
dependencies: [
|
|
40
|
+
CmsModelOpenSearchIndexProvider,
|
|
41
|
+
ListModelsUseCase,
|
|
42
|
+
Logger
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
export { CreateElasticsearchIndexTask };
|
|
41
46
|
|
|
42
|
-
//# sourceMappingURL=
|
|
47
|
+
//# sourceMappingURL=CreateElasticsearchIndexTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks/CreateElasticsearchIndexTask.js","sources":["../../src/tasks/CreateElasticsearchIndexTask.ts"],"sourcesContent":["import { OpenSearchTenantIndexFactory } from \"@webiny/api-elasticsearch-tasks\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"~/features/CmsModelOpenSearchIndex/index.js\";\nimport { getOpenSearchIndexPrefix } from \"@webiny/api-opensearch\";\nimport { Logger } from \"@webiny/api-core/exports/api/logger.js\";\n\nclass CreateElasticsearchIndexTaskImpl implements OpenSearchTenantIndexFactory.Interface {\n constructor(\n private readonly indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private listModels: ListModelsUseCase.Interface,\n private readonly logger: Logger.Interface\n ) {}\n\n async getIndexList(tenant: Tenant): Promise<OpenSearchTenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n if (result.isFail()) {\n this.logger.error(result.error);\n return [];\n }\n const models = result.value;\n\n if (models.length === 0) {\n return [];\n }\n\n const prefix = getOpenSearchIndexPrefix();\n const configs: OpenSearchTenantIndexFactory.IndexConfig[] = [];\n\n for (const model of models) {\n const { index, settings } = await this.indexProvider.execute({\n model: {\n ...model,\n tenant: tenant.id\n }\n });\n\n configs.push({\n index: prefix ? prefix + index : index,\n settings\n });\n }\n\n return configs;\n }\n}\n\nexport const CreateElasticsearchIndexTask = OpenSearchTenantIndexFactory.createImplementation({\n implementation: CreateElasticsearchIndexTaskImpl,\n dependencies: [CmsModelOpenSearchIndexProvider, ListModelsUseCase, Logger]\n});\n"],"names":["CreateElasticsearchIndexTaskImpl","indexProvider","listModels","logger","tenant","result","models","prefix","getOpenSearchIndexPrefix","configs","model","index","settings","CreateElasticsearchIndexTask","OpenSearchTenantIndexFactory","CmsModelOpenSearchIndexProvider","ListModelsUseCase","Logger"],"mappings":";;;;;AAOA,MAAMA;IACF,YACqBC,aAAwD,EACjEC,UAAuC,EAC9BC,MAAwB,CAC3C;aAHmBF,aAAa,GAAbA;aACTC,UAAU,GAAVA;aACSC,MAAM,GAANA;IAClB;IAEH,MAAM,aAAaC,MAAc,EAAuD;QACpF,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAC5C,IAAIA,OAAO,MAAM,IAAI;YACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAACA,OAAO,KAAK;YAC9B,OAAO,EAAE;QACb;QACA,MAAMC,SAASD,OAAO,KAAK;QAE3B,IAAIC,AAAkB,MAAlBA,OAAO,MAAM,EACb,OAAO,EAAE;QAGb,MAAMC,SAASC;QACf,MAAMC,UAAsD,EAAE;QAE9D,KAAK,MAAMC,SAASJ,OAAQ;YACxB,MAAM,EAAEK,KAAK,EAAEC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBACzD,OAAO;oBACH,GAAGF,KAAK;oBACR,QAAQN,OAAO,EAAE;gBACrB;YACJ;YAEAK,QAAQ,IAAI,CAAC;gBACT,OAAOF,SAASA,SAASI,QAAQA;gBACjCC;YACJ;QACJ;QAEA,OAAOH;IACX;AACJ;AAEO,MAAMI,+BAA+BC,6BAA6B,oBAAoB,CAAC;IAC1F,gBAAgBd;IAChB,cAAc;QAACe;QAAiCC;QAAmBC;KAAO;AAC9E"}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type { CmsContext
|
|
2
|
-
import type {
|
|
3
|
-
import type { Client, IOpenSearchEntity as IElasticsearchEntity, OpenSearchContext } from "@webiny/api-opensearch";
|
|
4
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
1
|
+
import type { CmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsEntryValues, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { Client, IOpenSearchEntity as IElasticsearchEntity } from "@webiny/api-opensearch";
|
|
5
3
|
import type { IEntryEntity, IGroupEntity, IModelEntity } from "./definitions/types.js";
|
|
6
4
|
import type { ITable } from "@webiny/db-dynamodb";
|
|
7
|
-
|
|
8
|
-
}
|
|
5
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
6
|
+
export { CmsContext };
|
|
9
7
|
/**
|
|
10
8
|
* A definition of the entry that is being prepared for the Elasticsearch.
|
|
11
9
|
*
|
|
@@ -29,7 +27,6 @@ export declare enum ENTITIES {
|
|
|
29
27
|
ENTRIES_ES = "CmsEntriesElasticsearch"
|
|
30
28
|
}
|
|
31
29
|
export interface StorageOperationsFactoryParams {
|
|
32
|
-
documentClient: DynamoDBDocument;
|
|
33
30
|
elasticsearch: Client;
|
|
34
31
|
table?: string;
|
|
35
32
|
esTable?: string;
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsEntryValues,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { Client, IOpenSearchEntity as IElasticsearchEntity } from \"@webiny/api-opensearch\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\nexport { CmsContext };\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Partial<T>;\n /**\n * Dev can add whatever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface StorageOperationsFactoryParams {\n elasticsearch: Client;\n table?: string;\n esTable?: string;\n plugins: PluginsContainer;\n container: CmsContext[\"container\"];\n}\n\nexport interface IGetEntitiesResponse {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n entriesEs: IElasticsearchEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => ITable;\n getEsTable: () => ITable;\n getEntities: () => IGetEntitiesResponse;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AA8BO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;;WAARA"}
|
package/debuggerNamespaces.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claims the `cms.` debug namespace prefix.
|
|
3
|
-
*
|
|
4
|
-
* The module specifier has to be exactly this one - augmenting a relative path would silently do
|
|
5
|
-
* nothing.
|
|
6
|
-
*/
|
|
7
|
-
declare module "@webiny/api-core/features/debugger/abstractions.js" {
|
|
8
|
-
interface DebugNamespaces {
|
|
9
|
-
cms: `cms.${string}`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {};
|
package/debuggerNamespaces.js
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks/createIndexTaskPlugin.js","sources":["../../src/tasks/createIndexTaskPlugin.ts"],"sourcesContent":["import { OpensearchTenantIndexFactory } from \"@webiny/api-elasticsearch-tasks\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"~/features/CmsModelOpenSearchIndex/index.js\";\nimport { getOpenSearchIndexPrefix } from \"@webiny/api-opensearch\";\nimport { Logger } from \"@webiny/api-core/exports/api/logger.js\";\nimport type { CmsContext } from \"~/types.js\";\n\nclass CreateElasticsearchIndexTask implements OpensearchTenantIndexFactory.Interface {\n constructor(\n private listModels: ListModelsUseCase.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private logger: Logger.Interface\n ) {}\n\n async getIndexList(_tenant: Tenant): Promise<OpensearchTenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n if (result.isFail()) {\n this.logger.error(result.error);\n return [];\n }\n const models = result.value;\n\n if (models.length === 0) {\n return [];\n }\n\n const prefix = getOpenSearchIndexPrefix();\n\n return await Promise.all(\n models.map(async model => {\n const { index, settings } = await this.indexProvider.execute({ model });\n return {\n index: prefix ? prefix + index : index,\n settings\n };\n })\n );\n }\n}\n\nexport const createCreateIndexTask = (context: CmsContext) => {\n context.container.registerFactory(OpensearchTenantIndexFactory, () => {\n const listModels = context.container.resolve(ListModelsUseCase);\n const indexProvider = context.container.resolve(CmsModelOpenSearchIndexProvider);\n const logger = context.container.resolve(Logger);\n return new CreateElasticsearchIndexTask(listModels, indexProvider, logger);\n });\n};\n"],"names":["CreateElasticsearchIndexTask","listModels","indexProvider","logger","_tenant","result","models","prefix","getOpenSearchIndexPrefix","Promise","model","index","settings","createCreateIndexTask","context","OpensearchTenantIndexFactory","ListModelsUseCase","CmsModelOpenSearchIndexProvider","Logger"],"mappings":";;;;;AAQA,MAAMA;IACF,YACYC,UAAuC,EACvCC,aAAwD,EACxDC,MAAwB,CAClC;aAHUF,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;IACT;IAEH,MAAM,aAAaC,OAAe,EAAuD;QACrF,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAC5C,IAAIA,OAAO,MAAM,IAAI;YACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAACA,OAAO,KAAK;YAC9B,OAAO,EAAE;QACb;QACA,MAAMC,SAASD,OAAO,KAAK;QAE3B,IAAIC,AAAkB,MAAlBA,OAAO,MAAM,EACb,OAAO,EAAE;QAGb,MAAMC,SAASC;QAEf,OAAO,MAAMC,QAAQ,GAAG,CACpBH,OAAO,GAAG,CAAC,OAAMI;YACb,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBAAEF;YAAM;YACrE,OAAO;gBACH,OAAOH,SAASA,SAASI,QAAQA;gBACjCC;YACJ;QACJ;IAER;AACJ;AAEO,MAAMC,wBAAwB,CAACC;IAClCA,QAAQ,SAAS,CAAC,eAAe,CAACC,8BAA8B;QAC5D,MAAMd,aAAaa,QAAQ,SAAS,CAAC,OAAO,CAACE;QAC7C,MAAMd,gBAAgBY,QAAQ,SAAS,CAAC,OAAO,CAACG;QAChD,MAAMd,SAASW,QAAQ,SAAS,CAAC,OAAO,CAACI;QACzC,OAAO,IAAIlB,6BAA6BC,YAAYC,eAAeC;IACvE;AACJ"}
|