@webiny/api-prerendering-service-so-ddb 0.0.0-mt-3 → 0.0.0-unstable.3386f66516
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/definitions/queueJob.d.ts +2 -2
- package/definitions/queueJob.js +3 -7
- package/definitions/queueJob.js.map +1 -0
- package/definitions/render.d.ts +2 -2
- package/definitions/render.js +6 -16
- package/definitions/render.js.map +1 -0
- package/definitions/{tagUrlLink.d.ts → renderLegacy.d.ts} +2 -2
- package/definitions/renderLegacy.js +52 -0
- package/definitions/renderLegacy.js.map +1 -0
- package/definitions/settings.d.ts +8 -0
- package/definitions/settings.js +40 -0
- package/definitions/settings.js.map +1 -0
- package/definitions/table.d.ts +3 -2
- package/definitions/table.js +7 -1
- package/definitions/table.js.map +1 -0
- package/definitions/tagPathLink.d.ts +9 -0
- package/definitions/tagPathLink.js +46 -0
- package/definitions/tagPathLink.js.map +1 -0
- package/definitions/tagPathLinkLegacy.d.ts +9 -0
- package/definitions/tagPathLinkLegacy.js +49 -0
- package/definitions/tagPathLinkLegacy.js.map +1 -0
- package/index.js +22 -15
- package/index.js.map +1 -0
- package/operations/queueJob.d.ts +6 -0
- package/operations/{queueJob/index.js → queueJob.js} +5 -10
- package/operations/queueJob.js.map +1 -0
- package/operations/render.d.ts +21 -0
- package/operations/{render/index.js → render.js} +122 -83
- package/operations/render.js.map +1 -0
- package/operations/settings.d.ts +6 -0
- package/operations/settings.js +75 -0
- package/operations/settings.js.map +1 -0
- package/package.json +17 -17
- package/types.d.ts +8 -2
- package/types.js +2 -1
- package/types.js.map +1 -0
- package/definitions/tagUrlLink.js +0 -53
- package/operations/queueJob/index.d.ts +0 -6
- package/operations/render/index.d.ts +0 -16
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
export interface
|
|
3
|
+
export interface CreateQueueJobEntityParams {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
|
-
export declare const createQueueJobEntity: (params:
|
|
8
|
+
export declare const createQueueJobEntity: (params: CreateQueueJobEntityParams) => Entity<any>;
|
package/definitions/queueJob.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createQueueJobEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
14
|
const createQueueJobEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
entityName,
|
|
@@ -24,7 +20,7 @@ const createQueueJobEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
name: entityName,
|
|
26
22
|
table,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["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"}
|
package/definitions/render.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
export interface
|
|
3
|
+
export interface CreateRenderEntityParams {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
|
-
export declare const createRenderEntity: (params:
|
|
8
|
+
export declare const createRenderEntity: (params: CreateRenderEntityParams) => Entity<any>;
|
package/definitions/render.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createRenderEntity = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
14
|
const createRenderEntity = params => {
|
|
19
15
|
const {
|
|
20
16
|
entityName,
|
|
@@ -24,7 +20,7 @@ const createRenderEntity = params => {
|
|
|
24
20
|
return new _dynamodbToolbox.Entity({
|
|
25
21
|
name: entityName,
|
|
26
22
|
table,
|
|
27
|
-
attributes:
|
|
23
|
+
attributes: (0, _objectSpread2.default)({
|
|
28
24
|
PK: {
|
|
29
25
|
partitionKey: true
|
|
30
26
|
},
|
|
@@ -34,20 +30,14 @@ const createRenderEntity = params => {
|
|
|
34
30
|
TYPE: {
|
|
35
31
|
type: "string"
|
|
36
32
|
},
|
|
37
|
-
|
|
33
|
+
GSI1_PK: {
|
|
38
34
|
type: "string"
|
|
39
35
|
},
|
|
40
|
-
|
|
36
|
+
GSI1_SK: {
|
|
41
37
|
type: "string"
|
|
42
38
|
},
|
|
43
|
-
|
|
39
|
+
data: {
|
|
44
40
|
type: "map"
|
|
45
|
-
},
|
|
46
|
-
configuration: {
|
|
47
|
-
type: "map"
|
|
48
|
-
},
|
|
49
|
-
files: {
|
|
50
|
-
type: "list"
|
|
51
41
|
}
|
|
52
42
|
}, attributes || {})
|
|
53
43
|
});
|
|
@@ -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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
export interface
|
|
3
|
+
export interface CreateRenderEntityParams {
|
|
4
4
|
table: Table;
|
|
5
5
|
entityName: string;
|
|
6
6
|
attributes: Attributes;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
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"}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
2
2
|
import { Table } from "dynamodb-toolbox";
|
|
3
3
|
import { TableModifier } from "../types";
|
|
4
|
-
|
|
4
|
+
interface CreateTableParams {
|
|
5
5
|
table?: TableModifier;
|
|
6
6
|
documentClient: DocumentClient;
|
|
7
7
|
}
|
|
8
|
-
export declare const createTable: (params:
|
|
8
|
+
export declare const createTable: (params: CreateTableParams) => Table;
|
|
9
|
+
export {};
|
package/definitions/table.js
CHANGED
|
@@ -16,7 +16,13 @@ const createTable = params => {
|
|
|
16
16
|
name: process.env.DB_TABLE_PRERENDERING_SERVICE || process.env.DB_TABLE,
|
|
17
17
|
partitionKey: "PK",
|
|
18
18
|
sortKey: "SK",
|
|
19
|
-
DocumentClient: documentClient
|
|
19
|
+
DocumentClient: documentClient,
|
|
20
|
+
indexes: {
|
|
21
|
+
GSI1: {
|
|
22
|
+
partitionKey: "GSI1_PK",
|
|
23
|
+
sortKey: "GSI1_SK"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
20
26
|
};
|
|
21
27
|
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
22
28
|
return new _dynamodbToolbox.Table(config);
|
|
@@ -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.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createPrerenderingServiceStorageOperations = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
13
|
|
|
@@ -17,17 +17,17 @@ var _table = require("./definitions/table");
|
|
|
17
17
|
|
|
18
18
|
var _render = require("./definitions/render");
|
|
19
19
|
|
|
20
|
+
var _settings = require("./definitions/settings");
|
|
21
|
+
|
|
20
22
|
var _queueJob = require("./definitions/queueJob");
|
|
21
23
|
|
|
22
24
|
var _render2 = require("./operations/render");
|
|
23
25
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var _tagUrlLink = require("./definitions/tagUrlLink");
|
|
26
|
+
var _settings2 = require("./operations/settings");
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
var _queueJob2 = require("./operations/queueJob");
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
var _tagPathLink = require("./definitions/tagPathLink");
|
|
31
31
|
|
|
32
32
|
const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
|
|
33
33
|
|
|
@@ -43,7 +43,7 @@ const isReserved = name => {
|
|
|
43
43
|
|
|
44
44
|
const createPrerenderingServiceStorageOperations = params => {
|
|
45
45
|
const {
|
|
46
|
-
attributes
|
|
46
|
+
attributes,
|
|
47
47
|
table,
|
|
48
48
|
documentClient
|
|
49
49
|
} = params;
|
|
@@ -62,27 +62,34 @@ const createPrerenderingServiceStorageOperations = params => {
|
|
|
62
62
|
render: (0, _render.createRenderEntity)({
|
|
63
63
|
entityName: _types.ENTITIES.RENDER,
|
|
64
64
|
table: tableInstance,
|
|
65
|
-
attributes: attributes[_types.ENTITIES.RENDER]
|
|
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] : {}
|
|
66
71
|
}),
|
|
67
72
|
queueJob: (0, _queueJob.createQueueJobEntity)({
|
|
68
73
|
entityName: _types.ENTITIES.QUEUE_JOB,
|
|
69
74
|
table: tableInstance,
|
|
70
|
-
attributes: attributes[_types.ENTITIES.QUEUE_JOB]
|
|
75
|
+
attributes: attributes ? attributes[_types.ENTITIES.QUEUE_JOB] : {}
|
|
71
76
|
}),
|
|
72
|
-
|
|
73
|
-
entityName: _types.ENTITIES.
|
|
77
|
+
tagPathLink: (0, _tagPathLink.createTagPathLinkEntity)({
|
|
78
|
+
entityName: _types.ENTITIES.TAG_PATH_LINK,
|
|
74
79
|
table: tableInstance,
|
|
75
|
-
attributes: attributes[_types.ENTITIES.
|
|
80
|
+
attributes: attributes ? attributes[_types.ENTITIES.TAG_PATH_LINK] : {}
|
|
76
81
|
})
|
|
77
82
|
};
|
|
78
|
-
return
|
|
83
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
79
84
|
getTable: () => tableInstance,
|
|
80
85
|
getEntities: () => entities
|
|
81
86
|
}, (0, _render2.createRenderStorageOperations)({
|
|
82
87
|
entity: entities.render,
|
|
83
|
-
|
|
88
|
+
tagPathLinkEntity: entities.tagPathLink
|
|
84
89
|
})), (0, _queueJob2.createQueueJobStorageOperations)({
|
|
85
90
|
entity: entities.queueJob
|
|
91
|
+
})), (0, _settings2.createSettingsStorageOperations)({
|
|
92
|
+
entity: entities.settings
|
|
86
93
|
}));
|
|
87
94
|
};
|
|
88
95
|
|
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;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createQueueJobStorageOperations = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
13
|
|
|
@@ -17,10 +17,6 @@ var _query = require("@webiny/db-dynamodb/utils/query");
|
|
|
17
17
|
|
|
18
18
|
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
19
19
|
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
20
|
const createQueueJobStorageOperations = params => {
|
|
25
21
|
const {
|
|
26
22
|
entity
|
|
@@ -48,7 +44,7 @@ const createQueueJobStorageOperations = params => {
|
|
|
48
44
|
};
|
|
49
45
|
|
|
50
46
|
try {
|
|
51
|
-
await entity.put(
|
|
47
|
+
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, queueJob), keys), {}, {
|
|
52
48
|
TYPE: createQueueJobType()
|
|
53
49
|
}));
|
|
54
50
|
return queueJob;
|
|
@@ -58,10 +54,9 @@ const createQueueJobStorageOperations = params => {
|
|
|
58
54
|
queueJob
|
|
59
55
|
});
|
|
60
56
|
}
|
|
61
|
-
};
|
|
62
|
-
|
|
57
|
+
};
|
|
63
58
|
|
|
64
|
-
const listQueueJobs = async
|
|
59
|
+
const listQueueJobs = async () => {
|
|
65
60
|
const queryAllParams = {
|
|
66
61
|
entity,
|
|
67
62
|
partitionKey: createQueueJobPartitionKey(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createQueueJobStorageOperations","params","entity","createQueueJobPartitionKey","createQueueJobSortKey","id","createQueueJobType","createQueueJob","queueJob","keys","PK","SK","put","TYPE","ex","WebinyError","message","code","listQueueJobs","queryAllParams","partitionKey","options","gte","results","queryAll","cleanupItems","deleteQueueJobs","queueJobs","items","map","job","deleteBatch","batchWriteAll","table"],"sources":["queueJob.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceQueueJobStorageOperations,\n PrerenderingServiceStorageOperationsCreateQueueJobParams,\n PrerenderingServiceStorageOperationsDeleteQueueJobsParams,\n QueueJob\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\n\nexport interface CreateQueueJobStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createQueueJobStorageOperations = (\n params: CreateQueueJobStorageOperationsParams\n): PrerenderingServiceQueueJobStorageOperations => {\n const { entity } = params;\n\n const createQueueJobPartitionKey = (): string => {\n return \"PS#Q#JOB\";\n };\n const createQueueJobSortKey = (id: string): string => {\n return id;\n };\n\n const createQueueJobType = () => {\n return \"ps.queue.job\";\n };\n\n const createQueueJob = async (\n params: PrerenderingServiceStorageOperationsCreateQueueJobParams\n ): Promise<QueueJob> => {\n const { queueJob } = params;\n const keys = {\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(queueJob.id)\n };\n\n try {\n await entity.put({\n ...queueJob,\n ...keys,\n TYPE: createQueueJobType()\n });\n return queueJob;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create render record.\",\n ex.code || \"CREATE_RENDER_ERROR\",\n {\n keys,\n queueJob\n }\n );\n }\n };\n\n const listQueueJobs = async () => {\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createQueueJobPartitionKey(),\n options: {\n gte: \" \"\n }\n };\n\n try {\n const results = await queryAll<QueueJob>(queryAllParams);\n\n return cleanupItems(entity, results);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list queue jobs records.\",\n ex.code || \"LIST_QUEUE_JOBS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n };\n\n const deleteQueueJobs = async (\n params: PrerenderingServiceStorageOperationsDeleteQueueJobsParams\n ) => {\n const { queueJobs } = params;\n\n const items = queueJobs.map(job => {\n return entity.deleteBatch({\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(job.id)\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n return queueJobs;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete queue jobs records.\",\n ex.code || \"DELETE_QUEUE_JOBS_ERROR\",\n {\n queueJobs\n }\n );\n }\n };\n\n return {\n createQueueJob,\n deleteQueueJobs,\n listQueueJobs\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAMO,MAAMA,+BAA+B,GACxCC,MAD2C,IAEI;EAC/C,MAAM;IAAEC;EAAF,IAAaD,MAAnB;;EAEA,MAAME,0BAA0B,GAAG,MAAc;IAC7C,OAAO,UAAP;EACH,CAFD;;EAGA,MAAMC,qBAAqB,GAAIC,EAAD,IAAwB;IAClD,OAAOA,EAAP;EACH,CAFD;;EAIA,MAAMC,kBAAkB,GAAG,MAAM;IAC7B,OAAO,cAAP;EACH,CAFD;;EAIA,MAAMC,cAAc,GAAG,MACnBN,MADmB,IAEC;IACpB,MAAM;MAAEO;IAAF,IAAeP,MAArB;IACA,MAAMQ,IAAI,GAAG;MACTC,EAAE,EAAEP,0BAA0B,EADrB;MAETQ,EAAE,EAAEP,qBAAqB,CAACI,QAAQ,CAACH,EAAV;IAFhB,CAAb;;IAKA,IAAI;MACA,MAAMH,MAAM,CAACU,GAAP,yFACCJ,QADD,GAECC,IAFD;QAGFI,IAAI,EAAEP,kBAAkB;MAHtB,GAAN;MAKA,OAAOE,QAAP;IACH,CAPD,CAOE,OAAOM,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,iCADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,qBAFT,EAGF;QACIR,IADJ;QAEID;MAFJ,CAHE,CAAN;IAQH;EACJ,CA1BD;;EA4BA,MAAMU,aAAa,GAAG,YAAY;IAC9B,MAAMC,cAA8B,GAAG;MACnCjB,MADmC;MAEnCkB,YAAY,EAAEjB,0BAA0B,EAFL;MAGnCkB,OAAO,EAAE;QACLC,GAAG,EAAE;MADA;IAH0B,CAAvC;;IAQA,IAAI;MACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,eAAA,EAAmBL,cAAnB,CAAtB;MAEA,OAAO,IAAAM,qBAAA,EAAavB,MAAb,EAAqBqB,OAArB,CAAP;IACH,CAJD,CAIE,OAAOT,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,oCADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,uBAFT,EAGF;QACIG,YAAY,EAAED,cAAc,CAACC,YADjC;QAEIC,OAAO,EAAEF,cAAc,CAACE;MAF5B,CAHE,CAAN;IAQH;EACJ,CAvBD;;EAyBA,MAAMK,eAAe,GAAG,MACpBzB,MADoB,IAEnB;IACD,MAAM;MAAE0B;IAAF,IAAgB1B,MAAtB;IAEA,MAAM2B,KAAK,GAAGD,SAAS,CAACE,GAAV,CAAcC,GAAG,IAAI;MAC/B,OAAO5B,MAAM,CAAC6B,WAAP,CAAmB;QACtBrB,EAAE,EAAEP,0BAA0B,EADR;QAEtBQ,EAAE,EAAEP,qBAAqB,CAAC0B,GAAG,CAACzB,EAAL;MAFH,CAAnB,CAAP;IAIH,CALa,CAAd;;IAOA,IAAI;MACA,MAAM,IAAA2B,yBAAA,EAAc;QAChBC,KAAK,EAAE/B,MAAM,CAAC+B,KADE;QAEhBL;MAFgB,CAAd,CAAN;MAIA,OAAOD,SAAP;IACH,CAND,CAME,OAAOb,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,sCADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,yBAFT,EAGF;QACIU;MADJ,CAHE,CAAN;IAOH;EACJ,CA3BD;;EA6BA,OAAO;IACHpB,cADG;IAEHmB,eAFG;IAGHR;EAHG,CAAP;AAKH,CAvGM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PrerenderingServiceRenderStorageOperations } from "@webiny/api-prerendering-service/types";
|
|
2
|
+
import { Entity } from "dynamodb-toolbox";
|
|
3
|
+
import { Tag } from "@webiny/api-prerendering-service/types";
|
|
4
|
+
export interface CreateRenderStorageOperationsParams {
|
|
5
|
+
entity: Entity<any>;
|
|
6
|
+
tagPathLinkEntity: Entity<any>;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateTagPathLinkPartitionKeyParams {
|
|
9
|
+
tenant: string;
|
|
10
|
+
tag: Tag;
|
|
11
|
+
path: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateTagPathLinkGSI1PartitionKeyParams {
|
|
14
|
+
tenant: string;
|
|
15
|
+
tag: Tag;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateTagPathLinkSortKeyParams {
|
|
18
|
+
tag: Tag;
|
|
19
|
+
path?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const createRenderStorageOperations: (params: CreateRenderStorageOperationsParams) => PrerenderingServiceRenderStorageOperations;
|