@webiny/api-form-builder-so-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.40876133bb
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 +7 -5
- package/configurations.js +31 -9
- package/configurations.js.map +1 -0
- package/definitions/elasticsearch.d.ts +2 -1
- package/definitions/elasticsearch.js +3 -7
- package/definitions/elasticsearch.js.map +1 -0
- package/definitions/form.d.ts +2 -1
- package/definitions/form.js +3 -7
- package/definitions/form.js.map +1 -0
- package/definitions/settings.d.ts +2 -1
- package/definitions/settings.js +3 -7
- package/definitions/settings.js.map +1 -0
- package/definitions/submission.d.ts +2 -1
- package/definitions/submission.js +3 -7
- package/definitions/submission.js.map +1 -0
- package/definitions/system.d.ts +2 -1
- package/definitions/system.js +3 -7
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +3 -2
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +2 -1
- package/definitions/tableElasticsearch.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +10 -0
- package/elasticsearch/createElasticsearchIndex.js +63 -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.js +36 -33
- package/index.js.map +1 -0
- package/operations/form/elasticsearchBody.js +12 -29
- package/operations/form/elasticsearchBody.js.map +1 -0
- package/operations/form/elasticsearchFields.js.map +1 -0
- package/operations/form/fields.js.map +1 -0
- package/operations/form/index.d.ts +2 -2
- package/operations/form/index.js +51 -50
- package/operations/form/index.js.map +1 -0
- package/operations/settings/index.d.ts +2 -2
- package/operations/settings/index.js +4 -8
- package/operations/settings/index.js.map +1 -0
- package/operations/submission/elasticsearchBody.js +16 -26
- package/operations/submission/elasticsearchBody.js.map +1 -0
- package/operations/submission/elasticsearchFields.js.map +1 -0
- package/operations/submission/index.d.ts +2 -2
- package/operations/submission/index.js +22 -27
- package/operations/submission/index.js.map +1 -0
- package/operations/system/index.d.ts +2 -2
- package/operations/system/index.js +4 -8
- package/operations/system/index.js.map +1 -0
- package/package.json +23 -27
- package/plugins/FormDynamoDbFieldPlugin.js +1 -1
- package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
- package/plugins/FormElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchBodyModifierPlugin.js +3 -3
- package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/FormElasticsearchFieldPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchFieldPlugin.js +3 -3
- package/plugins/FormElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/FormElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/FormElasticsearchIndexPlugin.js +17 -0
- package/plugins/FormElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/FormElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchQueryModifierPlugin.js +3 -3
- package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/FormElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchSortModifierPlugin.js +3 -3
- package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +3 -3
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchFieldPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchFieldPlugin.js +3 -3
- package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +3 -3
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchSortModifierPlugin.js +3 -3
- package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -0
- package/types.d.ts +2 -2
- package/types.js.map +1 -0
- package/operations/system/createElasticsearchIndex.d.ts +0 -6
- package/operations/system/createElasticsearchIndex.js +0 -70
- package/upgrades/5.16.0/index.d.ts +0 -8
- package/upgrades/5.16.0/index.js +0 -141
package/configurations.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export interface ElasticsearchConfigParams {
|
|
2
2
|
tenant: string;
|
|
3
|
+
locale: string;
|
|
3
4
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface ElasticsearchConfig {
|
|
6
|
+
index: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const configurations: {
|
|
9
|
+
es(params: ElasticsearchConfigParams): ElasticsearchConfig;
|
|
8
10
|
};
|
|
9
|
-
export
|
|
11
|
+
export {};
|
package/configurations.js
CHANGED
|
@@ -1,28 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
+
exports.configurations = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
const configurations = {
|
|
8
13
|
es(params) {
|
|
9
14
|
const {
|
|
10
|
-
tenant
|
|
15
|
+
tenant,
|
|
16
|
+
locale
|
|
11
17
|
} = params;
|
|
18
|
+
|
|
19
|
+
if (!tenant) {
|
|
20
|
+
throw new _error.default(`Missing "tenant" parameter when trying to create Elasticsearch index name.`, "TENANT_ERROR");
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
|
|
13
|
-
const
|
|
14
|
-
|
|
24
|
+
const tenantId = sharedIndex ? "root" : tenant;
|
|
25
|
+
let localeCode = null;
|
|
26
|
+
|
|
27
|
+
if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === "true") {
|
|
28
|
+
if (!locale) {
|
|
29
|
+
throw new _error.default(`Missing "locale" parameter when trying to create Elasticsearch index name.`, "LOCALE_ERROR");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
localeCode = locale;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const index = [tenantId, localeCode, "form-builder"].filter(Boolean).join("-").toLowerCase();
|
|
36
|
+
const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX || "";
|
|
15
37
|
|
|
16
|
-
if (prefix) {
|
|
38
|
+
if (!prefix) {
|
|
17
39
|
return {
|
|
18
|
-
index
|
|
40
|
+
index
|
|
19
41
|
};
|
|
20
42
|
}
|
|
21
43
|
|
|
22
44
|
return {
|
|
23
|
-
index
|
|
45
|
+
index: prefix + index
|
|
24
46
|
};
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
};
|
|
28
|
-
exports.
|
|
50
|
+
exports.configurations = configurations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["configurations","es","params","tenant","locale","WebinyError","sharedIndex","process","env","ELASTICSEARCH_SHARED_INDEXES","tenantId","localeCode","WEBINY_ELASTICSEARCH_INDEX_LOCALE","index","filter","Boolean","join","toLowerCase","prefix","ELASTIC_SEARCH_INDEX_PREFIX"],"sources":["configurations.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport interface ElasticsearchConfigParams {\n tenant: string;\n locale: string;\n}\n\ninterface ElasticsearchConfig {\n index: string;\n}\n\nexport const configurations = {\n es(params: ElasticsearchConfigParams): ElasticsearchConfig {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(\n `Missing \"tenant\" parameter when trying to create Elasticsearch index name.`,\n \"TENANT_ERROR\"\n );\n }\n\n const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === \"true\";\n\n const tenantId = sharedIndex ? \"root\" : tenant;\n let localeCode: string | null = null;\n if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === \"true\") {\n if (!locale) {\n throw new WebinyError(\n `Missing \"locale\" parameter when trying to create Elasticsearch index name.`,\n \"LOCALE_ERROR\"\n );\n }\n localeCode = locale;\n }\n\n const index = [tenantId, localeCode, \"form-builder\"]\n .filter(Boolean)\n .join(\"-\")\n .toLowerCase();\n\n const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX || \"\";\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n }\n};\n"],"mappings":";;;;;;;;;AAAA;;AAWO,MAAMA,cAAc,GAAG;EAC1BC,EAAE,CAACC,MAAD,EAAyD;IACvD,MAAM;MAAEC,MAAF;MAAUC;IAAV,IAAqBF,MAA3B;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,cAAJ,CACD,4EADC,EAEF,cAFE,CAAN;IAIH;;IAED,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAR,CAAYC,4BAAZ,KAA6C,MAAjE;IAEA,MAAMC,QAAQ,GAAGJ,WAAW,GAAG,MAAH,GAAYH,MAAxC;IACA,IAAIQ,UAAyB,GAAG,IAAhC;;IACA,IAAIJ,OAAO,CAACC,GAAR,CAAYI,iCAAZ,KAAkD,MAAtD,EAA8D;MAC1D,IAAI,CAACR,MAAL,EAAa;QACT,MAAM,IAAIC,cAAJ,CACD,4EADC,EAEF,cAFE,CAAN;MAIH;;MACDM,UAAU,GAAGP,MAAb;IACH;;IAED,MAAMS,KAAK,GAAG,CAACH,QAAD,EAAWC,UAAX,EAAuB,cAAvB,EACTG,MADS,CACFC,OADE,EAETC,IAFS,CAEJ,GAFI,EAGTC,WAHS,EAAd;IAKA,MAAMC,MAAM,GAAGX,OAAO,CAACC,GAAR,CAAYW,2BAAZ,IAA2C,EAA1D;;IACA,IAAI,CAACD,MAAL,EAAa;MACT,OAAO;QACHL;MADG,CAAP;IAGH;;IACD,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IADb,CAAP;EAGH;;AAtCyB,CAAvB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
8
|
export declare const createElasticsearchEntity: (params: Params) => Entity<{}>;
|
|
9
|
+
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createElasticsearchEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
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
14
|
const createElasticsearchEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
table,
|
|
@@ -24,7 +20,7 @@ const createElasticsearchEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
name: entityName,
|
|
26
22
|
table,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElasticsearchEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","index","type","data","TYPE"],"sources":["elasticsearch.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createElasticsearchEntity = (params: Params) => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n TYPE: {\n type: \"string\"\n },\n\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,yBAAyB,GAAIC,MAAD,IAAoB;EACzD,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEH,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,KAAK,EAAE;QACHC,IAAI,EAAE;MADH,CAPD;MAUNC,IAAI,EAAE;QACFD,IAAI,EAAE;MADJ,CAVA;MAaNE,IAAI,EAAE;QACFF,IAAI,EAAE;MADJ;IAbA,GAiBFR,UAAU,IAAI,EAjBZ;EAHI,CAAX,CAAP;AAuBH,CAzBM"}
|
package/definitions/form.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
8
|
export declare const createFormEntity: (params: Params) => Entity<any>;
|
|
9
|
+
export {};
|
package/definitions/form.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createFormEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
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
14
|
const createFormEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
table,
|
|
@@ -24,7 +20,7 @@ const createFormEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
table,
|
|
26
22
|
name: entityName,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFormEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","formId","tenant","locale","createdBy","ownedBy","savedOn","createdOn","slug","version","locked","published","publishedOn","status","fields","layout","stats","settings","triggers","webinyVersion"],"sources":["form.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createFormEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n formId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n savedOn: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n published: {\n type: \"boolean\"\n },\n publishedOn: {\n type: \"string\"\n },\n status: {\n type: \"string\"\n },\n fields: {\n type: \"list\"\n },\n layout: {\n type: \"list\"\n },\n stats: {\n type: \"map\"\n },\n settings: {\n type: \"map\"\n },\n triggers: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,gBAAgB,GAAIC,MAAD,IAAiC;EAC7D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdH,KADc;IAEdI,IAAI,EAAEH,UAFQ;IAGdC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,EAAE,EAAE;QACAD,IAAI,EAAE;MADN,CAVE;MAaNE,MAAM,EAAE;QACJF,IAAI,EAAE;MADF,CAbF;MAgBNG,MAAM,EAAE;QACJH,IAAI,EAAE;MADF,CAhBF;MAmBNI,MAAM,EAAE;QACJJ,IAAI,EAAE;MADF,CAnBF;MAsBNK,SAAS,EAAE;QACPL,IAAI,EAAE;MADC,CAtBL;MAyBNM,OAAO,EAAE;QACLN,IAAI,EAAE;MADD,CAzBH;MA4BNO,OAAO,EAAE;QACLP,IAAI,EAAE;MADD,CA5BH;MA+BNQ,SAAS,EAAE;QACPR,IAAI,EAAE;MADC,CA/BL;MAkCNN,IAAI,EAAE;QACFM,IAAI,EAAE;MADJ,CAlCA;MAqCNS,IAAI,EAAE;QACFT,IAAI,EAAE;MADJ,CArCA;MAwCNU,OAAO,EAAE;QACLV,IAAI,EAAE;MADD,CAxCH;MA2CNW,MAAM,EAAE;QACJX,IAAI,EAAE;MADF,CA3CF;MA8CNY,SAAS,EAAE;QACPZ,IAAI,EAAE;MADC,CA9CL;MAiDNa,WAAW,EAAE;QACTb,IAAI,EAAE;MADG,CAjDP;MAoDNc,MAAM,EAAE;QACJd,IAAI,EAAE;MADF,CApDF;MAuDNe,MAAM,EAAE;QACJf,IAAI,EAAE;MADF,CAvDF;MA0DNgB,MAAM,EAAE;QACJhB,IAAI,EAAE;MADF,CA1DF;MA6DNiB,KAAK,EAAE;QACHjB,IAAI,EAAE;MADH,CA7DD;MAgENkB,QAAQ,EAAE;QACNlB,IAAI,EAAE;MADA,CAhEJ;MAmENmB,QAAQ,EAAE;QACNnB,IAAI,EAAE;MADA,CAnEJ;MAsENoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MADK;IAtET,GAyEFR,UAAU,IAAI,EAzEZ;EAHI,CAAX,CAAP;AA+EH,CAjFM"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
8
|
export declare const createSettingsEntity: (params: Params) => Entity<any>;
|
|
9
|
+
export {};
|
package/definitions/settings.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createSettingsEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
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
14
|
const createSettingsEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
entityName,
|
|
@@ -24,7 +20,7 @@ const createSettingsEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
name: entityName,
|
|
26
22
|
table,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","reCaptcha","domain","tenant","locale"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n reCaptcha: {\n type: \"map\"\n },\n domain: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,oBAAoB,GAAIC,MAAD,IAAiC;EACjE,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,SAAS,EAAE;QACPD,IAAI,EAAE;MADC,CAVL;MAaNE,MAAM,EAAE;QACJF,IAAI,EAAE;MADF,CAbF;MAgBNG,MAAM,EAAE;QACJH,IAAI,EAAE;MADF,CAhBF;MAmBNI,MAAM,EAAE;QACJJ,IAAI,EAAE;MADF;IAnBF,GAsBFT,UAAU,IAAI,EAtBZ;EAHI,CAAX,CAAP;AA4BH,CA9BM"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
8
|
export declare const createSubmissionEntity: (params: Params) => Entity<any>;
|
|
9
|
+
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createSubmissionEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
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
14
|
const createSubmissionEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
table,
|
|
@@ -24,7 +20,7 @@ const createSubmissionEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
table,
|
|
26
22
|
name: entityName,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSubmissionEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","id","type","TYPE","data","meta","form","logs","createdOn","savedOn","ownedBy","tenant","locale","webinyVersion"],"sources":["submission.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSubmissionEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n id: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n form: {\n type: \"map\"\n },\n logs: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n ownedBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,sBAAsB,GAAIC,MAAD,IAAiC;EACnE,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdH,KADc;IAEdI,IAAI,EAAEH,UAFQ;IAGdC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,EAAE,EAAE;QACAC,IAAI,EAAE;MADN,CAPE;MAUNC,IAAI,EAAE;QACFD,IAAI,EAAE;MADJ,CAVA;MAaNE,IAAI,EAAE;QACFF,IAAI,EAAE;MADJ,CAbA;MAgBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ,CAhBA;MAmBNI,IAAI,EAAE;QACFJ,IAAI,EAAE;MADJ,CAnBA;MAsBNK,IAAI,EAAE;QACFL,IAAI,EAAE;MADJ,CAtBA;MAyBNM,SAAS,EAAE;QACPN,IAAI,EAAE;MADC,CAzBL;MA4BNO,OAAO,EAAE;QACLP,IAAI,EAAE;MADD,CA5BH;MA+BNQ,OAAO,EAAE;QACLR,IAAI,EAAE;MADD,CA/BH;MAkCNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CAlCF;MAqCNU,MAAM,EAAE;QACJV,IAAI,EAAE;MADF,CArCF;MAwCNW,aAAa,EAAE;QACXX,IAAI,EAAE;MADK;IAxCT,GA2CFR,UAAU,IAAI,EA3CZ;EAHI,CAAX,CAAP;AAiDH,CAnDM"}
|
package/definitions/system.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
8
|
export declare const createSystemEntity: (params: Params) => Entity<any>;
|
|
9
|
+
export {};
|
package/definitions/system.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createSystemEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
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
14
|
const createSystemEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
entityName,
|
|
@@ -24,7 +20,7 @@ const createSystemEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
name: entityName,
|
|
26
22
|
table,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant"],"sources":["system.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,kBAAkB,GAAIC,MAAD,IAAiC;EAC/D,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD,CAPH;MAUNC,MAAM,EAAE;QACJD,IAAI,EAAE;MADF;IAVF,GAaFT,UAAU,IAAI,EAbZ;EAHI,CAAX,CAAP;AAmBH,CArBM"}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
2
2
|
import { Table } from "dynamodb-toolbox";
|
|
3
|
-
|
|
4
|
-
tableName
|
|
3
|
+
interface Params {
|
|
4
|
+
tableName?: string;
|
|
5
5
|
documentClient: DocumentClient;
|
|
6
6
|
}
|
|
7
7
|
export declare const createTable: (params: Params) => Table;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient"],"sources":["table.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\n\ninterface Params {\n tableName?: string;\n documentClient: DocumentClient;\n}\n\nexport const createTable = (params: Params): Table => {\n const { tableName, documentClient } = params;\n\n return new Table({\n name: tableName || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient\n });\n};\n"],"mappings":";;;;;;;AACA;;AAOO,MAAMA,WAAW,GAAIC,MAAD,IAA2B;EAClD,MAAM;IAAEC,SAAF;IAAaC;EAAb,IAAgCF,MAAtC;EAEA,OAAO,IAAIG,sBAAJ,CAAU;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAR,CAAYC,QADnB;IAEbC,YAAY,EAAE,IAFD;IAGbC,OAAO,EAAE,IAHI;IAIbC,cAAc,EAAER;EAJH,CAAV,CAAP;AAMH,CATM"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Table } from "dynamodb-toolbox";
|
|
2
2
|
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
3
|
-
|
|
3
|
+
interface Params {
|
|
4
4
|
documentClient: DocumentClient;
|
|
5
5
|
tableName?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const createElasticsearchTable: (params: Params) => Table;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElasticsearchTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import { Table } from \"dynamodb-toolbox\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\n\ninterface Params {\n documentClient: DocumentClient;\n tableName?: string;\n}\n\nexport const createElasticsearchTable = (params: Params): Table => {\n const { tableName, documentClient } = params;\n return new Table({\n name: tableName || (process.env.DB_TABLE_ELASTICSEARCH as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient\n });\n};\n"],"mappings":";;;;;;;AAAA;;AAQO,MAAMA,wBAAwB,GAAIC,MAAD,IAA2B;EAC/D,MAAM;IAAEC,SAAF;IAAaC;EAAb,IAAgCF,MAAtC;EACA,OAAO,IAAIG,sBAAJ,CAAU;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAR,CAAYC,sBADnB;IAEbC,YAAY,EAAE,IAFD;IAGbC,OAAO,EAAE,IAHI;IAIbC,cAAc,EAAER;EAJH,CAAV,CAAP;AAMH,CARM"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
interface CreateElasticsearchIndexParams {
|
|
4
|
+
elasticsearch: Client;
|
|
5
|
+
plugins: PluginsContainer;
|
|
6
|
+
tenant: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const createElasticsearchIndex: (params: CreateElasticsearchIndexParams) => Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
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.createElasticsearchIndex = void 0;
|
|
9
|
+
|
|
10
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
11
|
+
|
|
12
|
+
var _FormElasticsearchIndexPlugin = require("../plugins/FormElasticsearchIndexPlugin");
|
|
13
|
+
|
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
+
|
|
16
|
+
var _configurations = require("../configurations");
|
|
17
|
+
|
|
18
|
+
const createElasticsearchIndex = async params => {
|
|
19
|
+
const {
|
|
20
|
+
elasticsearch,
|
|
21
|
+
plugins: container,
|
|
22
|
+
locale,
|
|
23
|
+
tenant
|
|
24
|
+
} = params;
|
|
25
|
+
const plugin = (0, _apiElasticsearch.getLastAddedIndexPlugin)({
|
|
26
|
+
container,
|
|
27
|
+
type: _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin.type,
|
|
28
|
+
locale
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
index
|
|
33
|
+
} = _configurations.configurations.es({
|
|
34
|
+
locale,
|
|
35
|
+
tenant
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const response = await elasticsearch.indices.exists({
|
|
40
|
+
index
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (response.body) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await elasticsearch.indices.create({
|
|
48
|
+
index,
|
|
49
|
+
body: plugin.body
|
|
50
|
+
});
|
|
51
|
+
} catch (ex) {
|
|
52
|
+
throw new _error.default(ex.message || "Could not create Elasticsearch index for the Form Builder.", ex.code || "FB_ELASTICSEARCH_INDEX_ERROR", {
|
|
53
|
+
error: ex,
|
|
54
|
+
type: _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin.type,
|
|
55
|
+
locale,
|
|
56
|
+
tenant,
|
|
57
|
+
index,
|
|
58
|
+
body: plugin.body
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.createElasticsearchIndex = createElasticsearchIndex;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElasticsearchIndex","params","elasticsearch","plugins","container","locale","tenant","plugin","getLastAddedIndexPlugin","type","FormElasticsearchIndexPlugin","index","configurations","es","response","indices","exists","body","create","ex","WebinyError","message","code","error"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { getLastAddedIndexPlugin } from \"@webiny/api-elasticsearch\";\nimport { FormElasticsearchIndexPlugin } from \"~/plugins/FormElasticsearchIndexPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport { configurations } from \"~/configurations\";\n\ninterface CreateElasticsearchIndexParams {\n elasticsearch: Client;\n plugins: PluginsContainer;\n tenant: string;\n locale: string;\n}\n\nexport const createElasticsearchIndex = async (params: CreateElasticsearchIndexParams) => {\n const { elasticsearch, plugins: container, locale, tenant } = params;\n\n const plugin = getLastAddedIndexPlugin<FormElasticsearchIndexPlugin>({\n container,\n type: FormElasticsearchIndexPlugin.type,\n locale\n });\n\n const { index } = configurations.es({\n locale,\n tenant\n });\n\n try {\n const response = await elasticsearch.indices.exists({\n index\n });\n if (response.body) {\n return;\n }\n\n await elasticsearch.indices.create({\n index,\n body: plugin.body\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create Elasticsearch index for the Form Builder.\",\n ex.code || \"FB_ELASTICSEARCH_INDEX_ERROR\",\n {\n error: ex,\n type: FormElasticsearchIndexPlugin.type,\n locale,\n tenant,\n index,\n body: plugin.body\n }\n );\n }\n};\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AASO,MAAMA,wBAAwB,GAAG,MAAOC,MAAP,IAAkD;EACtF,MAAM;IAAEC,aAAF;IAAiBC,OAAO,EAAEC,SAA1B;IAAqCC,MAArC;IAA6CC;EAA7C,IAAwDL,MAA9D;EAEA,MAAMM,MAAM,GAAG,IAAAC,yCAAA,EAAsD;IACjEJ,SADiE;IAEjEK,IAAI,EAAEC,0DAAA,CAA6BD,IAF8B;IAGjEJ;EAHiE,CAAtD,CAAf;;EAMA,MAAM;IAAEM;EAAF,IAAYC,8BAAA,CAAeC,EAAf,CAAkB;IAChCR,MADgC;IAEhCC;EAFgC,CAAlB,CAAlB;;EAKA,IAAI;IACA,MAAMQ,QAAQ,GAAG,MAAMZ,aAAa,CAACa,OAAd,CAAsBC,MAAtB,CAA6B;MAChDL;IADgD,CAA7B,CAAvB;;IAGA,IAAIG,QAAQ,CAACG,IAAb,EAAmB;MACf;IACH;;IAED,MAAMf,aAAa,CAACa,OAAd,CAAsBG,MAAtB,CAA6B;MAC/BP,KAD+B;MAE/BM,IAAI,EAAEV,MAAM,CAACU;IAFkB,CAA7B,CAAN;EAIH,CAZD,CAYE,OAAOE,EAAP,EAAW;IACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,4DADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,8BAFT,EAGF;MACIC,KAAK,EAAEJ,EADX;MAEIV,IAAI,EAAEC,0DAAA,CAA6BD,IAFvC;MAGIJ,MAHJ;MAIIC,MAJJ;MAKIK,KALJ;MAMIM,IAAI,EAAEV,MAAM,CAACU;IANjB,CAHE,CAAN;EAYH;AACJ,CAxCM"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.base = void 0;
|
|
7
|
+
|
|
8
|
+
var _FormElasticsearchIndexPlugin = require("../../plugins/FormElasticsearchIndexPlugin");
|
|
9
|
+
|
|
10
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
11
|
+
|
|
12
|
+
const base = new _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin({
|
|
13
|
+
body: (0, _apiElasticsearch.getBaseConfiguration)()
|
|
14
|
+
});
|
|
15
|
+
exports.base = base;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["base","FormElasticsearchIndexPlugin","body","getBaseConfiguration"],"sources":["base.ts"],"sourcesContent":["import { FormElasticsearchIndexPlugin } from \"~/plugins/FormElasticsearchIndexPlugin\";\nimport { getBaseConfiguration } from \"@webiny/api-elasticsearch\";\n\nexport const base = new FormElasticsearchIndexPlugin({\n body: getBaseConfiguration()\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,IAAI,GAAG,IAAIC,0DAAJ,CAAiC;EACjDC,IAAI,EAAE,IAAAC,sCAAA;AAD2C,CAAjC,CAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const elasticsearchIndexPlugins: () => import("../../plugins/FormElasticsearchIndexPlugin").FormElasticsearchIndexPlugin[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.elasticsearchIndexPlugins = void 0;
|
|
7
|
+
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
|
|
10
|
+
var _japanese = require("./japanese");
|
|
11
|
+
|
|
12
|
+
const elasticsearchIndexPlugins = () => {
|
|
13
|
+
return [_base.base, _japanese.japanese];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.elasticsearchIndexPlugins = elasticsearchIndexPlugins;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["elasticsearchIndexPlugins","base","japanese"],"sources":["index.ts"],"sourcesContent":["import { base } from \"./base\";\nimport { japanese } from \"./japanese\";\n\nexport const elasticsearchIndexPlugins = () => {\n return [base, japanese];\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,OAAO,CAACC,UAAD,EAAOC,kBAAP,CAAP;AACH,CAFM"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.japanese = void 0;
|
|
7
|
+
|
|
8
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
9
|
+
|
|
10
|
+
var _FormElasticsearchIndexPlugin = require("../../plugins/FormElasticsearchIndexPlugin");
|
|
11
|
+
|
|
12
|
+
const japanese = new _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin({
|
|
13
|
+
body: (0, _apiElasticsearch.getJapaneseConfiguration)(),
|
|
14
|
+
locales: ["ja", "ja-jp"]
|
|
15
|
+
});
|
|
16
|
+
exports.japanese = japanese;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["japanese","FormElasticsearchIndexPlugin","body","getJapaneseConfiguration","locales"],"sources":["japanese.ts"],"sourcesContent":["import { getJapaneseConfiguration } from \"@webiny/api-elasticsearch\";\nimport { FormElasticsearchIndexPlugin } from \"~/plugins/FormElasticsearchIndexPlugin\";\n\nexport const japanese = new FormElasticsearchIndexPlugin({\n body: getJapaneseConfiguration(),\n locales: [\"ja\", \"ja-jp\"]\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,QAAQ,GAAG,IAAIC,0DAAJ,CAAiC;EACrDC,IAAI,EAAE,IAAAC,0CAAA,GAD+C;EAErDC,OAAO,EAAE,CAAC,IAAD,EAAO,OAAP;AAF4C,CAAjC,CAAjB"}
|