@webiny/api-form-builder-so-ddb 0.0.0-unstable.990c3ab1b6 → 0.0.0-unstable.aa00eecd97
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/index.d.ts +1 -0
- package/index.js +25 -5
- package/index.js.map +1 -1
- package/package.json +21 -21
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +27 -0
- package/plugins/index.js.map +1 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -4,8 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
createFormBuilderStorageOperations: true
|
|
9
|
+
};
|
|
7
10
|
exports.createFormBuilderStorageOperations = void 0;
|
|
8
11
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
|
|
13
|
+
var _fields = _interopRequireDefault(require("./operations/submission/fields"));
|
|
14
|
+
var _fields2 = _interopRequireDefault(require("./operations/form/fields"));
|
|
15
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
16
|
var _types = require("./types");
|
|
10
17
|
var _table = require("./definitions/table");
|
|
11
18
|
var _form = require("./definitions/form");
|
|
@@ -17,10 +24,18 @@ var _submission2 = require("./operations/submission");
|
|
|
17
24
|
var _settings2 = require("./operations/settings");
|
|
18
25
|
var _form2 = require("./operations/form");
|
|
19
26
|
var _plugins = require("@webiny/plugins");
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
var _plugins2 = require("./plugins");
|
|
28
|
+
Object.keys(_plugins2).forEach(function (key) {
|
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
|
+
if (key in exports && exports[key] === _plugins2[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _plugins2[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
24
39
|
const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
|
|
25
40
|
const isReserved = name => {
|
|
26
41
|
if (reservedFields.includes(name) === false) {
|
|
@@ -89,7 +104,12 @@ const createFormBuilderStorageOperations = params => {
|
|
|
89
104
|
})
|
|
90
105
|
};
|
|
91
106
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
92
|
-
|
|
107
|
+
beforeInit: async context => {
|
|
108
|
+
const types = [_plugins2.FormDynamoDbFieldPlugin.type, _plugins2.FormSubmissionDynamoDbFieldPlugin.type];
|
|
109
|
+
for (const type of types) {
|
|
110
|
+
plugins.mergeByType(context.plugins, type);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
93
113
|
getTable: () => table,
|
|
94
114
|
getEntities: () => entities
|
|
95
115
|
}, (0, _system2.createSystemStorageOperations)({
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","documentClient","plugins","userPlugins","Object","values","forEach","attrs","keys","PluginsContainer","formSubmissionFields","formFields","dynamoDbValueFilters","createTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","
|
|
1
|
+
{"version":3,"names":["reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","documentClient","plugins","userPlugins","Object","values","forEach","attrs","keys","PluginsContainer","formSubmissionFields","formFields","dynamoDbValueFilters","createTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","beforeInit","context","types","FormDynamoDbFieldPlugin","type","FormSubmissionDynamoDbFieldPlugin","mergeByType","getTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formSubmissionFields from \"~/operations/submission/fields\";\nimport formFields from \"~/operations/form/fields\";\nimport WebinyError from \"@webiny/error\";\nimport { FormBuilderStorageOperationsFactory, ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createFormEntity } from \"~/definitions/form\";\nimport { createSubmissionEntity } from \"~/definitions/submission\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSubmissionStorageOperations } from \"~/operations/submission\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createFormStorageOperations } from \"~/operations/form\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { FormDynamoDbFieldPlugin, FormSubmissionDynamoDbFieldPlugin } from \"~/plugins\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport * from \"./plugins\";\n\nexport const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory = params => {\n const { attributes, table: tableName, documentClient, plugins: userPlugins } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const plugins = new PluginsContainer([\n /**\n * User defined plugins.\n */\n userPlugins || [],\n /**\n * Form submission DynamoDB fields.\n */\n formSubmissionFields(),\n /**\n * Form DynamoDB fields.\n */\n formFields(),\n\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters()\n ]);\n\n const table = createTable({\n tableName,\n documentClient\n });\n\n const entities = {\n /**\n * Regular entities.\n */\n form: createFormEntity({\n entityName: ENTITIES.FORM,\n table,\n attributes: attributes ? attributes[ENTITIES.FORM] : {}\n }),\n submission: createSubmissionEntity({\n entityName: ENTITIES.SUBMISSION,\n table,\n attributes: attributes ? attributes[ENTITIES.SUBMISSION] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n })\n };\n\n return {\n beforeInit: async context => {\n const types: string[] = [\n FormDynamoDbFieldPlugin.type,\n FormSubmissionDynamoDbFieldPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n getTable: () => table,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n table,\n entity: entities.form,\n plugins\n }),\n ...createSubmissionStorageOperations({\n table,\n entity: entities.submission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAXA,MAAMA,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;AAE5F,MAAM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AC;AAEV,CAAC;AAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-form-builder-so-ddb",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.aa00eecd97",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-form-builder",
|
|
@@ -20,28 +20,28 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/runtime": "7.20.
|
|
24
|
-
"@webiny/api-form-builder": "0.0.0-unstable.
|
|
25
|
-
"@webiny/db-dynamodb": "0.0.0-unstable.
|
|
26
|
-
"@webiny/error": "0.0.0-unstable.
|
|
27
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
28
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
23
|
+
"@babel/runtime": "7.20.13",
|
|
24
|
+
"@webiny/api-form-builder": "0.0.0-unstable.aa00eecd97",
|
|
25
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.aa00eecd97",
|
|
26
|
+
"@webiny/error": "0.0.0-unstable.aa00eecd97",
|
|
27
|
+
"@webiny/plugins": "0.0.0-unstable.aa00eecd97",
|
|
28
|
+
"@webiny/utils": "0.0.0-unstable.aa00eecd97",
|
|
29
29
|
"dynamodb-toolbox": "0.3.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/cli": "
|
|
33
|
-
"@babel/core": "
|
|
34
|
-
"@babel/preset-env": "
|
|
35
|
-
"@babel/preset-typescript": "
|
|
36
|
-
"@webiny/cli": "
|
|
37
|
-
"@webiny/handler-db": "
|
|
38
|
-
"@webiny/project-utils": "
|
|
39
|
-
"csvtojson": "
|
|
40
|
-
"jest": "
|
|
41
|
-
"jest-dynalite": "
|
|
42
|
-
"jest-environment-node": "
|
|
43
|
-
"rimraf": "
|
|
44
|
-
"ttypescript": "
|
|
32
|
+
"@babel/cli": "7.20.7",
|
|
33
|
+
"@babel/core": "7.20.12",
|
|
34
|
+
"@babel/preset-env": "7.20.2",
|
|
35
|
+
"@babel/preset-typescript": "7.18.6",
|
|
36
|
+
"@webiny/cli": "0.0.0-unstable.aa00eecd97",
|
|
37
|
+
"@webiny/handler-db": "0.0.0-unstable.aa00eecd97",
|
|
38
|
+
"@webiny/project-utils": "0.0.0-unstable.aa00eecd97",
|
|
39
|
+
"csvtojson": "2.0.10",
|
|
40
|
+
"jest": "28.1.3",
|
|
41
|
+
"jest-dynalite": "3.6.1",
|
|
42
|
+
"jest-environment-node": "27.5.1",
|
|
43
|
+
"rimraf": "3.0.2",
|
|
44
|
+
"ttypescript": "1.5.15",
|
|
45
45
|
"typescript": "4.7.4"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"build": "yarn webiny run build",
|
|
53
53
|
"watch": "yarn webiny run watch"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "aa00eecd97d16da9bdb0581f33d491487ce43ce9"
|
|
56
56
|
}
|
package/plugins/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _FormDynamoDbFieldPlugin = require("./FormDynamoDbFieldPlugin");
|
|
7
|
+
Object.keys(_FormDynamoDbFieldPlugin).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FormDynamoDbFieldPlugin[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FormDynamoDbFieldPlugin[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _FormSubmissionDynamoDbFieldPlugin = require("./FormSubmissionDynamoDbFieldPlugin");
|
|
18
|
+
Object.keys(_FormSubmissionDynamoDbFieldPlugin).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _FormSubmissionDynamoDbFieldPlugin[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _FormSubmissionDynamoDbFieldPlugin[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./FormDynamoDbFieldPlugin\";\nexport * from \"./FormSubmissionDynamoDbFieldPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|