@webiny/api-headless-cms-ddb-es 6.6.0-alpha.13 → 6.6.0-alpha.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.
- package/feature.d.ts +4 -4
- package/feature.js +4 -60
- package/feature.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +24 -24
- package/registry/CmsEntitiesDbRegistryDecorator.d.ts +4 -4
- package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -1
- package/storageFeature.d.ts +12 -0
- package/storageFeature.js +25 -0
- package/storageFeature.js.map +1 -0
- package/tablesFeature.d.ts +8 -0
- package/tablesFeature.js +53 -0
- package/tablesFeature.js.map +1 -0
package/feature.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DynamoDB+OpenSearch CMS storage
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* DynamoDB+OpenSearch CMS storage in one container: the tables and entities, and the storage. A
|
|
3
|
+
* composition registers the two apart: the tables and entities once, in the root
|
|
4
|
+
* (`HeadlessCmsDdbEsTablesFeature`), and the storage in each tenant scope on this storage
|
|
5
|
+
* (`HeadlessCmsDdbEsStorageFeature`).
|
|
6
6
|
*/
|
|
7
7
|
export declare const HeadlessCmsDdbEsFeature: {
|
|
8
8
|
name: string;
|
package/feature.js
CHANGED
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
import { DynamoDBClient, createTable } from "@webiny/db-dynamodb";
|
|
2
|
-
import { ENTITIES } from "./types.js";
|
|
3
1
|
import { createFeature } from "@webiny/feature/api/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { createEntryEntity } from "./definitions/entry.js";
|
|
7
|
-
import { createOpenSearchEntity, createOpenSearchTable } from "@webiny/api-opensearch-aws";
|
|
8
|
-
import { FilterUtilFeature } from "@webiny/db-dynamodb/feature/FilterUtil/feature.js";
|
|
9
|
-
import { CmsDdbEsTable } from "./abstractions/CmsDdbEsTable.js";
|
|
10
|
-
import { CmsDdbEsOsTable } from "./abstractions/CmsDdbEsOsTable.js";
|
|
11
|
-
import { CmsDdbEsGroupEntity } from "./abstractions/CmsDdbEsGroupEntity.js";
|
|
12
|
-
import { CmsDdbEsModelEntity } from "./abstractions/CmsDdbEsModelEntity.js";
|
|
13
|
-
import { CmsDdbEsEntryEntity } from "./abstractions/CmsDdbEsEntryEntity.js";
|
|
14
|
-
import { CmsDdbEsEntriesEsEntity } from "./abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
15
|
-
import { CmsEntryOpenSearchUtilsFeature } from "@webiny/api-headless-cms-utils-os";
|
|
16
|
-
import { FilterRegistriesFeature } from "@webiny/api-headless-cms-storage";
|
|
17
|
-
import { CreateElasticsearchIndexTask } from "./tasks/CreateElasticsearchIndexTask.js";
|
|
18
|
-
import { CmsEntitiesDbRegistryDecorator } from "./registry/CmsEntitiesDbRegistryDecorator.js";
|
|
19
|
-
import { DdbEsGroupStorageOpsFeature } from "./operations/group/feature.js";
|
|
20
|
-
import { DdbEsModelStorageOpsFeature } from "./operations/model/feature.js";
|
|
21
|
-
import { DdbEsEntryStorageOpsFeature } from "./operations/entry/feature.js";
|
|
2
|
+
import { HeadlessCmsDdbEsTablesFeature } from "./tablesFeature.js";
|
|
3
|
+
import { HeadlessCmsDdbEsStorageFeature } from "./storageFeature.js";
|
|
22
4
|
const HeadlessCmsDdbEsFeature = createFeature({
|
|
23
5
|
name: "cms.storageOperations.openSearch",
|
|
24
6
|
register: (container)=>{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const documentClient = db.client;
|
|
28
|
-
const tableInstance = createTable({
|
|
29
|
-
name: process.env.DB_TABLE,
|
|
30
|
-
documentClient
|
|
31
|
-
});
|
|
32
|
-
const tableElasticsearchInstance = createOpenSearchTable({
|
|
33
|
-
name: process.env.DB_TABLE_OPENSEARCH,
|
|
34
|
-
documentClient
|
|
35
|
-
});
|
|
36
|
-
const groupEntity = createGroupEntity({
|
|
37
|
-
entityName: ENTITIES.GROUPS,
|
|
38
|
-
table: tableInstance
|
|
39
|
-
});
|
|
40
|
-
const modelEntity = createModelEntity({
|
|
41
|
-
entityName: ENTITIES.MODELS,
|
|
42
|
-
table: tableInstance
|
|
43
|
-
});
|
|
44
|
-
const entryEntity = createEntryEntity({
|
|
45
|
-
entityName: ENTITIES.ENTRIES,
|
|
46
|
-
table: tableInstance
|
|
47
|
-
});
|
|
48
|
-
const entriesEsEntity = createOpenSearchEntity({
|
|
49
|
-
entityName: ENTITIES.ENTRIES_ES,
|
|
50
|
-
table: tableElasticsearchInstance
|
|
51
|
-
});
|
|
52
|
-
container.registerInstance(CmsDdbEsTable, tableInstance);
|
|
53
|
-
container.registerInstance(CmsDdbEsOsTable, tableElasticsearchInstance);
|
|
54
|
-
container.registerInstance(CmsDdbEsGroupEntity, groupEntity);
|
|
55
|
-
container.registerInstance(CmsDdbEsModelEntity, modelEntity);
|
|
56
|
-
container.registerInstance(CmsDdbEsEntryEntity, entryEntity);
|
|
57
|
-
container.registerInstance(CmsDdbEsEntriesEsEntity, entriesEsEntity);
|
|
58
|
-
CmsEntryOpenSearchUtilsFeature.register(container);
|
|
59
|
-
FilterRegistriesFeature.register(container);
|
|
60
|
-
container.register(CreateElasticsearchIndexTask);
|
|
61
|
-
container.registerDecorator(CmsEntitiesDbRegistryDecorator);
|
|
62
|
-
DdbEsGroupStorageOpsFeature.register(container);
|
|
63
|
-
DdbEsModelStorageOpsFeature.register(container);
|
|
64
|
-
DdbEsEntryStorageOpsFeature.register(container);
|
|
7
|
+
HeadlessCmsDdbEsTablesFeature.register(container);
|
|
8
|
+
HeadlessCmsDdbEsStorageFeature.register(container);
|
|
65
9
|
}
|
|
66
10
|
});
|
|
67
11
|
export { HeadlessCmsDdbEsFeature };
|
package/feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.js","sources":["../src/feature.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"feature.js","sources":["../src/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { HeadlessCmsDdbEsTablesFeature } from \"./tablesFeature.js\";\nimport { HeadlessCmsDdbEsStorageFeature } from \"./storageFeature.js\";\n\n/**\n * DynamoDB+OpenSearch CMS storage in one container: the tables and entities, and the storage. A\n * composition registers the two apart: the tables and entities once, in the root\n * (`HeadlessCmsDdbEsTablesFeature`), and the storage in each tenant scope on this storage\n * (`HeadlessCmsDdbEsStorageFeature`).\n */\nexport const HeadlessCmsDdbEsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n HeadlessCmsDdbEsTablesFeature.register(container);\n HeadlessCmsDdbEsStorageFeature.register(container);\n }\n});\n"],"names":["HeadlessCmsDdbEsFeature","createFeature","container","HeadlessCmsDdbEsTablesFeature","HeadlessCmsDdbEsStorageFeature"],"mappings":";;;AAUO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAAUC,CAAAA;QACNC,8BAA8B,QAAQ,CAACD;QACvCE,+BAA+B,QAAQ,CAACF;IAC5C;AACJ"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.14",
|
|
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.6.0-alpha.
|
|
34
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
35
|
-
"@webiny/api-headless-cms": "6.6.0-alpha.
|
|
36
|
-
"@webiny/api-headless-cms-storage": "6.6.0-alpha.
|
|
37
|
-
"@webiny/api-headless-cms-utils-os": "6.6.0-alpha.
|
|
38
|
-
"@webiny/api-opensearch": "6.6.0-alpha.
|
|
39
|
-
"@webiny/api-opensearch-aws": "6.6.0-alpha.
|
|
40
|
-
"@webiny/api-search-index-tasks": "6.6.0-alpha.
|
|
41
|
-
"@webiny/db": "6.6.0-alpha.
|
|
42
|
-
"@webiny/db-dynamodb": "6.6.0-alpha.
|
|
43
|
-
"@webiny/error": "6.6.0-alpha.
|
|
44
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
45
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
33
|
+
"@webiny/api": "6.6.0-alpha.14",
|
|
34
|
+
"@webiny/api-core": "6.6.0-alpha.14",
|
|
35
|
+
"@webiny/api-headless-cms": "6.6.0-alpha.14",
|
|
36
|
+
"@webiny/api-headless-cms-storage": "6.6.0-alpha.14",
|
|
37
|
+
"@webiny/api-headless-cms-utils-os": "6.6.0-alpha.14",
|
|
38
|
+
"@webiny/api-opensearch": "6.6.0-alpha.14",
|
|
39
|
+
"@webiny/api-opensearch-aws": "6.6.0-alpha.14",
|
|
40
|
+
"@webiny/api-search-index-tasks": "6.6.0-alpha.14",
|
|
41
|
+
"@webiny/db": "6.6.0-alpha.14",
|
|
42
|
+
"@webiny/db-dynamodb": "6.6.0-alpha.14",
|
|
43
|
+
"@webiny/error": "6.6.0-alpha.14",
|
|
44
|
+
"@webiny/feature": "6.6.0-alpha.14",
|
|
45
|
+
"@webiny/plugins": "6.6.0-alpha.14",
|
|
46
46
|
"@webiny/stdlib": "0.0.21",
|
|
47
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
47
|
+
"@webiny/utils": "6.6.0-alpha.14",
|
|
48
48
|
"dataloader": "2.2.3",
|
|
49
49
|
"lodash": "4.18.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/jsonpack": "1.1.6",
|
|
53
|
-
"@webiny/api-core-testing": "6.6.0-alpha.
|
|
54
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
55
|
-
"@webiny/api-kernel-core": "6.6.0-alpha.
|
|
56
|
-
"@webiny/api-search-index-tasks-ddb-os": "6.6.0-alpha.
|
|
57
|
-
"@webiny/api-sync-ddb-to-opensearch": "6.6.0-alpha.
|
|
58
|
-
"@webiny/background-tasks": "6.6.0-alpha.
|
|
59
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
53
|
+
"@webiny/api-core-testing": "6.6.0-alpha.14",
|
|
54
|
+
"@webiny/api-graphql": "6.6.0-alpha.14",
|
|
55
|
+
"@webiny/api-kernel-core": "6.6.0-alpha.14",
|
|
56
|
+
"@webiny/api-search-index-tasks-ddb-os": "6.6.0-alpha.14",
|
|
57
|
+
"@webiny/api-sync-ddb-to-opensearch": "6.6.0-alpha.14",
|
|
58
|
+
"@webiny/background-tasks": "6.6.0-alpha.14",
|
|
59
|
+
"@webiny/build-tools": "6.6.0-alpha.14",
|
|
60
60
|
"@webiny/di": "2.0.0",
|
|
61
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
62
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
61
|
+
"@webiny/handler": "6.6.0-alpha.14",
|
|
62
|
+
"@webiny/wcp": "6.6.0-alpha.14",
|
|
63
63
|
"jest-dynalite": "3.6.1",
|
|
64
64
|
"rimraf": "6.1.4",
|
|
65
65
|
"typescript": "7.0.2",
|
|
@@ -8,10 +8,10 @@ import { CmsDdbEsEntriesEsEntity } from "../abstractions/CmsDdbEsEntriesEsEntity
|
|
|
8
8
|
* DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the
|
|
9
9
|
* OpenSearch entries entity), so every one of those registries needs them.
|
|
10
10
|
*
|
|
11
|
-
* The CMS storage
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The CMS storage registers this decorator in each tenant scope on its storage (a scope on another
|
|
12
|
+
* storage gets none). Decorators on a container-scoped registration apply to every instance as it is
|
|
13
|
+
* built, so this constructor runs once per scope's registry and adds the two entities. Every other
|
|
14
|
+
* call passes through to the registry.
|
|
15
15
|
*/
|
|
16
16
|
declare class CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {
|
|
17
17
|
private readonly decoratee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry/CmsEntitiesDbRegistryDecorator.js","sources":["../../src/registry/CmsEntitiesDbRegistryDecorator.ts"],"sourcesContent":["import { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * Adds the CMS entities to every request's DbRegistry.\n *\n * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The\n * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the\n * OpenSearch entries entity), so every one of those registries needs them.\n *\n * The CMS storage
|
|
1
|
+
{"version":3,"file":"registry/CmsEntitiesDbRegistryDecorator.js","sources":["../../src/registry/CmsEntitiesDbRegistryDecorator.ts"],"sourcesContent":["import { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * Adds the CMS entities to every request's DbRegistry.\n *\n * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The\n * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the\n * OpenSearch entries entity), so every one of those registries needs them.\n *\n * The CMS storage registers this decorator in each tenant scope on its storage (a scope on another\n * storage gets none). Decorators on a container-scoped registration apply to every instance as it is\n * built, so this constructor runs once per scope's registry and adds the two entities. Every other\n * call passes through to the registry.\n */\nclass CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {\n public constructor(\n entryEntity: CmsDdbEsEntryEntity.Interface,\n entriesEsEntity: CmsDdbEsEntriesEsEntity.Interface,\n private readonly decoratee: DbRegistry.Interface\n ) {\n decoratee.register({\n item: entryEntity,\n app: \"cms\",\n tags: [\"regular\", entryEntity.name]\n });\n decoratee.register({\n item: entriesEsEntity,\n app: \"cms\",\n tags: [\"es\", entriesEsEntity.name]\n });\n }\n\n public register<T = unknown>(params: DbRegistry.RegisterParams<T>): void {\n this.decoratee.register(params);\n }\n\n public getOneItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> {\n return this.decoratee.getOneItem(cb);\n }\n\n public getItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> | null {\n return this.decoratee.getItem(cb);\n }\n\n public getItems<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T>[] {\n return this.decoratee.getItems(cb);\n }\n}\n\nexport const CmsEntitiesDbRegistryDecorator = DbRegistry.createDecorator({\n decorator: CmsEntitiesDbRegistryDecoratorImpl,\n dependencies: [CmsDdbEsEntryEntity, CmsDdbEsEntriesEsEntity]\n});\n"],"names":["CmsEntitiesDbRegistryDecoratorImpl","entryEntity","entriesEsEntity","decoratee","params","cb","CmsEntitiesDbRegistryDecorator","DbRegistry","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity"],"mappings":";;;AAgBA,MAAMA;IACF,YACIC,WAA0C,EAC1CC,eAAkD,EACjCC,SAA+B,CAClD;aADmBA,SAAS,GAATA;QAEjBA,UAAU,QAAQ,CAAC;YACf,MAAMF;YACN,KAAK;YACL,MAAM;gBAAC;gBAAWA,YAAY,IAAI;aAAC;QACvC;QACAE,UAAU,QAAQ,CAAC;YACf,MAAMD;YACN,KAAK;YACL,MAAM;gBAAC;gBAAMA,gBAAgB,IAAI;aAAC;QACtC;IACJ;IAEO,SAAsBE,MAAoC,EAAQ;QACrE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IAC5B;IAEO,WACHC,EAAiD,EACvB;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAACA;IACrC;IAEO,QACHA,EAAiD,EAChB;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAClC;IAEO,SACHA,EAAiD,EACrB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IACnC;AACJ;AAEO,MAAMC,iCAAiCC,WAAW,eAAe,CAAC;IACrE,WAAWP;IACX,cAAc;QAACQ;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DynamoDB+OpenSearch CMS storage of a tenant scope: the storage operations, the per-scope state
|
|
3
|
+
* (the entry DataLoaders, the filter registries, the OpenSearch field indexes and model index cache),
|
|
4
|
+
* the index creation task and the decorator that adds the CMS entities to the scope's `DbRegistry`
|
|
5
|
+
* for the DDB to OpenSearch sync. They run on the tables and entities the root holds
|
|
6
|
+
* (`HeadlessCmsDdbEsTablesFeature`) and the OpenSearch core. Registered in each scope on this storage,
|
|
7
|
+
* so a scope on another storage gets none of them.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HeadlessCmsDdbEsStorageFeature: {
|
|
10
|
+
name: string;
|
|
11
|
+
register(container: import("@webiny/di").Container): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
2
|
+
import { FilterUtilFeature } from "@webiny/db-dynamodb/feature/FilterUtil/feature.js";
|
|
3
|
+
import { CmsEntryOpenSearchUtilsFeature } from "@webiny/api-headless-cms-utils-os";
|
|
4
|
+
import { FilterRegistriesFeature } from "@webiny/api-headless-cms-storage";
|
|
5
|
+
import { CreateElasticsearchIndexTask } from "./tasks/CreateElasticsearchIndexTask.js";
|
|
6
|
+
import { CmsEntitiesDbRegistryDecorator } from "./registry/CmsEntitiesDbRegistryDecorator.js";
|
|
7
|
+
import { DdbEsGroupStorageOpsFeature } from "./operations/group/feature.js";
|
|
8
|
+
import { DdbEsModelStorageOpsFeature } from "./operations/model/feature.js";
|
|
9
|
+
import { DdbEsEntryStorageOpsFeature } from "./operations/entry/feature.js";
|
|
10
|
+
const HeadlessCmsDdbEsStorageFeature = createFeature({
|
|
11
|
+
name: "cms.storageOperations.openSearch.storage",
|
|
12
|
+
register: (container)=>{
|
|
13
|
+
FilterUtilFeature.register(container);
|
|
14
|
+
CmsEntryOpenSearchUtilsFeature.register(container);
|
|
15
|
+
FilterRegistriesFeature.register(container);
|
|
16
|
+
container.register(CreateElasticsearchIndexTask);
|
|
17
|
+
container.registerDecorator(CmsEntitiesDbRegistryDecorator);
|
|
18
|
+
DdbEsGroupStorageOpsFeature.register(container);
|
|
19
|
+
DdbEsModelStorageOpsFeature.register(container);
|
|
20
|
+
DdbEsEntryStorageOpsFeature.register(container);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export { HeadlessCmsDdbEsStorageFeature };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=storageFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageFeature.js","sources":["../src/storageFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { FilterUtilFeature } from \"@webiny/db-dynamodb/feature/FilterUtil/feature.js\";\nimport { CmsEntryOpenSearchUtilsFeature } from \"@webiny/api-headless-cms-utils-os\";\nimport { FilterRegistriesFeature } from \"@webiny/api-headless-cms-storage\";\nimport { CreateElasticsearchIndexTask } from \"~/tasks/CreateElasticsearchIndexTask.js\";\nimport { CmsEntitiesDbRegistryDecorator } from \"~/registry/CmsEntitiesDbRegistryDecorator.js\";\nimport { DdbEsGroupStorageOpsFeature } from \"~/operations/group/feature.js\";\nimport { DdbEsModelStorageOpsFeature } from \"~/operations/model/feature.js\";\nimport { DdbEsEntryStorageOpsFeature } from \"~/operations/entry/feature.js\";\n\n/**\n * The DynamoDB+OpenSearch CMS storage of a tenant scope: the storage operations, the per-scope state\n * (the entry DataLoaders, the filter registries, the OpenSearch field indexes and model index cache),\n * the index creation task and the decorator that adds the CMS entities to the scope's `DbRegistry`\n * for the DDB to OpenSearch sync. They run on the tables and entities the root holds\n * (`HeadlessCmsDdbEsTablesFeature`) and the OpenSearch core. Registered in each scope on this storage,\n * so a scope on another storage gets none of them.\n */\nexport const HeadlessCmsDdbEsStorageFeature = createFeature({\n name: \"cms.storageOperations.openSearch.storage\",\n register: container => {\n FilterUtilFeature.register(container);\n CmsEntryOpenSearchUtilsFeature.register(container);\n FilterRegistriesFeature.register(container);\n\n container.register(CreateElasticsearchIndexTask);\n\n // Adds the CMS entities to the scope's DbRegistry, for the DDB to OpenSearch sync.\n container.registerDecorator(CmsEntitiesDbRegistryDecorator);\n\n DdbEsGroupStorageOpsFeature.register(container);\n DdbEsModelStorageOpsFeature.register(container);\n DdbEsEntryStorageOpsFeature.register(container);\n }\n});\n"],"names":["HeadlessCmsDdbEsStorageFeature","createFeature","container","FilterUtilFeature","CmsEntryOpenSearchUtilsFeature","FilterRegistriesFeature","CreateElasticsearchIndexTask","CmsEntitiesDbRegistryDecorator","DdbEsGroupStorageOpsFeature","DdbEsModelStorageOpsFeature","DdbEsEntryStorageOpsFeature"],"mappings":";;;;;;;;;AAkBO,MAAMA,iCAAiCC,cAAc;IACxD,MAAM;IACN,UAAUC,CAAAA;QACNC,kBAAkB,QAAQ,CAACD;QAC3BE,+BAA+B,QAAQ,CAACF;QACxCG,wBAAwB,QAAQ,CAACH;QAEjCA,UAAU,QAAQ,CAACI;QAGnBJ,UAAU,iBAAiB,CAACK;QAE5BC,4BAA4B,QAAQ,CAACN;QACrCO,4BAA4B,QAAQ,CAACP;QACrCQ,4BAA4B,QAAQ,CAACR;IACzC;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DynamoDB+OpenSearch CMS storage's tables and entities: built once per process, in the root
|
|
3
|
+
* container. Requires DynamoDBClient to be registered there first.
|
|
4
|
+
*/
|
|
5
|
+
export declare const HeadlessCmsDdbEsTablesFeature: {
|
|
6
|
+
name: string;
|
|
7
|
+
register(container: import("@webiny/di").Container): void;
|
|
8
|
+
};
|
package/tablesFeature.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DynamoDBClient, createTable } from "@webiny/db-dynamodb";
|
|
2
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
3
|
+
import { createOpenSearchEntity, createOpenSearchTable } from "@webiny/api-opensearch-aws";
|
|
4
|
+
import { ENTITIES } from "./types.js";
|
|
5
|
+
import { createGroupEntity } from "./definitions/group.js";
|
|
6
|
+
import { createModelEntity } from "./definitions/model.js";
|
|
7
|
+
import { createEntryEntity } from "./definitions/entry.js";
|
|
8
|
+
import { CmsDdbEsTable } from "./abstractions/CmsDdbEsTable.js";
|
|
9
|
+
import { CmsDdbEsOsTable } from "./abstractions/CmsDdbEsOsTable.js";
|
|
10
|
+
import { CmsDdbEsGroupEntity } from "./abstractions/CmsDdbEsGroupEntity.js";
|
|
11
|
+
import { CmsDdbEsModelEntity } from "./abstractions/CmsDdbEsModelEntity.js";
|
|
12
|
+
import { CmsDdbEsEntryEntity } from "./abstractions/CmsDdbEsEntryEntity.js";
|
|
13
|
+
import { CmsDdbEsEntriesEsEntity } from "./abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
14
|
+
const HeadlessCmsDdbEsTablesFeature = createFeature({
|
|
15
|
+
name: "cms.storageOperations.openSearch.tables",
|
|
16
|
+
register: (container)=>{
|
|
17
|
+
const db = container.resolve(DynamoDBClient);
|
|
18
|
+
const documentClient = db.client;
|
|
19
|
+
const tableInstance = createTable({
|
|
20
|
+
name: process.env.DB_TABLE,
|
|
21
|
+
documentClient
|
|
22
|
+
});
|
|
23
|
+
const tableElasticsearchInstance = createOpenSearchTable({
|
|
24
|
+
name: process.env.DB_TABLE_OPENSEARCH,
|
|
25
|
+
documentClient
|
|
26
|
+
});
|
|
27
|
+
const groupEntity = createGroupEntity({
|
|
28
|
+
entityName: ENTITIES.GROUPS,
|
|
29
|
+
table: tableInstance
|
|
30
|
+
});
|
|
31
|
+
const modelEntity = createModelEntity({
|
|
32
|
+
entityName: ENTITIES.MODELS,
|
|
33
|
+
table: tableInstance
|
|
34
|
+
});
|
|
35
|
+
const entryEntity = createEntryEntity({
|
|
36
|
+
entityName: ENTITIES.ENTRIES,
|
|
37
|
+
table: tableInstance
|
|
38
|
+
});
|
|
39
|
+
const entriesEsEntity = createOpenSearchEntity({
|
|
40
|
+
entityName: ENTITIES.ENTRIES_ES,
|
|
41
|
+
table: tableElasticsearchInstance
|
|
42
|
+
});
|
|
43
|
+
container.registerInstance(CmsDdbEsTable, tableInstance);
|
|
44
|
+
container.registerInstance(CmsDdbEsOsTable, tableElasticsearchInstance);
|
|
45
|
+
container.registerInstance(CmsDdbEsGroupEntity, groupEntity);
|
|
46
|
+
container.registerInstance(CmsDdbEsModelEntity, modelEntity);
|
|
47
|
+
container.registerInstance(CmsDdbEsEntryEntity, entryEntity);
|
|
48
|
+
container.registerInstance(CmsDdbEsEntriesEsEntity, entriesEsEntity);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export { HeadlessCmsDdbEsTablesFeature };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=tablesFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tablesFeature.js","sources":["../src/tablesFeature.ts"],"sourcesContent":["import { createTable, DynamoDBClient } from \"@webiny/db-dynamodb\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { createOpenSearchEntity, createOpenSearchTable } from \"@webiny/api-opensearch-aws\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { CmsDdbEsTable } from \"~/abstractions/CmsDdbEsTable.js\";\nimport { CmsDdbEsOsTable } from \"~/abstractions/CmsDdbEsOsTable.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * The DynamoDB+OpenSearch CMS storage's tables and entities: built once per process, in the root\n * container. Requires DynamoDBClient to be registered there first.\n */\nexport const HeadlessCmsDdbEsTablesFeature = createFeature({\n name: \"cms.storageOperations.openSearch.tables\",\n register: container => {\n const db = container.resolve(DynamoDBClient);\n const documentClient = db.client;\n\n const tableInstance = createTable({\n name: process.env.DB_TABLE as string,\n documentClient\n });\n const tableElasticsearchInstance = createOpenSearchTable({\n name: process.env.DB_TABLE_OPENSEARCH as string,\n documentClient\n });\n\n const groupEntity = createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n });\n const modelEntity = createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n });\n const entryEntity = createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n });\n const entriesEsEntity = createOpenSearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance\n });\n\n container.registerInstance(CmsDdbEsTable, tableInstance);\n container.registerInstance(CmsDdbEsOsTable, tableElasticsearchInstance);\n container.registerInstance(CmsDdbEsGroupEntity, groupEntity);\n container.registerInstance(CmsDdbEsModelEntity, modelEntity);\n container.registerInstance(CmsDdbEsEntryEntity, entryEntity);\n container.registerInstance(CmsDdbEsEntriesEsEntity, entriesEsEntity);\n }\n});\n"],"names":["HeadlessCmsDdbEsTablesFeature","createFeature","container","db","DynamoDBClient","documentClient","tableInstance","createTable","process","tableElasticsearchInstance","createOpenSearchTable","groupEntity","createGroupEntity","ENTITIES","modelEntity","createModelEntity","entryEntity","createEntryEntity","entriesEsEntity","createOpenSearchEntity","CmsDdbEsTable","CmsDdbEsOsTable","CmsDdbEsGroupEntity","CmsDdbEsModelEntity","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity"],"mappings":";;;;;;;;;;;;;AAkBO,MAAMA,gCAAgCC,cAAc;IACvD,MAAM;IACN,UAAUC,CAAAA;QACN,MAAMC,KAAKD,UAAU,OAAO,CAACE;QAC7B,MAAMC,iBAAiBF,GAAG,MAAM;QAEhC,MAAMG,gBAAgBC,YAAY;YAC9B,MAAMC,QAAQ,GAAG,CAAC,QAAQ;YAC1BH;QACJ;QACA,MAAMI,6BAA6BC,sBAAsB;YACrD,MAAMF,QAAQ,GAAG,CAAC,mBAAmB;YACrCH;QACJ;QAEA,MAAMM,cAAcC,kBAAkB;YAClC,YAAYC,SAAS,MAAM;YAC3B,OAAOP;QACX;QACA,MAAMQ,cAAcC,kBAAkB;YAClC,YAAYF,SAAS,MAAM;YAC3B,OAAOP;QACX;QACA,MAAMU,cAAcC,kBAAkB;YAClC,YAAYJ,SAAS,OAAO;YAC5B,OAAOP;QACX;QACA,MAAMY,kBAAkBC,uBAAuB;YAC3C,YAAYN,SAAS,UAAU;YAC/B,OAAOJ;QACX;QAEAP,UAAU,gBAAgB,CAACkB,eAAed;QAC1CJ,UAAU,gBAAgB,CAACmB,iBAAiBZ;QAC5CP,UAAU,gBAAgB,CAACoB,qBAAqBX;QAChDT,UAAU,gBAAgB,CAACqB,qBAAqBT;QAChDZ,UAAU,gBAAgB,CAACsB,qBAAqBR;QAChDd,UAAU,gBAAgB,CAACuB,yBAAyBP;IACxD;AACJ"}
|