@webiny/api-headless-cms-ddb-es 5.17.4-beta.1 → 5.18.0-beta.2
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 +5 -17
- package/configurations.js +9 -38
- package/definitions/entry.d.ts +6 -11
- package/definitions/entry.js +17 -14
- package/definitions/entryElasticsearch.d.ts +8 -0
- package/definitions/entryElasticsearch.js +46 -0
- package/definitions/group.d.ts +8 -0
- package/definitions/group.js +74 -0
- package/definitions/model.d.ts +7 -6
- package/definitions/model.js +45 -20
- package/definitions/settings.d.ts +8 -0
- package/definitions/settings.js +62 -0
- package/definitions/system.d.ts +8 -0
- package/definitions/system.js +50 -0
- package/definitions/table.d.ts +7 -3
- package/definitions/table.js +12 -29
- package/definitions/tableElasticsearch.d.ts +7 -3
- package/definitions/tableElasticsearch.js +12 -29
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +4 -3
- package/dynamoDb/storage/date.d.ts +2 -2
- package/dynamoDb/storage/date.js +17 -17
- package/dynamoDb/storage/longText.d.ts +7 -0
- package/dynamoDb/storage/longText.js +83 -0
- package/dynamoDb/storage/richText.d.ts +2 -2
- package/dynamoDb/storage/richText.js +69 -67
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +1 -2
- package/elasticsearch/indexing/dateTimeIndexing.js +1 -2
- package/elasticsearch/indexing/defaultFieldIndexing.js +1 -2
- package/elasticsearch/indexing/index.js +4 -3
- package/elasticsearch/indexing/longTextIndexing.d.ts +3 -0
- package/elasticsearch/indexing/longTextIndexing.js +36 -0
- package/elasticsearch/indexing/numberIndexing.js +1 -2
- package/elasticsearch/indexing/objectIndexing.js +32 -27
- package/elasticsearch/indexing/richTextIndexing.js +1 -2
- package/elasticsearch/search/index.js +1 -2
- package/elasticsearch/search/refSearch.js +1 -2
- package/elasticsearch/search/timeSearch.js +1 -2
- package/helpers/createElasticsearchQueryBody.d.ts +5 -4
- package/helpers/createElasticsearchQueryBody.js +89 -44
- package/helpers/entryIndexHelpers.d.ts +14 -12
- package/helpers/entryIndexHelpers.js +63 -58
- package/helpers/fields.d.ts +11 -10
- package/helpers/fields.js +4 -5
- package/helpers/index.js +1 -2
- package/helpers/operatorPluginsList.d.ts +2 -2
- package/helpers/operatorPluginsList.js +3 -4
- package/helpers/searchPluginsList.d.ts +2 -2
- package/helpers/searchPluginsList.js +3 -4
- package/helpers/transformValueForSearch.d.ts +4 -5
- package/helpers/transformValueForSearch.js +3 -6
- package/index.d.ts +2 -2
- package/index.js +154 -12
- package/operations/entry/dataLoaders.d.ts +38 -14
- package/operations/entry/dataLoaders.js +193 -125
- package/operations/entry/elasticsearchFields.d.ts +2 -0
- package/operations/entry/elasticsearchFields.js +32 -0
- package/operations/entry/fields.d.ts +2 -2
- package/operations/entry/fields.js +1 -2
- package/operations/entry/index.d.ts +13 -3
- package/operations/entry/index.js +1148 -15
- package/operations/entry/keys.d.ts +12 -0
- package/operations/entry/keys.js +40 -0
- package/operations/group/index.d.ts +8 -0
- package/operations/group/index.js +202 -0
- package/operations/model/index.d.ts +8 -3
- package/operations/model/index.js +196 -17
- package/operations/settings/index.d.ts +6 -3
- package/operations/settings/index.js +132 -16
- package/operations/system/createElasticsearchTemplate.d.ts +5 -0
- package/operations/system/createElasticsearchTemplate.js +62 -0
- package/operations/system/index.d.ts +6 -3
- package/operations/system/index.js +93 -17
- package/package.json +15 -14
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +17 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +9 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +9 -3
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +17 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +17 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +24 -0
- package/types.d.ts +61 -80
- package/types.js +55 -1
- package/upgrades/index.js +1 -2
- package/upgrades/utils.js +1 -2
- package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +2 -2
- package/upgrades/v5.0.0/cleanDatabaseRecord.js +1 -2
- package/upgrades/v5.0.0/createOldVersionIndiceName.js +1 -2
- package/upgrades/v5.0.0/entryValueFixer.d.ts +3 -3
- package/upgrades/v5.0.0/entryValueFixer.js +3 -4
- package/upgrades/v5.0.0/fieldFinder.d.ts +4 -4
- package/upgrades/v5.0.0/fieldFinder.js +1 -2
- package/upgrades/v5.0.0/helpers.js +1 -2
- package/upgrades/v5.0.0/index.js +1 -2
- package/upgrades/v5.8.0/index.js +3 -3
- package/configurations.js.map +0 -1
- package/definitions/elasticsearchEntry.d.ts +0 -13
- package/definitions/elasticsearchEntry.js +0 -43
- package/definitions/elasticsearchEntry.js.map +0 -1
- package/definitions/entry.js.map +0 -1
- package/definitions/index.d.ts +0 -17
- package/definitions/index.js +0 -28
- package/definitions/index.js.map +0 -1
- package/definitions/model.js.map +0 -1
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/richText.js.map +0 -1
- package/elasticsearch/index.js.map +0 -1
- package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
- package/elasticsearch/indexing/index.js.map +0 -1
- package/elasticsearch/indexing/numberIndexing.js.map +0 -1
- package/elasticsearch/indexing/objectIndexing.js.map +0 -1
- package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
- package/elasticsearch/search/index.js.map +0 -1
- package/elasticsearch/search/refSearch.js.map +0 -1
- package/elasticsearch/search/timeSearch.js.map +0 -1
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/entryIndexHelpers.js.map +0 -1
- package/helpers/fields.js.map +0 -1
- package/helpers/index.js.map +0 -1
- package/helpers/operatorPluginsList.js.map +0 -1
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/CmsContentEntryDynamoElastic.d.ts +0 -54
- package/operations/entry/CmsContentEntryDynamoElastic.js +0 -1128
- package/operations/entry/CmsContentEntryDynamoElastic.js.map +0 -1
- package/operations/entry/dataLoaders.js.map +0 -1
- package/operations/entry/fields.js.map +0 -1
- package/operations/entry/index.js.map +0 -1
- package/operations/model/CmsContentModelDynamoElastic.d.ts +0 -18
- package/operations/model/CmsContentModelDynamoElastic.js +0 -180
- package/operations/model/CmsContentModelDynamoElastic.js.map +0 -1
- package/operations/model/index.js.map +0 -1
- package/operations/modelGroup/CmsContentModelGroupDynamoElastic.d.ts +0 -40
- package/operations/modelGroup/CmsContentModelGroupDynamoElastic.js +0 -193
- package/operations/modelGroup/CmsContentModelGroupDynamoElastic.js.map +0 -1
- package/operations/modelGroup/index.d.ts +0 -3
- package/operations/modelGroup/index.js +0 -26
- package/operations/modelGroup/index.js.map +0 -1
- package/operations/settings/CmsSettingsDynamoElastic.d.ts +0 -14
- package/operations/settings/CmsSettingsDynamoElastic.js +0 -127
- package/operations/settings/CmsSettingsDynamoElastic.js.map +0 -1
- package/operations/settings/index.js.map +0 -1
- package/operations/system/CmsSystemDynamoElastic.d.ts +0 -14
- package/operations/system/CmsSystemDynamoElastic.js +0 -101
- package/operations/system/CmsSystemDynamoElastic.js.map +0 -1
- package/operations/system/CmsSystemInstallationPlugin.d.ts +0 -11
- package/operations/system/CmsSystemInstallationPlugin.js +0 -78
- package/operations/system/CmsSystemInstallationPlugin.js.map +0 -1
- package/operations/system/index.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
- package/types.js.map +0 -1
- package/upgrades/index.js.map +0 -1
- package/upgrades/utils.js.map +0 -1
- package/upgrades/v5.0.0/cleanDatabaseRecord.js.map +0 -1
- package/upgrades/v5.0.0/createOldVersionIndiceName.js.map +0 -1
- package/upgrades/v5.0.0/entryValueFixer.js.map +0 -1
- package/upgrades/v5.0.0/fieldFinder.js.map +0 -1
- package/upgrades/v5.0.0/helpers.js.map +0 -1
- package/upgrades/v5.0.0/index.js.map +0 -1
- package/upgrades/v5.8.0/index.js.map +0 -1
- package/utils.d.ts +0 -3
- package/utils.js +0 -42
- package/utils.js.map +0 -1
package/configurations.d.ts
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface DatabaseConfigKeyFields {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
interface DatabaseConfigKeys {
|
|
6
|
-
primary: boolean;
|
|
7
|
-
unique: boolean;
|
|
8
|
-
name: string;
|
|
9
|
-
fields: DatabaseConfigKeyFields[];
|
|
10
|
-
}
|
|
11
|
-
export interface CmsDatabaseConfig {
|
|
12
|
-
table: string;
|
|
13
|
-
keys: DatabaseConfigKeys[];
|
|
14
|
-
}
|
|
1
|
+
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
15
2
|
interface ElasticsearchConfig {
|
|
16
3
|
index: string;
|
|
17
4
|
}
|
|
5
|
+
interface CmsElasticsearchParams {
|
|
6
|
+
model: CmsModel;
|
|
7
|
+
}
|
|
18
8
|
interface Configurations {
|
|
19
|
-
|
|
20
|
-
esDb: () => CmsDatabaseConfig;
|
|
21
|
-
es: (context: CmsContext, model: CmsContentModel) => ElasticsearchConfig;
|
|
9
|
+
es: (params: CmsElasticsearchParams) => ElasticsearchConfig;
|
|
22
10
|
}
|
|
23
11
|
declare const configurations: Configurations;
|
|
24
12
|
export default configurations;
|
package/configurations.js
CHANGED
|
@@ -5,43 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
const configurations = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
name: "PK"
|
|
16
|
-
}, {
|
|
17
|
-
name: "SK"
|
|
18
|
-
}]
|
|
19
|
-
}]
|
|
20
|
-
}),
|
|
21
|
-
esDb: () => ({
|
|
22
|
-
table: process.env.DB_TABLE_ELASTICSEARCH,
|
|
23
|
-
keys: [{
|
|
24
|
-
primary: true,
|
|
25
|
-
unique: true,
|
|
26
|
-
name: "primary",
|
|
27
|
-
fields: [{
|
|
28
|
-
name: "PK"
|
|
29
|
-
}, {
|
|
30
|
-
name: "SK"
|
|
31
|
-
}]
|
|
32
|
-
}]
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
es(context, model) {
|
|
36
|
-
const tenant = context.tenancy.getCurrentTenant();
|
|
37
|
-
|
|
38
|
-
if (!tenant) {
|
|
39
|
-
throw new Error(`There is no tenant on "context.security".`);
|
|
40
|
-
}
|
|
41
|
-
|
|
8
|
+
es({
|
|
9
|
+
model
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
tenant,
|
|
13
|
+
locale
|
|
14
|
+
} = model;
|
|
42
15
|
const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
|
|
43
|
-
const
|
|
44
|
-
const index = [sharedIndex ? "root" : tenant.id, "headless-cms", locale, model.modelId].join("-").toLowerCase();
|
|
16
|
+
const index = [sharedIndex ? "root" : tenant, "headless-cms", locale, model.modelId].join("-").toLowerCase();
|
|
45
17
|
const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;
|
|
46
18
|
|
|
47
19
|
if (prefix) {
|
|
@@ -57,5 +29,4 @@ const configurations = {
|
|
|
57
29
|
|
|
58
30
|
};
|
|
59
31
|
var _default = configurations;
|
|
60
|
-
exports.default = _default;
|
|
61
|
-
//# sourceMappingURL=configurations.js.map
|
|
32
|
+
exports.default = _default;
|
package/definitions/entry.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Attributes } from "../types";
|
|
3
|
+
export interface Params {
|
|
4
4
|
table: Table;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* - ignore
|
|
10
|
-
* - version
|
|
11
|
-
* - savedOn
|
|
12
|
-
*/
|
|
13
|
-
export default _default;
|
|
5
|
+
entityName: string;
|
|
6
|
+
attributes: Attributes;
|
|
7
|
+
}
|
|
8
|
+
export declare const createEntryEntity: (params: Params) => Entity<any>;
|
package/definitions/entry.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
8
|
+
exports.createEntryEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
11
|
|
|
8
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
var _default = params => {
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createEntryEntity = params => {
|
|
17
19
|
const {
|
|
18
|
-
table
|
|
20
|
+
table,
|
|
21
|
+
entityName,
|
|
22
|
+
attributes
|
|
19
23
|
} = params;
|
|
20
24
|
return new _dynamodbToolbox.Entity({
|
|
21
|
-
name:
|
|
25
|
+
name: entityName,
|
|
22
26
|
table,
|
|
23
|
-
attributes: {
|
|
27
|
+
attributes: _objectSpread({
|
|
24
28
|
PK: {
|
|
25
29
|
type: "string",
|
|
26
30
|
partitionKey: true
|
|
@@ -80,9 +84,8 @@ var _default = params => {
|
|
|
80
84
|
values: {
|
|
81
85
|
type: "map"
|
|
82
86
|
}
|
|
83
|
-
}
|
|
87
|
+
}, attributes || {})
|
|
84
88
|
});
|
|
85
89
|
};
|
|
86
90
|
|
|
87
|
-
exports.
|
|
88
|
-
//# sourceMappingURL=entry.js.map
|
|
91
|
+
exports.createEntryEntity = createEntryEntity;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
+
import { Attributes } from "../types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
table: Table;
|
|
5
|
+
entityName: string;
|
|
6
|
+
attributes: Attributes;
|
|
7
|
+
}
|
|
8
|
+
export declare const createEntryElasticsearchEntity: (params: Params) => Entity<any>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createEntryElasticsearchEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createEntryElasticsearchEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
table,
|
|
21
|
+
entityName,
|
|
22
|
+
attributes
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
type: "string",
|
|
30
|
+
partitionKey: true
|
|
31
|
+
},
|
|
32
|
+
SK: {
|
|
33
|
+
type: "string",
|
|
34
|
+
sortKey: true
|
|
35
|
+
},
|
|
36
|
+
index: {
|
|
37
|
+
type: "string"
|
|
38
|
+
},
|
|
39
|
+
data: {
|
|
40
|
+
type: "map"
|
|
41
|
+
}
|
|
42
|
+
}, attributes || {})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.createEntryElasticsearchEntity = createEntryElasticsearchEntity;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createGroupEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createGroupEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
table,
|
|
21
|
+
attributes,
|
|
22
|
+
entityName
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
TYPE: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
webinyVersion: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
id: {
|
|
41
|
+
type: "string"
|
|
42
|
+
},
|
|
43
|
+
name: {
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
slug: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
locale: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
description: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
icon: {
|
|
56
|
+
type: "string"
|
|
57
|
+
},
|
|
58
|
+
createdBy: {
|
|
59
|
+
type: "map"
|
|
60
|
+
},
|
|
61
|
+
createdOn: {
|
|
62
|
+
type: "string"
|
|
63
|
+
},
|
|
64
|
+
savedOn: {
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
tenant: {
|
|
68
|
+
type: "string"
|
|
69
|
+
}
|
|
70
|
+
}, attributes || {})
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
exports.createGroupEntity = createGroupEntity;
|
package/definitions/model.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
+
import { Attributes } from "../types";
|
|
3
|
+
export interface Params {
|
|
4
4
|
table: Table;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
entityName: string;
|
|
6
|
+
attributes: Attributes;
|
|
7
|
+
}
|
|
8
|
+
export declare const createModelEntity: (params: Params) => Entity<any>;
|
package/definitions/model.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
8
|
+
exports.createModelEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
11
|
|
|
8
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
13
|
|
|
10
|
-
var
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createModelEntity = params => {
|
|
11
19
|
const {
|
|
12
|
-
table
|
|
20
|
+
table,
|
|
21
|
+
attributes,
|
|
22
|
+
entityName
|
|
13
23
|
} = params;
|
|
14
24
|
return new _dynamodbToolbox.Entity({
|
|
15
|
-
name:
|
|
25
|
+
name: entityName,
|
|
16
26
|
table,
|
|
17
|
-
attributes: {
|
|
27
|
+
attributes: _objectSpread({
|
|
18
28
|
PK: {
|
|
19
29
|
partitionKey: true
|
|
20
30
|
},
|
|
@@ -22,50 +32,65 @@ var _default = params => {
|
|
|
22
32
|
sortKey: true
|
|
23
33
|
},
|
|
24
34
|
TYPE: {
|
|
25
|
-
type: "string"
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true
|
|
26
37
|
},
|
|
27
38
|
webinyVersion: {
|
|
28
|
-
type: "string"
|
|
39
|
+
type: "string",
|
|
40
|
+
required: true
|
|
29
41
|
},
|
|
30
42
|
name: {
|
|
31
|
-
type: "string"
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true
|
|
32
45
|
},
|
|
33
46
|
modelId: {
|
|
34
|
-
type: "string"
|
|
47
|
+
type: "string",
|
|
48
|
+
required: true
|
|
35
49
|
},
|
|
36
50
|
locale: {
|
|
37
|
-
type: "string"
|
|
51
|
+
type: "string",
|
|
52
|
+
required: true
|
|
38
53
|
},
|
|
39
54
|
group: {
|
|
40
|
-
type: "map"
|
|
55
|
+
type: "map",
|
|
56
|
+
required: true
|
|
41
57
|
},
|
|
42
58
|
description: {
|
|
43
59
|
type: "string"
|
|
44
60
|
},
|
|
45
61
|
createdOn: {
|
|
46
|
-
type: "string"
|
|
62
|
+
type: "string",
|
|
63
|
+
required: true
|
|
47
64
|
},
|
|
48
65
|
savedOn: {
|
|
49
|
-
type: "string"
|
|
66
|
+
type: "string",
|
|
67
|
+
required: true
|
|
50
68
|
},
|
|
51
69
|
createdBy: {
|
|
52
|
-
type: "map"
|
|
70
|
+
type: "map",
|
|
71
|
+
required: true
|
|
53
72
|
},
|
|
54
73
|
fields: {
|
|
55
|
-
type: "list"
|
|
74
|
+
type: "list",
|
|
75
|
+
required: true
|
|
56
76
|
},
|
|
57
77
|
layout: {
|
|
58
|
-
type: "list"
|
|
78
|
+
type: "list",
|
|
79
|
+
required: true
|
|
59
80
|
},
|
|
60
81
|
lockedFields: {
|
|
61
|
-
type: "list"
|
|
82
|
+
type: "list",
|
|
83
|
+
required: true
|
|
62
84
|
},
|
|
63
85
|
titleFieldId: {
|
|
64
86
|
type: "string"
|
|
87
|
+
},
|
|
88
|
+
tenant: {
|
|
89
|
+
type: "string",
|
|
90
|
+
required: true
|
|
65
91
|
}
|
|
66
|
-
}
|
|
92
|
+
}, attributes || {})
|
|
67
93
|
});
|
|
68
94
|
};
|
|
69
95
|
|
|
70
|
-
exports.
|
|
71
|
-
//# sourceMappingURL=model.js.map
|
|
96
|
+
exports.createModelEntity = createModelEntity;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createSettingsEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createSettingsEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
entityName,
|
|
21
|
+
table,
|
|
22
|
+
attributes
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
TYPE: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
key: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
uploadMinFileSize: {
|
|
41
|
+
type: "number"
|
|
42
|
+
},
|
|
43
|
+
uploadMaxFileSize: {
|
|
44
|
+
type: "number"
|
|
45
|
+
},
|
|
46
|
+
srcPrefix: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
contentModelLastChange: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
tenant: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
locale: {
|
|
56
|
+
type: "string"
|
|
57
|
+
}
|
|
58
|
+
}, attributes || {})
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.createSettingsEntity = createSettingsEntity;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createSystemEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
const createSystemEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
entityName,
|
|
21
|
+
attributes,
|
|
22
|
+
table
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
version: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
locale: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
tenant: {
|
|
41
|
+
type: "string"
|
|
42
|
+
},
|
|
43
|
+
readAPIKey: {
|
|
44
|
+
type: "string"
|
|
45
|
+
}
|
|
46
|
+
}, attributes || {})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.createSystemEntity = createSystemEntity;
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableModifier } from "../types";
|
|
2
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
2
3
|
import { Table } from "dynamodb-toolbox";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export interface Params {
|
|
5
|
+
table?: TableModifier;
|
|
6
|
+
documentClient: DocumentClient;
|
|
7
|
+
}
|
|
8
|
+
export declare const createTable: ({ table, documentClient }: Params) => Table;
|
package/definitions/table.js
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
var _configurations = _interopRequireDefault(require("../configurations"));
|
|
6
|
+
exports.createTable = void 0;
|
|
13
7
|
|
|
14
8
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
if (!driver || !driver.documentClient) {
|
|
23
|
-
throw new _error.default(`Missing documentDriver on the context.db.driver property.`, "DOCUMENT_CLIENT_ERROR");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const tableName = _configurations.default.db().table;
|
|
27
|
-
|
|
28
|
-
if (!tableName && !db.table) {
|
|
29
|
-
throw new _error.default(`Missing table on the context.db property.`, "TABLE_NAME_ERROR");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return new _dynamodbToolbox.Table({
|
|
33
|
-
name: tableName || db.table,
|
|
10
|
+
const createTable = ({
|
|
11
|
+
table,
|
|
12
|
+
documentClient
|
|
13
|
+
}) => {
|
|
14
|
+
const tableConfig = {
|
|
15
|
+
name: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
|
|
34
16
|
partitionKey: "PK",
|
|
35
17
|
sortKey: "SK",
|
|
36
|
-
DocumentClient:
|
|
37
|
-
}
|
|
18
|
+
DocumentClient: documentClient
|
|
19
|
+
};
|
|
20
|
+
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
21
|
+
return new _dynamodbToolbox.Table(config);
|
|
38
22
|
};
|
|
39
23
|
|
|
40
|
-
exports.
|
|
41
|
-
//# sourceMappingURL=table.js.map
|
|
24
|
+
exports.createTable = createTable;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableModifier } from "../types";
|
|
2
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
2
3
|
import { Table } from "dynamodb-toolbox";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export interface Params {
|
|
5
|
+
table?: TableModifier;
|
|
6
|
+
documentClient: DocumentClient;
|
|
7
|
+
}
|
|
8
|
+
export declare const createElasticsearchTable: ({ table, documentClient }: Params) => Table;
|