@webiny/api-page-builder-so-ddb-es 0.0.0-ee-vpcs.549378cf03
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/LICENSE +21 -0
- package/README.md +30 -0
- package/configurations.d.ts +9 -0
- package/configurations.js +49 -0
- package/configurations.js.map +1 -0
- package/definitions/blockCategoryEntity.d.ts +9 -0
- package/definitions/blockCategoryEntity.js +61 -0
- package/definitions/blockCategoryEntity.js.map +1 -0
- package/definitions/categoryEntity.d.ts +9 -0
- package/definitions/categoryEntity.js +61 -0
- package/definitions/categoryEntity.js.map +1 -0
- package/definitions/menuEntity.d.ts +9 -0
- package/definitions/menuEntity.js +61 -0
- package/definitions/menuEntity.js.map +1 -0
- package/definitions/pageBlockEntity.d.ts +9 -0
- package/definitions/pageBlockEntity.js +64 -0
- package/definitions/pageBlockEntity.js.map +1 -0
- package/definitions/pageElasticsearchEntity.d.ts +9 -0
- package/definitions/pageElasticsearchEntity.js +40 -0
- package/definitions/pageElasticsearchEntity.js.map +1 -0
- package/definitions/pageElementEntity.d.ts +9 -0
- package/definitions/pageElementEntity.js +67 -0
- package/definitions/pageElementEntity.js.map +1 -0
- package/definitions/pageEntity.d.ts +9 -0
- package/definitions/pageEntity.js +97 -0
- package/definitions/pageEntity.js.map +1 -0
- package/definitions/settingsEntity.d.ts +9 -0
- package/definitions/settingsEntity.js +77 -0
- package/definitions/settingsEntity.js.map +1 -0
- package/definitions/systemEntity.d.ts +9 -0
- package/definitions/systemEntity.js +40 -0
- package/definitions/systemEntity.js.map +1 -0
- package/definitions/table.d.ts +9 -0
- package/definitions/table.js +24 -0
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +9 -0
- package/definitions/tableElasticsearch.js +24 -0
- package/definitions/tableElasticsearch.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +60 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +15 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +16 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +16 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +233 -0
- package/index.js.map +1 -0
- package/operations/blockCategory/dataLoader.d.ts +16 -0
- package/operations/blockCategory/dataLoader.js +79 -0
- package/operations/blockCategory/dataLoader.js.map +1 -0
- package/operations/blockCategory/fields.d.ts +2 -0
- package/operations/blockCategory/fields.js +28 -0
- package/operations/blockCategory/fields.js.map +1 -0
- package/operations/blockCategory/index.d.ts +8 -0
- package/operations/blockCategory/index.js +208 -0
- package/operations/blockCategory/index.js.map +1 -0
- package/operations/blockCategory/keys.d.ts +9 -0
- package/operations/blockCategory/keys.js +25 -0
- package/operations/blockCategory/keys.js.map +1 -0
- package/operations/category/dataLoader.d.ts +16 -0
- package/operations/category/dataLoader.js +79 -0
- package/operations/category/dataLoader.js.map +1 -0
- package/operations/category/fields.d.ts +2 -0
- package/operations/category/fields.js +28 -0
- package/operations/category/fields.js.map +1 -0
- package/operations/category/index.d.ts +8 -0
- package/operations/category/index.js +208 -0
- package/operations/category/index.js.map +1 -0
- package/operations/category/keys.d.ts +9 -0
- package/operations/category/keys.js +25 -0
- package/operations/category/keys.js.map +1 -0
- package/operations/menu/fields.d.ts +2 -0
- package/operations/menu/fields.js +27 -0
- package/operations/menu/fields.js.map +1 -0
- package/operations/menu/index.d.ts +8 -0
- package/operations/menu/index.js +217 -0
- package/operations/menu/index.js.map +1 -0
- package/operations/pageBlock/dataLoader.d.ts +16 -0
- package/operations/pageBlock/dataLoader.js +79 -0
- package/operations/pageBlock/dataLoader.js.map +1 -0
- package/operations/pageBlock/fields.d.ts +2 -0
- package/operations/pageBlock/fields.js +25 -0
- package/operations/pageBlock/fields.js.map +1 -0
- package/operations/pageBlock/index.d.ts +8 -0
- package/operations/pageBlock/index.js +208 -0
- package/operations/pageBlock/index.js.map +1 -0
- package/operations/pageBlock/keys.d.ts +9 -0
- package/operations/pageBlock/keys.js +25 -0
- package/operations/pageBlock/keys.js.map +1 -0
- package/operations/pageElement/fields.d.ts +2 -0
- package/operations/pageElement/fields.js +19 -0
- package/operations/pageElement/fields.js.map +1 -0
- package/operations/pageElement/index.d.ts +8 -0
- package/operations/pageElement/index.js +207 -0
- package/operations/pageElement/index.js.map +1 -0
- package/operations/pages/elasticsearchQueryBody.d.ts +12 -0
- package/operations/pages/elasticsearchQueryBody.js +237 -0
- package/operations/pages/elasticsearchQueryBody.js.map +1 -0
- package/operations/pages/fields.d.ts +4 -0
- package/operations/pages/fields.js +54 -0
- package/operations/pages/fields.js.map +1 -0
- package/operations/pages/helpers.d.ts +35 -0
- package/operations/pages/helpers.js +83 -0
- package/operations/pages/helpers.js.map +1 -0
- package/operations/pages/index.d.ts +11 -0
- package/operations/pages/index.js +829 -0
- package/operations/pages/index.js.map +1 -0
- package/operations/pages/keys.d.ts +24 -0
- package/operations/pages/keys.js +79 -0
- package/operations/pages/keys.js.map +1 -0
- package/operations/settings/index.d.ts +6 -0
- package/operations/settings/index.js +178 -0
- package/operations/settings/index.js.map +1 -0
- package/operations/system/index.d.ts +6 -0
- package/operations/system/index.js +104 -0
- package/operations/system/index.js.map +1 -0
- package/package.json +65 -0
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.d.ts +4 -0
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js +17 -0
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js.map +1 -0
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.d.ts +4 -0
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js +17 -0
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js.map +1 -0
- package/plugins/definitions/IndexPageDataPlugin.d.ts +17 -0
- package/plugins/definitions/IndexPageDataPlugin.js +32 -0
- package/plugins/definitions/IndexPageDataPlugin.js.map +1 -0
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.d.ts +4 -0
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js +17 -0
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js.map +1 -0
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.d.ts +4 -0
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js +17 -0
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js.map +1 -0
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.d.ts +4 -0
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js +17 -0
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.d.ts +4 -0
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js +17 -0
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/definitions/PageElasticsearchFieldPlugin.d.ts +4 -0
- package/plugins/definitions/PageElasticsearchFieldPlugin.js +17 -0
- package/plugins/definitions/PageElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/definitions/PageElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/definitions/PageElasticsearchIndexPlugin.js +17 -0
- package/plugins/definitions/PageElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.d.ts +4 -0
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js +17 -0
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.d.ts +4 -0
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.js +17 -0
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.d.ts +4 -0
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js +17 -0
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js.map +1 -0
- package/plugins/definitions/SearchLatestPagesPlugin.d.ts +4 -0
- package/plugins/definitions/SearchLatestPagesPlugin.js +17 -0
- package/plugins/definitions/SearchLatestPagesPlugin.js.map +1 -0
- package/plugins/definitions/SearchPagesPlugin.d.ts +23 -0
- package/plugins/definitions/SearchPagesPlugin.js +39 -0
- package/plugins/definitions/SearchPagesPlugin.js.map +1 -0
- package/plugins/definitions/SearchPublishedPagesPlugin.d.ts +4 -0
- package/plugins/definitions/SearchPublishedPagesPlugin.js +17 -0
- package/plugins/definitions/SearchPublishedPagesPlugin.js.map +1 -0
- package/types.d.ts +39 -0
- package/types.js +20 -0
- package/types.js.map +1 -0
- package/upgrades/index.d.ts +2 -0
- package/upgrades/index.js +14 -0
- package/upgrades/index.js.map +1 -0
- package/upgrades/v5.15.0/category.d.ts +2 -0
- package/upgrades/v5.15.0/category.js +73 -0
- package/upgrades/v5.15.0/category.js.map +1 -0
- package/upgrades/v5.15.0/index.d.ts +4 -0
- package/upgrades/v5.15.0/index.js +52 -0
- package/upgrades/v5.15.0/index.js.map +1 -0
- package/upgrades/v5.15.0/menu.d.ts +2 -0
- package/upgrades/v5.15.0/menu.js +73 -0
- package/upgrades/v5.15.0/menu.js.map +1 -0
- package/upgrades/v5.15.0/pageElement.d.ts +2 -0
- package/upgrades/v5.15.0/pageElement.js +73 -0
- package/upgrades/v5.15.0/pageElement.js.map +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSortKey = exports.createPartitionKey = void 0;
|
|
7
|
+
|
|
8
|
+
const createPartitionKey = params => {
|
|
9
|
+
const {
|
|
10
|
+
tenant,
|
|
11
|
+
locale
|
|
12
|
+
} = params;
|
|
13
|
+
return `T#${tenant}#L#${locale}#PB#BC`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.createPartitionKey = createPartitionKey;
|
|
17
|
+
|
|
18
|
+
const createSortKey = params => {
|
|
19
|
+
const {
|
|
20
|
+
slug
|
|
21
|
+
} = params;
|
|
22
|
+
return slug;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.createSortKey = createSortKey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPartitionKey","params","tenant","locale","createSortKey","slug"],"sources":["keys.ts"],"sourcesContent":["export interface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#PB#BC`;\n};\n\nexport interface SortKeyParams {\n slug: string;\n}\nexport const createSortKey = (params: SortKeyParams): string => {\n const { slug } = params;\n return slug;\n};\n"],"mappings":";;;;;;;AAIO,MAAMA,kBAAkB,GAAIC,MAAD,IAAwC;EACtE,MAAM;IAAEC,MAAF;IAAUC;EAAV,IAAqBF,MAA3B;EACA,OAAQ,KAAIC,MAAO,MAAKC,MAAO,QAA/B;AACH,CAHM;;;;AAQA,MAAMC,aAAa,GAAIH,MAAD,IAAmC;EAC5D,MAAM;IAAEI;EAAF,IAAWJ,MAAjB;EACA,OAAOI,IAAP;AACH,CAHM"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Category } from "@webiny/api-page-builder/types";
|
|
2
|
+
import { Entity } from "dynamodb-toolbox";
|
|
3
|
+
interface Params {
|
|
4
|
+
entity: Entity<any>;
|
|
5
|
+
}
|
|
6
|
+
declare type DataLoaderGetItem = Pick<Category, "slug" | "tenant" | "locale">;
|
|
7
|
+
export declare class CategoryDataLoader {
|
|
8
|
+
private _getDataLoader;
|
|
9
|
+
private readonly entity;
|
|
10
|
+
constructor(params: Params);
|
|
11
|
+
getOne(item: DataLoaderGetItem): Promise<Category>;
|
|
12
|
+
getAll(items: DataLoaderGetItem[]): Promise<Category[]>;
|
|
13
|
+
clear(): void;
|
|
14
|
+
private getDataLoader;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.CategoryDataLoader = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
13
|
+
|
|
14
|
+
var _batchRead = require("@webiny/db-dynamodb/utils/batchRead");
|
|
15
|
+
|
|
16
|
+
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
17
|
+
|
|
18
|
+
var _keys = require("./keys");
|
|
19
|
+
|
|
20
|
+
class CategoryDataLoader {
|
|
21
|
+
constructor(params) {
|
|
22
|
+
(0, _defineProperty2.default)(this, "_getDataLoader", undefined);
|
|
23
|
+
(0, _defineProperty2.default)(this, "entity", void 0);
|
|
24
|
+
this.entity = params.entity;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async getOne(item) {
|
|
28
|
+
return await this.getDataLoader().load(item);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async getAll(items) {
|
|
32
|
+
return await this.getDataLoader().loadMany(items);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
clear() {
|
|
36
|
+
this.getDataLoader().clearAll();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getDataLoader() {
|
|
40
|
+
if (!this._getDataLoader) {
|
|
41
|
+
const cacheKeyFn = key => {
|
|
42
|
+
return `T#${key.tenant}#L#${key.locale}#${key.slug}`;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this._getDataLoader = new _dataloader.default(async items => {
|
|
46
|
+
const batched = items.map(item => {
|
|
47
|
+
return this.entity.getBatch({
|
|
48
|
+
PK: (0, _keys.createPartitionKey)(item),
|
|
49
|
+
SK: (0, _keys.createSortKey)(item)
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
const records = await (0, _batchRead.batchReadAll)({
|
|
53
|
+
table: this.entity.table,
|
|
54
|
+
items: batched
|
|
55
|
+
});
|
|
56
|
+
const results = records.reduce((collection, result) => {
|
|
57
|
+
if (!result) {
|
|
58
|
+
return collection;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const key = cacheKeyFn(result);
|
|
62
|
+
collection[key] = (0, _cleanup.cleanupItem)(this.entity, result);
|
|
63
|
+
return collection;
|
|
64
|
+
}, {});
|
|
65
|
+
return items.map(item => {
|
|
66
|
+
const key = cacheKeyFn(item);
|
|
67
|
+
return results[key] || null;
|
|
68
|
+
});
|
|
69
|
+
}, {
|
|
70
|
+
cacheKeyFn
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return this._getDataLoader;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.CategoryDataLoader = CategoryDataLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CategoryDataLoader","constructor","params","undefined","entity","getOne","item","getDataLoader","load","getAll","items","loadMany","clear","clearAll","_getDataLoader","cacheKeyFn","key","tenant","locale","slug","DataLoader","batched","map","getBatch","PK","createPartitionKey","SK","createSortKey","records","batchReadAll","table","results","reduce","collection","result","cleanupItem"],"sources":["dataLoader.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { Category } from \"@webiny/api-page-builder/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { createPartitionKey, createSortKey } from \"./keys\";\n\ninterface Params {\n entity: Entity<any>;\n}\n\ntype DataLoaderGetItem = Pick<Category, \"slug\" | \"tenant\" | \"locale\">;\n\nexport class CategoryDataLoader {\n private _getDataLoader: DataLoader<any, any> | undefined = undefined;\n\n private readonly entity: Entity<any>;\n\n constructor(params: Params) {\n this.entity = params.entity;\n }\n\n public async getOne(item: DataLoaderGetItem): Promise<Category> {\n return await this.getDataLoader().load(item);\n }\n\n public async getAll(items: DataLoaderGetItem[]): Promise<Category[]> {\n return await this.getDataLoader().loadMany(items);\n }\n\n public clear(): void {\n this.getDataLoader().clearAll();\n }\n\n private getDataLoader(): DataLoader<any, any> {\n if (!this._getDataLoader) {\n const cacheKeyFn = (key: DataLoaderGetItem) => {\n return `T#${key.tenant}#L#${key.locale}#${key.slug}`;\n };\n this._getDataLoader = new DataLoader(\n async items => {\n const batched = items.map(item => {\n return this.entity.getBatch({\n PK: createPartitionKey(item),\n SK: createSortKey(item)\n });\n });\n\n const records = await batchReadAll<Category>({\n table: this.entity.table,\n items: batched\n });\n\n const results = records.reduce((collection, result) => {\n if (!result) {\n return collection;\n }\n const key = cacheKeyFn(result);\n collection[key] = cleanupItem(this.entity, result) as Category;\n return collection;\n }, {} as Record<string, Category>);\n return items.map(item => {\n const key = cacheKeyFn(item);\n return results[key] || null;\n });\n },\n {\n cacheKeyFn\n }\n );\n }\n return this._getDataLoader;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AAQO,MAAMA,kBAAN,CAAyB;EAK5BC,WAAW,CAACC,MAAD,EAAiB;IAAA,sDAJ+BC,SAI/B;IAAA;IACxB,KAAKC,MAAL,GAAcF,MAAM,CAACE,MAArB;EACH;;EAEkB,MAANC,MAAM,CAACC,IAAD,EAA6C;IAC5D,OAAO,MAAM,KAAKC,aAAL,GAAqBC,IAArB,CAA0BF,IAA1B,CAA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hB,IAAI,IAAI;UACrB,MAAMU,GAAG,GAAGD,UAAU,CAACT,IAAD,CAAtB;UACA,OAAOyB,OAAO,CAACf,GAAD,CAAP,IAAgB,IAAvB;QACH,CAHM,CAAP;MAIH,CA1BiB,EA2BlB;QACID;MADJ,CA3BkB,CAAtB;IA+BH;;IACD,OAAO,KAAKD,cAAZ;EACH;;AA3D2B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCategoryDynamoDbFields = void 0;
|
|
7
|
+
|
|
8
|
+
var _CategoryDynamoDbElasticFieldPlugin = require("../../plugins/definitions/CategoryDynamoDbElasticFieldPlugin");
|
|
9
|
+
|
|
10
|
+
const createCategoryDynamoDbFields = () => {
|
|
11
|
+
return [new _CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin({
|
|
12
|
+
field: "id"
|
|
13
|
+
}), new _CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin({
|
|
14
|
+
field: "createdOn",
|
|
15
|
+
type: "date"
|
|
16
|
+
}), new _CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin({
|
|
17
|
+
field: "savedOn",
|
|
18
|
+
type: "date"
|
|
19
|
+
}), new _CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin({
|
|
20
|
+
field: "publishedOn",
|
|
21
|
+
type: "date"
|
|
22
|
+
}), new _CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin({
|
|
23
|
+
field: "createdBy",
|
|
24
|
+
path: "createdBy.id"
|
|
25
|
+
})];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.createCategoryDynamoDbFields = createCategoryDynamoDbFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createCategoryDynamoDbFields","CategoryDynamoDbElasticFieldPlugin","field","type","path"],"sources":["fields.ts"],"sourcesContent":["import { CategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/CategoryDynamoDbElasticFieldPlugin\";\n\nexport const createCategoryDynamoDbFields = (): CategoryDynamoDbElasticFieldPlugin[] => {\n return [\n new CategoryDynamoDbElasticFieldPlugin({\n field: \"id\"\n }),\n new CategoryDynamoDbElasticFieldPlugin({\n field: \"createdOn\",\n type: \"date\"\n }),\n new CategoryDynamoDbElasticFieldPlugin({\n field: \"savedOn\",\n type: \"date\"\n }),\n new CategoryDynamoDbElasticFieldPlugin({\n field: \"publishedOn\",\n type: \"date\"\n }),\n new CategoryDynamoDbElasticFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n })\n ];\n};\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,4BAA4B,GAAG,MAA4C;EACpF,OAAO,CACH,IAAIC,sEAAJ,CAAuC;IACnCC,KAAK,EAAE;EAD4B,CAAvC,CADG,EAIH,IAAID,sEAAJ,CAAuC;IACnCC,KAAK,EAAE,WAD4B;IAEnCC,IAAI,EAAE;EAF6B,CAAvC,CAJG,EAQH,IAAIF,sEAAJ,CAAuC;IACnCC,KAAK,EAAE,SAD4B;IAEnCC,IAAI,EAAE;EAF6B,CAAvC,CARG,EAYH,IAAIF,sEAAJ,CAAuC;IACnCC,KAAK,EAAE,aAD4B;IAEnCC,IAAI,EAAE;EAF6B,CAAvC,CAZG,EAgBH,IAAIF,sEAAJ,CAAuC;IACnCC,KAAK,EAAE,WAD4B;IAEnCE,IAAI,EAAE;EAF6B,CAAvC,CAhBG,CAAP;AAqBH,CAtBM"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CategoryStorageOperations } from "@webiny/api-page-builder/types";
|
|
2
|
+
import { Entity } from "dynamodb-toolbox";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface CreateCategoryStorageOperationsParams {
|
|
5
|
+
entity: Entity<any>;
|
|
6
|
+
plugins: PluginsContainer;
|
|
7
|
+
}
|
|
8
|
+
export declare const createCategoryStorageOperations: ({ entity, plugins }: CreateCategoryStorageOperationsParams) => CategoryStorageOperations;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createCategoryStorageOperations = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
+
|
|
16
|
+
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
17
|
+
|
|
18
|
+
var _sort = require("@webiny/db-dynamodb/utils/sort");
|
|
19
|
+
|
|
20
|
+
var _filter = require("@webiny/db-dynamodb/utils/filter");
|
|
21
|
+
|
|
22
|
+
var _dataLoader = require("./dataLoader");
|
|
23
|
+
|
|
24
|
+
var _listResponse = require("@webiny/db-dynamodb/utils/listResponse");
|
|
25
|
+
|
|
26
|
+
var _CategoryDynamoDbElasticFieldPlugin = require("../../plugins/definitions/CategoryDynamoDbElasticFieldPlugin");
|
|
27
|
+
|
|
28
|
+
var _keys = require("./keys");
|
|
29
|
+
|
|
30
|
+
const _excluded = ["tenant", "locale"];
|
|
31
|
+
|
|
32
|
+
const createType = () => {
|
|
33
|
+
return "pb.category";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const createCategoryStorageOperations = ({
|
|
37
|
+
entity,
|
|
38
|
+
plugins
|
|
39
|
+
}) => {
|
|
40
|
+
const dataLoader = new _dataLoader.CategoryDataLoader({
|
|
41
|
+
entity
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const get = async params => {
|
|
45
|
+
const {
|
|
46
|
+
where
|
|
47
|
+
} = params;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return await dataLoader.getOne(where);
|
|
51
|
+
} catch (ex) {
|
|
52
|
+
throw new _error.default(ex.message || "Could not load category by given parameters.", ex.code || "CATEGORY_GET_ERROR", {
|
|
53
|
+
where
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const create = async params => {
|
|
59
|
+
const {
|
|
60
|
+
category
|
|
61
|
+
} = params;
|
|
62
|
+
const keys = {
|
|
63
|
+
PK: (0, _keys.createPartitionKey)({
|
|
64
|
+
tenant: category.tenant,
|
|
65
|
+
locale: category.locale
|
|
66
|
+
}),
|
|
67
|
+
SK: (0, _keys.createSortKey)(category)
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, category), {}, {
|
|
72
|
+
TYPE: createType()
|
|
73
|
+
}, keys));
|
|
74
|
+
/**
|
|
75
|
+
* Always clear data loader cache when modifying the records.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
dataLoader.clear();
|
|
79
|
+
return category;
|
|
80
|
+
} catch (ex) {
|
|
81
|
+
throw new _error.default(ex.message || "Could not create category.", ex.code || "CATEGORY_CREATE_ERROR", {
|
|
82
|
+
keys
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const update = async params => {
|
|
88
|
+
const {
|
|
89
|
+
original,
|
|
90
|
+
category
|
|
91
|
+
} = params;
|
|
92
|
+
const keys = {
|
|
93
|
+
PK: (0, _keys.createPartitionKey)({
|
|
94
|
+
tenant: original.tenant,
|
|
95
|
+
locale: original.locale
|
|
96
|
+
}),
|
|
97
|
+
SK: (0, _keys.createSortKey)(category)
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, category), {}, {
|
|
102
|
+
TYPE: createType()
|
|
103
|
+
}, keys));
|
|
104
|
+
/**
|
|
105
|
+
* Always clear data loader cache when modifying the records.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
dataLoader.clear();
|
|
109
|
+
return category;
|
|
110
|
+
} catch (ex) {
|
|
111
|
+
throw new _error.default(ex.message || "Could not update category.", ex.code || "CATEGORY_UPDATE_ERROR", {
|
|
112
|
+
keys,
|
|
113
|
+
original,
|
|
114
|
+
category
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const deleteCategory = async params => {
|
|
120
|
+
const {
|
|
121
|
+
category
|
|
122
|
+
} = params;
|
|
123
|
+
const keys = {
|
|
124
|
+
PK: (0, _keys.createPartitionKey)({
|
|
125
|
+
tenant: category.tenant,
|
|
126
|
+
locale: category.locale
|
|
127
|
+
}),
|
|
128
|
+
SK: (0, _keys.createSortKey)(category)
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
await entity.delete((0, _objectSpread2.default)((0, _objectSpread2.default)({}, category), keys));
|
|
133
|
+
/**
|
|
134
|
+
* Always clear data loader cache when modifying the records.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
dataLoader.clear();
|
|
138
|
+
return category;
|
|
139
|
+
} catch (ex) {
|
|
140
|
+
throw new _error.default(ex.message || "Could not delete category.", ex.code || "CATEGORY_DELETE_ERROR", {
|
|
141
|
+
keys,
|
|
142
|
+
category
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const list = async params => {
|
|
148
|
+
const {
|
|
149
|
+
where,
|
|
150
|
+
sort,
|
|
151
|
+
limit
|
|
152
|
+
} = params;
|
|
153
|
+
const {
|
|
154
|
+
tenant,
|
|
155
|
+
locale
|
|
156
|
+
} = where,
|
|
157
|
+
restWhere = (0, _objectWithoutProperties2.default)(where, _excluded);
|
|
158
|
+
const queryAllParams = {
|
|
159
|
+
entity,
|
|
160
|
+
partitionKey: (0, _keys.createPartitionKey)({
|
|
161
|
+
tenant,
|
|
162
|
+
locale
|
|
163
|
+
}),
|
|
164
|
+
options: {
|
|
165
|
+
gt: " "
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
let items = [];
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
items = await (0, _query.queryAll)(queryAllParams);
|
|
172
|
+
} catch (ex) {
|
|
173
|
+
throw new _error.default(ex.message || "Could not list categories by given parameters.", ex.code || "CATEGORIES_LIST_ERROR", {
|
|
174
|
+
partitionKey: queryAllParams.partitionKey,
|
|
175
|
+
options: queryAllParams.options
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const fields = plugins.byType(_CategoryDynamoDbElasticFieldPlugin.CategoryDynamoDbElasticFieldPlugin.type);
|
|
180
|
+
const filteredItems = (0, _filter.filterItems)({
|
|
181
|
+
plugins,
|
|
182
|
+
where: restWhere,
|
|
183
|
+
items,
|
|
184
|
+
fields
|
|
185
|
+
});
|
|
186
|
+
const sortedItems = (0, _sort.sortItems)({
|
|
187
|
+
items: filteredItems,
|
|
188
|
+
sort,
|
|
189
|
+
fields
|
|
190
|
+
});
|
|
191
|
+
return (0, _listResponse.createListResponse)({
|
|
192
|
+
items: sortedItems,
|
|
193
|
+
limit: limit || 100000,
|
|
194
|
+
totalCount: filteredItems.length,
|
|
195
|
+
after: null
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
get,
|
|
201
|
+
create,
|
|
202
|
+
update,
|
|
203
|
+
delete: deleteCategory,
|
|
204
|
+
list
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
exports.createCategoryStorageOperations = createCategoryStorageOperations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createType","createCategoryStorageOperations","entity","plugins","dataLoader","CategoryDataLoader","get","params","where","getOne","ex","WebinyError","message","code","create","category","keys","PK","createPartitionKey","tenant","locale","SK","createSortKey","put","TYPE","clear","update","original","deleteCategory","delete","list","sort","limit","restWhere","queryAllParams","partitionKey","options","gt","items","queryAll","fields","byType","CategoryDynamoDbElasticFieldPlugin","type","filteredItems","filterItems","sortedItems","sortItems","createListResponse","totalCount","length","after"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n Category,\n CategoryStorageOperations,\n CategoryStorageOperationsCreateParams,\n CategoryStorageOperationsDeleteParams,\n CategoryStorageOperationsGetParams,\n CategoryStorageOperationsListParams,\n CategoryStorageOperationsUpdateParams\n} from \"@webiny/api-page-builder/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport { CategoryDataLoader } from \"./dataLoader\";\nimport { createListResponse } from \"@webiny/db-dynamodb/utils/listResponse\";\nimport { CategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/CategoryDynamoDbElasticFieldPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createPartitionKey, createSortKey } from \"~/operations/category/keys\";\n\nconst createType = (): string => {\n return \"pb.category\";\n};\n\nexport interface CreateCategoryStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createCategoryStorageOperations = ({\n entity,\n plugins\n}: CreateCategoryStorageOperationsParams): CategoryStorageOperations => {\n const dataLoader = new CategoryDataLoader({\n entity\n });\n\n const get = async (params: CategoryStorageOperationsGetParams) => {\n const { where } = params;\n\n try {\n return await dataLoader.getOne(where);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load category by given parameters.\",\n ex.code || \"CATEGORY_GET_ERROR\",\n {\n where\n }\n );\n }\n };\n\n const create = async (params: CategoryStorageOperationsCreateParams) => {\n const { category } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: category.tenant,\n locale: category.locale\n }),\n SK: createSortKey(category)\n };\n\n try {\n await entity.put({\n ...category,\n TYPE: createType(),\n ...keys\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return category;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create category.\",\n ex.code || \"CATEGORY_CREATE_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const update = async (params: CategoryStorageOperationsUpdateParams) => {\n const { original, category } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: original.tenant,\n locale: original.locale\n }),\n SK: createSortKey(category)\n };\n\n try {\n await entity.put({\n ...category,\n TYPE: createType(),\n ...keys\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return category;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update category.\",\n ex.code || \"CATEGORY_UPDATE_ERROR\",\n {\n keys,\n original,\n category\n }\n );\n }\n };\n\n const deleteCategory = async (params: CategoryStorageOperationsDeleteParams) => {\n const { category } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: category.tenant,\n locale: category.locale\n }),\n SK: createSortKey(category)\n };\n\n try {\n await entity.delete({\n ...category,\n ...keys\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return category;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete category.\",\n ex.code || \"CATEGORY_DELETE_ERROR\",\n {\n keys,\n category\n }\n );\n }\n };\n\n const list = async (params: CategoryStorageOperationsListParams) => {\n const { where, sort, limit } = params;\n\n const { tenant, locale, ...restWhere } = where;\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({ tenant, locale }),\n options: {\n gt: \" \"\n }\n };\n\n let items: Category[] = [];\n\n try {\n items = await queryAll<Category>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list categories by given parameters.\",\n ex.code || \"CATEGORIES_LIST_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n const fields = plugins.byType<CategoryDynamoDbElasticFieldPlugin>(\n CategoryDynamoDbElasticFieldPlugin.type\n );\n\n const filteredItems = filterItems<Category>({\n plugins,\n where: restWhere,\n items,\n fields\n });\n\n const sortedItems = sortItems<Category>({\n items: filteredItems,\n sort,\n fields\n });\n\n return createListResponse({\n items: sortedItems,\n limit: limit || 100000,\n totalCount: filteredItems.length,\n after: null\n });\n };\n\n return {\n get,\n create,\n update,\n delete: deleteCategory,\n list\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,MAAc;EAC7B,OAAO,aAAP;AACH,CAFD;;AAQO,MAAMC,+BAA+B,GAAG,CAAC;EAC5CC,MAD4C;EAE5CC;AAF4C,CAAD,KAGyB;EACpE,MAAMC,UAAU,GAAG,IAAIC,8BAAJ,CAAuB;IACtCH;EADsC,CAAvB,CAAnB;;EAIA,MAAMI,GAAG,GAAG,MAAOC,MAAP,IAAsD;IAC9D,MAAM;MAAEC;IAAF,IAAYD,MAAlB;;IAEA,IAAI;MACA,OAAO,MAAMH,UAAU,CAACK,MAAX,CAAkBD,KAAlB,CAAb;IACH,CAFD,CAEE,OAAOE,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,8CADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,oBAFT,EAGF;QACIL;MADJ,CAHE,CAAN;IAOH;EACJ,CAdD;;EAgBA,MAAMM,MAAM,GAAG,MAAOP,MAAP,IAAyD;IACpE,MAAM;MAAEQ;IAAF,IAAeR,MAArB;IAEA,MAAMS,IAAI,GAAG;MACTC,EAAE,EAAE,IAAAC,wBAAA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AAc,gDADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,uBAFT,EAGF;QACIsB,YAAY,EAAED,cAAc,CAACC,YADjC;QAEIC,OAAO,EAAEF,cAAc,CAACE;MAF5B,CAHE,CAAN;IAQH;;IAED,MAAMI,MAAM,GAAGrC,OAAO,CAACsC,MAAR,CACXC,sEAAA,CAAmCC,IADxB,CAAf;IAIA,MAAMC,aAAa,GAAG,IAAAC,mBAAA,EAAsB;MACxC1C,OADwC;MAExCK,KAAK,EAAEyB,SAFiC;MAGxCK,KAHwC;MAIxCE;IAJwC,CAAtB,CAAtB;IAOA,MAAMM,WAAW,GAAG,IAAAC,eAAA,EAAoB;MACpCT,KAAK,EAAEM,aAD6B;MAEpCb,IAFoC;MAGpCS;IAHoC,CAApB,CAApB;IAMA,OAAO,IAAAQ,gCAAA,EAAmB;MACtBV,KAAK,EAAEQ,WADe;MAEtBd,KAAK,EAAEA,KAAK,IAAI,MAFM;MAGtBiB,UAAU,EAAEL,aAAa,CAACM,MAHJ;MAItBC,KAAK,EAAE;IAJe,CAAnB,CAAP;EAMH,CAlDD;;EAoDA,OAAO;IACH7C,GADG;IAEHQ,MAFG;IAGHY,MAHG;IAIHG,MAAM,EAAED,cAJL;IAKHE;EALG,CAAP;AAOH,CAzLM"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface PartitionKeyParams {
|
|
2
|
+
tenant: string;
|
|
3
|
+
locale: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const createPartitionKey: (params: PartitionKeyParams) => string;
|
|
6
|
+
export interface SortKeyParams {
|
|
7
|
+
slug: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const createSortKey: (params: SortKeyParams) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSortKey = exports.createPartitionKey = void 0;
|
|
7
|
+
|
|
8
|
+
const createPartitionKey = params => {
|
|
9
|
+
const {
|
|
10
|
+
tenant,
|
|
11
|
+
locale
|
|
12
|
+
} = params;
|
|
13
|
+
return `T#${tenant}#L#${locale}#PB#C`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.createPartitionKey = createPartitionKey;
|
|
17
|
+
|
|
18
|
+
const createSortKey = params => {
|
|
19
|
+
const {
|
|
20
|
+
slug
|
|
21
|
+
} = params;
|
|
22
|
+
return slug;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.createSortKey = createSortKey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPartitionKey","params","tenant","locale","createSortKey","slug"],"sources":["keys.ts"],"sourcesContent":["export interface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#PB#C`;\n};\n\nexport interface SortKeyParams {\n slug: string;\n}\nexport const createSortKey = (params: SortKeyParams): string => {\n const { slug } = params;\n return slug;\n};\n"],"mappings":";;;;;;;AAIO,MAAMA,kBAAkB,GAAIC,MAAD,IAAwC;EACtE,MAAM;IAAEC,MAAF;IAAUC;EAAV,IAAqBF,MAA3B;EACA,OAAQ,KAAIC,MAAO,MAAKC,MAAO,OAA/B;AACH,CAHM;;;;AAQA,MAAMC,aAAa,GAAIH,MAAD,IAAmC;EAC5D,MAAM;IAAEI;EAAF,IAAWJ,MAAjB;EACA,OAAOI,IAAP;AACH,CAHM"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createMenuDynamoDbFields = void 0;
|
|
7
|
+
|
|
8
|
+
var _MenuDynamoDbElasticFieldPlugin = require("../../plugins/definitions/MenuDynamoDbElasticFieldPlugin");
|
|
9
|
+
|
|
10
|
+
const createMenuDynamoDbFields = () => {
|
|
11
|
+
return [new _MenuDynamoDbElasticFieldPlugin.MenuDynamoDbElasticFieldPlugin({
|
|
12
|
+
field: "id"
|
|
13
|
+
}), new _MenuDynamoDbElasticFieldPlugin.MenuDynamoDbElasticFieldPlugin({
|
|
14
|
+
field: "title"
|
|
15
|
+
}), new _MenuDynamoDbElasticFieldPlugin.MenuDynamoDbElasticFieldPlugin({
|
|
16
|
+
field: "slug"
|
|
17
|
+
}), new _MenuDynamoDbElasticFieldPlugin.MenuDynamoDbElasticFieldPlugin({
|
|
18
|
+
field: "createdOn",
|
|
19
|
+
type: "date"
|
|
20
|
+
}), new _MenuDynamoDbElasticFieldPlugin.MenuDynamoDbElasticFieldPlugin({
|
|
21
|
+
field: "createdBy",
|
|
22
|
+
path: "createdBy.id",
|
|
23
|
+
sortable: false
|
|
24
|
+
})];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.createMenuDynamoDbFields = createMenuDynamoDbFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createMenuDynamoDbFields","MenuDynamoDbElasticFieldPlugin","field","type","path","sortable"],"sources":["fields.ts"],"sourcesContent":["import { MenuDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/MenuDynamoDbElasticFieldPlugin\";\n\nexport const createMenuDynamoDbFields = (): MenuDynamoDbElasticFieldPlugin[] => {\n return [\n new MenuDynamoDbElasticFieldPlugin({\n field: \"id\"\n }),\n new MenuDynamoDbElasticFieldPlugin({\n field: \"title\"\n }),\n new MenuDynamoDbElasticFieldPlugin({\n field: \"slug\"\n }),\n new MenuDynamoDbElasticFieldPlugin({\n field: \"createdOn\",\n type: \"date\"\n }),\n new MenuDynamoDbElasticFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\",\n sortable: false\n })\n ];\n};\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,wBAAwB,GAAG,MAAwC;EAC5E,OAAO,CACH,IAAIC,8DAAJ,CAAmC;IAC/BC,KAAK,EAAE;EADwB,CAAnC,CADG,EAIH,IAAID,8DAAJ,CAAmC;IAC/BC,KAAK,EAAE;EADwB,CAAnC,CAJG,EAOH,IAAID,8DAAJ,CAAmC;IAC/BC,KAAK,EAAE;EADwB,CAAnC,CAPG,EAUH,IAAID,8DAAJ,CAAmC;IAC/BC,KAAK,EAAE,WADwB;IAE/BC,IAAI,EAAE;EAFyB,CAAnC,CAVG,EAcH,IAAIF,8DAAJ,CAAmC;IAC/BC,KAAK,EAAE,WADwB;IAE/BE,IAAI,EAAE,cAFyB;IAG/BC,QAAQ,EAAE;EAHqB,CAAnC,CAdG,CAAP;AAoBH,CArBM"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MenuStorageOperations } from "@webiny/api-page-builder/types";
|
|
2
|
+
import { Entity } from "dynamodb-toolbox";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface CreateMenuStorageOperationsParams {
|
|
5
|
+
entity: Entity<any>;
|
|
6
|
+
plugins: PluginsContainer;
|
|
7
|
+
}
|
|
8
|
+
export declare const createMenuStorageOperations: ({ entity, plugins }: CreateMenuStorageOperationsParams) => MenuStorageOperations;
|