@webiny/api-form-builder-so-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f

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.
Files changed (101) hide show
  1. package/configurations.d.ts +7 -5
  2. package/configurations.js +23 -12
  3. package/configurations.js.map +1 -0
  4. package/definitions/elasticsearch.d.ts +2 -1
  5. package/definitions/elasticsearch.js +3 -12
  6. package/definitions/elasticsearch.js.map +1 -0
  7. package/definitions/form.d.ts +2 -1
  8. package/definitions/form.js +3 -12
  9. package/definitions/form.js.map +1 -0
  10. package/definitions/settings.d.ts +2 -1
  11. package/definitions/settings.js +3 -12
  12. package/definitions/settings.js.map +1 -0
  13. package/definitions/submission.d.ts +2 -1
  14. package/definitions/submission.js +3 -12
  15. package/definitions/submission.js.map +1 -0
  16. package/definitions/system.d.ts +2 -1
  17. package/definitions/system.js +3 -12
  18. package/definitions/system.js.map +1 -0
  19. package/definitions/table.d.ts +3 -2
  20. package/definitions/table.js +0 -3
  21. package/definitions/table.js.map +1 -0
  22. package/definitions/tableElasticsearch.d.ts +2 -1
  23. package/definitions/tableElasticsearch.js +0 -3
  24. package/definitions/tableElasticsearch.js.map +1 -0
  25. package/elasticsearch/createElasticsearchIndex.d.ts +10 -0
  26. package/elasticsearch/createElasticsearchIndex.js +52 -0
  27. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  28. package/elasticsearch/indices/base.d.ts +2 -0
  29. package/elasticsearch/indices/base.js +12 -0
  30. package/elasticsearch/indices/base.js.map +1 -0
  31. package/elasticsearch/indices/index.d.ts +1 -0
  32. package/elasticsearch/indices/index.js +12 -0
  33. package/elasticsearch/indices/index.js.map +1 -0
  34. package/elasticsearch/indices/japanese.d.ts +2 -0
  35. package/elasticsearch/indices/japanese.js +13 -0
  36. package/elasticsearch/indices/japanese.js.map +1 -0
  37. package/index.d.ts +1 -0
  38. package/index.js +54 -61
  39. package/index.js.map +1 -0
  40. package/operations/form/elasticsearchBody.js +12 -56
  41. package/operations/form/elasticsearchBody.js.map +1 -0
  42. package/operations/form/elasticsearchFields.js +0 -3
  43. package/operations/form/elasticsearchFields.js.map +1 -0
  44. package/operations/form/fields.js +0 -3
  45. package/operations/form/fields.js.map +1 -0
  46. package/operations/form/index.d.ts +2 -2
  47. package/operations/form/index.js +53 -153
  48. package/operations/form/index.js.map +1 -0
  49. package/operations/settings/index.d.ts +2 -2
  50. package/operations/settings/index.js +5 -29
  51. package/operations/settings/index.js.map +1 -0
  52. package/operations/submission/elasticsearchBody.js +15 -54
  53. package/operations/submission/elasticsearchBody.js.map +1 -0
  54. package/operations/submission/elasticsearchFields.js +0 -3
  55. package/operations/submission/elasticsearchFields.js.map +1 -0
  56. package/operations/submission/index.d.ts +2 -2
  57. package/operations/submission/index.js +23 -76
  58. package/operations/submission/index.js.map +1 -0
  59. package/operations/system/index.d.ts +2 -2
  60. package/operations/system/index.js +4 -26
  61. package/operations/system/index.js.map +1 -0
  62. package/package.json +27 -32
  63. package/plugins/FormDynamoDbFieldPlugin.js +1 -6
  64. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
  65. package/plugins/FormElasticsearchBodyModifierPlugin.d.ts +1 -1
  66. package/plugins/FormElasticsearchBodyModifierPlugin.js +3 -8
  67. package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -0
  68. package/plugins/FormElasticsearchFieldPlugin.d.ts +1 -1
  69. package/plugins/FormElasticsearchFieldPlugin.js +3 -8
  70. package/plugins/FormElasticsearchFieldPlugin.js.map +1 -0
  71. package/plugins/FormElasticsearchIndexPlugin.d.ts +4 -0
  72. package/plugins/FormElasticsearchIndexPlugin.js +12 -0
  73. package/plugins/FormElasticsearchIndexPlugin.js.map +1 -0
  74. package/plugins/FormElasticsearchQueryModifierPlugin.d.ts +1 -1
  75. package/plugins/FormElasticsearchQueryModifierPlugin.js +3 -8
  76. package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -0
  77. package/plugins/FormElasticsearchSortModifierPlugin.d.ts +1 -1
  78. package/plugins/FormElasticsearchSortModifierPlugin.js +3 -8
  79. package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -0
  80. package/plugins/SubmissionElasticsearchBodyModifierPlugin.d.ts +1 -1
  81. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +3 -8
  82. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -0
  83. package/plugins/SubmissionElasticsearchFieldPlugin.d.ts +1 -1
  84. package/plugins/SubmissionElasticsearchFieldPlugin.js +3 -8
  85. package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -0
  86. package/plugins/SubmissionElasticsearchQueryModifierPlugin.d.ts +1 -1
  87. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +3 -8
  88. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -0
  89. package/plugins/SubmissionElasticsearchSortModifierPlugin.d.ts +1 -1
  90. package/plugins/SubmissionElasticsearchSortModifierPlugin.js +3 -8
  91. package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -0
  92. package/plugins/index.d.ts +10 -0
  93. package/plugins/index.js +115 -0
  94. package/plugins/index.js.map +1 -0
  95. package/types.d.ts +2 -2
  96. package/types.js +0 -1
  97. package/types.js.map +1 -0
  98. package/operations/system/createElasticsearchIndex.d.ts +0 -6
  99. package/operations/system/createElasticsearchIndex.js +0 -70
  100. package/upgrades/5.16.0/index.d.ts +0 -8
  101. package/upgrades/5.16.0/index.js +0 -141
