@webiny/api-prerendering-service-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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @webiny/api-prerendering-service
2
+ [![](https://img.shields.io/npm/dw/@webiny/api-prerendering-service.svg)](https://www.npmjs.com/package/@webiny/api-prerendering-service)
3
+ [![](https://img.shields.io/npm/v/@webiny/api-prerendering-service.svg)](https://www.npmjs.com/package/@webiny/api-prerendering-service)
4
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
@@ -0,0 +1,8 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ export interface CreateQueueJobEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createQueueJobEntity: (params: CreateQueueJobEntityParams) => Entity<any>;
@@ -0,0 +1,43 @@
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.createQueueJobEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createQueueJobEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ id: {
34
+ type: "string"
35
+ },
36
+ args: {
37
+ type: "map"
38
+ }
39
+ }, attributes || {})
40
+ });
41
+ };
42
+
43
+ exports.createQueueJobEntity = createQueueJobEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createQueueJobEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","args"],"sources":["queueJob.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateQueueJobEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createQueueJobEntity = (params: CreateQueueJobEntityParams): 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 id: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,oBAAoB,GAAIC,MAAD,IAAqD;EACrF,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,EAAE,EAAE;QACAD,IAAI,EAAE;MADN,CAVE;MAaNE,IAAI,EAAE;QACFF,IAAI,EAAE;MADJ;IAbA,GAgBFT,UAAU,IAAI,EAhBZ;EAHI,CAAX,CAAP;AAsBH,CAxBM"}
@@ -0,0 +1,8 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ export interface CreateRenderEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createRenderEntity: (params: CreateRenderEntityParams) => Entity<any>;
@@ -0,0 +1,46 @@
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.createRenderEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createRenderEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ GSI1_PK: {
34
+ type: "string"
35
+ },
36
+ GSI1_SK: {
37
+ type: "string"
38
+ },
39
+ data: {
40
+ type: "map"
41
+ }
42
+ }, attributes || {})
43
+ });
44
+ };
45
+
46
+ exports.createRenderEntity = createRenderEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data"],"sources":["render.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): 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 GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,kBAAkB,GAAIC,MAAD,IAAmD;EACjF,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,OAAO,EAAE;QACLD,IAAI,EAAE;MADD,CAVH;MAaNE,OAAO,EAAE;QACLF,IAAI,EAAE;MADD,CAbH;MAgBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ;IAhBA,GAmBFT,UAAU,IAAI,EAnBZ;EAHI,CAAX,CAAP;AAyBH,CA3BM"}
@@ -0,0 +1,8 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ export interface CreateRenderEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createRenderEntity: (params: CreateRenderEntityParams) => Entity<any>;
@@ -0,0 +1,52 @@
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.createRenderEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createRenderEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ namespace: {
34
+ type: "string"
35
+ },
36
+ url: {
37
+ type: "string"
38
+ },
39
+ args: {
40
+ type: "map"
41
+ },
42
+ configuration: {
43
+ type: "map"
44
+ },
45
+ files: {
46
+ type: "list"
47
+ }
48
+ }, attributes || {})
49
+ });
50
+ };
51
+
52
+ exports.createRenderEntity = createRenderEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","args","configuration","files"],"sources":["renderLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): 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 namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n configuration: {\n type: \"map\"\n },\n files: {\n type: \"list\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,kBAAkB,GAAIC,MAAD,IAAmD;EACjF,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,GAAG,EAAE;QACDF,IAAI,EAAE;MADL,CAbC;MAgBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ,CAhBA;MAmBNI,aAAa,EAAE;QACXJ,IAAI,EAAE;MADK,CAnBT;MAsBNK,KAAK,EAAE;QACHL,IAAI,EAAE;MADH;IAtBD,GAyBFT,UAAU,IAAI,EAzBZ;EAHI,CAAX,CAAP;AA+BH,CAjCM"}
@@ -0,0 +1,8 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ export interface CreateSettingsEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createSettingsEntity: (params: CreateSettingsEntityParams) => Entity<any>;
@@ -0,0 +1,40 @@
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.createSettingsEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createSettingsEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ data: {
34
+ type: "map"
35
+ }
36
+ }, attributes || {})
37
+ });
38
+ };
39
+
40
+ exports.createSettingsEntity = createSettingsEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","data"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateSettingsEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: CreateSettingsEntityParams): 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 data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,oBAAoB,GAAIC,MAAD,IAAqD;EACrF,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,IAAI,EAAE;QACFD,IAAI,EAAE;MADJ;IAVA,GAaFT,UAAU,IAAI,EAbZ;EAHI,CAAX,CAAP;AAmBH,CArBM"}
@@ -0,0 +1,9 @@
1
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
+ import { Table } from "dynamodb-toolbox";
3
+ import { TableModifier } from "../types";
4
+ interface CreateTableParams {
5
+ table?: TableModifier;
6
+ documentClient: DocumentClient;
7
+ }
8
+ export declare const createTable: (params: CreateTableParams) => Table;
9
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createTable = void 0;
7
+
8
+ var _dynamodbToolbox = require("dynamodb-toolbox");
9
+
10
+ const createTable = params => {
11
+ const {
12
+ table,
13
+ documentClient
14
+ } = params;
15
+ const tableConfig = {
16
+ name: process.env.DB_TABLE_PRERENDERING_SERVICE || process.env.DB_TABLE,
17
+ partitionKey: "PK",
18
+ sortKey: "SK",
19
+ DocumentClient: documentClient,
20
+ indexes: {
21
+ GSI1: {
22
+ partitionKey: "GSI1_PK",
23
+ sortKey: "GSI1_SK"
24
+ }
25
+ }
26
+ };
27
+ const config = typeof table === "function" ? table(tableConfig) : tableConfig;
28
+ return new _dynamodbToolbox.Table(config);
29
+ };
30
+
31
+ exports.createTable = createTable;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTable","params","table","documentClient","tableConfig","name","process","env","DB_TABLE_PRERENDERING_SERVICE","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","config","Table"],"sources":["table.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\nimport { TableModifier } from \"~/types\";\nimport { TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\n\ninterface CreateTableParams {\n table?: TableModifier;\n documentClient: DocumentClient;\n}\n\nexport const createTable = (params: CreateTableParams): Table => {\n const { table, documentClient } = params;\n\n const tableConfig: TableConstructor = {\n name: (process.env.DB_TABLE_PRERENDERING_SERVICE || process.env.DB_TABLE) as string,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n }\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;;AACA;;AASO,MAAMA,WAAW,GAAIC,MAAD,IAAsC;EAC7D,MAAM;IAAEC,KAAF;IAASC;EAAT,IAA4BF,MAAlC;EAEA,MAAMG,WAA6B,GAAG;IAClCC,IAAI,EAAGC,OAAO,CAACC,GAAR,CAAYC,6BAAZ,IAA6CF,OAAO,CAACC,GAAR,CAAYE,QAD9B;IAElCC,YAAY,EAAE,IAFoB;IAGlCC,OAAO,EAAE,IAHyB;IAIlCC,cAAc,EAAET,cAJkB;IAKlCU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SADZ;QAEFC,OAAO,EAAE;MAFP;IADD;EALyB,CAAtC;EAaA,MAAMI,MAAM,GAAG,OAAOb,KAAP,KAAiB,UAAjB,GAA8BA,KAAK,CAACE,WAAD,CAAnC,GAAmDA,WAAlE;EAEA,OAAO,IAAIY,sBAAJ,CAAUD,MAAV,CAAP;AACH,CAnBM"}
@@ -0,0 +1,9 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ interface CreateTagPathLinkEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createTagPathLinkEntity: (params: CreateTagPathLinkEntityParams) => Entity<{}>;
9
+ export {};
@@ -0,0 +1,46 @@
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.createTagPathLinkEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createTagPathLinkEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ GSI1_PK: {
34
+ type: "string"
35
+ },
36
+ GSI1_SK: {
37
+ type: "string"
38
+ },
39
+ data: {
40
+ type: "map"
41
+ }
42
+ }, attributes || {})
43
+ });
44
+ };
45
+
46
+ exports.createTagPathLinkEntity = createTagPathLinkEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTagPathLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data"],"sources":["tagPathLink.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagPathLinkEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagPathLinkEntity = (params: CreateTagPathLinkEntityParams) => {\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 GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,uBAAuB,GAAIC,MAAD,IAA2C;EAC9E,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,OAAO,EAAE;QACLD,IAAI,EAAE;MADD,CAVH;MAaNE,OAAO,EAAE;QACLF,IAAI,EAAE;MADD,CAbH;MAgBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ;IAhBA,GAmBFT,UAAU,IAAI,EAnBZ;EAHI,CAAX,CAAP;AAyBH,CA3BM"}
@@ -0,0 +1,9 @@
1
+ import { Entity, Table } from "dynamodb-toolbox";
2
+ import { Attributes } from "../types";
3
+ interface CreateTagUrlLinkEntityParams {
4
+ table: Table;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createTagUrlLinkEntity: (params: CreateTagUrlLinkEntityParams) => Entity<{}>;
9
+ export {};
@@ -0,0 +1,49 @@
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.createTagUrlLinkEntity = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _dynamodbToolbox = require("dynamodb-toolbox");
13
+
14
+ const createTagUrlLinkEntity = params => {
15
+ const {
16
+ entityName,
17
+ attributes,
18
+ table
19
+ } = params;
20
+ return new _dynamodbToolbox.Entity({
21
+ name: entityName,
22
+ table,
23
+ attributes: (0, _objectSpread2.default)({
24
+ PK: {
25
+ partitionKey: true
26
+ },
27
+ SK: {
28
+ sortKey: true
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ namespace: {
34
+ type: "string"
35
+ },
36
+ url: {
37
+ type: "string"
38
+ },
39
+ value: {
40
+ type: "string"
41
+ },
42
+ key: {
43
+ type: "string"
44
+ }
45
+ }, attributes || {})
46
+ });
47
+ };
48
+
49
+ exports.createTagUrlLinkEntity = createTagUrlLinkEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTagUrlLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","value","key"],"sources":["tagPathLinkLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagUrlLinkEntityParams {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagUrlLinkEntity = (params: CreateTagUrlLinkEntityParams) => {\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 namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n value: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,sBAAsB,GAAIC,MAAD,IAA0C;EAC5E,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,GAAG,EAAE;QACDF,IAAI,EAAE;MADL,CAbC;MAgBNG,KAAK,EAAE;QACHH,IAAI,EAAE;MADH,CAhBD;MAmBNI,GAAG,EAAE;QACDJ,IAAI,EAAE;MADL;IAnBC,GAsBFT,UAAU,IAAI,EAtBZ;EAHI,CAAX,CAAP;AA4BH,CA9BM"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { PrerenderingServiceFactory } from "./types";
2
+ export declare const createPrerenderingServiceStorageOperations: PrerenderingServiceFactory;
package/index.js ADDED
@@ -0,0 +1,96 @@
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.createPrerenderingServiceStorageOperations = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _error = _interopRequireDefault(require("@webiny/error"));
13
+
14
+ var _types = require("./types");
15
+
16
+ var _table = require("./definitions/table");
17
+
18
+ var _render = require("./definitions/render");
19
+
20
+ var _settings = require("./definitions/settings");
21
+
22
+ var _queueJob = require("./definitions/queueJob");
23
+
24
+ var _render2 = require("./operations/render");
25
+
26
+ var _settings2 = require("./operations/settings");
27
+
28
+ var _queueJob2 = require("./operations/queueJob");
29
+
30
+ var _tagPathLink = require("./definitions/tagPathLink");
31
+
32
+ const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
33
+
34
+ const isReserved = name => {
35
+ if (reservedFields.includes(name) === false) {
36
+ return;
37
+ }
38
+
39
+ throw new _error.default(`Attribute name "${name}" is not allowed.`, "ATTRIBUTE_NOT_ALLOWED", {
40
+ name
41
+ });
42
+ };
43
+
44
+ const createPrerenderingServiceStorageOperations = params => {
45
+ const {
46
+ attributes,
47
+ table,
48
+ documentClient
49
+ } = params;
50
+
51
+ if (attributes) {
52
+ Object.values(attributes).forEach(attrs => {
53
+ Object.keys(attrs).forEach(isReserved);
54
+ });
55
+ }
56
+
57
+ const tableInstance = (0, _table.createTable)({
58
+ table,
59
+ documentClient
60
+ });
61
+ const entities = {
62
+ render: (0, _render.createRenderEntity)({
63
+ entityName: _types.ENTITIES.RENDER,
64
+ table: tableInstance,
65
+ attributes: attributes ? attributes[_types.ENTITIES.RENDER] : {}
66
+ }),
67
+ settings: (0, _settings.createSettingsEntity)({
68
+ entityName: _types.ENTITIES.SETTINGS,
69
+ table: tableInstance,
70
+ attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
71
+ }),
72
+ queueJob: (0, _queueJob.createQueueJobEntity)({
73
+ entityName: _types.ENTITIES.QUEUE_JOB,
74
+ table: tableInstance,
75
+ attributes: attributes ? attributes[_types.ENTITIES.QUEUE_JOB] : {}
76
+ }),
77
+ tagPathLink: (0, _tagPathLink.createTagPathLinkEntity)({
78
+ entityName: _types.ENTITIES.TAG_PATH_LINK,
79
+ table: tableInstance,
80
+ attributes: attributes ? attributes[_types.ENTITIES.TAG_PATH_LINK] : {}
81
+ })
82
+ };
83
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
84
+ getTable: () => tableInstance,
85
+ getEntities: () => entities
86
+ }, (0, _render2.createRenderStorageOperations)({
87
+ entity: entities.render,
88
+ tagPathLinkEntity: entities.tagPathLink
89
+ })), (0, _queueJob2.createQueueJobStorageOperations)({
90
+ entity: entities.queueJob
91
+ })), (0, _settings2.createSettingsStorageOperations)({
92
+ entity: entities.settings
93
+ }));
94
+ };
95
+
96
+ exports.createPrerenderingServiceStorageOperations = createPrerenderingServiceStorageOperations;
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reservedFields","isReserved","name","includes","WebinyError","createPrerenderingServiceStorageOperations","params","attributes","table","documentClient","Object","values","forEach","attrs","keys","tableInstance","createTable","entities","render","createRenderEntity","entityName","ENTITIES","RENDER","settings","createSettingsEntity","SETTINGS","queueJob","createQueueJobEntity","QUEUE_JOB","tagPathLink","createTagPathLinkEntity","TAG_PATH_LINK","getTable","getEntities","createRenderStorageOperations","entity","tagPathLinkEntity","createQueueJobStorageOperations","createSettingsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ENTITIES, PrerenderingServiceFactory, PrerenderingServiceFactoryParams } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createRenderEntity } from \"~/definitions/render\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createQueueJobEntity } from \"~/definitions/queueJob\";\nimport { createRenderStorageOperations } from \"~/operations/render\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createQueueJobStorageOperations } from \"~/operations/queueJob\";\nimport { createTagPathLinkEntity } from \"~/definitions/tagPathLink\";\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 const createPrerenderingServiceStorageOperations: PrerenderingServiceFactory = (\n params: PrerenderingServiceFactoryParams\n) => {\n const { attributes, table, documentClient } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const tableInstance = createTable({ table, documentClient });\n\n const entities = {\n render: createRenderEntity({\n entityName: ENTITIES.RENDER,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.RENDER] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n queueJob: createQueueJobEntity({\n entityName: ENTITIES.QUEUE_JOB,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.QUEUE_JOB] : {}\n }),\n tagPathLink: createTagPathLinkEntity({\n entityName: ENTITIES.TAG_PATH_LINK,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.TAG_PATH_LINK] : {}\n })\n };\n\n return {\n getTable: () => tableInstance,\n getEntities: () => entities,\n ...createRenderStorageOperations({\n entity: entities.render,\n tagPathLinkEntity: entities.tagPathLink\n }),\n ...createQueueJobStorageOperations({\n entity: entities.queueJob\n }),\n ...createSettingsStorageOperations({\n entity: entities.settings\n })\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,MAAMA,cAAc,GAAG,CAAC,IAAD,EAAO,IAAP,EAAa,OAAb,EAAsB,MAAtB,EAA8B,MAA9B,EAAsC,QAAtC,EAAgD,SAAhD,EAA2D,SAA3D,CAAvB;;AAEA,MAAMC,UAAU,GAAIC,IAAD,IAAwB;EACvC,IAAIF,cAAc,CAACG,QAAf,CAAwBD,IAAxB,MAAkC,KAAtC,EAA6C;IACzC;EACH;;EACD,MAAM,IAAIE,cAAJ,CAAiB,mBAAkBF,IAAK,mBAAxC,EAA4D,uBAA5D,EAAqF;IACvFA;EADuF,CAArF,CAAN;AAGH,CAPD;;AASO,MAAMG,0CAAsE,GAC/EC,MADkF,IAEjF;EACD,MAAM;IAAEC,UAAF;IAAcC,KAAd;IAAqBC;EAArB,IAAwCH,MAA9C;;EAEA,IAAIC,UAAJ,EAAgB;IACZG,MAAM,CAACC,MAAP,CAAcJ,UAAd,EAA0BK,OAA1B,CAAkCC,KAAK,IAAI;MACvCH,MAAM,CAACI,IAAP,CAAYD,KAAZ,EAAmBD,OAAnB,CAA2BX,UAA3B;IACH,CAFD;EAGH;;EAED,MAAMc,aAAa,GAAG,IAAAC,kBAAA,EAAY;IAAER,KAAF;IAASC;EAAT,CAAZ,CAAtB;EAEA,MAAMQ,QAAQ,GAAG;IACbC,MAAM,EAAE,IAAAC,0BAAA,EAAmB;MACvBC,UAAU,EAAEC,eAAA,CAASC,MADE;MAEvBd,KAAK,EAAEO,aAFgB;MAGvBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAA,CAASC,MAAV,CAAb,GAAiC;IAHhC,CAAnB,CADK;IAMbC,QAAQ,EAAE,IAAAC,8BAAA,EAAqB;MAC3BJ,UAAU,EAAEC,eAAA,CAASI,QADM;MAE3BjB,KAAK,EAAEO,aAFoB;MAG3BR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAA,CAASI,QAAV,CAAb,GAAmC;IAH9B,CAArB,CANG;IAWbC,QAAQ,EAAE,IAAAC,8BAAA,EAAqB;MAC3BP,UAAU,EAAEC,eAAA,CAASO,SADM;MAE3BpB,KAAK,EAAEO,aAFoB;MAG3BR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAA,CAASO,SAAV,CAAb,GAAoC;IAH/B,CAArB,CAXG;IAgBbC,WAAW,EAAE,IAAAC,oCAAA,EAAwB;MACjCV,UAAU,EAAEC,eAAA,CAASU,aADY;MAEjCvB,KAAK,EAAEO,aAF0B;MAGjCR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAA,CAASU,aAAV,CAAb,GAAwC;IAH7B,CAAxB;EAhBA,CAAjB;EAuBA;IACIC,QAAQ,EAAE,MAAMjB,aADpB;IAEIkB,WAAW,EAAE,MAAMhB;EAFvB,GAGO,IAAAiB,sCAAA,EAA8B;IAC7BC,MAAM,EAAElB,QAAQ,CAACC,MADY;IAE7BkB,iBAAiB,EAAEnB,QAAQ,CAACY;EAFC,CAA9B,CAHP,GAOO,IAAAQ,0CAAA,EAAgC;IAC/BF,MAAM,EAAElB,QAAQ,CAACS;EADc,CAAhC,CAPP,GAUO,IAAAY,0CAAA,EAAgC;IAC/BH,MAAM,EAAElB,QAAQ,CAACM;EADc,CAAhC,CAVP;AAcH,CAlDM"}
@@ -0,0 +1,6 @@
1
+ import { PrerenderingServiceQueueJobStorageOperations } from "@webiny/api-prerendering-service/types";
2
+ import { Entity } from "dynamodb-toolbox";
3
+ export interface CreateQueueJobStorageOperationsParams {
4
+ entity: Entity<any>;
5
+ }
6
+ export declare const createQueueJobStorageOperations: (params: CreateQueueJobStorageOperationsParams) => PrerenderingServiceQueueJobStorageOperations;