@webiny/api-headless-cms-ddb-es 6.4.4-beta.0 → 6.4.4-beta.10
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/configurations.d.ts +18 -15
- package/configurations.js +22 -16
- package/configurations.js.map +1 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +4 -4
- package/elasticsearch/createElasticsearchIndex.js +4 -16
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +4 -2
- package/elasticsearch/deleteElasticsearchIndex.js +2 -2
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/exports/api/cms/opensearch.d.ts +1 -1
- package/exports/api/cms/opensearch.js +1 -1
- package/feature.js +13 -7
- package/feature.js.map +1 -1
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.d.ts +25 -0
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js +36 -0
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js.map +1 -0
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.d.ts +8 -0
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js +17 -0
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js.map +1 -0
- package/features/CmsModelOpenSearchIndex/abstractions.d.ts +20 -0
- package/features/CmsModelOpenSearchIndex/abstractions.js +5 -0
- package/features/CmsModelOpenSearchIndex/abstractions.js.map +1 -0
- package/features/{CmsEntryOpenSearchIndex → CmsModelOpenSearchIndex}/feature.d.ts +1 -1
- package/features/CmsModelOpenSearchIndex/feature.js +13 -0
- package/features/CmsModelOpenSearchIndex/feature.js.map +1 -0
- package/features/CmsModelOpenSearchIndex/index.d.ts +3 -0
- package/features/CmsModelOpenSearchIndex/index.js +3 -0
- package/operations/entry/elasticsearch/body.d.ts +2 -1
- package/operations/entry/elasticsearch/body.js +3 -2
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +1 -0
- package/operations/entry/elasticsearch/initialQuery.js +2 -4
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/index.d.ts +2 -0
- package/operations/entry/index.js +11 -10
- package/operations/entry/index.js.map +1 -1
- package/operations/model/index.d.ts +2 -0
- package/operations/model/index.js +2 -18
- package/operations/model/index.js.map +1 -1
- package/package.json +23 -23
- package/tasks/createIndexTaskPlugin.js +14 -23
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +0 -11
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +0 -17
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +0 -14
- package/features/CmsEntryOpenSearchIndex/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchIndex/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchIndex/feature.js +0 -11
- package/features/CmsEntryOpenSearchIndex/feature.js.map +0 -1
- package/features/CmsEntryOpenSearchIndex/index.d.ts +0 -3
- package/features/CmsEntryOpenSearchIndex/index.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "6.4.4-beta.
|
|
3
|
+
"version": "6.4.4-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -30,36 +30,36 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@webiny/api": "6.4.4-beta.
|
|
34
|
-
"@webiny/api-elasticsearch-tasks": "6.4.4-beta.
|
|
35
|
-
"@webiny/api-headless-cms": "6.4.4-beta.
|
|
36
|
-
"@webiny/api-opensearch": "6.4.4-beta.
|
|
37
|
-
"@webiny/aws-sdk": "6.4.4-beta.
|
|
38
|
-
"@webiny/db-dynamodb": "6.4.4-beta.
|
|
39
|
-
"@webiny/error": "6.4.4-beta.
|
|
40
|
-
"@webiny/feature": "6.4.4-beta.
|
|
41
|
-
"@webiny/handler-db": "6.4.4-beta.
|
|
42
|
-
"@webiny/plugins": "6.4.4-beta.
|
|
43
|
-
"@webiny/utils": "6.4.4-beta.
|
|
33
|
+
"@webiny/api": "6.4.4-beta.10",
|
|
34
|
+
"@webiny/api-elasticsearch-tasks": "6.4.4-beta.10",
|
|
35
|
+
"@webiny/api-headless-cms": "6.4.4-beta.10",
|
|
36
|
+
"@webiny/api-opensearch": "6.4.4-beta.10",
|
|
37
|
+
"@webiny/aws-sdk": "6.4.4-beta.10",
|
|
38
|
+
"@webiny/db-dynamodb": "6.4.4-beta.10",
|
|
39
|
+
"@webiny/error": "6.4.4-beta.10",
|
|
40
|
+
"@webiny/feature": "6.4.4-beta.10",
|
|
41
|
+
"@webiny/handler-db": "6.4.4-beta.10",
|
|
42
|
+
"@webiny/plugins": "6.4.4-beta.10",
|
|
43
|
+
"@webiny/utils": "6.4.4-beta.10",
|
|
44
44
|
"dataloader": "2.2.3",
|
|
45
45
|
"lodash": "4.18.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/jsonpack": "1.1.6",
|
|
49
|
-
"@webiny/api-core": "6.4.4-beta.
|
|
50
|
-
"@webiny/api-dynamodb-to-elasticsearch": "6.4.4-beta.
|
|
51
|
-
"@webiny/background-tasks": "6.4.4-beta.
|
|
52
|
-
"@webiny/build-tools": "6.4.4-beta.
|
|
53
|
-
"@webiny/di": "1.0.
|
|
54
|
-
"@webiny/handler": "6.4.4-beta.
|
|
55
|
-
"@webiny/handler-aws": "6.4.4-beta.
|
|
56
|
-
"@webiny/handler-graphql": "6.4.4-beta.
|
|
57
|
-
"@webiny/project-utils": "6.4.4-beta.
|
|
58
|
-
"@webiny/wcp": "6.4.4-beta.
|
|
49
|
+
"@webiny/api-core": "6.4.4-beta.10",
|
|
50
|
+
"@webiny/api-dynamodb-to-elasticsearch": "6.4.4-beta.10",
|
|
51
|
+
"@webiny/background-tasks": "6.4.4-beta.10",
|
|
52
|
+
"@webiny/build-tools": "6.4.4-beta.10",
|
|
53
|
+
"@webiny/di": "1.0.2",
|
|
54
|
+
"@webiny/handler": "6.4.4-beta.10",
|
|
55
|
+
"@webiny/handler-aws": "6.4.4-beta.10",
|
|
56
|
+
"@webiny/handler-graphql": "6.4.4-beta.10",
|
|
57
|
+
"@webiny/project-utils": "6.4.4-beta.10",
|
|
58
|
+
"@webiny/wcp": "6.4.4-beta.10",
|
|
59
59
|
"jest-dynalite": "3.6.1",
|
|
60
60
|
"rimraf": "6.1.3",
|
|
61
61
|
"typescript": "6.0.3",
|
|
62
|
-
"vitest": "4.1.
|
|
62
|
+
"vitest": "4.1.10"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
import { OpensearchTenantIndexFactory } from "@webiny/api-elasticsearch-tasks";
|
|
2
2
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CmsModelOpenSearchIndexProvider } from "../features/CmsModelOpenSearchIndex/index.js";
|
|
4
|
+
import { getOpenSearchIndexPrefix } from "@webiny/api-opensearch";
|
|
5
5
|
class CreateElasticsearchIndexTask {
|
|
6
|
-
constructor(
|
|
7
|
-
this.context = context;
|
|
6
|
+
constructor(listModels, indexProvider){
|
|
8
7
|
this.listModels = listModels;
|
|
8
|
+
this.indexProvider = indexProvider;
|
|
9
9
|
}
|
|
10
|
-
async getIndexList(
|
|
10
|
+
async getIndexList(_tenant) {
|
|
11
11
|
const result = await this.listModels.execute();
|
|
12
12
|
const models = result.value;
|
|
13
13
|
if (0 === models.length) return [];
|
|
14
|
-
const
|
|
15
|
-
const indexes = models.map((model)=>{
|
|
16
|
-
const { index } =
|
|
17
|
-
model
|
|
18
|
-
modelId: model.modelId,
|
|
19
|
-
tenant: tenant.id
|
|
20
|
-
}
|
|
14
|
+
const prefix = getOpenSearchIndexPrefix();
|
|
15
|
+
const indexes = await Promise.all(models.map(async (model)=>{
|
|
16
|
+
const { index, settings } = await this.indexProvider.execute({
|
|
17
|
+
model
|
|
21
18
|
});
|
|
22
19
|
return {
|
|
23
|
-
index,
|
|
24
|
-
settings
|
|
25
|
-
indexConfigs,
|
|
26
|
-
model: {
|
|
27
|
-
modelId: model.modelId,
|
|
28
|
-
tenant: tenant.id,
|
|
29
|
-
group: model.group
|
|
30
|
-
}
|
|
31
|
-
})
|
|
20
|
+
index: prefix ? prefix + index : index,
|
|
21
|
+
settings
|
|
32
22
|
};
|
|
33
|
-
});
|
|
23
|
+
}));
|
|
34
24
|
return indexes;
|
|
35
25
|
}
|
|
36
26
|
}
|
|
37
27
|
const createCreateIndexTask = (context)=>{
|
|
38
28
|
context.container.registerFactory(OpensearchTenantIndexFactory, ()=>{
|
|
39
29
|
const listModels = context.container.resolve(ListModelsUseCase);
|
|
40
|
-
|
|
30
|
+
const indexProvider = context.container.resolve(CmsModelOpenSearchIndexProvider);
|
|
31
|
+
return new CreateElasticsearchIndexTask(listModels, indexProvider);
|
|
41
32
|
});
|
|
42
33
|
};
|
|
43
34
|
export { createCreateIndexTask };
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 type { CmsContext } from \"~/types.js\";\n\nclass CreateElasticsearchIndexTask implements OpensearchTenantIndexFactory.Interface {\n constructor(\n private listModels: ListModelsUseCase.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {}\n\n async getIndexList(_tenant: Tenant): Promise<OpensearchTenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n const models = result.value;\n\n if (models.length === 0) {\n return [];\n }\n\n const prefix = getOpenSearchIndexPrefix();\n\n const indexes = 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 return indexes;\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 return new CreateElasticsearchIndexTask(listModels, indexProvider);\n });\n};\n"],"names":["CreateElasticsearchIndexTask","listModels","indexProvider","_tenant","result","models","prefix","getOpenSearchIndexPrefix","indexes","Promise","model","index","settings","createCreateIndexTask","context","OpensearchTenantIndexFactory","ListModelsUseCase","CmsModelOpenSearchIndexProvider"],"mappings":";;;;AAOA,MAAMA;IACF,YACYC,UAAuC,EACvCC,aAAwD,CAClE;aAFUD,UAAU,GAAVA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,aAAaC,OAAe,EAAuD;QACrF,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAC5C,MAAMC,SAASD,OAAO,KAAK;QAE3B,IAAIC,AAAkB,MAAlBA,OAAO,MAAM,EACb,OAAO,EAAE;QAGb,MAAMC,SAASC;QAEf,MAAMC,UAAU,MAAMC,QAAQ,GAAG,CAC7BJ,OAAO,GAAG,CAAC,OAAMK;YACb,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBAAEF;YAAM;YACrE,OAAO;gBACH,OAAOJ,SAASA,SAASK,QAAQA;gBACjCC;YACJ;QACJ;QAGJ,OAAOJ;IACX;AACJ;AAEO,MAAMK,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,OAAO,IAAIjB,6BAA6BC,YAAYC;IACxD;AACJ"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CmsEntryOpenSearchIndex } from "./abstractions.js";
|
|
2
|
-
import type { OpenSearchIndexRequestBody } from "@webiny/api-opensearch/types.js";
|
|
3
|
-
declare class BaseOpenSearchIndexImpl implements CmsEntryOpenSearchIndex.Interface {
|
|
4
|
-
readonly body: OpenSearchIndexRequestBody;
|
|
5
|
-
constructor();
|
|
6
|
-
canUse(_: CmsEntryOpenSearchIndex.CanUseParams): boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const BaseOpenSearchIndex: typeof BaseOpenSearchIndexImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICmsEntryOpenSearchIndex>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getBaseConfiguration } from "@webiny/api-opensearch";
|
|
2
|
-
import { CmsEntryOpenSearchIndex } from "./abstractions.js";
|
|
3
|
-
class BaseOpenSearchIndexImpl {
|
|
4
|
-
constructor(){
|
|
5
|
-
this.body = getBaseConfiguration();
|
|
6
|
-
}
|
|
7
|
-
canUse(_) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
const BaseOpenSearchIndex = CmsEntryOpenSearchIndex.createImplementation({
|
|
12
|
-
implementation: BaseOpenSearchIndexImpl,
|
|
13
|
-
dependencies: []
|
|
14
|
-
});
|
|
15
|
-
export { BaseOpenSearchIndex };
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=BaseOpenSearchIndex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js","sources":["../../../src/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.ts"],"sourcesContent":["import { getBaseConfiguration } from \"@webiny/api-opensearch\";\nimport { CmsEntryOpenSearchIndex } from \"./abstractions.js\";\nimport type { OpenSearchIndexRequestBody } from \"@webiny/api-opensearch/types.js\";\n\nclass BaseOpenSearchIndexImpl implements CmsEntryOpenSearchIndex.Interface {\n public readonly body: OpenSearchIndexRequestBody;\n\n public constructor() {\n this.body = getBaseConfiguration();\n }\n public canUse(_: CmsEntryOpenSearchIndex.CanUseParams): boolean {\n return true;\n }\n}\n\nexport const BaseOpenSearchIndex = CmsEntryOpenSearchIndex.createImplementation({\n implementation: BaseOpenSearchIndexImpl,\n dependencies: []\n});\n"],"names":["BaseOpenSearchIndexImpl","getBaseConfiguration","_","BaseOpenSearchIndex","CmsEntryOpenSearchIndex"],"mappings":";;AAIA,MAAMA;IAGF,aAAqB;QACjB,IAAI,CAAC,IAAI,GAAGC;IAChB;IACO,OAAOC,CAAuC,EAAW;QAC5D,OAAO;IACX;AACJ;AAEO,MAAMC,sBAAsBC,wBAAwB,oBAAoB,CAAC;IAC5E,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { OpenSearchIndexRequestBody } from "@webiny/api-opensearch/types.js";
|
|
2
|
-
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
-
export interface ICmsEntryOpenSearchIndexCanUseParams {
|
|
4
|
-
model: Pick<CmsModel, "tenant" | "modelId" | "group">;
|
|
5
|
-
}
|
|
6
|
-
export interface ICmsEntryOpenSearchIndex {
|
|
7
|
-
readonly body: OpenSearchIndexRequestBody;
|
|
8
|
-
canUse(params: ICmsEntryOpenSearchIndexCanUseParams): boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const CmsEntryOpenSearchIndex: import("@webiny/di").Abstraction<ICmsEntryOpenSearchIndex>;
|
|
11
|
-
export declare namespace CmsEntryOpenSearchIndex {
|
|
12
|
-
type Interface = ICmsEntryOpenSearchIndex;
|
|
13
|
-
type CanUseParams = ICmsEntryOpenSearchIndexCanUseParams;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CmsEntryOpenSearchIndex/abstractions.js","sources":["../../../src/features/CmsEntryOpenSearchIndex/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { OpenSearchIndexRequestBody } from \"@webiny/api-opensearch/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface ICmsEntryOpenSearchIndexCanUseParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\" | \"group\">;\n}\n\nexport interface ICmsEntryOpenSearchIndex {\n readonly body: OpenSearchIndexRequestBody;\n canUse(params: ICmsEntryOpenSearchIndexCanUseParams): boolean;\n}\n\nexport const CmsEntryOpenSearchIndex = createAbstraction<ICmsEntryOpenSearchIndex>(\n \"Cms/Entry/OpenSearch/Index\"\n);\n\nexport namespace CmsEntryOpenSearchIndex {\n export type Interface = ICmsEntryOpenSearchIndex;\n export type CanUseParams = ICmsEntryOpenSearchIndexCanUseParams;\n}\n"],"names":["CmsEntryOpenSearchIndex","createAbstraction"],"mappings":";AAaO,MAAMA,0BAA0BC,kBACnC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { BaseOpenSearchIndex } from "./BaseOpenSearchIndex.js";
|
|
3
|
-
const CmsEntryOpenSearchIndexFeature = createFeature({
|
|
4
|
-
name: "Cms/Entry/OpenSearch/IndexFeature",
|
|
5
|
-
register: (container)=>{
|
|
6
|
-
container.register(BaseOpenSearchIndex);
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export { CmsEntryOpenSearchIndexFeature };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CmsEntryOpenSearchIndex/feature.js","sources":["../../../src/features/CmsEntryOpenSearchIndex/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { BaseOpenSearchIndex } from \"./BaseOpenSearchIndex.js\";\n\nexport const CmsEntryOpenSearchIndexFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/IndexFeature\",\n register: container => {\n container.register(BaseOpenSearchIndex);\n }\n});\n"],"names":["CmsEntryOpenSearchIndexFeature","createFeature","container","BaseOpenSearchIndex"],"mappings":";;AAGO,MAAMA,iCAAiCC,cAAc;IACxD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|