@@ -1,9 +1,11 @@
1
1
  export interface ElasticsearchConfigParams {
2
2
  tenant: string;
3
+ locale: string;
3
4
  }
4
- declare const _default: {
5
- es(params: ElasticsearchConfigParams): {
6
- index: string;
7
- };
5
+ interface ElasticsearchConfig {
6
+ index: string;
7
+ }
8
+ export declare const configurations: {
9
+ es(params: ElasticsearchConfigParams): ElasticsearchConfig;
8
10
  };
9
- export default _default;
11
+ export {};
package/configurations.js CHANGED
@@ -1,28 +1,39 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = void 0;
7
- var _default = {
7
+ exports.configurations = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const configurations = {
8
10
  es(params) {
9
11
  const {
10
- tenant
12
+ tenant,
13
+ locale
11
14
  } = params;
15
+ if (!tenant) {
16
+ throw new _error.default(`Missing "tenant" parameter when trying to create Elasticsearch index name.`, "TENANT_ERROR");
17
+ }
12
18
  const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
13
- const index = `${sharedIndex ? "root" : tenant}-form-builder`;
14
- const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;
15
-
16
- if (prefix) {
19
+ const tenantId = sharedIndex ? "root" : tenant;
20
+ let localeCode = null;
21
+ if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === "true") {
22
+ if (!locale) {
23
+ throw new _error.default(`Missing "locale" parameter when trying to create Elasticsearch index name.`, "LOCALE_ERROR");
24
+ }
25
+ localeCode = locale;
26
+ }
27
+ const index = [tenantId, localeCode, "form-builder"].filter(Boolean).join("-").toLowerCase();
28
+ const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX || "";
29
+ if (!prefix) {
17
30
  return {
18
- index: prefix + index
31
+ index
19
32
  };
20
33
  }
21
-
22
34
  return {
23
- index
35
+ index: prefix + index
24
36
  };
25
37
  }
26
-
27
38
  };
28
- exports.default = _default;
39
+ 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,MAAiC,EAAuB;IACvD,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGF,MAAM;IACjC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CAChB,4EAA2E,EAC5E,cAAc,CACjB;IACL;IAEA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,4BAA4B,KAAK,MAAM;IAEvE,MAAMC,QAAQ,GAAGJ,WAAW,GAAG,MAAM,GAAGH,MAAM;IAC9C,IAAIQ,UAAyB,GAAG,IAAI;IACpC,IAAIJ,OAAO,CAACC,GAAG,CAACI,iCAAiC,KAAK,MAAM,EAAE;MAC1D,IAAI,CAACR,MAAM,EAAE;QACT,MAAM,IAAIC,cAAW,CAChB,4EAA2E,EAC5E,cAAc,CACjB;MACL;MACAM,UAAU,GAAGP,MAAM;IACvB;IAEA,MAAMS,KAAK,GAAG,CAACH,QAAQ,EAAEC,UAAU,EAAE,cAAc,CAAC,CAC/CG,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC,CACTC,WAAW,EAAE;IAElB,MAAMC,MAAM,GAAGX,OAAO,CAACC,GAAG,CAACW,2BAA2B,IAAI,EAAE;IAC5D,IAAI,CAACD,MAAM,EAAE;MACT,OAAO;QACHL;MACJ,CAAC;IACL;IACA,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IACpB,CAAC;EACL;AACJ,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
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,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createElasticsearchEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  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
10
  const createElasticsearchEntity = params => {
19
11
  const {
20
12
  table,
@@ -24,7 +16,7 @@ const createElasticsearchEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  name: entityName,
26
18
  table,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -43,5 +35,4 @@ const createElasticsearchEntity = params => {
43
35
  }, attributes || {})
44
36
  });
45
37
  };
