@webiny/api-form-builder-so-ddb 0.0.0-ee-vpcs.549378cf03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/definitions/form.d.ts +9 -0
- package/definitions/form.js +106 -0
- package/definitions/form.js.map +1 -0
- package/definitions/settings.d.ts +9 -0
- package/definitions/settings.js +49 -0
- package/definitions/settings.js.map +1 -0
- package/definitions/submission.d.ts +9 -0
- package/definitions/submission.js +70 -0
- package/definitions/submission.js.map +1 -0
- package/definitions/system.d.ts +9 -0
- package/definitions/system.js +40 -0
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +8 -0
- package/definitions/table.js +29 -0
- package/definitions/table.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +135 -0
- package/index.js.map +1 -0
- package/operations/form/fields.d.ts +3 -0
- package/operations/form/fields.js +43 -0
- package/operations/form/fields.js.map +1 -0
- package/operations/form/index.d.ts +9 -0
- package/operations/form/index.js +738 -0
- package/operations/form/index.js.map +1 -0
- package/operations/settings/index.d.ts +7 -0
- package/operations/settings/index.js +118 -0
- package/operations/settings/index.js.map +1 -0
- package/operations/submission/fields.d.ts +3 -0
- package/operations/submission/fields.js +18 -0
- package/operations/submission/fields.js.map +1 -0
- package/operations/submission/index.d.ts +9 -0
- package/operations/submission/index.js +241 -0
- package/operations/submission/index.js.map +1 -0
- package/operations/system/index.d.ts +7 -0
- package/operations/system/index.js +101 -0
- package/operations/system/index.js.map +1 -0
- package/package.json +56 -0
- package/plugins/FormDynamoDbFieldPlugin.d.ts +4 -0
- package/plugins/FormDynamoDbFieldPlugin.js +17 -0
- package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
- package/plugins/FormSubmissionDynamoDbFieldPlugin.d.ts +4 -0
- package/plugins/FormSubmissionDynamoDbFieldPlugin.js +17 -0
- package/plugins/FormSubmissionDynamoDbFieldPlugin.js.map +1 -0
- package/types.d.ts +65 -0
- package/types.js +15 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
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.createSystemStorageOperations = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
13
|
+
|
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
+
|
|
16
|
+
var _get = require("@webiny/db-dynamodb/utils/get");
|
|
17
|
+
|
|
18
|
+
const createSystemStorageOperations = params => {
|
|
19
|
+
const {
|
|
20
|
+
entity
|
|
21
|
+
} = params;
|
|
22
|
+
|
|
23
|
+
const createSystemPartitionKey = ({
|
|
24
|
+
tenant
|
|
25
|
+
}) => {
|
|
26
|
+
return `T#${tenant}#SYSTEM`;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createSystemSortKey = () => {
|
|
30
|
+
return "FB";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const createKeys = params => {
|
|
34
|
+
return {
|
|
35
|
+
PK: createSystemPartitionKey(params),
|
|
36
|
+
SK: createSystemSortKey()
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const createSystem = async params => {
|
|
41
|
+
const {
|
|
42
|
+
system
|
|
43
|
+
} = params;
|
|
44
|
+
const keys = createKeys(system);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
|
|
48
|
+
return system;
|
|
49
|
+
} catch (ex) {
|
|
50
|
+
throw new _error.default(ex.message || "Could not create the system record by given keys.", ex.code || "CREATE_SYSTEM_ERROR", {
|
|
51
|
+
keys,
|
|
52
|
+
system
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const getSystem = async params => {
|
|
58
|
+
const keys = createKeys(params);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const item = await (0, _get.get)({
|
|
62
|
+
entity,
|
|
63
|
+
keys
|
|
64
|
+
});
|
|
65
|
+
return (0, _cleanup.cleanupItem)(entity, item);
|
|
66
|
+
} catch (ex) {
|
|
67
|
+
throw new _error.default(ex.message || "Could not get the system record by given keys.", ex.code || "LOAD_SYSTEM_ERROR", {
|
|
68
|
+
keys
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const updateSystem = async params => {
|
|
74
|
+
const {
|
|
75
|
+
system,
|
|
76
|
+
original
|
|
77
|
+
} = params;
|
|
78
|
+
const keys = createKeys(system);
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
|
|
82
|
+
return system;
|
|
83
|
+
} catch (ex) {
|
|
84
|
+
throw new _error.default(ex.message || "Could not update the system record by given keys.", ex.code || "UPDATE_SYSTEM_ERROR", {
|
|
85
|
+
keys,
|
|
86
|
+
original,
|
|
87
|
+
system
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
createSystem,
|
|
94
|
+
getSystem,
|
|
95
|
+
updateSystem,
|
|
96
|
+
createSystemPartitionKey,
|
|
97
|
+
createSystemSortKey
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
exports.createSystemStorageOperations = createSystemStorageOperations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSystemStorageOperations","params","entity","createSystemPartitionKey","tenant","createSystemSortKey","createKeys","PK","SK","createSystem","system","keys","put","ex","WebinyError","message","code","getSystem","item","get","cleanupItem","updateSystem","original"],"sources":["index.ts"],"sourcesContent":["import {\n FormBuilderStorageOperationsCreateSystemParams,\n FormBuilderStorageOperationsGetSystemParams,\n FormBuilderStorageOperationsUpdateSystemParams,\n System\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { FormBuilderSystemCreateKeysParams, FormBuilderSystemStorageOperations } from \"~/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport WebinyError from \"@webiny/error\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\n\nexport interface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n table: Table;\n}\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): FormBuilderSystemStorageOperations => {\n const { entity } = params;\n\n const createSystemPartitionKey = ({ tenant }: FormBuilderSystemCreateKeysParams): string => {\n return `T#${tenant}#SYSTEM`;\n };\n\n const createSystemSortKey = (): string => {\n return \"FB\";\n };\n\n const createKeys = (params: FormBuilderSystemCreateKeysParams) => {\n return {\n PK: createSystemPartitionKey(params),\n SK: createSystemSortKey()\n };\n };\n\n const createSystem = async (\n params: FormBuilderStorageOperationsCreateSystemParams\n ): Promise<System> => {\n const { system } = params;\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create the system record by given keys.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n keys,\n system\n }\n );\n }\n };\n\n const getSystem = async (\n params: FormBuilderStorageOperationsGetSystemParams\n ): Promise<System | null> => {\n const keys = createKeys(params);\n\n try {\n const item = await get<System>({ entity, keys });\n return cleanupItem(entity, item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get the system record by given keys.\",\n ex.code || \"LOAD_SYSTEM_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const updateSystem = async (\n params: FormBuilderStorageOperationsUpdateSystemParams\n ): Promise<System> => {\n const { system, original } = params;\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update the system record by given keys.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n keys,\n original,\n system\n }\n );\n }\n };\n\n return {\n createSystem,\n getSystem,\n updateSystem,\n createSystemPartitionKey,\n createSystemSortKey\n };\n};\n"],"mappings":";;;;;;;;;;;AAQA;;AACA;;AACA;;AAOO,MAAMA,6BAA6B,GACtCC,MADyC,IAEJ;EACrC,MAAM;IAAEC;EAAF,IAAaD,MAAnB;;EAEA,MAAME,wBAAwB,GAAG,CAAC;IAAEC;EAAF,CAAD,KAA2D;IACxF,OAAQ,KAAIA,MAAO,SAAnB;EACH,CAFD;;EAIA,MAAMC,mBAAmB,GAAG,MAAc;IACtC,OAAO,IAAP;EACH,CAFD;;EAIA,MAAMC,UAAU,GAAIL,MAAD,IAA+C;IAC9D,OAAO;MACHM,EAAE,EAAEJ,wBAAwB,CAACF,MAAD,CADzB;MAEHO,EAAE,EAAEH,mBAAmB;IAFpB,CAAP;EAIH,CALD;;EAOA,MAAMI,YAAY,GAAG,MACjBR,MADiB,IAEC;IAClB,MAAM;MAAES;IAAF,IAAaT,MAAnB;IACA,MAAMU,IAAI,GAAGL,UAAU,CAACI,MAAD,CAAvB;;IAEA,IAAI;MACA,MAAMR,MAAM,CAACU,GAAP,6DACCF,MADD,GAECC,IAFD,EAAN;MAIA,OAAOD,MAAP;IACH,CAND,CAME,OAAOG,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,mDADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,qBAFT,EAGF;QACIL,IADJ;QAEID;MAFJ,CAHE,CAAN;IAQH;EACJ,CAtBD;;EAwBA,MAAMO,SAAS,GAAG,MACdhB,MADc,IAEW;IACzB,MAAMU,IAAI,GAAGL,UAAU,CAACL,MAAD,CAAvB;;IAEA,IAAI;MACA,MAAMiB,IAAI,GAAG,MAAM,IAAAC,QAAA,EAAY;QAAEjB,MAAF;QAAUS;MAAV,CAAZ,CAAnB;MACA,OAAO,IAAAS,oBAAA,EAAYlB,MAAZ,EAAoBgB,IAApB,CAAP;IACH,CAHD,CAGE,OAAOL,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,gDADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,mBAFT,EAGF;QACIL;MADJ,CAHE,CAAN;IAOH;EACJ,CAjBD;;EAmBA,MAAMU,YAAY,GAAG,MACjBpB,MADiB,IAEC;IAClB,MAAM;MAAES,MAAF;MAAUY;IAAV,IAAuBrB,MAA7B;IACA,MAAMU,IAAI,GAAGL,UAAU,CAACI,MAAD,CAAvB;;IAEA,IAAI;MACA,MAAMR,MAAM,CAACU,GAAP,6DACCF,MADD,GAECC,IAFD,EAAN;MAIA,OAAOD,MAAP;IACH,CAND,CAME,OAAOG,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,mDADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,qBAFT,EAGF;QACIL,IADJ;QAEIW,QAFJ;QAGIZ;MAHJ,CAHE,CAAN;IASH;EACJ,CAvBD;;EAyBA,OAAO;IACHD,YADG;IAEHQ,SAFG;IAGHI,YAHG;IAIHlB,wBAJG;IAKHE;EALG,CAAP;AAOH,CA/FM"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/api-form-builder-so-ddb",
|
|
3
|
+
"version": "0.0.0-ee-vpcs.549378cf03",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"@webiny/api-form-builder",
|
|
7
|
+
"storage-operations",
|
|
8
|
+
"dynamodb",
|
|
9
|
+
"fb:ddb"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/webiny/webiny-js.git",
|
|
14
|
+
"directory": "packages/api-form-builder-so-ddb"
|
|
15
|
+
},
|
|
16
|
+
"contributors": [
|
|
17
|
+
"Pavel Denisjuk <pavel@webiny.com>",
|
|
18
|
+
"Sven Al Hamad <sven@webiny.com>",
|
|
19
|
+
"Adrian Smijulj <adrian@webiny.com>"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@babel/runtime": "7.19.0",
|
|
24
|
+
"@webiny/api-form-builder": "0.0.0-ee-vpcs.549378cf03",
|
|
25
|
+
"@webiny/db-dynamodb": "0.0.0-ee-vpcs.549378cf03",
|
|
26
|
+
"@webiny/error": "0.0.0-ee-vpcs.549378cf03",
|
|
27
|
+
"@webiny/plugins": "0.0.0-ee-vpcs.549378cf03",
|
|
28
|
+
"@webiny/utils": "0.0.0-ee-vpcs.549378cf03",
|
|
29
|
+
"dynamodb-toolbox": "0.3.5"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@babel/cli": "^7.19.3",
|
|
33
|
+
"@babel/core": "^7.19.3",
|
|
34
|
+
"@babel/preset-env": "^7.19.4",
|
|
35
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
36
|
+
"@webiny/cli": "^0.0.0-ee-vpcs.549378cf03",
|
|
37
|
+
"@webiny/handler-db": "^0.0.0-ee-vpcs.549378cf03",
|
|
38
|
+
"@webiny/project-utils": "^0.0.0-ee-vpcs.549378cf03",
|
|
39
|
+
"csvtojson": "^2.0.10",
|
|
40
|
+
"jest": "^28.1.0",
|
|
41
|
+
"jest-dynalite": "^3.2.0",
|
|
42
|
+
"jest-environment-node": "^27.2.4",
|
|
43
|
+
"rimraf": "^3.0.2",
|
|
44
|
+
"ttypescript": "^1.5.12",
|
|
45
|
+
"typescript": "4.7.4"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"directory": "dist"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "yarn webiny run build",
|
|
53
|
+
"watch": "yarn webiny run watch"
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "549378cf03fcd27845fc3fa23d1dc6b32896f630"
|
|
56
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.FormDynamoDbFieldPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _FieldPlugin = require("@webiny/db-dynamodb/plugins/definitions/FieldPlugin");
|
|
13
|
+
|
|
14
|
+
class FormDynamoDbFieldPlugin extends _FieldPlugin.FieldPlugin {}
|
|
15
|
+
|
|
16
|
+
exports.FormDynamoDbFieldPlugin = FormDynamoDbFieldPlugin;
|
|
17
|
+
(0, _defineProperty2.default)(FormDynamoDbFieldPlugin, "type", "formBuilder.dynamodb.field.form");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FormDynamoDbFieldPlugin","FieldPlugin"],"sources":["FormDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FormDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"formBuilder.dynamodb.field.form\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,uBAAN,SAAsCC,wBAAtC,CAAkD;;;8BAA5CD,uB,UACsC,iC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.FormSubmissionDynamoDbFieldPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _FieldPlugin = require("@webiny/db-dynamodb/plugins/definitions/FieldPlugin");
|
|
13
|
+
|
|
14
|
+
class FormSubmissionDynamoDbFieldPlugin extends _FieldPlugin.FieldPlugin {}
|
|
15
|
+
|
|
16
|
+
exports.FormSubmissionDynamoDbFieldPlugin = FormSubmissionDynamoDbFieldPlugin;
|
|
17
|
+
(0, _defineProperty2.default)(FormSubmissionDynamoDbFieldPlugin, "type", "formBuilder.dynamodb.field.formSubmission");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FormSubmissionDynamoDbFieldPlugin","FieldPlugin"],"sources":["FormSubmissionDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FormSubmissionDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"formBuilder.dynamodb.field.formSubmission\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,iCAAN,SAAgDC,wBAAhD,CAA4D;;;8BAAtDD,iC,UACsC,2C"}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FormBuilderStorageOperations as BaseFormBuilderStorageOperations, FormBuilderSystemStorageOperations as BaseFormBuilderSystemStorageOperations, FormBuilderSubmissionStorageOperations as BaseFormBuilderSubmissionStorageOperations, FormBuilderSettingsStorageOperations as BaseFormBuilderSettingsStorageOperations, FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations } from "@webiny/api-form-builder/types";
|
|
2
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
3
|
+
import { Table, Entity } from "dynamodb-toolbox";
|
|
4
|
+
import { DynamoDBTypes } from "dynamodb-toolbox/dist/classes/Table";
|
|
5
|
+
import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
|
|
6
|
+
import { Plugin } from "@webiny/plugins";
|
|
7
|
+
export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
|
|
8
|
+
export declare type Attributes = Record<string, AttributeDefinition>;
|
|
9
|
+
export declare enum ENTITIES {
|
|
10
|
+
FORM = "FormBuilderForm",
|
|
11
|
+
SUBMISSION = "FormBuilderSubmission",
|
|
12
|
+
SYSTEM = "FormBuilderSystem",
|
|
13
|
+
SETTINGS = "FormBuilderSettings"
|
|
14
|
+
}
|
|
15
|
+
export interface FormBuilderStorageOperationsFactoryParams {
|
|
16
|
+
documentClient: DocumentClient;
|
|
17
|
+
table?: string;
|
|
18
|
+
attributes?: Record<ENTITIES, Attributes>;
|
|
19
|
+
plugins?: Plugin;
|
|
20
|
+
}
|
|
21
|
+
export interface FormBuilderSystemCreateKeysParams {
|
|
22
|
+
tenant: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FormBuilderSystemStorageOperations extends BaseFormBuilderSystemStorageOperations {
|
|
25
|
+
createSystemPartitionKey: (params: FormBuilderSystemCreateKeysParams) => string;
|
|
26
|
+
createSystemSortKey: () => string;
|
|
27
|
+
}
|
|
28
|
+
export interface FormBuilderFormCreatePartitionKeyParams {
|
|
29
|
+
tenant: string;
|
|
30
|
+
locale: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FormBuilderFormCreateGSIPartitionKeyParams {
|
|
33
|
+
id?: string;
|
|
34
|
+
formId?: string;
|
|
35
|
+
tenant: string;
|
|
36
|
+
locale: string;
|
|
37
|
+
}
|
|
38
|
+
export interface FormBuilderFormStorageOperations extends BaseFormBuilderFormStorageOperations {
|
|
39
|
+
createFormPartitionKey: (params: FormBuilderFormCreatePartitionKeyParams) => string;
|
|
40
|
+
}
|
|
41
|
+
export interface FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams {
|
|
42
|
+
tenant: string;
|
|
43
|
+
locale: string;
|
|
44
|
+
formId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface FormBuilderSubmissionStorageOperations extends BaseFormBuilderSubmissionStorageOperations {
|
|
47
|
+
createSubmissionPartitionKey: (params: FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams) => string;
|
|
48
|
+
createSubmissionSortKey: (id: string) => string;
|
|
49
|
+
}
|
|
50
|
+
export interface FormBuilderSettingsStorageOperationsCreatePartitionKeyParams {
|
|
51
|
+
tenant: string;
|
|
52
|
+
locale: string;
|
|
53
|
+
}
|
|
54
|
+
export interface FormBuilderSettingsStorageOperations extends BaseFormBuilderSettingsStorageOperations {
|
|
55
|
+
createSettingsPartitionKey: (params: FormBuilderSettingsStorageOperationsCreatePartitionKeyParams) => string;
|
|
56
|
+
createSettingsSortKey: () => string;
|
|
57
|
+
}
|
|
58
|
+
export declare type Entities = "form" | "submission" | "system" | "settings";
|
|
59
|
+
export interface FormBuilderStorageOperations extends BaseFormBuilderStorageOperations, FormBuilderSettingsStorageOperations, FormBuilderSubmissionStorageOperations, FormBuilderFormStorageOperations, FormBuilderSystemStorageOperations {
|
|
60
|
+
getTable(): Table;
|
|
61
|
+
getEntities(): Record<Entities, Entity<any>>;
|
|
62
|
+
}
|
|
63
|
+
export interface FormBuilderStorageOperationsFactory {
|
|
64
|
+
(params: FormBuilderStorageOperationsFactoryParams): FormBuilderStorageOperations;
|
|
65
|
+
}
|
package/types.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ENTITIES = void 0;
|
|
7
|
+
let ENTITIES;
|
|
8
|
+
exports.ENTITIES = ENTITIES;
|
|
9
|
+
|
|
10
|
+
(function (ENTITIES) {
|
|
11
|
+
ENTITIES["FORM"] = "FormBuilderForm";
|
|
12
|
+
ENTITIES["SUBMISSION"] = "FormBuilderSubmission";
|
|
13
|
+
ENTITIES["SYSTEM"] = "FormBuilderSystem";
|
|
14
|
+
ENTITIES["SETTINGS"] = "FormBuilderSettings";
|
|
15
|
+
})(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
|
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import {\n FormBuilderStorageOperations as BaseFormBuilderStorageOperations,\n FormBuilderSystemStorageOperations as BaseFormBuilderSystemStorageOperations,\n FormBuilderSubmissionStorageOperations as BaseFormBuilderSubmissionStorageOperations,\n FormBuilderSettingsStorageOperations as BaseFormBuilderSettingsStorageOperations,\n FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations\n} from \"@webiny/api-form-builder/types\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table, Entity } from \"dynamodb-toolbox\";\nimport { DynamoDBTypes } from \"dynamodb-toolbox/dist/classes/Table\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n FORM = \"FormBuilderForm\",\n SUBMISSION = \"FormBuilderSubmission\",\n SYSTEM = \"FormBuilderSystem\",\n SETTINGS = \"FormBuilderSettings\"\n}\n\nexport interface FormBuilderStorageOperationsFactoryParams {\n documentClient: DocumentClient;\n table?: string;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: Plugin;\n}\n\nexport interface FormBuilderSystemCreateKeysParams {\n tenant: string;\n}\n\nexport interface FormBuilderSystemStorageOperations extends BaseFormBuilderSystemStorageOperations {\n createSystemPartitionKey: (params: FormBuilderSystemCreateKeysParams) => string;\n createSystemSortKey: () => string;\n}\n\nexport interface FormBuilderFormCreatePartitionKeyParams {\n tenant: string;\n locale: string;\n}\n\nexport interface FormBuilderFormCreateGSIPartitionKeyParams {\n id?: string;\n formId?: string;\n tenant: string;\n locale: string;\n}\n\nexport interface FormBuilderFormStorageOperations extends BaseFormBuilderFormStorageOperations {\n createFormPartitionKey: (params: FormBuilderFormCreatePartitionKeyParams) => string;\n}\n\nexport interface FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams {\n tenant: string;\n locale: string;\n formId: string;\n}\n\nexport interface FormBuilderSubmissionStorageOperations\n extends BaseFormBuilderSubmissionStorageOperations {\n createSubmissionPartitionKey: (\n params: FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n ) => string;\n createSubmissionSortKey: (id: string) => string;\n}\n\nexport interface FormBuilderSettingsStorageOperationsCreatePartitionKeyParams {\n tenant: string;\n locale: string;\n}\n\nexport interface FormBuilderSettingsStorageOperations\n extends BaseFormBuilderSettingsStorageOperations {\n createSettingsPartitionKey: (\n params: FormBuilderSettingsStorageOperationsCreatePartitionKeyParams\n ) => string;\n createSettingsSortKey: () => string;\n}\n\nexport type Entities = \"form\" | \"submission\" | \"system\" | \"settings\";\n\nexport interface FormBuilderStorageOperations\n extends BaseFormBuilderStorageOperations,\n FormBuilderSettingsStorageOperations,\n FormBuilderSubmissionStorageOperations,\n FormBuilderFormStorageOperations,\n FormBuilderSystemStorageOperations {\n getTable(): Table;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface FormBuilderStorageOperationsFactory {\n (params: FormBuilderStorageOperationsFactoryParams): FormBuilderStorageOperations;\n}\n"],"mappings":";;;;;;IAoBYA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q"}
|