@webiny/api-page-builder-import-export-so-ddb 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f
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/importExportTaskEntity.d.ts +116 -0
- package/definitions/importExportTaskEntity.js +71 -0
- package/definitions/importExportTaskEntity.js.map +1 -0
- package/definitions/table.d.ts +7 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +125 -149
- package/index.js.map +1 -0
- package/package.json +18 -26
- package/types.d.ts +6 -13
- package/types.js +3 -1
- package/types.js.map +1 -0
- package/definitions/pageImportExportTaskEntity.d.ts +0 -9
- package/definitions/pageImportExportTaskEntity.js +0 -79
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Attributes } from "../types";
|
|
4
|
+
interface Params {
|
|
5
|
+
entityName: string;
|
|
6
|
+
table: Table<string, string, string>;
|
|
7
|
+
attributes?: Attributes;
|
|
8
|
+
}
|
|
9
|
+
export declare const createImportExportTaskEntity: ({ entityName, table, attributes }: Params) => Entity<string, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, Table<string, string, string>, boolean, boolean, boolean, string, string, string, boolean, {
|
|
10
|
+
PK: {
|
|
11
|
+
partitionKey: true;
|
|
12
|
+
};
|
|
13
|
+
SK: {
|
|
14
|
+
sortKey: true;
|
|
15
|
+
};
|
|
16
|
+
GSI1_PK: {
|
|
17
|
+
type: "string";
|
|
18
|
+
};
|
|
19
|
+
GSI1_SK: {
|
|
20
|
+
type: "string";
|
|
21
|
+
};
|
|
22
|
+
TYPE: {
|
|
23
|
+
type: "string";
|
|
24
|
+
};
|
|
25
|
+
id: {
|
|
26
|
+
type: "string";
|
|
27
|
+
};
|
|
28
|
+
parent: {
|
|
29
|
+
type: "string";
|
|
30
|
+
};
|
|
31
|
+
status: {
|
|
32
|
+
type: "string";
|
|
33
|
+
};
|
|
34
|
+
data: {
|
|
35
|
+
type: "map";
|
|
36
|
+
};
|
|
37
|
+
input: {
|
|
38
|
+
type: "map";
|
|
39
|
+
};
|
|
40
|
+
stats: {
|
|
41
|
+
type: "map";
|
|
42
|
+
};
|
|
43
|
+
error: {
|
|
44
|
+
type: "map";
|
|
45
|
+
};
|
|
46
|
+
createdOn: {
|
|
47
|
+
type: "string";
|
|
48
|
+
};
|
|
49
|
+
createdBy: {
|
|
50
|
+
type: "map";
|
|
51
|
+
};
|
|
52
|
+
tenant: {
|
|
53
|
+
type: "string";
|
|
54
|
+
};
|
|
55
|
+
locale: {
|
|
56
|
+
type: "string";
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
PK: {
|
|
60
|
+
partitionKey: true;
|
|
61
|
+
};
|
|
62
|
+
SK: {
|
|
63
|
+
sortKey: true;
|
|
64
|
+
};
|
|
65
|
+
GSI1_PK: {
|
|
66
|
+
type: "string";
|
|
67
|
+
};
|
|
68
|
+
GSI1_SK: {
|
|
69
|
+
type: "string";
|
|
70
|
+
};
|
|
71
|
+
TYPE: {
|
|
72
|
+
type: "string";
|
|
73
|
+
};
|
|
74
|
+
id: {
|
|
75
|
+
type: "string";
|
|
76
|
+
};
|
|
77
|
+
parent: {
|
|
78
|
+
type: "string";
|
|
79
|
+
};
|
|
80
|
+
status: {
|
|
81
|
+
type: "string";
|
|
82
|
+
};
|
|
83
|
+
data: {
|
|
84
|
+
type: "map";
|
|
85
|
+
};
|
|
86
|
+
input: {
|
|
87
|
+
type: "map";
|
|
88
|
+
};
|
|
89
|
+
stats: {
|
|
90
|
+
type: "map";
|
|
91
|
+
};
|
|
92
|
+
error: {
|
|
93
|
+
type: "map";
|
|
94
|
+
};
|
|
95
|
+
createdOn: {
|
|
96
|
+
type: "string";
|
|
97
|
+
};
|
|
98
|
+
createdBy: {
|
|
99
|
+
type: "map";
|
|
100
|
+
};
|
|
101
|
+
tenant: {
|
|
102
|
+
type: "string";
|
|
103
|
+
};
|
|
104
|
+
locale: {
|
|
105
|
+
type: "string";
|
|
106
|
+
};
|
|
107
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
108
|
+
[x: string]: any;
|
|
109
|
+
[x: number]: any;
|
|
110
|
+
[x: symbol]: any;
|
|
111
|
+
}, {
|
|
112
|
+
[x: string]: any;
|
|
113
|
+
[x: number]: any;
|
|
114
|
+
[x: symbol]: any;
|
|
115
|
+
}>;
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createImportExportTaskEntity = void 0;
|
|
7
|
+
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
8
|
+
const createImportExportTaskEntity = ({
|
|
9
|
+
entityName,
|
|
10
|
+
table,
|
|
11
|
+
attributes
|
|
12
|
+
}) => {
|
|
13
|
+
return new _toolbox.Entity({
|
|
14
|
+
name: entityName,
|
|
15
|
+
table,
|
|
16
|
+
attributes: {
|
|
17
|
+
PK: {
|
|
18
|
+
partitionKey: true
|
|
19
|
+
},
|
|
20
|
+
SK: {
|
|
21
|
+
sortKey: true
|
|
22
|
+
},
|
|
23
|
+
GSI1_PK: {
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
GSI1_SK: {
|
|
27
|
+
type: "string"
|
|
28
|
+
},
|
|
29
|
+
TYPE: {
|
|
30
|
+
type: "string"
|
|
31
|
+
},
|
|
32
|
+
id: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
parent: {
|
|
36
|
+
type: "string"
|
|
37
|
+
},
|
|
38
|
+
status: {
|
|
39
|
+
type: "string"
|
|
40
|
+
},
|
|
41
|
+
data: {
|
|
42
|
+
type: "map"
|
|
43
|
+
},
|
|
44
|
+
input: {
|
|
45
|
+
type: "map"
|
|
46
|
+
},
|
|
47
|
+
stats: {
|
|
48
|
+
type: "map"
|
|
49
|
+
},
|
|
50
|
+
error: {
|
|
51
|
+
type: "map"
|
|
52
|
+
},
|
|
53
|
+
createdOn: {
|
|
54
|
+
type: "string"
|
|
55
|
+
},
|
|
56
|
+
createdBy: {
|
|
57
|
+
type: "map"
|
|
58
|
+
},
|
|
59
|
+
tenant: {
|
|
60
|
+
type: "string"
|
|
61
|
+
},
|
|
62
|
+
locale: {
|
|
63
|
+
type: "string"
|
|
64
|
+
},
|
|
65
|
+
...attributes
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
exports.createImportExportTaskEntity = createImportExportTaskEntity;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=importExportTaskEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createImportExportTaskEntity","entityName","table","attributes","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","parent","status","data","input","stats","error","createdOn","createdBy","tenant","locale","exports"],"sources":["importExportTaskEntity.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n entityName: string;\n table: Table<string, string, string>;\n attributes?: Attributes;\n}\n\nexport const createImportExportTaskEntity = ({ entityName, table, attributes }: Params) => {\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n parent: {\n type: \"string\"\n },\n status: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n input: {\n type: \"map\"\n },\n stats: {\n type: \"map\"\n },\n error: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...attributes\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAmB,CAAC,KAAK;EACvF,OAAO,IAAIC,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBC,KAAK;IACLC,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,EAAE,EAAE;QACAH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,MAAM,EAAE;QACJL,IAAI,EAAE;MACV,CAAC;MACDM,IAAI,EAAE;QACFN,IAAI,EAAE;MACV,CAAC;MACDO,KAAK,EAAE;QACHP,IAAI,EAAE;MACV,CAAC;MACDQ,KAAK,EAAE;QACHR,IAAI,EAAE;MACV,CAAC;MACDS,KAAK,EAAE;QACHT,IAAI,EAAE;MACV,CAAC;MACDU,SAAS,EAAE;QACPV,IAAI,EAAE;MACV,CAAC;MACDW,SAAS,EAAE;QACPX,IAAI,EAAE;MACV,CAAC;MACDY,MAAM,EAAE;QACJZ,IAAI,EAAE;MACV,CAAC;MACDa,MAAM,EAAE;QACJb,IAAI,EAAE;MACV,CAAC;MACD,GAAGR;IACP;EACJ,CAAC,CAAC;AACN,CAAC;AAACsB,OAAA,CAAAzB,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Table } from "dynamodb
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
table
|
|
5
|
-
documentClient:
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
|
+
interface CreateTableParams {
|
|
4
|
+
table?: string;
|
|
5
|
+
documentClient: DynamoDBDocument;
|
|
6
6
|
}
|
|
7
|
-
export declare const createTable: ({ table, documentClient }:
|
|
7
|
+
export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table<string, "PK", "SK">;
|
|
8
|
+
export {};
|
package/definitions/table.js
CHANGED
|
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createTable = void 0;
|
|
7
|
-
|
|
8
|
-
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
|
-
|
|
7
|
+
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
10
8
|
const createTable = ({
|
|
11
9
|
table,
|
|
12
10
|
documentClient
|
|
13
11
|
}) => {
|
|
14
|
-
return new
|
|
12
|
+
return new _toolbox.Table({
|
|
15
13
|
name: table || process.env.DB_TABLE_PAGE_BUILDER || process.env.DB_TABLE,
|
|
16
14
|
partitionKey: "PK",
|
|
17
15
|
sortKey: "SK",
|
|
@@ -21,8 +19,11 @@ const createTable = ({
|
|
|
21
19
|
partitionKey: "GSI1_PK",
|
|
22
20
|
sortKey: "GSI1_SK"
|
|
23
21
|
}
|
|
24
|
-
}
|
|
22
|
+
},
|
|
23
|
+
autoExecute: true,
|
|
24
|
+
autoParse: true
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
+
exports.createTable = createTable;
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","Table","name","process","env","DB_TABLE_PAGE_BUILDER","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","exports"],"sources":["table.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\n\ninterface CreateTableParams {\n table?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = ({ table, documentClient }: CreateTableParams) => {\n return new Table({\n name: table || process.env.DB_TABLE_PAGE_BUILDER || (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 autoExecute: true,\n autoParse: true\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAkC,CAAC,KAAK;EACzE,OAAO,IAAIC,cAAK,CAAC;IACbC,IAAI,EAAEH,KAAK,IAAII,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IACpFC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CreateStorageOperations } from "./types";
|
|
1
|
+
import type { CreateStorageOperations } from "./types";
|
|
2
2
|
export declare const createStorageOperations: CreateStorageOperations;
|
package/index.js
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createStorageOperations = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
13
|
-
|
|
14
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
16
9
|
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
17
|
-
|
|
18
10
|
var _listResponse = require("@webiny/db-dynamodb/utils/listResponse");
|
|
19
|
-
|
|
20
11
|
var _table = require("./definitions/table");
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
var _importExportTaskEntity = require("./definitions/importExportTaskEntity");
|
|
13
|
+
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
14
|
+
const PARENT_TASK_GSI1_PK = "PB#IE_TASKS";
|
|
15
|
+
const createPartitionKey = ({
|
|
16
|
+
tenant,
|
|
17
|
+
locale,
|
|
18
|
+
id
|
|
19
|
+
}) => {
|
|
20
|
+
return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;
|
|
21
|
+
};
|
|
22
|
+
const createSortKey = input => {
|
|
23
|
+
return `SUB#${input}`;
|
|
24
|
+
};
|
|
25
|
+
const createGsiPartitionKey = ({
|
|
26
|
+
tenant,
|
|
27
|
+
locale,
|
|
28
|
+
id
|
|
29
|
+
}) => {
|
|
30
|
+
return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;
|
|
31
|
+
};
|
|
32
|
+
const createGsiSortKey = (status, id) => {
|
|
33
|
+
return `S#${status}#${id}`;
|
|
34
|
+
};
|
|
35
|
+
const createType = () => {
|
|
36
|
+
return "pb.importExportTask";
|
|
37
|
+
};
|
|
29
38
|
const createStorageOperations = params => {
|
|
30
39
|
const {
|
|
31
40
|
table: tableName,
|
|
@@ -36,113 +45,74 @@ const createStorageOperations = params => {
|
|
|
36
45
|
table: tableName,
|
|
37
46
|
documentClient
|
|
38
47
|
});
|
|
39
|
-
const entity = (0,
|
|
40
|
-
entityName: "
|
|
48
|
+
const entity = (0, _importExportTaskEntity.createImportExportTaskEntity)({
|
|
49
|
+
entityName: "ImportExportTask",
|
|
41
50
|
table,
|
|
42
51
|
attributes
|
|
43
52
|
});
|
|
44
|
-
const PARENT_TASK_GSI1_PK = "PB#IE_TASKS";
|
|
45
53
|
return {
|
|
46
54
|
getTable() {
|
|
47
55
|
return table;
|
|
48
56
|
},
|
|
49
|
-
|
|
50
57
|
getEntity() {
|
|
51
58
|
return entity;
|
|
52
59
|
},
|
|
53
|
-
|
|
54
|
-
createPartitionKey({
|
|
55
|
-
tenant,
|
|
56
|
-
locale,
|
|
57
|
-
id
|
|
58
|
-
}) {
|
|
59
|
-
return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
createSortKey(input) {
|
|
63
|
-
return `SUB#${input}`;
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
createGsiPartitionKey({
|
|
67
|
-
tenant,
|
|
68
|
-
locale,
|
|
69
|
-
id
|
|
70
|
-
}) {
|
|
71
|
-
return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
createGsiSortKey(status, id) {
|
|
75
|
-
return `S#${status}#${id}`;
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
createType() {
|
|
79
|
-
return "pb.pageImportExportTask";
|
|
80
|
-
},
|
|
81
|
-
|
|
82
60
|
async getTask(params) {
|
|
83
61
|
const {
|
|
84
62
|
where
|
|
85
63
|
} = params;
|
|
86
64
|
const keys = {
|
|
87
|
-
PK:
|
|
65
|
+
PK: createPartitionKey(where),
|
|
88
66
|
SK: "A"
|
|
89
67
|
};
|
|
90
|
-
|
|
91
68
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return (0, _cleanup.cleanupItem)(entity, result.Item);
|
|
69
|
+
return await (0, _dbDynamodb.getClean)({
|
|
70
|
+
entity,
|
|
71
|
+
keys
|
|
72
|
+
});
|
|
99
73
|
} catch (ex) {
|
|
100
|
-
throw new _error.default(ex.message || "Could not load
|
|
74
|
+
throw new _error.default(ex.message || "Could not load element by given parameters.", ex.code || "IMPORT_EXPORT_TASK_GET_ERROR", {
|
|
101
75
|
where
|
|
102
76
|
});
|
|
103
77
|
}
|
|
104
78
|
},
|
|
105
|
-
|
|
106
79
|
async listTasks(params) {
|
|
107
80
|
const {
|
|
108
|
-
limit
|
|
81
|
+
limit = 100
|
|
109
82
|
} = params;
|
|
110
83
|
const queryAllParams = {
|
|
111
84
|
entity: entity,
|
|
112
85
|
partitionKey: PARENT_TASK_GSI1_PK,
|
|
113
86
|
options: {
|
|
114
|
-
beginsWith: "",
|
|
115
87
|
index: "GSI1",
|
|
116
88
|
limit: limit || undefined
|
|
117
89
|
}
|
|
118
90
|
};
|
|
119
91
|
let results = [];
|
|
120
|
-
|
|
121
92
|
try {
|
|
122
|
-
results = await (0, _query.
|
|
93
|
+
results = await (0, _query.queryAllClean)(queryAllParams);
|
|
123
94
|
} catch (ex) {
|
|
124
|
-
throw new _error.default(ex.message || "Could not list
|
|
95
|
+
throw new _error.default(ex.message || "Could not list import export tasks by given parameters.", ex.code || "IMPORT_EXPORT_TASKS_LIST_ERROR", {
|
|
125
96
|
partitionKey: queryAllParams.partitionKey,
|
|
126
97
|
options: queryAllParams.options
|
|
127
98
|
});
|
|
128
99
|
}
|
|
129
100
|
|
|
130
|
-
|
|
101
|
+
// TODO: Implement sort and filter
|
|
131
102
|
|
|
132
103
|
return (0, _listResponse.createListResponse)({
|
|
133
|
-
items:
|
|
104
|
+
items: results,
|
|
134
105
|
limit,
|
|
135
|
-
totalCount:
|
|
106
|
+
totalCount: results.length,
|
|
136
107
|
after: null
|
|
137
108
|
});
|
|
138
109
|
},
|
|
139
|
-
|
|
140
110
|
async createTask(params) {
|
|
141
111
|
const {
|
|
142
112
|
task
|
|
143
113
|
} = params;
|
|
144
114
|
const keys = {
|
|
145
|
-
PK:
|
|
115
|
+
PK: createPartitionKey({
|
|
146
116
|
tenant: task.tenant,
|
|
147
117
|
locale: task.locale,
|
|
148
118
|
id: task.id
|
|
@@ -151,27 +121,30 @@ const createStorageOperations = params => {
|
|
|
151
121
|
GSI1_PK: PARENT_TASK_GSI1_PK,
|
|
152
122
|
GSI1_SK: task.createdOn
|
|
153
123
|
};
|
|
154
|
-
|
|
155
124
|
try {
|
|
156
|
-
await
|
|
157
|
-
|
|
158
|
-
|
|
125
|
+
await (0, _dbDynamodb.put)({
|
|
126
|
+
entity,
|
|
127
|
+
item: {
|
|
128
|
+
...task,
|
|
129
|
+
TYPE: createType(),
|
|
130
|
+
...keys
|
|
131
|
+
}
|
|
132
|
+
});
|
|
159
133
|
return task;
|
|
160
134
|
} catch (ex) {
|
|
161
|
-
throw new _error.default(ex.message || "Could not create
|
|
135
|
+
throw new _error.default(ex.message || "Could not create importExportTask.", ex.code || "IMPORT_EXPORT_TASK_CREATE_ERROR", {
|
|
162
136
|
keys,
|
|
163
|
-
|
|
137
|
+
importExportTask: task
|
|
164
138
|
});
|
|
165
139
|
}
|
|
166
140
|
},
|
|
167
|
-
|
|
168
141
|
async updateTask(params) {
|
|
169
142
|
const {
|
|
170
143
|
task,
|
|
171
144
|
original
|
|
172
145
|
} = params;
|
|
173
146
|
const keys = {
|
|
174
|
-
PK:
|
|
147
|
+
PK: createPartitionKey({
|
|
175
148
|
tenant: task.tenant,
|
|
176
149
|
locale: task.locale,
|
|
177
150
|
id: task.id
|
|
@@ -180,45 +153,49 @@ const createStorageOperations = params => {
|
|
|
180
153
|
GSI1_PK: PARENT_TASK_GSI1_PK,
|
|
181
154
|
GSI1_SK: task.createdOn
|
|
182
155
|
};
|
|
183
|
-
|
|
184
156
|
try {
|
|
185
|
-
await
|
|
186
|
-
|
|
187
|
-
|
|
157
|
+
await (0, _dbDynamodb.put)({
|
|
158
|
+
entity,
|
|
159
|
+
item: {
|
|
160
|
+
...task,
|
|
161
|
+
TYPE: createType(),
|
|
162
|
+
...keys
|
|
163
|
+
}
|
|
164
|
+
});
|
|
188
165
|
return task;
|
|
189
166
|
} catch (ex) {
|
|
190
|
-
throw new _error.default(ex.message || "Could not update
|
|
167
|
+
throw new _error.default(ex.message || "Could not update importExportTask.", ex.code || "IMPORT_EXPORT_TASK_UPDATE_ERROR", {
|
|
191
168
|
keys,
|
|
192
169
|
original,
|
|
193
170
|
task: task
|
|
194
171
|
});
|
|
195
172
|
}
|
|
196
173
|
},
|
|
197
|
-
|
|
198
174
|
async deleteTask(params) {
|
|
199
175
|
const {
|
|
200
176
|
task
|
|
201
177
|
} = params;
|
|
202
178
|
const keys = {
|
|
203
|
-
PK:
|
|
179
|
+
PK: createPartitionKey({
|
|
204
180
|
tenant: task.tenant,
|
|
205
181
|
locale: task.locale,
|
|
206
182
|
id: task.id
|
|
207
183
|
}),
|
|
208
184
|
SK: "A"
|
|
209
185
|
};
|
|
210
|
-
|
|
211
186
|
try {
|
|
212
|
-
await
|
|
187
|
+
await (0, _dbDynamodb.deleteItem)({
|
|
188
|
+
entity,
|
|
189
|
+
keys
|
|
190
|
+
});
|
|
213
191
|
return task;
|
|
214
192
|
} catch (ex) {
|
|
215
|
-
throw new _error.default(ex.message || "Could not delete
|
|
193
|
+
throw new _error.default(ex.message || "Could not delete importExportTask.", ex.code || "IMPORT_EXPORT_TASK_DELETE_ERROR", {
|
|
216
194
|
keys,
|
|
217
195
|
task: task
|
|
218
196
|
});
|
|
219
197
|
}
|
|
220
198
|
},
|
|
221
|
-
|
|
222
199
|
async updateTaskStats(params) {
|
|
223
200
|
const {
|
|
224
201
|
original,
|
|
@@ -228,7 +205,7 @@ const createStorageOperations = params => {
|
|
|
228
205
|
}
|
|
229
206
|
} = params;
|
|
230
207
|
const keys = {
|
|
231
|
-
PK:
|
|
208
|
+
PK: createPartitionKey({
|
|
232
209
|
tenant: original.tenant,
|
|
233
210
|
locale: original.locale,
|
|
234
211
|
id: original.id
|
|
@@ -237,31 +214,32 @@ const createStorageOperations = params => {
|
|
|
237
214
|
GSI1_PK: PARENT_TASK_GSI1_PK,
|
|
238
215
|
GSI1_SK: original.createdOn
|
|
239
216
|
};
|
|
240
|
-
|
|
241
217
|
try {
|
|
242
|
-
await
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
218
|
+
await (0, _dbDynamodb.update)({
|
|
219
|
+
entity,
|
|
220
|
+
item: {
|
|
221
|
+
TYPE: createType(),
|
|
222
|
+
...keys,
|
|
223
|
+
stats: {
|
|
224
|
+
$set: {
|
|
225
|
+
[prevStatus]: {
|
|
226
|
+
$add: -1
|
|
227
|
+
},
|
|
228
|
+
[nextStatus]: {
|
|
229
|
+
$add: 1
|
|
230
|
+
}
|
|
252
231
|
}
|
|
253
232
|
}
|
|
254
233
|
}
|
|
255
|
-
})
|
|
234
|
+
});
|
|
256
235
|
return original;
|
|
257
236
|
} catch (ex) {
|
|
258
|
-
throw new _error.default(ex.message || "Could not update
|
|
237
|
+
throw new _error.default(ex.message || "Could not update importExportTask.", ex.code || "IMPORT_EXPORT_TASK_UPDATE_ERROR", {
|
|
259
238
|
keys,
|
|
260
239
|
original
|
|
261
240
|
});
|
|
262
241
|
}
|
|
263
242
|
},
|
|
264
|
-
|
|
265
243
|
async createSubTask(params) {
|
|
266
244
|
const {
|
|
267
245
|
subTask
|
|
@@ -272,25 +250,28 @@ const createStorageOperations = params => {
|
|
|
272
250
|
id: subTask.parent
|
|
273
251
|
};
|
|
274
252
|
const keys = {
|
|
275
|
-
PK:
|
|
276
|
-
SK:
|
|
277
|
-
GSI1_PK:
|
|
278
|
-
GSI1_SK:
|
|
253
|
+
PK: createPartitionKey(pkParams),
|
|
254
|
+
SK: createSortKey(subTask.id),
|
|
255
|
+
GSI1_PK: createGsiPartitionKey(pkParams),
|
|
256
|
+
GSI1_SK: createGsiSortKey(subTask.status, subTask.id)
|
|
279
257
|
};
|
|
280
|
-
|
|
281
258
|
try {
|
|
282
|
-
await
|
|
283
|
-
|
|
284
|
-
|
|
259
|
+
await (0, _dbDynamodb.put)({
|
|
260
|
+
entity,
|
|
261
|
+
item: {
|
|
262
|
+
...subTask,
|
|
263
|
+
TYPE: createType(),
|
|
264
|
+
...keys
|
|
265
|
+
}
|
|
266
|
+
});
|
|
285
267
|
return subTask;
|
|
286
268
|
} catch (ex) {
|
|
287
|
-
throw new _error.default(ex.message || "Could not create
|
|
269
|
+
throw new _error.default(ex.message || "Could not create importExportSubTask.", ex.code || "CREATE_IMPORT_EXPORT_SUB_TASK_ERROR", {
|
|
288
270
|
keys,
|
|
289
271
|
subTask: subTask
|
|
290
272
|
});
|
|
291
273
|
}
|
|
292
274
|
},
|
|
293
|
-
|
|
294
275
|
async updateSubTask(params) {
|
|
295
276
|
const {
|
|
296
277
|
subTask,
|
|
@@ -302,58 +283,56 @@ const createStorageOperations = params => {
|
|
|
302
283
|
id: subTask.parent
|
|
303
284
|
};
|
|
304
285
|
const keys = {
|
|
305
|
-
PK:
|
|
306
|
-
SK:
|
|
307
|
-
GSI1_PK:
|
|
308
|
-
GSI1_SK:
|
|
286
|
+
PK: createPartitionKey(pkParams),
|
|
287
|
+
SK: createSortKey(subTask.id),
|
|
288
|
+
GSI1_PK: createGsiPartitionKey(pkParams),
|
|
289
|
+
GSI1_SK: createGsiSortKey(subTask.status, subTask.id)
|
|
309
290
|
};
|
|
310
|
-
|
|
311
291
|
try {
|
|
312
|
-
await
|
|
313
|
-
|
|
314
|
-
|
|
292
|
+
await (0, _dbDynamodb.put)({
|
|
293
|
+
entity,
|
|
294
|
+
item: {
|
|
295
|
+
...subTask,
|
|
296
|
+
TYPE: createType(),
|
|
297
|
+
...keys
|
|
298
|
+
}
|
|
299
|
+
});
|
|
315
300
|
return subTask;
|
|
316
301
|
} catch (ex) {
|
|
317
|
-
throw new _error.default(ex.message || "Could not update
|
|
302
|
+
throw new _error.default(ex.message || "Could not update importExportSubTask.", ex.code || "UPDATE_IMPORT_EXPORT_SUB_TASK_ERROR", {
|
|
318
303
|
keys,
|
|
319
304
|
original,
|
|
320
305
|
subTask: subTask
|
|
321
306
|
});
|
|
322
307
|
}
|
|
323
308
|
},
|
|
324
|
-
|
|
325
309
|
async getSubTask(params) {
|
|
326
310
|
const {
|
|
327
311
|
where
|
|
328
312
|
} = params;
|
|
329
313
|
const keys = {
|
|
330
|
-
PK:
|
|
314
|
+
PK: createPartitionKey({
|
|
331
315
|
tenant: where.tenant,
|
|
332
316
|
locale: where.locale,
|
|
333
317
|
id: where.parent
|
|
334
318
|
}),
|
|
335
|
-
SK:
|
|
319
|
+
SK: createSortKey(where.id)
|
|
336
320
|
};
|
|
337
|
-
|
|
338
321
|
try {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
return (0, _cleanup.cleanupItem)(entity, result.Item);
|
|
322
|
+
return await (0, _dbDynamodb.getClean)({
|
|
323
|
+
entity,
|
|
324
|
+
keys
|
|
325
|
+
});
|
|
346
326
|
} catch (ex) {
|
|
347
|
-
throw new _error.default(ex.message || "Could not load
|
|
327
|
+
throw new _error.default(ex.message || "Could not load import export subTask by given parameters.", ex.code || "IMPORT_EXPORT_TASK_GET_ERROR", {
|
|
348
328
|
where
|
|
349
329
|
});
|
|
350
330
|
}
|
|
351
331
|
},
|
|
352
|
-
|
|
353
332
|
async listSubTasks(params) {
|
|
354
333
|
const {
|
|
355
334
|
where,
|
|
356
|
-
limit
|
|
335
|
+
limit = 100
|
|
357
336
|
} = params;
|
|
358
337
|
const {
|
|
359
338
|
tenant,
|
|
@@ -363,7 +342,7 @@ const createStorageOperations = params => {
|
|
|
363
342
|
} = where;
|
|
364
343
|
const queryAllParams = {
|
|
365
344
|
entity: entity,
|
|
366
|
-
partitionKey:
|
|
345
|
+
partitionKey: createGsiPartitionKey({
|
|
367
346
|
tenant,
|
|
368
347
|
locale,
|
|
369
348
|
id: parent
|
|
@@ -375,26 +354,23 @@ const createStorageOperations = params => {
|
|
|
375
354
|
}
|
|
376
355
|
};
|
|
377
356
|
let results = [];
|
|
378
|
-
|
|
379
357
|
try {
|
|
380
|
-
results = await (0, _query.
|
|
358
|
+
results = await (0, _query.queryAllClean)(queryAllParams);
|
|
381
359
|
} catch (ex) {
|
|
382
|
-
throw new _error.default(ex.message || "Could not list
|
|
360
|
+
throw new _error.default(ex.message || "Could not list import export tasks by given parameters.", ex.code || "LIST_IMPORT_EXPORT_SUB_TASKS_ERROR", {
|
|
383
361
|
partitionKey: queryAllParams.partitionKey,
|
|
384
362
|
options: queryAllParams.options
|
|
385
363
|
});
|
|
386
364
|
}
|
|
387
|
-
|
|
388
|
-
const items = results.map(item => (0, _cleanup.cleanupItem)(entity, item));
|
|
389
365
|
return (0, _listResponse.createListResponse)({
|
|
390
|
-
items:
|
|
366
|
+
items: results,
|
|
391
367
|
limit,
|
|
392
|
-
totalCount:
|
|
368
|
+
totalCount: results.length,
|
|
393
369
|
after: null
|
|
394
370
|
});
|
|
395
371
|
}
|
|
396
|
-
|
|
397
372
|
};
|
|
398
373
|
};
|
|
374
|
+
exports.createStorageOperations = createStorageOperations;
|
|
399
375
|
|
|
400
|
-
|
|
376
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_query","_listResponse","_table","_importExportTaskEntity","_dbDynamodb","PARENT_TASK_GSI1_PK","createPartitionKey","tenant","locale","id","createSortKey","input","createGsiPartitionKey","createGsiSortKey","status","createType","createStorageOperations","params","table","tableName","documentClient","attributes","createTable","entity","createImportExportTaskEntity","entityName","getTable","getEntity","getTask","where","keys","PK","SK","getClean","ex","WebinyError","message","code","listTasks","limit","queryAllParams","partitionKey","options","index","undefined","results","queryAllClean","createListResponse","items","totalCount","length","after","createTask","task","GSI1_PK","GSI1_SK","createdOn","put","item","TYPE","importExportTask","updateTask","original","deleteTask","deleteItem","updateTaskStats","prevStatus","nextStatus","update","stats","$set","$add","createSubTask","subTask","pkParams","parent","updateSubTask","getSubTask","listSubTasks","beginsWith","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n ImportExportTask,\n ImportExportTaskStatus,\n ImportExportTaskStorageOperationsCreateParams,\n ImportExportTaskStorageOperationsCreateSubTaskParams,\n ImportExportTaskStorageOperationsDeleteParams,\n ImportExportTaskStorageOperationsGetParams,\n ImportExportTaskStorageOperationsGetSubTaskParams,\n ImportExportTaskStorageOperationsListParams,\n ImportExportTaskStorageOperationsListResponse,\n ImportExportTaskStorageOperationsListSubTaskParams,\n ImportExportTaskStorageOperationsListSubTaskResponse,\n ImportExportTaskStorageOperationsUpdateParams,\n ImportExportTaskStorageOperationsUpdateSubTaskParams,\n ImportExportTaskStorageOperationsUpdateTaskStatsParams\n} from \"@webiny/api-page-builder-import-export/types\";\nimport WebinyError from \"@webiny/error\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAllClean } from \"@webiny/db-dynamodb/utils/query\";\nimport { createListResponse } from \"@webiny/db-dynamodb/utils/listResponse\";\nimport { createTable } from \"~/definitions/table\";\nimport { createImportExportTaskEntity } from \"~/definitions/importExportTaskEntity\";\nimport type { CreateStorageOperations } from \"./types\";\nimport { deleteItem, getClean, put, update } from \"@webiny/db-dynamodb\";\n\ninterface PartitionKeyOptions {\n tenant: string;\n locale: string;\n id?: string;\n}\n\nconst PARENT_TASK_GSI1_PK = \"PB#IE_TASKS\";\n\nconst createPartitionKey = ({ tenant, locale, id }: PartitionKeyOptions): string => {\n return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;\n};\n\nconst createSortKey = (input: string): string => {\n return `SUB#${input}`;\n};\n\nconst createGsiPartitionKey = ({ tenant, locale, id }: PartitionKeyOptions): string => {\n return `T#${tenant}#L#${locale}#PB#IE_TASK#${id}`;\n};\n\nconst createGsiSortKey = (status: ImportExportTaskStatus, id: string): string => {\n return `S#${status}#${id}`;\n};\n\nconst createType = (): string => {\n return \"pb.importExportTask\";\n};\n\nexport const createStorageOperations: CreateStorageOperations = params => {\n const { table: tableName, documentClient, attributes = {} } = params;\n\n const table = createTable({ table: tableName, documentClient });\n\n const entity = createImportExportTaskEntity({\n entityName: \"ImportExportTask\",\n table,\n attributes\n });\n\n return {\n getTable() {\n return table;\n },\n getEntity() {\n return entity;\n },\n async getTask(params: ImportExportTaskStorageOperationsGetParams) {\n const { where } = params;\n\n const keys = {\n PK: createPartitionKey(where),\n SK: \"A\"\n };\n\n try {\n return await getClean<ImportExportTask>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load element by given parameters.\",\n ex.code || \"IMPORT_EXPORT_TASK_GET_ERROR\",\n {\n where\n }\n );\n }\n },\n\n async listTasks(\n params: ImportExportTaskStorageOperationsListParams\n ): Promise<ImportExportTaskStorageOperationsListResponse> {\n const { limit = 100 } = params;\n\n const queryAllParams: QueryAllParams = {\n entity: entity,\n partitionKey: PARENT_TASK_GSI1_PK,\n options: {\n index: \"GSI1\",\n limit: limit || undefined\n }\n };\n\n let results: ImportExportTask[] = [];\n\n try {\n results = await queryAllClean<ImportExportTask>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list import export tasks by given parameters.\",\n ex.code || \"IMPORT_EXPORT_TASKS_LIST_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n // TODO: Implement sort and filter\n\n return createListResponse({\n items: results,\n limit,\n totalCount: results.length,\n after: null\n });\n },\n\n async createTask(\n params: ImportExportTaskStorageOperationsCreateParams\n ): Promise<ImportExportTask> {\n const { task } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: task.tenant,\n locale: task.locale,\n id: task.id\n }),\n SK: \"A\",\n GSI1_PK: PARENT_TASK_GSI1_PK,\n GSI1_SK: task.createdOn\n };\n\n try {\n await put({\n entity,\n item: {\n ...task,\n TYPE: createType(),\n ...keys\n }\n });\n return task;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create importExportTask.\",\n ex.code || \"IMPORT_EXPORT_TASK_CREATE_ERROR\",\n {\n keys,\n importExportTask: task\n }\n );\n }\n },\n\n async updateTask(\n params: ImportExportTaskStorageOperationsUpdateParams\n ): Promise<ImportExportTask> {\n const { task, original } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: task.tenant,\n locale: task.locale,\n id: task.id\n }),\n SK: \"A\",\n GSI1_PK: PARENT_TASK_GSI1_PK,\n GSI1_SK: task.createdOn\n };\n\n try {\n await put({\n entity,\n item: {\n ...task,\n TYPE: createType(),\n ...keys\n }\n });\n return task;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update importExportTask.\",\n ex.code || \"IMPORT_EXPORT_TASK_UPDATE_ERROR\",\n {\n keys,\n original,\n task: task\n }\n );\n }\n },\n\n async deleteTask(\n params: ImportExportTaskStorageOperationsDeleteParams\n ): Promise<ImportExportTask> {\n const { task } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: task.tenant,\n locale: task.locale,\n id: task.id\n }),\n SK: \"A\"\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n return task;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete importExportTask.\",\n ex.code || \"IMPORT_EXPORT_TASK_DELETE_ERROR\",\n {\n keys,\n task: task\n }\n );\n }\n },\n\n async updateTaskStats(\n params: ImportExportTaskStorageOperationsUpdateTaskStatsParams\n ): Promise<ImportExportTask> {\n const {\n original,\n input: { prevStatus, nextStatus }\n } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: original.tenant,\n locale: original.locale,\n id: original.id\n }),\n SK: \"A\",\n GSI1_PK: PARENT_TASK_GSI1_PK,\n GSI1_SK: original.createdOn\n };\n\n try {\n await update({\n entity,\n item: {\n TYPE: createType(),\n ...keys,\n stats: {\n $set: {\n [prevStatus]: { $add: -1 },\n [nextStatus]: { $add: 1 }\n }\n }\n }\n });\n return original;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update importExportTask.\",\n ex.code || \"IMPORT_EXPORT_TASK_UPDATE_ERROR\",\n {\n keys,\n original\n }\n );\n }\n },\n\n async createSubTask(\n params: ImportExportTaskStorageOperationsCreateSubTaskParams\n ): Promise<ImportExportTask> {\n const { subTask } = params;\n const pkParams = {\n tenant: subTask.tenant,\n locale: subTask.locale,\n id: subTask.parent\n };\n const keys = {\n PK: createPartitionKey(pkParams),\n SK: createSortKey(subTask.id),\n GSI1_PK: createGsiPartitionKey(pkParams),\n GSI1_SK: createGsiSortKey(subTask.status, subTask.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...subTask,\n TYPE: createType(),\n ...keys\n }\n });\n return subTask;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create importExportSubTask.\",\n ex.code || \"CREATE_IMPORT_EXPORT_SUB_TASK_ERROR\",\n {\n keys,\n subTask: subTask\n }\n );\n }\n },\n\n async updateSubTask(\n params: ImportExportTaskStorageOperationsUpdateSubTaskParams\n ): Promise<ImportExportTask> {\n const { subTask, original } = params;\n const pkParams = {\n tenant: subTask.tenant,\n locale: subTask.locale,\n id: subTask.parent\n };\n const keys = {\n PK: createPartitionKey(pkParams),\n SK: createSortKey(subTask.id),\n GSI1_PK: createGsiPartitionKey(pkParams),\n GSI1_SK: createGsiSortKey(subTask.status, subTask.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...subTask,\n TYPE: createType(),\n ...keys\n }\n });\n return subTask;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update importExportSubTask.\",\n ex.code || \"UPDATE_IMPORT_EXPORT_SUB_TASK_ERROR\",\n {\n keys,\n original,\n subTask: subTask\n }\n );\n }\n },\n\n async getSubTask(params: ImportExportTaskStorageOperationsGetSubTaskParams) {\n const { where } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: where.tenant,\n locale: where.locale,\n id: where.parent\n }),\n SK: createSortKey(where.id)\n };\n try {\n return await getClean<ImportExportTask>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load import export subTask by given parameters.\",\n ex.code || \"IMPORT_EXPORT_TASK_GET_ERROR\",\n {\n where\n }\n );\n }\n },\n\n async listSubTasks(\n params: ImportExportTaskStorageOperationsListSubTaskParams\n ): Promise<ImportExportTaskStorageOperationsListSubTaskResponse> {\n const { where, limit = 100 } = params;\n\n const { tenant, locale, parent, status } = where;\n const queryAllParams: QueryAllParams = {\n entity: entity,\n partitionKey: createGsiPartitionKey({\n tenant,\n locale,\n id: parent\n }),\n options: {\n beginsWith: `S#${status}`,\n limit: limit || undefined,\n index: \"GSI1\"\n }\n };\n\n let results: ImportExportTask[] = [];\n\n try {\n results = await queryAllClean<ImportExportTask>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list import export tasks by given parameters.\",\n ex.code || \"LIST_IMPORT_EXPORT_SUB_TASKS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n return createListResponse({\n items: results,\n limit,\n totalCount: results.length,\n after: null\n });\n }\n };\n};\n"],"mappings":";;;;;;;AAgBA,IAAAA,MA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E,EAAEkE;QACR,CAAC,CAAC;QACFjC,OAAO,EAAE;UACLqC,UAAU,EAAE,KAAKjE,MAAM,EAAE;UACzByB,KAAK,EAAEA,KAAK,IAAIK,SAAS;UACzBD,KAAK,EAAE;QACX;MACJ,CAAC;MAED,IAAIE,OAA2B,GAAG,EAAE;MAEpC,IAAI;QACAA,OAAO,GAAG,MAAM,IAAAC,oBAAa,EAAmBN,cAAc,CAAC;MACnE,CAAC,CAAC,OAAON,EAAE,EAAE;QACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,yDAAyD,EACvEF,EAAE,CAACG,IAAI,IAAI,oCAAoC,EAC/C;UACII,YAAY,EAAED,cAAc,CAACC,YAAY;UACzCC,OAAO,EAAEF,cAAc,CAACE;QAC5B,CACJ,CAAC;MACL;MAEA,OAAO,IAAAK,gCAAkB,EAAC;QACtBC,KAAK,EAAEH,OAAO;QACdN,KAAK;QACLU,UAAU,EAAEJ,OAAO,CAACK,MAAM;QAC1BC,KAAK,EAAE;MACX,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAAC6B,OAAA,CAAAhE,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-page-builder-import-export-so-ddb",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-unstable.06b2ede40f",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-page-builder-import-export",
|
|
7
7
|
"storage-operations",
|
|
8
8
|
"dynamodb",
|
|
9
|
+
"ddb",
|
|
9
10
|
"pbie:ddb"
|
|
10
11
|
],
|
|
11
12
|
"repository": {
|
|
@@ -17,38 +18,29 @@
|
|
|
17
18
|
"description": "The DynamoDB storage operations for import export feature in the Webiny Page Builder API.",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/db-dynamodb": "0.0.0-
|
|
23
|
-
"@webiny/error": "0.0.0-
|
|
24
|
-
"dynamodb-toolbox": "0.3.4"
|
|
21
|
+
"@webiny/api-page-builder-import-export": "0.0.0-unstable.06b2ede40f",
|
|
22
|
+
"@webiny/aws-sdk": "0.0.0-unstable.06b2ede40f",
|
|
23
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.06b2ede40f",
|
|
24
|
+
"@webiny/error": "0.0.0-unstable.06b2ede40f"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@webiny/
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@webiny/handler-graphql": "^0.0.0-mt-2",
|
|
37
|
-
"@webiny/project-utils": "^0.0.0-mt-2",
|
|
38
|
-
"jest": "^26.6.3",
|
|
39
|
-
"jest-dynalite": "^3.2.0",
|
|
40
|
-
"jest-environment-node": "^27.0.6",
|
|
41
|
-
"rimraf": "^3.0.2",
|
|
42
|
-
"ttypescript": "^1.5.12",
|
|
43
|
-
"typescript": "^4.1.3"
|
|
27
|
+
"@webiny/api-security": "0.0.0-unstable.06b2ede40f",
|
|
28
|
+
"@webiny/api-tenancy": "0.0.0-unstable.06b2ede40f",
|
|
29
|
+
"@webiny/handler-aws": "0.0.0-unstable.06b2ede40f",
|
|
30
|
+
"@webiny/handler-graphql": "0.0.0-unstable.06b2ede40f",
|
|
31
|
+
"@webiny/project-utils": "0.0.0-unstable.06b2ede40f",
|
|
32
|
+
"jest": "29.7.0",
|
|
33
|
+
"jest-dynalite": "3.6.1",
|
|
34
|
+
"rimraf": "6.0.1",
|
|
35
|
+
"typescript": "5.3.3"
|
|
44
36
|
},
|
|
45
37
|
"publishConfig": {
|
|
46
38
|
"access": "public",
|
|
47
39
|
"directory": "dist"
|
|
48
40
|
},
|
|
49
41
|
"scripts": {
|
|
50
|
-
"build": "
|
|
51
|
-
"watch": "
|
|
42
|
+
"build": "node ../cli/bin.js run build",
|
|
43
|
+
"watch": "node ../cli/bin.js run watch"
|
|
52
44
|
},
|
|
53
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "06b2ede40fc2212a70eeafd74afd50b56fb0ce82"
|
|
54
46
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
|
|
6
|
-
export declare type Attributes = Record<string, AttributeDefinition>;
|
|
7
|
-
export interface PartitionKeyOptions {
|
|
8
|
-
tenant: string;
|
|
9
|
-
locale: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
}
|
|
1
|
+
import type { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
|
+
import type { ImportExportTaskStorageOperations } from "@webiny/api-page-builder-import-export/types";
|
|
4
|
+
export type Attributes = Record<string, AttributeDefinition>;
|
|
12
5
|
export interface CreateStorageOperations {
|
|
13
6
|
(params: {
|
|
14
|
-
documentClient:
|
|
7
|
+
documentClient: DynamoDBDocument;
|
|
15
8
|
table?: string;
|
|
16
9
|
attributes?: Attributes;
|
|
17
|
-
}):
|
|
10
|
+
}): ImportExportTaskStorageOperations;
|
|
18
11
|
}
|
package/types.js
CHANGED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { ImportExportTaskStorageOperations } from \"@webiny/api-page-builder-import-export/types\";\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport interface CreateStorageOperations {\n (params: {\n documentClient: DynamoDBDocument;\n table?: string;\n attributes?: Attributes;\n }): ImportExportTaskStorageOperations;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
-
import { Attributes } from "../types";
|
|
3
|
-
interface Params {
|
|
4
|
-
entityName: string;
|
|
5
|
-
table: Table;
|
|
6
|
-
attributes?: Attributes;
|
|
7
|
-
}
|
|
8
|
-
export declare const createPageImportExportTaskEntity: ({ entityName, table, attributes }: Params) => Entity<{}>;
|
|
9
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createPageImportExportTaskEntity = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
|
-
const createPageImportExportTaskEntity = ({
|
|
19
|
-
entityName,
|
|
20
|
-
table,
|
|
21
|
-
attributes
|
|
22
|
-
}) => {
|
|
23
|
-
return new _dynamodbToolbox.Entity({
|
|
24
|
-
name: entityName,
|
|
25
|
-
table,
|
|
26
|
-
attributes: _objectSpread({
|
|
27
|
-
PK: {
|
|
28
|
-
partitionKey: true
|
|
29
|
-
},
|
|
30
|
-
SK: {
|
|
31
|
-
sortKey: true
|
|
32
|
-
},
|
|
33
|
-
GSI1_PK: {
|
|
34
|
-
type: "string"
|
|
35
|
-
},
|
|
36
|
-
GSI1_SK: {
|
|
37
|
-
type: "string"
|
|
38
|
-
},
|
|
39
|
-
TYPE: {
|
|
40
|
-
type: "string"
|
|
41
|
-
},
|
|
42
|
-
id: {
|
|
43
|
-
type: "string"
|
|
44
|
-
},
|
|
45
|
-
parent: {
|
|
46
|
-
type: "string"
|
|
47
|
-
},
|
|
48
|
-
status: {
|
|
49
|
-
type: "string"
|
|
50
|
-
},
|
|
51
|
-
data: {
|
|
52
|
-
type: "map"
|
|
53
|
-
},
|
|
54
|
-
input: {
|
|
55
|
-
type: "map"
|
|
56
|
-
},
|
|
57
|
-
stats: {
|
|
58
|
-
type: "map"
|
|
59
|
-
},
|
|
60
|
-
error: {
|
|
61
|
-
type: "map"
|
|
62
|
-
},
|
|
63
|
-
createdOn: {
|
|
64
|
-
type: "string"
|
|
65
|
-
},
|
|
66
|
-
createdBy: {
|
|
67
|
-
type: "map"
|
|
68
|
-
},
|
|
69
|
-
tenant: {
|
|
70
|
-
type: "string"
|
|
71
|
-
},
|
|
72
|
-
locale: {
|
|
73
|
-
type: "string"
|
|
74
|
-
}
|
|
75
|
-
}, attributes)
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
exports.createPageImportExportTaskEntity = createPageImportExportTaskEntity;
|