46
-
47
38
  exports.createElasticsearchEntity = createElasticsearchEntity;
@@ -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,MAAc,IAAK;EACzD,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV;IAAC,GAEGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
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 {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  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
10
  const createFormEntity = params => {
19
11
  const {
20
12
  table,
@@ -24,7 +16,7 @@ const createFormEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  table,
26
18
  name: entityName,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -100,5 +92,4 @@ const createFormEntity = params => {
100
92
  }, attributes || {})
101
93
  });
102
94
  };
103
-
104
95
  exports.createFormEntity = createFormEntity;
@@ -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,MAAc,IAAkB;EAC7D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,OAAO,EAAE;QACLN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDS,IAAI,EAAE;QACFT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,MAAM,EAAE;QACJX,IAAI,EAAE;MACV,CAAC;MACDY,SAAS,EAAE;QACPZ,IAAI,EAAE;MACV,CAAC;MACDa,WAAW,EAAE;QACTb,IAAI,EAAE;MACV,CAAC;MACDc,MAAM,EAAE;QACJd,IAAI,EAAE;MACV,CAAC;MACDe,MAAM,EAAE;QACJf,IAAI,EAAE;MACV,CAAC;MACDgB,MAAM,EAAE;QACJhB,IAAI,EAAE;MACV,CAAC;MACDiB,KAAK,EAAE;QACHjB,IAAI,EAAE;MACV,CAAC;MACDkB,QAAQ,EAAE;QACNlB,IAAI,EAAE;MACV,CAAC;MACDmB,QAAQ,EAAE;QACNnB,IAAI,EAAE;MACV,CAAC;MACDoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MACV;IAAC,GACGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
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 {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSettingsEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  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
10
  const createSettingsEntity = params => {
19
11
  const {
20
12
  entityName,
@@ -24,7 +16,7 @@ const createSettingsEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  name: entityName,
26
18
  table,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -49,5 +41,4 @@ const createSettingsEntity = params => {
49
41
  }, attributes || {})
50
42
  });
51
43
  };
52
-
53
44
  exports.createSettingsEntity = createSettingsEntity;
@@ -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,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV;IAAC,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
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,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSubmissionEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  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
10
  const createSubmissionEntity = params => {
19
11
  const {
20
12
  table,
@@ -24,7 +16,7 @@ const createSubmissionEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  table,
26
18
  name: entityName,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -70,5 +62,4 @@ const createSubmissionEntity = params => {
70
62
  }, attributes || {})
71
63
  });
