@forge/migrations 0.3.3-next.0 → 0.3.3
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/CHANGELOG.md +15 -0
- package/out/migration/migration.js +66 -68
- package/out/migration/query-api.js +6 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @forge/migrations
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f8a4714]
|
|
8
|
+
- Updated dependencies [94956a5]
|
|
9
|
+
- @forge/api@3.5.0
|
|
10
|
+
|
|
11
|
+
## 0.3.3-next.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [94956a5]
|
|
16
|
+
- @forge/api@3.5.0-next.1
|
|
17
|
+
|
|
3
18
|
## 0.3.3-next.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -3,76 +3,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Migration = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
class Migration {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
basePath = '/app/migration/forge/v1';
|
|
7
|
+
getMappingById = async (transferId, namespace, keys) => {
|
|
8
|
+
const result = await (0, utils_1.invokePOSTApi)(`${this.basePath}/mapping/${transferId}/find?namespace=${namespace}`, keys);
|
|
9
|
+
return (0, utils_1.getResponseBody)(result);
|
|
10
|
+
};
|
|
11
|
+
getAppDataList = async (transferId) => {
|
|
12
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/data/${transferId}/all`);
|
|
13
|
+
return (0, utils_1.getResponseBody)(result);
|
|
14
|
+
};
|
|
15
|
+
getAppDataPayload = async (s3Key) => {
|
|
16
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/data/${s3Key}`);
|
|
17
|
+
return (0, utils_1.getResponseBody)(result);
|
|
18
|
+
};
|
|
19
|
+
messageProcessed = async (transferId, messageId) => {
|
|
20
|
+
const request = {
|
|
21
|
+
status: 'SUCCESS',
|
|
22
|
+
messageIds: [messageId]
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
const result = await (0, utils_1.invokePOSTApi)(`${this.basePath}/message/${transferId}/status`, request);
|
|
25
|
+
return (0, utils_1.getResponseBody)(result);
|
|
26
|
+
};
|
|
27
|
+
getMappings = async (transferId, namespace, lastEntity, pageSize) => {
|
|
28
|
+
let queryParams = `namespace=${namespace}`;
|
|
29
|
+
if (pageSize != undefined) {
|
|
30
|
+
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
31
|
+
}
|
|
32
|
+
if (lastEntity != undefined) {
|
|
33
|
+
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
34
|
+
}
|
|
35
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/mapping/${transferId}/page?${queryParams}`);
|
|
36
|
+
const mappingResponse = await (0, utils_1.getResponseBody)(result);
|
|
37
|
+
let results = [];
|
|
38
|
+
if (mappingResponse.items != null) {
|
|
39
|
+
results = Object.entries(mappingResponse.items).map((item) => {
|
|
40
|
+
return { key: item[0], value: item[1] };
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
results: results,
|
|
45
|
+
nextCursor: mappingResponse.meta.lastEntity != null ? mappingResponse.meta.lastEntity : undefined
|
|
15
46
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
47
|
+
};
|
|
48
|
+
getContainers = async (transferId, containerType, lastEntity, pageSize) => {
|
|
49
|
+
let queryParams = `containerType=${containerType}`;
|
|
50
|
+
if (pageSize != undefined) {
|
|
51
|
+
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
52
|
+
}
|
|
53
|
+
if (lastEntity != undefined) {
|
|
54
|
+
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
55
|
+
}
|
|
56
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/container/${transferId}/page?${queryParams}`);
|
|
57
|
+
const containerResponse = await (0, utils_1.getResponseBody)(result);
|
|
58
|
+
let results = [];
|
|
59
|
+
if (containerResponse.containers != null) {
|
|
60
|
+
results = Object.entries(containerResponse.containers).map((item) => {
|
|
61
|
+
return { key: item[0], value: item[1] };
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
results: results,
|
|
66
|
+
nextCursor: containerResponse.meta.lastEntity != null ? containerResponse.meta.lastEntity : undefined
|
|
19
67
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
this.getMappings = async (transferId, namespace, lastEntity, pageSize) => {
|
|
29
|
-
let queryParams = `namespace=${namespace}`;
|
|
30
|
-
if (pageSize != undefined) {
|
|
31
|
-
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
32
|
-
}
|
|
33
|
-
if (lastEntity != undefined) {
|
|
34
|
-
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
35
|
-
}
|
|
36
|
-
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/mapping/${transferId}/page?${queryParams}`);
|
|
37
|
-
const mappingResponse = await (0, utils_1.getResponseBody)(result);
|
|
38
|
-
let results = [];
|
|
39
|
-
if (mappingResponse.items != null) {
|
|
40
|
-
results = Object.entries(mappingResponse.items).map((item) => {
|
|
41
|
-
return { key: item[0], value: item[1] };
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
results: results,
|
|
46
|
-
nextCursor: mappingResponse.meta.lastEntity != null ? mappingResponse.meta.lastEntity : undefined
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
this.getContainers = async (transferId, containerType, lastEntity, pageSize) => {
|
|
50
|
-
let queryParams = `containerType=${containerType}`;
|
|
51
|
-
if (pageSize != undefined) {
|
|
52
|
-
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
53
|
-
}
|
|
54
|
-
if (lastEntity != undefined) {
|
|
55
|
-
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
56
|
-
}
|
|
57
|
-
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/container/${transferId}/page?${queryParams}`);
|
|
58
|
-
const containerResponse = await (0, utils_1.getResponseBody)(result);
|
|
59
|
-
let results = [];
|
|
60
|
-
if (containerResponse.containers != null) {
|
|
61
|
-
results = Object.entries(containerResponse.containers).map((item) => {
|
|
62
|
-
return { key: item[0], value: item[1] };
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
results: results,
|
|
67
|
-
nextCursor: containerResponse.meta.lastEntity != null ? containerResponse.meta.lastEntity : undefined
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
this.list = async (options, pageSize) => {
|
|
71
|
-
if (options.namespace != undefined)
|
|
72
|
-
return this.getMappings(options.transferId, options.namespace, options.cursor, pageSize);
|
|
73
|
-
else
|
|
74
|
-
return this.getContainers(options.transferId, options.containerType, options.cursor, pageSize);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
68
|
+
};
|
|
69
|
+
list = async (options, pageSize) => {
|
|
70
|
+
if (options.namespace != undefined)
|
|
71
|
+
return this.getMappings(options.transferId, options.namespace, options.cursor, pageSize);
|
|
72
|
+
else
|
|
73
|
+
return this.getContainers(options.transferId, options.containerType, options.cursor, pageSize);
|
|
74
|
+
};
|
|
77
75
|
}
|
|
78
76
|
exports.Migration = Migration;
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultQueryBuilder = void 0;
|
|
4
4
|
class DefaultQueryBuilder {
|
|
5
|
+
migration;
|
|
6
|
+
queryOptions;
|
|
5
7
|
constructor(migration, queryOptions) {
|
|
6
8
|
this.migration = migration;
|
|
7
9
|
this.queryOptions = queryOptions;
|
|
8
10
|
}
|
|
9
11
|
cursor(cursor) {
|
|
10
|
-
return new DefaultQueryBuilder(this.migration,
|
|
12
|
+
return new DefaultQueryBuilder(this.migration, {
|
|
13
|
+
...this.queryOptions,
|
|
14
|
+
cursor
|
|
15
|
+
});
|
|
11
16
|
}
|
|
12
17
|
async getOne() {
|
|
13
18
|
const listResults = await this.migration.list(this.queryOptions, 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/migrations",
|
|
3
|
-
"version": "0.3.3
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "App migration methods for Forge app",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"node-fetch": "2.7.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@forge/api": "3.
|
|
21
|
+
"@forge/api": "3.5.0"
|
|
22
22
|
}
|
|
23
23
|
}
|