72
64
  };
73
-
74
65
  exports.createSubmissionEntity = createSubmissionEntity;
@@ -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,MAAc,IAAkB;EACnE,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,EAAE,EAAE;QACAC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,IAAI,EAAE;QACFJ,IAAI,EAAE;MACV,CAAC;MACDK,IAAI,EAAE;QACFL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,OAAO,EAAE;QACLR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACDW,aAAa,EAAE;QACXX,IAAI,EAAE;MACV;IAAC,GACGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
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 {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSystemEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  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
10
  const createSystemEntity = params => {
19
11
  const {
20
12
  entityName,
@@ -24,7 +16,7 @@ const createSystemEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  name: entityName,
26
18
  table,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -40,5 +32,4 @@ const createSystemEntity = params => {
40
32
  }, attributes || {})
41
33
  });
42
34
  };
43
-
44
35
  exports.createSystemEntity = createSystemEntity;
@@ -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,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV;IAAC,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,7 +1,8 @@
1
1
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
2
  import { Table } from "dynamodb-toolbox";
3
- export interface Params {
4
- tableName: string;
3
+ interface Params {
4
+ tableName?: string;
5
5
  documentClient: DocumentClient;
6
6
  }
7
7
  export declare const createTable: (params: Params) => Table;
8
+ export {};
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createTable = void 0;
7
-
8
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
9
-
10
8
  const createTable = params => {
11
9
  const {
12
10
  tableName,
@@ -19,5 +17,4 @@ const createTable = params => {
19
17
  DocumentClient: documentClient
20
18
  });
21
19
  };
22
-
23
20
  exports.createTable = createTable;
@@ -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,MAAc,IAAY;EAClD,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAE5C,OAAO,IAAIG,sBAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,QAAmB;IACnDC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER;EACpB,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,7 +1,8 @@
1
1
  import { Table } from "dynamodb-toolbox";
2
2
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
3
- export interface Params {
3
+ interface Params {
4
4
  documentClient: DocumentClient;
5
5
  tableName?: string;
6
6
  }
7
7
  export declare const createElasticsearchTable: (params: Params) => Table;
8
+ export {};
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createElasticsearchTable = void 0;
7
-
8
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
9
-
10
8
  const createElasticsearchTable = params => {
11
9
  const {
12
10
  tableName,
@@ -19,5 +17,4 @@ const createElasticsearchTable = params => {
19
17
  DocumentClient: documentClient
20
18
  });
21
19
  };
22
-
23
20
  exports.createElasticsearchTable = createElasticsearchTable;
@@ -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,MAAc,IAAY;EAC/D,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAC5C,OAAO,IAAIG,sBAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,sBAAiC;IACjEC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER;EACpB,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -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,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createElasticsearchIndex = void 0;
8
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
9
+ var _FormElasticsearchIndexPlugin = require("../plugins/FormElasticsearchIndexPlugin");
10
+ var _error = _interopRequireDefault(require("@webiny/error"));
11
+ var _configurations = require("../configurations");
12
+ const createElasticsearchIndex = async params => {
13
+ const {
14
+ elasticsearch,
15
+ plugins: container,
16
+ locale,
17
+ tenant
18
+ } = params;
19
+ const plugin = (0, _apiElasticsearch.getLastAddedIndexPlugin)({
20
+ container,
21
+ type: _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin.type,
22
+ locale
23
+ });
24
+ const {
25
+ index
26
+ } = _configurations.configurations.es({
27
+ locale,
28
+ tenant
29
+ });
30
+ try {
31
+ const response = await elasticsearch.indices.exists({
32
+ index
33
+ });
34
+ if (response.body) {
35
+ return;
36
+ }
37
+ await elasticsearch.indices.create({
38
+ index,
39
+ body: plugin.body
40
+ });
41
+ } catch (ex) {
42
+ throw new _error.default(ex.message || "Could not create Elasticsearch index for the Form Builder.", ex.code || "FB_ELASTICSEARCH_INDEX_ERROR", {
43
+ error: ex,
44
+ type: _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin.type,
45
+ locale,
46
+ tenant,
47
+ index,
48
+ body: plugin.body
49
+ });
50
+ }
51
+ };
52
+ 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,MAAsC,IAAK;EACtF,MAAM;IAAEC,aAAa;IAAEC,OAAO,EAAEC,SAAS;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGL,MAAM;EAEpE,MAAMM,MAAM,GAAG,IAAAC,yCAAuB,EAA+B;IACjEJ,SAAS;IACTK,IAAI,EAAEC,0DAA4B,CAACD,IAAI;IACvCJ;EACJ,CAAC,CAAC;EAEF,MAAM;IAAEM;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCR,MAAM;IACNC;EACJ,CAAC,CAAC;EAEF,IAAI;IACA,MAAMQ,QAAQ,GAAG,MAAMZ,aAAa,CAACa,OAAO,CAACC,MAAM,CAAC;MAChDL;IACJ,CAAC,CAAC;IACF,IAAIG,QAAQ,CAACG,IAAI,EAAE;MACf;IACJ;IAEA,MAAMf,aAAa,CAACa,OAAO,CAACG,MAAM,CAAC;MAC/BP,KAAK;MACLM,IAAI,EAAEV,MAAM,CAACU;IACjB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,4DAA4D,EAC1EF,EAAE,CAACG,IAAI,IAAI,8BAA8B,EACzC;MACIC,KAAK,EAAEJ,EAAE;MACTV,IAAI,EAAEC,0DAA4B,CAACD,IAAI;MACvCJ,MAAM;MACNC,MAAM;MACNK,KAAK;MACLM,IAAI,EAAEV,MAAM,CAACU;IACjB,CAAC,CACJ;EACL;AACJ,CAAC;AAAC"}
@@ -0,0 +1,2 @@
1
+ import { FormElasticsearchIndexPlugin } from "../../plugins/FormElasticsearchIndexPlugin";
2
+ export declare const base: FormElasticsearchIndexPlugin;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.base = void 0;
7
+ var _FormElasticsearchIndexPlugin = require("../../plugins/FormElasticsearchIndexPlugin");
8
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
9
+ const base = new _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin({
10
+ body: (0, _apiElasticsearch.getBaseConfiguration)()
11
+ });
12
+ 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,0DAA4B,CAAC;EACjDC,IAAI,EAAE,IAAAC,sCAAoB;AAC9B,CAAC,CAAC;AAAC"}
@@ -0,0 +1 @@
1
+ export declare const elasticsearchIndexPlugins: () => import("../..").FormElasticsearchIndexPlugin[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.elasticsearchIndexPlugins = void 0;
7
+ var _base = require("./base");
8
+ var _japanese = require("./japanese");
9
+ const elasticsearchIndexPlugins = () => {
10
+ return [_base.base, _japanese.japanese];
11
+ };
12
+ 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,UAAI,EAAEC,kBAAQ,CAAC;AAC3B,CAAC;AAAC"}
@@ -0,0 +1,2 @@
1
+ import { FormElasticsearchIndexPlugin } from "../../plugins/FormElasticsearchIndexPlugin";
2
+ export declare const japanese: FormElasticsearchIndexPlugin;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.japanese = void 0;
7
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
8
+ var _FormElasticsearchIndexPlugin = require("../../plugins/FormElasticsearchIndexPlugin");
9
+ const japanese = new _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin({
10
+ body: (0, _apiElasticsearch.getJapaneseConfiguration)(),
11
+ locales: ["ja", "ja-jp"]
12
+ });
13
+ 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,0DAA4B,CAAC;EACrDC,IAAI,EAAE,IAAAC,0CAAwB,GAAE;EAChCC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO;AAC3B,CAAC,CAAC;AAAC"}
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import { FormBuilderStorageOperationsFactory } from "./types";
2
+ export * from "./plugins";
2
3
  export declare const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory;